Add Shell small strain kinematics
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
program test_shell_membrane_strain
|
||||
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: npart, x, x0
|
||||
use sph_shell, only: shell_membrane_strain, shell_bending_strain, &
|
||||
shell_shear_strain, shell_max_membrane_strain, &
|
||||
sph_shell_compute_small_strain
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
|
||||
call check_rigid_translation()
|
||||
call check_uniaxial_membrane()
|
||||
call check_simple_shear_membrane()
|
||||
|
||||
contains
|
||||
|
||||
subroutine check_rigid_translation()
|
||||
integer :: i
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for Shell rigid strain')
|
||||
call sph_read_inp('tests/data/shell_rigid_translation_strain_061.inp', ierr)
|
||||
call assert_ok(ierr, 'read failed for Shell rigid strain')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build failed for Shell rigid strain')
|
||||
do i = 1, npart
|
||||
x(:,i) = x0(:,i) + (/0.2_rk, -0.3_rk, 0.4_rk/)
|
||||
end do
|
||||
call sph_shell_compute_small_strain(ierr)
|
||||
call assert_ok(ierr, 'Shell rigid strain compute failed')
|
||||
if (maxval(abs(shell_membrane_strain)) > 1.0e-12_rk) &
|
||||
call fail('rigid translation produced Shell membrane strain')
|
||||
if (maxval(abs(shell_bending_strain)) > 1.0e-12_rk) &
|
||||
call fail('rigid translation produced Shell bending strain')
|
||||
if (maxval(abs(shell_shear_strain)) > 1.0e-12_rk) &
|
||||
call fail('rigid translation produced Shell shear strain')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Shell rigid strain')
|
||||
end subroutine check_rigid_translation
|
||||
|
||||
subroutine check_uniaxial_membrane()
|
||||
integer :: i
|
||||
real(rk) :: eps
|
||||
|
||||
eps = 0.02_rk
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for Shell uniaxial strain')
|
||||
call sph_read_inp('tests/data/shell_uniaxial_membrane_061.inp', ierr)
|
||||
call assert_ok(ierr, 'read failed for Shell uniaxial strain')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build failed for Shell uniaxial strain')
|
||||
do i = 1, npart
|
||||
x(:,i) = x0(:,i)
|
||||
x(1,i) = (1.0_rk + eps) * x0(1,i)
|
||||
end do
|
||||
call sph_shell_compute_small_strain(ierr)
|
||||
call assert_ok(ierr, 'Shell uniaxial strain compute failed')
|
||||
do i = 1, npart
|
||||
if (abs(shell_membrane_strain(1,i) - eps) > 1.0e-12_rk) &
|
||||
call fail('Shell uniaxial membrane strain 11 mismatch')
|
||||
if (abs(shell_membrane_strain(2,i)) > 1.0e-12_rk) &
|
||||
call fail('Shell uniaxial membrane strain 22 mismatch')
|
||||
if (abs(shell_membrane_strain(3,i)) > 1.0e-12_rk) &
|
||||
call fail('Shell uniaxial membrane strain 12 mismatch')
|
||||
end do
|
||||
if (abs(shell_max_membrane_strain - eps) > 1.0e-12_rk) &
|
||||
call fail('Shell membrane strain diagnostic mismatch')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Shell uniaxial strain')
|
||||
end subroutine check_uniaxial_membrane
|
||||
|
||||
subroutine check_simple_shear_membrane()
|
||||
integer :: i
|
||||
real(rk) :: gamma
|
||||
|
||||
gamma = 0.04_rk
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for Shell shear membrane')
|
||||
call sph_read_inp('tests/data/shell_simple_shear_membrane_061.inp', ierr)
|
||||
call assert_ok(ierr, 'read failed for Shell shear membrane')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build failed for Shell shear membrane')
|
||||
do i = 1, npart
|
||||
x(:,i) = x0(:,i)
|
||||
x(2,i) = x0(2,i) + gamma * x0(1,i)
|
||||
end do
|
||||
call sph_shell_compute_small_strain(ierr)
|
||||
call assert_ok(ierr, 'Shell shear membrane compute failed')
|
||||
do i = 1, npart
|
||||
if (abs(shell_membrane_strain(3,i) - 0.5_rk * gamma) > 1.0e-12_rk) &
|
||||
call fail('Shell simple shear membrane strain mismatch')
|
||||
end do
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed for Shell shear membrane')
|
||||
end subroutine check_simple_shear_membrane
|
||||
|
||||
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_membrane_strain
|
||||
Reference in New Issue
Block a user