program test_explosive_reaction_progress 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_explosive_state, only: explosive_reaction_progress implicit none integer :: ierr real(rk) :: lambda_mid call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed') call sph_read_inp('tests/data/explosive_programmed_burn_040.inp', ierr) call assert_ok(ierr, 'read programmed burn failed') call sph_build_model(ierr) call assert_ok(ierr, 'build programmed burn failed') call sph_advance_explicit(2.0e-7_rk, ierr) call assert_ok(ierr, 'first programmed burn step failed') lambda_mid = explosive_reaction_progress(1) if (lambda_mid <= 0.0_rk .or. lambda_mid >= 1.0_rk) then call fail('programmed burn lambda did not enter partial range') end if call sph_advance_explicit(1.0e-6_rk, ierr) call assert_ok(ierr, 'second programmed burn step failed') if (explosive_reaction_progress(1) < lambda_mid) call fail('lambda is not monotonic') if (explosive_reaction_progress(1) > 1.0_rk + 1.0e-12_rk) then call fail('lambda exceeded one') end if 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_reaction_progress