Files
SPHLite/tests/module/test_explosive_gas_coupling.f90
2026-07-03 12:53:34 +08:00

46 lines
1.6 KiB
Fortran

program test_explosive_gas_coupling
use sph_precision, only: rk
use sph_error, only: SPH_SUCCESS
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, &
sph_build_model, sph_advance_explicit
use sph_database, only: gas_particle_count, gas_volume, gas_max_pressure
use sph_gas, only: gas_material_count, gas_material_eos_defined
implicit none
integer :: ierr
call sph_initialize(ierr)
call assert_ok(ierr, 'initialize failed')
call sph_read_inp('tests/data/explosive_conversion_phase_040.inp', ierr)
call assert_ok(ierr, 'read Explosive Gas coupling failed')
call sph_build_model(ierr)
call assert_ok(ierr, 'build Explosive Gas coupling failed')
if (gas_material_count /= 1 .or. .not. gas_material_eos_defined(1)) then
call fail('Explosive product Gas material was not registered')
end if
call sph_advance_explicit(1.0e-7_rk, ierr)
call assert_ok(ierr, 'Explosive Gas coupling advance failed')
if (gas_particle_count <= 0) call fail('Explosive conversion did not create Gas count')
if (gas_volume <= 0.0_rk) call fail('Explosive product Gas volume mismatch')
if (gas_max_pressure <= 0.0_rk) call fail('Explosive product Gas pressure mismatch')
call sph_finalize(ierr)
call assert_ok(ierr, 'finalize failed')
contains
subroutine assert_ok(ierr_value, message)
integer, intent(in) :: ierr_value
character(len=*), intent(in) :: message
if (ierr_value /= SPH_SUCCESS) call fail(message)
end subroutine assert_ok
subroutine fail(message)
character(len=*), intent(in) :: message
write(*, '(A)') trim(message)
stop 1
end subroutine fail
end program test_explosive_gas_coupling