91 lines
4.5 KiB
Fortran
91 lines
4.5 KiB
Fortran
program test_shell_state_build
|
|
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
|
|
use sph_database, only: particle_phase, SPH_PHASE_SHELL, SPH_PHASE_SOLID, &
|
|
SPH_STATUS_ACTIVE
|
|
use sph_shell, only: shell_thickness, shell_director, shell_omega, &
|
|
shell_membrane_strain, shell_bending_strain, shell_shear_strain, &
|
|
shell_damage, shell_softening, shell_internal_energy, &
|
|
shell_failure_status, shell_ip_count
|
|
implicit none
|
|
|
|
integer :: ierr
|
|
|
|
call check_shell_state_defaults()
|
|
call check_mixed_particle_defaults()
|
|
call check_finalize_releases_state()
|
|
|
|
contains
|
|
|
|
subroutine check_shell_state_defaults()
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for Shell state')
|
|
call sph_read_inp('tests/data/shell_minimal_060.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for Shell state')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build failed for Shell state')
|
|
if (.not. allocated(shell_thickness)) call fail('Shell thickness not allocated')
|
|
if (size(shell_thickness) /= 4) call fail('Shell state size mismatch')
|
|
if (abs(shell_thickness(1) - 0.010_rk) > 1.0e-12_rk) call fail('Shell thickness mismatch')
|
|
if (any(abs(shell_director(:,1) - (/0.0_rk, 0.0_rk, 1.0_rk/)) > 1.0e-12_rk)) &
|
|
call fail('Shell director default mismatch')
|
|
if (any(abs(shell_omega(:,1)) > 1.0e-12_rk)) call fail('Shell omega default mismatch')
|
|
if (any(abs(shell_membrane_strain(:,1)) > 1.0e-12_rk)) call fail('Shell membrane strain default mismatch')
|
|
if (any(abs(shell_bending_strain(:,1)) > 1.0e-12_rk)) call fail('Shell bending strain default mismatch')
|
|
if (any(abs(shell_shear_strain(:,1)) > 1.0e-12_rk)) call fail('Shell shear strain default mismatch')
|
|
if (shell_damage(1) /= 0.0_rk) call fail('Shell damage default mismatch')
|
|
if (shell_softening(1) /= 1.0_rk) call fail('Shell softening default mismatch')
|
|
if (shell_internal_energy(1) /= 0.0_rk) call fail('Shell internal energy default mismatch')
|
|
if (shell_failure_status(1) /= SPH_STATUS_ACTIVE) call fail('Shell failure status default mismatch')
|
|
if (shell_ip_count(1) /= 3) call fail('Shell integration count default mismatch')
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for Shell state')
|
|
end subroutine check_shell_state_defaults
|
|
|
|
subroutine check_mixed_particle_defaults()
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for mixed Shell state')
|
|
call sph_read_inp('tests/data/shell_solid_mixed_060.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for mixed Shell state')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build failed for mixed Shell state')
|
|
if (any(particle_phase(1:2) /= SPH_PHASE_SHELL)) call fail('mixed Shell phase mismatch')
|
|
if (any(particle_phase(3:4) /= SPH_PHASE_SOLID)) call fail('mixed Solid phase mismatch')
|
|
if (any(abs(shell_thickness(1:2) - 0.010_rk) > 1.0e-12_rk)) call fail('mixed Shell thickness mismatch')
|
|
if (any(abs(shell_thickness(3:4)) > 1.0e-12_rk)) call fail('non-Shell thickness not zero')
|
|
if (any(abs(shell_director(:,3)) > 1.0e-12_rk)) call fail('non-Shell director not zero')
|
|
if (shell_ip_count(3) /= 0 .or. shell_ip_count(4) /= 0) call fail('non-Shell integration count not zero')
|
|
if (shell_softening(3) /= 0.0_rk) call fail('non-Shell softening not safe default')
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for mixed Shell state')
|
|
end subroutine check_mixed_particle_defaults
|
|
|
|
subroutine check_finalize_releases_state()
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for Shell finalize state')
|
|
call sph_read_inp('tests/data/shell_minimal_060.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for Shell finalize state')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build failed for Shell finalize state')
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for Shell finalize state')
|
|
if (allocated(shell_thickness)) call fail('Shell state not released on finalize')
|
|
end subroutine check_finalize_releases_state
|
|
|
|
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_shell_state_build
|