50 lines
1.8 KiB
Fortran
50 lines
1.8 KiB
Fortran
program test_explosive_to_gas_phase
|
|
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: particle_phase, material_id, internal_energy, &
|
|
SPH_PHASE_GAS
|
|
use sph_explosive_state, only: explosive_reaction_progress
|
|
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 phase conversion failed')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build phase conversion failed')
|
|
call sph_advance_explicit(1.0e-7_rk, ierr)
|
|
call assert_ok(ierr, 'phase conversion advance failed')
|
|
if (particle_phase(1) /= SPH_PHASE_GAS) call fail('Explosive particle did not become Gas')
|
|
if (material_id(1) /= 2) call fail('Explosive product material mismatch')
|
|
if (internal_energy(1) <= 0.0_rk) call fail('Explosive product energy missing')
|
|
if (abs(explosive_reaction_progress(1) - 1.0_rk) > 1.0e-12_rk) then
|
|
call fail('Explosive lambda not complete')
|
|
end if
|
|
call sph_advance_explicit(1.0e-7_rk, ierr)
|
|
call assert_ok(ierr, 'phase conversion second advance failed')
|
|
if (particle_phase(1) /= SPH_PHASE_GAS) call fail('Explosive phase conversion reversed')
|
|
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_to_gas_phase
|