82 lines
3.1 KiB
Fortran
82 lines
3.1 KiB
Fortran
program test_shell_bending_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_bending_strain, shell_max_bending_strain, &
|
|
sph_shell_compute_small_strain, sph_shell_set_particle_director
|
|
implicit none
|
|
|
|
integer :: ierr
|
|
|
|
call check_uniform_director_bending_zero()
|
|
call check_controlled_curvature()
|
|
|
|
contains
|
|
|
|
subroutine check_uniform_director_bending_zero()
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for uniform Shell bending')
|
|
call sph_read_inp('tests/data/shell_reference_triangle_061.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for uniform Shell bending')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build failed for uniform Shell bending')
|
|
x = x0
|
|
call sph_shell_compute_small_strain(ierr)
|
|
call assert_ok(ierr, 'uniform Shell bending compute failed')
|
|
if (maxval(abs(shell_bending_strain)) > 1.0e-12_rk) &
|
|
call fail('uniform Shell director produced bending strain')
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for uniform Shell bending')
|
|
end subroutine check_uniform_director_bending_zero
|
|
|
|
subroutine check_controlled_curvature()
|
|
integer :: i
|
|
real(rk) :: kappa
|
|
real(rk) :: director_value(3)
|
|
|
|
kappa = 0.10_rk
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for controlled Shell curvature')
|
|
call sph_read_inp('tests/data/shell_controlled_curvature_061.inp', ierr)
|
|
call assert_ok(ierr, 'read failed for controlled Shell curvature')
|
|
call sph_build_model(ierr)
|
|
call assert_ok(ierr, 'build failed for controlled Shell curvature')
|
|
x = x0
|
|
do i = 1, npart
|
|
director_value = (/kappa * x0(1,i), 0.0_rk, 1.0_rk/)
|
|
call sph_shell_set_particle_director(i, director_value, ierr)
|
|
call assert_ok(ierr, 'set controlled Shell director failed')
|
|
end do
|
|
call sph_shell_compute_small_strain(ierr)
|
|
call assert_ok(ierr, 'controlled Shell curvature compute failed')
|
|
do i = 1, npart
|
|
if (abs(shell_bending_strain(1,i) - kappa) > 2.5e-3_rk) &
|
|
call fail('controlled Shell curvature strain 11 mismatch')
|
|
if (abs(shell_bending_strain(2,i)) > 1.0e-12_rk) &
|
|
call fail('controlled Shell curvature strain 22 mismatch')
|
|
if (abs(shell_bending_strain(3,i)) > 1.0e-12_rk) &
|
|
call fail('controlled Shell curvature strain 12 mismatch')
|
|
end do
|
|
if (abs(shell_max_bending_strain - kappa) > 2.5e-3_rk) &
|
|
call fail('Shell bending strain diagnostic mismatch')
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed for controlled Shell curvature')
|
|
end subroutine check_controlled_curvature
|
|
|
|
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_bending_strain
|