Add 0.7.0 blast region input controls

This commit is contained in:
Codex
2026-07-03 22:41:19 +08:00
parent fa5a28c5ad
commit 58d15da1ae
7 changed files with 530 additions and 30 deletions
+72
View File
@@ -20,6 +20,8 @@ module sph_input_reader
use sph_explosive, only: sph_explosive_note_material, &
sph_explosive_set_control, sph_explosive_set_ignition, &
sph_explosive_build, sph_explosive_count_unbound_materials
use sph_blast, only: sph_blast_reset, sph_blast_add_region, &
sph_blast_count_unused_regions
use sph_solid, only: sph_solid_note_material, sph_solid_set_elastic, &
sph_solid_set_johnson_cook, sph_solid_set_failure, &
sph_solid_set_control, sph_solid_build_state, &
@@ -69,6 +71,7 @@ contains
active_elset_name = 'ELSET'
active_material_name = 'MATERIAL'
active_orientation_name = 'ORIENTATION'
call sph_blast_reset()
end subroutine sph_input_reset
subroutine sph_input_get_warning_count(count)
@@ -98,6 +101,7 @@ contains
integer :: solid_unbound_count
integer :: shell_unbound_count
integer :: shell_unused_orientation_count
integer :: blast_unused_count
ierr = SPH_SUCCESS
if (npart <= 0) then
@@ -142,6 +146,8 @@ contains
input_warning_count = input_warning_count + shell_unbound_count
call sph_shell_count_unused_orientations(shell_unused_orientation_count)
input_warning_count = input_warning_count + shell_unused_orientation_count
call sph_blast_count_unused_regions(blast_unused_count)
input_warning_count = input_warning_count + blast_unused_count
call sph_solid_build_reference_state(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_solid_update_diagnostics(ierr)
@@ -354,6 +360,8 @@ contains
call sph_input_parse_explosive_control(line, ierr)
else if (index(upper_line, 'IGNITION') > 0) then
call sph_input_parse_ignition(line, ierr)
else if (index(upper_line, 'BLAST REGION') > 0) then
call sph_input_parse_blast_region(line, ierr)
else if (index(upper_line, 'SHELL DIRECTOR') > 0) then
call sph_input_parse_shell_director(line, ierr)
else if (index(upper_line, 'SHELL ROTATION') > 0) then
@@ -731,6 +739,70 @@ contains
call sph_shell_set_control(material_name, softening_name, width, ierr)
end subroutine sph_input_parse_shell_control
subroutine sph_input_parse_blast_region(line, ierr)
character(len=*), intent(in) :: line
integer, intent(out) :: ierr
character(len=SPH_INPUT_FIELD_LEN) :: name
character(len=SPH_INPUT_FIELD_LEN) :: source_phase
character(len=SPH_INPUT_FIELD_LEN) :: target_phase
character(len=SPH_INPUT_FIELD_LEN) :: target_set
character(len=SPH_INPUT_FIELD_LEN) :: mode_name
character(len=SPH_INPUT_FIELD_LEN) :: value
real(rk) :: center(SPH_NDIM)
real(rk) :: radius
real(rk) :: scale
real(rk) :: time_window
ierr = SPH_SUCCESS
center = 0.0_rk
radius = 0.0_rk
scale = 1.0_rk
time_window = 0.0_rk
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)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_optional_real(line, 'Y', center(2), ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_optional_real(line, 'Z', center(3), ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_required_real(line, 'RADIUS', radius, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_option(line, 'SOURCE_PHASE', source_phase)
if (len_trim(source_phase) == 0) call sph_input_get_option(line, 'SOURCE', source_phase)
if (len_trim(source_phase) == 0) source_phase = 'GAS'
call sph_input_get_option(line, 'TARGET_PHASE', target_phase)
if (len_trim(target_phase) == 0) call sph_input_get_option(line, 'TARGET', target_phase)
if (len_trim(target_phase) == 0) target_phase = 'STRUCTURE'
call sph_input_get_option(line, 'TARGET_SET', target_set)
if (len_trim(target_set) == 0) call sph_input_get_option(line, 'SET', target_set)
if (len_trim(target_set) == 0) call sph_input_get_option(line, 'ELSET', target_set)
if (len_trim(target_set) == 0) call sph_input_get_option(line, 'NSET', target_set)
if (len_trim(target_set) == 0) then
call sph_input_set_error('Blast region is missing TARGET_SET option')
ierr = SPH_ERROR_INPUT
return
end if
call sph_input_get_option(line, 'SCALE', value)
if (len_trim(value) == 0) call sph_input_get_option(line, 'FACTOR', value)
if (len_trim(value) > 0) then
call sph_input_parse_real_value(value, scale, 'invalid blast SCALE', ierr)
if (ierr /= SPH_SUCCESS) return
end if
call sph_input_get_option(line, 'TIME_WINDOW', value)
if (len_trim(value) == 0) call sph_input_get_option(line, 'WINDOW', value)
if (len_trim(value) > 0) then
call sph_input_parse_real_value(value, time_window, &
'invalid blast TIME_WINDOW', ierr)
if (ierr /= SPH_SUCCESS) return
end if
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_blast_add_region(name, center, radius, source_phase, &
target_phase, target_set, scale, time_window, mode_name, ierr)
end subroutine sph_input_parse_blast_region
subroutine sph_input_parse_shell_director(line, ierr)
character(len=*), intent(in) :: line
integer, intent(out) :: ierr