98 lines
4.0 KiB
Fortran
98 lines
4.0 KiB
Fortran
program test_blast_solver_order_071
|
|
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_blast, only: blast_region_count, blast_region_enabled, &
|
|
blast_candidate_pair_count, blast_explosive_progress_mean, &
|
|
blast_source_pressure_mean, blast_gas_count, blast_water_count
|
|
use sph_blast_load, only: blast_solid_external_force, &
|
|
blast_shell_external_force, blast_load_target_count, &
|
|
blast_load_pair_count, blast_load_energy_input, &
|
|
blast_load_nonfinite_count, blast_load_total_force
|
|
implicit none
|
|
|
|
integer :: ierr
|
|
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for 0.7.1 Blast order')
|
|
call sph_read_inp('tests/data/blast_multiregion_071.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for 0.7.1 Blast order')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build failed for 0.7.1 Blast order')
|
|
|
|
if (blast_region_count /= 3) call fail('0.7.1 Blast region count mismatch')
|
|
if (.not. blast_region_enabled(1)) call fail('Solid region disabled')
|
|
if (.not. blast_region_enabled(2)) call fail('Shell region disabled')
|
|
if (blast_region_enabled(3)) call fail('disabled region remained active')
|
|
if (blast_load_target_count(1) /= 2) call fail('initial Solid target mismatch')
|
|
if (blast_load_target_count(2) /= 2) call fail('initial Shell target mismatch')
|
|
if (blast_load_target_count(3) /= 0) call fail('disabled target mismatch')
|
|
if (maxval(abs(blast_solid_external_force(:,5:6))) <= 0.0_rk) then
|
|
call fail('initial Solid load cache missing')
|
|
end if
|
|
if (maxval(abs(blast_shell_external_force(:,7:8))) <= 0.0_rk) then
|
|
call fail('initial Shell load cache missing')
|
|
end if
|
|
|
|
call sph_advance_explicit(1.0e-7_rk, ierr)
|
|
call assert_ok(ierr, 'first advance failed for 0.7.1 Blast order')
|
|
call assert_active_post_step(1)
|
|
call assert_active_post_step(2)
|
|
if (blast_load_target_count(3) /= 0) call fail('disabled region loaded after step')
|
|
if (maxval(abs(blast_load_total_force(:,3))) > 0.0_rk) then
|
|
call fail('disabled region force changed after step')
|
|
end if
|
|
|
|
call sph_advance_explicit(1.0e-7_rk, ierr)
|
|
call assert_ok(ierr, 'second advance failed for 0.7.1 Blast order')
|
|
if (blast_load_target_count(1) /= 2) call fail('Solid region ended early')
|
|
if (blast_load_target_count(2) /= 0) call fail('Shell time window did not close')
|
|
if (maxval(abs(blast_shell_external_force)) > 0.0_rk) then
|
|
call fail('Shell load cache was not cleared after time window')
|
|
end if
|
|
if (blast_load_nonfinite_count(1) /= 0 .or. &
|
|
blast_load_nonfinite_count(2) /= 0) then
|
|
call fail('0.7.1 Blast order produced nonfinite load')
|
|
end if
|
|
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for 0.7.1 Blast order')
|
|
|
|
contains
|
|
|
|
subroutine assert_active_post_step(region)
|
|
integer, intent(in) :: region
|
|
|
|
if (blast_explosive_progress_mean(region) < 0.99_rk) then
|
|
call fail('Blast snapshot did not refresh after Explosive update')
|
|
end if
|
|
if (blast_gas_count(region) <= 0) call fail('Blast Gas snapshot missing')
|
|
if (blast_water_count(region) <= 0) call fail('Blast Water snapshot missing')
|
|
if (blast_source_pressure_mean(region) <= 0.0_rk) then
|
|
call fail('Blast source pressure missing before projection')
|
|
end if
|
|
if (blast_load_pair_count(region) /= blast_candidate_pair_count(region)) then
|
|
call fail('Blast post-step pair count mismatch')
|
|
end if
|
|
if (blast_load_energy_input(region) <= 0.0_rk) then
|
|
call fail('Blast energy diagnostic missing after Gas source update')
|
|
end if
|
|
end subroutine assert_active_post_step
|
|
|
|
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_blast_solver_order_071
|