Add Gas input parsing and state

This commit is contained in:
Codex
2026-07-03 09:19:28 +08:00
parent 44c0a1e144
commit ffbcad2c44
7 changed files with 1087 additions and 36 deletions
+14 -1
View File
@@ -7,7 +7,7 @@ module sph_water
water_momentum, water_max_pressure, water_min_density, water_max_density, &
water_pressure_impulse, water_dt_cfl, water_dt_accel, water_dt_viscous, &
SPH_PHASE_WATER, SPH_STATUS_ACTIVE, material_count, material_name, &
material_density, &
material_type, material_density, material_id, &
sph_db_clear_water_diagnostics
use sph_particle, only: SPH_KERNEL_DEFAULT, sph_kernel_gradient
implicit none
@@ -240,6 +240,7 @@ contains
if (ierr /= SPH_SUCCESS) return
do i = 1, npart
if (particle_status(i) /= SPH_STATUS_ACTIVE) cycle
if (.not. sph_water_is_material_particle(i)) cycle
particle_phase(i) = SPH_PHASE_WATER
rho(i) = water_rho0
pressure(i) = water_p0
@@ -533,6 +534,18 @@ contains
sph_water_is_active_particle = .true.
end function sph_water_is_active_particle
logical function sph_water_is_material_particle(i)
integer, intent(in) :: i
integer :: mat_index
sph_water_is_material_particle = .false.
if (i < 1 .or. i > npart) return
mat_index = material_id(i)
if (mat_index < 1 .or. mat_index > material_count) return
if (index(sph_water_upper(material_type(mat_index)), 'WATER') <= 0) return
sph_water_is_material_particle = .true.
end function sph_water_is_material_particle
function x_vector(i, j) result(rij)
integer, intent(in) :: i
integer, intent(in) :: j