Add Explosive input controls

This commit is contained in:
Codex
2026-07-03 11:57:50 +08:00
parent 434317d94d
commit d4e51e4177
3 changed files with 484 additions and 20 deletions
+64
View File
@@ -16,6 +16,9 @@ module sph_input_reader
use sph_gas, only: sph_gas_note_material, sph_gas_set_eos, &
sph_gas_set_particle_control, sph_gas_set_body_force, &
sph_gas_apply_initial_conditions, sph_gas_count_unbound_materials
use sph_explosive, only: sph_explosive_note_material, &
sph_explosive_set_control, sph_explosive_set_ignition, &
sph_explosive_validate_input, sph_explosive_count_unbound_materials
use sph_neighbor, only: sph_neighbor_rebuild
use sph_inp_defs, only: SPH_INPUT_LINE_LEN, SPH_INPUT_FIELD_LEN, &
SPH_INPUT_MAX_FIELDS, SPH_KEY_NODE, SPH_KEY_ELEMENT, SPH_KEY_NSET, &
@@ -75,6 +78,7 @@ contains
subroutine sph_input_build_model(ierr)
integer, intent(out) :: ierr
integer :: gas_unbound_count
integer :: explosive_unbound_count
ierr = SPH_SUCCESS
if (npart <= 0) then
@@ -103,8 +107,12 @@ contains
if (ierr /= SPH_SUCCESS) return
call sph_gas_apply_initial_conditions(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_explosive_validate_input(ierr)
if (ierr /= SPH_SUCCESS) return
call sph_gas_count_unbound_materials(gas_unbound_count)
input_warning_count = input_warning_count + gas_unbound_count
call sph_explosive_count_unbound_materials(explosive_unbound_count)
input_warning_count = input_warning_count + explosive_unbound_count
call sph_neighbor_rebuild(ierr)
end subroutine sph_input_build_model
@@ -257,6 +265,7 @@ contains
call sph_db_add_material(value, type_value, ierr)
call sph_water_note_material(value, type_value)
call sph_gas_note_material(value, type_value)
call sph_explosive_note_material(value, type_value)
else if (key_id == SPH_KEY_SECTION) then
input_has_section = .true.
call sph_input_get_option(line, 'ELSET', section_value)
@@ -289,6 +298,10 @@ contains
call sph_input_parse_particle_control(line, ierr)
else if (index(upper_line, 'BODY FORCE') > 0) then
call sph_input_parse_body_force(line, ierr)
else if (index(upper_line, 'EXPLOSIVE') > 0) then
call sph_input_parse_explosive_control(line, ierr)
else if (index(upper_line, 'IGNITION') > 0) then
call sph_input_parse_ignition(line, ierr)
else
input_warning_count = input_warning_count + 1
end if
@@ -484,6 +497,57 @@ contains
call sph_gas_set_body_force(force, ierr)
end subroutine sph_input_parse_body_force
subroutine sph_input_parse_explosive_control(line, ierr)
character(len=*), intent(in) :: line
integer, intent(out) :: ierr
character(len=SPH_INPUT_FIELD_LEN) :: material_name
character(len=SPH_INPUT_FIELD_LEN) :: model_type
character(len=SPH_INPUT_FIELD_LEN) :: product_material
character(len=SPH_INPUT_FIELD_LEN) :: conversion
real(rk) :: detonation_velocity
real(rk) :: energy
real(rk) :: burn_time
ierr = SPH_SUCCESS
call sph_input_get_option(line, 'MATERIAL', material_name)
call sph_input_get_option(line, 'TYPE', model_type)
call sph_input_get_option(line, 'PRODUCT_MATERIAL', product_material)
call sph_input_get_option(line, 'CONVERSION', conversion)
call sph_input_get_required_real(line, 'DETONATION_VELOCITY', &
detonation_velocity, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_required_real(line, 'ENERGY', energy, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_required_real(line, 'BURN_TIME', burn_time, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_explosive_set_control(material_name, model_type, &
detonation_velocity, energy, burn_time, product_material, &
conversion, ierr)
end subroutine sph_input_parse_explosive_control
subroutine sph_input_parse_ignition(line, ierr)
character(len=*), intent(in) :: line
integer, intent(out) :: ierr
character(len=SPH_INPUT_FIELD_LEN) :: material_name
real(rk) :: ignition_x(SPH_NDIM)
real(rk) :: ignition_time
ierr = SPH_SUCCESS
ignition_x = 0.0_rk
ignition_time = 0.0_rk
call sph_input_get_option(line, 'MATERIAL', material_name)
call sph_input_get_required_real(line, 'X', ignition_x(1), ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_required_real(line, 'Y', ignition_x(2), ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_required_real(line, 'Z', ignition_x(3), ierr)
if (ierr /= SPH_SUCCESS) return
call sph_input_get_required_real(line, 'TIME', ignition_time, ierr)
if (ierr /= SPH_SUCCESS) return
call sph_explosive_set_ignition(material_name, ignition_x, &
ignition_time, ierr)
end subroutine sph_input_parse_ignition
subroutine sph_input_parse_density(line, ierr)
character(len=*), intent(in) :: line
integer, intent(out) :: ierr