program test_shell_shear_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, SPH_STATUS_FAILED use sph_shell, only: shell_shear_strain, shell_membrane_strain, & shell_max_shear_strain, shell_failure_status, sph_shell_compute_small_strain implicit none integer :: ierr call check_transverse_shear() call check_solid_isolation() call check_failed_shell_skip() contains subroutine check_transverse_shear() integer :: i real(rk) :: gamma gamma = 0.05_rk call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for Shell transverse shear') call sph_read_inp('tests/data/shell_transverse_shear_061.inp', ierr) call assert_ok(ierr, 'read failed for Shell transverse shear') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for Shell transverse shear') do i = 1, npart x(:,i) = x0(:,i) x(3,i) = x0(3,i) + gamma * x0(1,i) end do call sph_shell_compute_small_strain(ierr) call assert_ok(ierr, 'Shell transverse shear compute failed') do i = 1, npart if (abs(shell_shear_strain(1,i) - gamma) > 1.0e-12_rk) & call fail('Shell transverse shear 13 mismatch') if (abs(shell_shear_strain(2,i)) > 1.0e-12_rk) & call fail('Shell transverse shear 23 mismatch') end do if (abs(shell_max_shear_strain - gamma) > 1.0e-12_rk) & call fail('Shell shear strain diagnostic mismatch') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for Shell transverse shear') end subroutine check_transverse_shear subroutine check_solid_isolation() call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for Shell strain isolation') call sph_read_inp('tests/data/shell_solid_kinematics_isolation_061.inp', ierr) call assert_ok(ierr, 'read failed for Shell strain isolation') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for Shell strain isolation') x = x0 x(1,3) = x0(1,3) + 10.0_rk x(2,4) = x0(2,4) - 10.0_rk call sph_shell_compute_small_strain(ierr) call assert_ok(ierr, 'Shell strain isolation compute failed') if (maxval(abs(shell_membrane_strain(:,3:4))) > 1.0e-12_rk) & call fail('Solid particles polluted Shell membrane strain') if (maxval(abs(shell_shear_strain(:,3:4))) > 1.0e-12_rk) & call fail('Solid particles polluted Shell shear strain') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for Shell strain isolation') end subroutine check_solid_isolation subroutine check_failed_shell_skip() integer :: i real(rk) :: eps eps = 0.03_rk call sph_initialize(ierr) call assert_ok(ierr, 'initialize failed for failed Shell strain') call sph_read_inp('tests/data/shell_uniaxial_membrane_061.inp', ierr) call assert_ok(ierr, 'read failed for failed Shell strain') call sph_build_model(ierr) call assert_ok(ierr, 'build failed for failed Shell strain') do i = 1, npart x(:,i) = x0(:,i) x(1,i) = (1.0_rk + eps) * x0(1,i) end do shell_failure_status(1) = SPH_STATUS_FAILED call sph_shell_compute_small_strain(ierr) call assert_ok(ierr, 'failed Shell strain compute failed') if (maxval(abs(shell_membrane_strain(:,1))) > 1.0e-12_rk) & call fail('failed Shell particle was not skipped') if (abs(shell_membrane_strain(1,2) - eps) > 1.0e-12_rk) & call fail('active Shell particle strain missing after failed skip') call sph_finalize(ierr) call assert_ok(ierr, 'finalize failed for failed Shell strain') end subroutine check_failed_shell_skip 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_shear_strain