Add S3 shell internal force path
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
program test_shell_internal
|
||||
use fem_precision
|
||||
use fem_error
|
||||
use fem_database
|
||||
use fem_element_internal
|
||||
implicit none
|
||||
|
||||
real(rk), parameter :: TOL = 1.0e-10_rk
|
||||
real(rk), parameter :: YOUNG = 30.0_rk
|
||||
real(rk), parameter :: POISSON = 0.25_rk
|
||||
real(rk), parameter :: THICKNESS = 0.2_rk
|
||||
real(rk), parameter :: EXX = 0.01_rk
|
||||
|
||||
call check_s3_membrane_patch()
|
||||
|
||||
contains
|
||||
|
||||
subroutine check_s3_membrane_patch()
|
||||
integer :: ierr
|
||||
|
||||
call setup_s3(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(1)
|
||||
call apply_x_extension(EXX)
|
||||
|
||||
call element_compute_internal_force(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(2)
|
||||
if (elem_status(1) .ne. 0) call fail(3)
|
||||
call check_state_shape(4)
|
||||
call check_membrane_state(10)
|
||||
call check_force_balance(20)
|
||||
call check_no_normal_or_rotation(30)
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(40)
|
||||
end subroutine check_s3_membrane_patch
|
||||
|
||||
subroutine setup_s3(ierr)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call database_allocate_model(3, 1, 0, 1, 0, 1, 1, 0, 1, &
|
||||
0, 0, 0, 0, 0, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
|
||||
node_id_ext(1) = 1
|
||||
node_id_ext(2) = 2
|
||||
node_id_ext(3) = 3
|
||||
coord0(:,1) = (/ ZERO, ZERO, ZERO /)
|
||||
coord0(:,2) = (/ ONE, ZERO, ZERO /)
|
||||
coord0(:,3) = (/ ZERO, ONE, ZERO /)
|
||||
coord = coord0
|
||||
|
||||
elem_id_ext(1) = 1
|
||||
elem_type(1) = 'S3'
|
||||
elem_nnode(1) = 3
|
||||
elem_conn(:,1) = 0
|
||||
elem_conn(1:3,1) = (/ 1, 2, 3 /)
|
||||
elem_mat(1) = 1
|
||||
elem_sec(1) = 1
|
||||
|
||||
elset_name(1) = 'EALL'
|
||||
elset_start(1) = 1
|
||||
elset_count(1) = 1
|
||||
elset_items(1) = 1
|
||||
|
||||
mat_name(1) = 'MAT'
|
||||
mat_density(1) = ONE
|
||||
mat_e(1) = YOUNG
|
||||
mat_nu(1) = POISSON
|
||||
|
||||
section_type(1) = 'SHELL'
|
||||
section_elset_name(1) = 'EALL'
|
||||
section_material_name(1) = 'MAT'
|
||||
section_thickness(1) = THICKNESS
|
||||
|
||||
call database_assign_dofs(ierr)
|
||||
end subroutine setup_s3
|
||||
|
||||
subroutine apply_x_extension(exx)
|
||||
real(rk), intent(in) :: exx
|
||||
integer :: node
|
||||
|
||||
u = ZERO
|
||||
do node = 1, nnode
|
||||
u(dof_id(1,node)) = exx * coord0(1,node)
|
||||
end do
|
||||
end subroutine apply_x_extension
|
||||
|
||||
subroutine check_state_shape(code)
|
||||
integer, intent(in) :: code
|
||||
|
||||
if (elem_gp_start(1) .ne. 1) call fail(code)
|
||||
if (elem_ngp(1) .ne. 1) call fail(code + 1)
|
||||
if (ngauss_total .ne. 1) call fail(code + 2)
|
||||
if (.not. allocated(stress)) call fail(code + 3)
|
||||
if (.not. allocated(strain)) call fail(code + 4)
|
||||
end subroutine check_state_shape
|
||||
|
||||
subroutine check_membrane_state(code)
|
||||
integer, intent(in) :: code
|
||||
real(rk) :: coeff
|
||||
real(rk) :: expected_stress(NSTRESS)
|
||||
real(rk) :: expected_strain(NSTRESS)
|
||||
|
||||
coeff = YOUNG / (ONE - POISSON * POISSON)
|
||||
expected_strain = ZERO
|
||||
expected_strain(1) = EXX
|
||||
expected_stress = ZERO
|
||||
expected_stress(1) = coeff * EXX
|
||||
expected_stress(2) = coeff * POISSON * EXX
|
||||
|
||||
call check_vector_close(strain(:,1), expected_strain, code)
|
||||
call check_vector_close(stress(:,1), expected_stress, code + 1)
|
||||
if (abs(statev(10,1)) .gt. TOL) call fail(code + 2)
|
||||
if (abs(statev(11,1)) .gt. TOL) call fail(code + 3)
|
||||
if (abs(statev(12,1)) .gt. TOL) call fail(code + 4)
|
||||
end subroutine check_membrane_state
|
||||
|
||||
subroutine check_force_balance(code)
|
||||
integer, intent(in) :: code
|
||||
real(rk) :: balance(NDOF_NODE)
|
||||
real(rk) :: max_force
|
||||
integer :: node
|
||||
integer :: idir
|
||||
|
||||
balance = ZERO
|
||||
max_force = ZERO
|
||||
do node = 1, nnode
|
||||
do idir = 1, NDOF_NODE
|
||||
balance(idir) = balance(idir) + fint(dof_id(idir,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_force_balance
|
||||
|
||||
subroutine check_no_normal_or_rotation(code)
|
||||
integer, intent(in) :: code
|
||||
integer :: node
|
||||
integer :: idir
|
||||
|
||||
do node = 1, nnode
|
||||
if (abs(fint(dof_id(3,node))) .gt. TOL) call fail(code)
|
||||
do idir = 4, NDOF_NODE
|
||||
if (abs(fint(dof_id(idir,node))) .gt. TOL) call fail(code + 1)
|
||||
end do
|
||||
end do
|
||||
end subroutine check_no_normal_or_rotation
|
||||
|
||||
subroutine check_vector_close(actual, expected, code)
|
||||
real(rk), intent(in) :: actual(NSTRESS)
|
||||
real(rk), intent(in) :: expected(NSTRESS)
|
||||
integer, intent(in) :: code
|
||||
integer :: i
|
||||
|
||||
do i = 1, NSTRESS
|
||||
if (abs(actual(i) - expected(i)) .gt. TOL * max(ONE, abs(expected(i)))) then
|
||||
call fail(code)
|
||||
end if
|
||||
end do
|
||||
end subroutine check_vector_close
|
||||
|
||||
subroutine fail(code)
|
||||
integer, intent(in) :: code
|
||||
|
||||
write(*,*) 'test_shell_internal failed:', code
|
||||
stop 1
|
||||
end subroutine fail
|
||||
|
||||
end program test_shell_internal
|
||||
Reference in New Issue
Block a user