Add 0.7.1 blast region input stabilization

This commit is contained in:
Codex
2026-07-04 00:11:54 +08:00
parent 2bc527179e
commit 6d06fd489a
10 changed files with 428 additions and 29 deletions
+32 -1
View File
@@ -756,12 +756,14 @@ contains
real(rk) :: radius
real(rk) :: scale
real(rk) :: time_window
logical :: enabled
ierr = SPH_SUCCESS
center = 0.0_rk
radius = 0.0_rk
scale = 1.0_rk
time_window = 0.0_rk
enabled = .true.
call sph_input_get_option(line, 'NAME', name)
if (len_trim(name) == 0) name = 'BLAST'
call sph_input_get_optional_real(line, 'X', center(1), ierr)
@@ -803,8 +805,16 @@ contains
call sph_input_get_option(line, 'MODE', mode_name)
if (len_trim(mode_name) == 0) call sph_input_get_option(line, 'PROJECTION', mode_name)
if (len_trim(mode_name) == 0) mode_name = 'RADIAL'
call sph_input_get_option(line, 'ENABLED', value)
if (len_trim(value) == 0) call sph_input_get_option(line, 'ACTIVE', value)
if (len_trim(value) > 0) then
call sph_input_parse_logical_value(value, enabled, &
'invalid blast ENABLED option', ierr)
if (ierr /= SPH_SUCCESS) return
end if
call sph_blast_add_region(name, center, radius, source_phase, &
target_phase, target_set, scale, time_window, mode_name, ierr)
target_phase, target_set, scale, time_window, mode_name, ierr, &
enabled)
end subroutine sph_input_parse_blast_region
subroutine sph_input_parse_shell_director(line, ierr)
@@ -1355,6 +1365,27 @@ contains
end if
end subroutine sph_input_parse_real_value
subroutine sph_input_parse_logical_value(text, value, message, ierr)
character(len=*), intent(in) :: text
logical, intent(out) :: value
character(len=*), intent(in) :: message
integer, intent(out) :: ierr
character(len=SPH_INPUT_FIELD_LEN) :: upper_text
ierr = SPH_SUCCESS
upper_text = sph_inp_upper(adjustl(text))
if (trim(upper_text) == 'TRUE' .or. trim(upper_text) == 'YES' .or. &
trim(upper_text) == 'ON' .or. trim(upper_text) == '1') then
value = .true.
else if (trim(upper_text) == 'FALSE' .or. trim(upper_text) == 'NO' .or. &
trim(upper_text) == 'OFF' .or. trim(upper_text) == '0') then
value = .false.
else
call sph_input_set_error(message)
ierr = SPH_ERROR_INPUT
end if
end subroutine sph_input_parse_logical_value
subroutine sph_input_set_error(message)
character(len=*), intent(in) :: message
character(len=SPH_INPUT_LINE_LEN) :: full_message