Apply blast loads in explicit response
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
program test_blast_shell_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_shell, only: shell_director
|
||||
use sph_blast_load, only: blast_shell_external_force, &
|
||||
blast_shell_external_moment, blast_load_max_acceleration, &
|
||||
blast_load_nonfinite_count
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
real(rk) :: director_before(3)
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for Blast Shell response')
|
||||
call sph_read_inp('tests/data/blast_water_gas_explosive_shell_070.inp', ierr)
|
||||
call assert_ok(ierr, 'read failed for Blast Shell response')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build failed for Blast Shell response')
|
||||
director_before = shell_director(:,5)
|
||||
if (blast_shell_external_force(1,5) <= 0.0_rk) then
|
||||
call fail('Shell Blast preload direction mismatch')
|
||||
end if
|
||||
if (maxval(abs(blast_shell_external_moment)) > 0.0_rk) then
|
||||
call fail('Shell Blast moment placeholder changed')
|
||||
end if
|
||||
|
||||
call sph_advance_explicit(1.0e-8_rk, ierr)
|
||||
call assert_ok(ierr, 'advance failed for Blast Shell response')
|
||||
if (a(1,5) <= 0.0_rk) call fail('Shell Blast acceleration missing')
|
||||
if (v(1,5) <= 0.0_rk) call fail('Shell Blast velocity missing')
|
||||
call assert_transverse_small(5, 'Shell transverse acceleration mismatch')
|
||||
if (maxval(abs(shell_director(:,5) - director_before)) > 1.0e-12_rk) then
|
||||
call fail('Shell director changed through Blast load path')
|
||||
end if
|
||||
if (maxval(abs(blast_shell_external_moment)) > 0.0_rk) then
|
||||
call fail('Shell Blast moment placeholder changed after advance')
|
||||
end if
|
||||
if (blast_load_max_acceleration(1) <= 0.0_rk) then
|
||||
call fail('Shell Blast acceleration diagnostic missing')
|
||||
end if
|
||||
if (blast_load_nonfinite_count(1) /= 0) call fail('Shell Blast nonfinite load')
|
||||
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Blast Shell response')
|
||||
|
||||
contains
|
||||
|
||||
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_shell_response
|
||||
Reference in New Issue
Block a user