From 7e4c6b61a679e38ee002454f8ed416d760284bc2 Mon Sep 17 00:00:00 2001 From: shenw Date: Mon, 22 Jun 2026 23:07:07 +0800 Subject: [PATCH] Add shell transverse shear patch tests --- tests/module/test_shell_internal.f90 | 101 +++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/tests/module/test_shell_internal.f90 b/tests/module/test_shell_internal.f90 index 28eb2a6..a169a07 100644 --- a/tests/module/test_shell_internal.f90 +++ b/tests/module/test_shell_internal.f90 @@ -10,11 +10,16 @@ program test_shell_internal real(rk), parameter :: POISSON = 0.25_rk real(rk), parameter :: THICKNESS = 0.2_rk real(rk), parameter :: EXX = 0.01_rk + real(rk), parameter :: GAMMA_XZ = 0.02_rk call check_s3_membrane_patch() call check_s4_membrane_patch() call check_s6_membrane_patch() call check_s8_membrane_patch() + call check_shear_patch('S3', 1, 200) + call check_shear_patch('S4', 4, 230) + call check_shear_patch('S6', 3, 260) + call check_shear_patch('S8', 9, 290) contains @@ -94,6 +99,47 @@ contains if (ierr .ne. FEM_SUCCESS) call fail(140) end subroutine check_s8_membrane_patch + subroutine check_shear_patch(etype, expected_ngp, code) + character(len=*), intent(in) :: etype + integer, intent(in) :: expected_ngp + integer, intent(in) :: code + integer :: ierr + + call setup_shell_by_type(etype, ierr) + if (ierr .ne. FEM_SUCCESS) call fail(code) + call apply_xz_shear(GAMMA_XZ) + + call element_compute_internal_force(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(code + 1) + if (elem_status(1) .ne. 0) call fail(code + 2) + call check_state_shape(expected_ngp, code + 3) + call check_shear_state(expected_ngp, code + 10) + call check_translational_balance(code + 20) + + call database_finalize(ierr) + if (ierr .ne. FEM_SUCCESS) call fail(code + 21) + end subroutine check_shear_patch + + subroutine setup_shell_by_type(etype, ierr) + character(len=*), intent(in) :: etype + integer, intent(out) :: ierr + character(len=ELEM_TYPE_LEN) :: local_type + + local_type = adjustl(etype) + select case (trim(local_type)) + case ('S3') + call setup_s3(ierr) + case ('S4') + call setup_s4(ierr) + case ('S6') + call setup_s6(ierr) + case ('S8') + call setup_s8(ierr) + case default + call fail(900) + end select + end subroutine setup_shell_by_type + subroutine setup_s3(ierr) integer, intent(out) :: ierr @@ -286,6 +332,16 @@ contains end do end subroutine apply_x_extension + subroutine apply_xz_shear(gamma_xz) + real(rk), intent(in) :: gamma_xz + integer :: node + + u = ZERO + do node = 1, nnode + u(dof_id(3,node)) = gamma_xz * coord0(1,node) + end do + end subroutine apply_xz_shear + subroutine check_state_shape(expected_ngp, code) integer, intent(in) :: expected_ngp integer, intent(in) :: code @@ -321,6 +377,29 @@ contains end do end subroutine check_membrane_state + subroutine check_shear_state(npoint, code) + integer, intent(in) :: npoint + integer, intent(in) :: code + real(rk) :: shear_mod + real(rk) :: expected_stress(NSTRESS) + real(rk) :: expected_strain(NSTRESS) + integer :: gp + + shear_mod = YOUNG / (2.0_rk * (ONE + POISSON)) + expected_strain = ZERO + expected_strain(5) = GAMMA_XZ + expected_stress = ZERO + expected_stress(5) = (5.0_rk / 6.0_rk) * shear_mod * GAMMA_XZ + + do gp = 1, npoint + call check_vector_close(strain(:,gp), expected_strain, code) + call check_vector_close(stress(:,gp), expected_stress, code + 1) + if (abs(statev(10,gp)) .gt. TOL) call fail(code + 2) + if (abs(statev(11,gp)) .gt. TOL) call fail(code + 3) + if (abs(statev(12,gp)) .gt. TOL) call fail(code + 4) + end do + end subroutine check_shear_state + subroutine check_force_balance(code) integer, intent(in) :: code real(rk) :: balance(NDOF_NODE) @@ -341,6 +420,28 @@ contains if (max_force .le. TOL) call fail(code + 1) end subroutine check_force_balance + subroutine check_translational_balance(code) + integer, intent(in) :: code + real(rk) :: balance(NDIM) + real(rk) :: max_force + integer :: node + integer :: idir + + balance = ZERO + max_force = ZERO + do node = 1, nnode + do idir = 1, NDIM + balance(idir) = balance(idir) + fint(dof_id(idir,node)) + end do + do idir = 1, NDOF_NODE + max_force = max(max_force, abs(fint(dof_id(idir,node)))) + end do + end do + + if (maxval(abs(balance)) .gt. TOL) call fail(code) + if (max_force .le. TOL) call fail(code + 1) + end subroutine check_translational_balance + subroutine check_no_normal_or_rotation(code) integer, intent(in) :: code integer :: node