Hook Solid explicit dynamics
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
program test_solid_explicit_smoke
|
||||
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, sph_get_current_time
|
||||
use sph_database, only: x, v, a, solid_particle_count, solid_mass, &
|
||||
solid_momentum, solid_kinetic_energy, solid_internal_energy_total, &
|
||||
solid_max_von_mises, solid_min_damage, solid_max_damage, water_mass, gas_mass
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
integer :: step
|
||||
real(rk) :: time
|
||||
|
||||
call check_solid_explicit_body_force()
|
||||
|
||||
contains
|
||||
|
||||
subroutine check_solid_explicit_body_force()
|
||||
real(rk) :: z_before
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for Solid explicit smoke')
|
||||
call sph_read_inp('tests/data/solid_body_force_050.inp', ierr)
|
||||
call assert_ok(ierr, 'read failed for Solid explicit smoke')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build failed for Solid explicit smoke')
|
||||
z_before = x(3,1)
|
||||
call sph_advance_explicit(1.0e-7_rk, ierr)
|
||||
call assert_ok(ierr, 'Solid explicit advance failed')
|
||||
call sph_get_current_time(time, step, ierr)
|
||||
call assert_ok(ierr, 'Solid current time failed')
|
||||
if (step /= 1) call fail('Solid explicit step mismatch')
|
||||
if (abs(time - 1.0e-7_rk) > 1.0e-14_rk) call fail('Solid explicit time mismatch')
|
||||
if (a(3,1) >= 0.0_rk) call fail('Solid body acceleration missing')
|
||||
if (v(3,1) >= 0.0_rk) call fail('Solid body force did not change velocity')
|
||||
if (x(3,1) >= z_before) call fail('Solid body force did not move particle')
|
||||
if (solid_particle_count /= 2) call fail('Solid diagnostics active count mismatch')
|
||||
if (solid_mass <= 0.0_rk) call fail('Solid diagnostics mass missing')
|
||||
if (maxval(abs(solid_momentum)) <= 0.0_rk) call fail('Solid diagnostics momentum missing')
|
||||
if (solid_kinetic_energy <= 0.0_rk) call fail('Solid kinetic energy missing')
|
||||
if (solid_internal_energy_total < 0.0_rk) call fail('Solid internal energy invalid')
|
||||
if (solid_max_von_mises < 0.0_rk) call fail('Solid von Mises diagnostic invalid')
|
||||
if (solid_min_damage < 0.0_rk .or. solid_max_damage > 1.0_rk) then
|
||||
call fail('Solid damage diagnostics out of range')
|
||||
end if
|
||||
if (water_mass /= 0.0_rk .or. gas_mass /= 0.0_rk) call fail('Solid path polluted fluid diagnostics')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Solid explicit smoke')
|
||||
end subroutine check_solid_explicit_body_force
|
||||
|
||||
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_solid_explicit_smoke
|
||||
Reference in New Issue
Block a user