81 lines
2.8 KiB
Fortran
81 lines
2.8 KiB
Fortran
program test_blast_solid_response
|
|
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: a, v
|
|
use sph_blast_load, only: blast_solid_external_force, &
|
|
blast_load_max_acceleration, blast_load_nonfinite_count
|
|
implicit none
|
|
|
|
integer :: ierr
|
|
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for Blast Solid response')
|
|
call sph_read_inp('tests/data/blast_water_gas_explosive_solid_070.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for Blast Solid response')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build failed for Blast Solid response')
|
|
if (blast_solid_external_force(1,5) <= 0.0_rk) then
|
|
call fail('Solid Blast preload direction mismatch')
|
|
end if
|
|
|
|
call sph_advance_explicit(1.0e-8_rk, ierr)
|
|
call assert_ok(ierr, 'first advance failed for Blast Solid response')
|
|
call assert_positive_x_response('first Solid response missing')
|
|
call assert_transverse_small(5, 'first Solid transverse acceleration mismatch')
|
|
if (blast_load_max_acceleration(1) <= 0.0_rk) then
|
|
call fail('Solid Blast acceleration diagnostic missing')
|
|
end if
|
|
if (blast_load_nonfinite_count(1) /= 0) call fail('Solid Blast nonfinite load')
|
|
|
|
call check_second_step_accumulates()
|
|
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for Blast Solid response')
|
|
|
|
contains
|
|
|
|
subroutine check_second_step_accumulates()
|
|
real(rk) :: previous_velocity
|
|
|
|
previous_velocity = v(1,5)
|
|
call sph_advance_explicit(1.0e-8_rk, ierr)
|
|
call assert_ok(ierr, 'second advance failed for Blast Solid response')
|
|
if (v(1,5) <= previous_velocity) then
|
|
call fail('Solid Blast velocity did not accumulate')
|
|
end if
|
|
call assert_positive_x_response('second Solid response missing')
|
|
end subroutine check_second_step_accumulates
|
|
|
|
subroutine assert_positive_x_response(message)
|
|
character(len=*), intent(in) :: message
|
|
|
|
if (a(1,5) <= 0.0_rk) call fail(message)
|
|
if (v(1,5) <= 0.0_rk) call fail(message)
|
|
end subroutine assert_positive_x_response
|
|
|
|
subroutine assert_transverse_small(index, message)
|
|
integer, intent(in) :: index
|
|
character(len=*), intent(in) :: message
|
|
|
|
if (abs(a(2,index)) > abs(a(1,index)) * 1.0e-8_rk) call fail(message)
|
|
if (abs(a(3,index)) > abs(a(1,index)) * 1.0e-8_rk) call fail(message)
|
|
end subroutine assert_transverse_small
|
|
|
|
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_solid_response
|