Add consistent shell pressure loads
This commit is contained in:
@@ -0,0 +1,210 @@
|
||||
program test_shell_pressure
|
||||
use fem_precision
|
||||
use fem_error
|
||||
use fem_database
|
||||
use fem_boundary
|
||||
implicit none
|
||||
|
||||
real(rk), parameter :: TOL = 1.0e-10_rk
|
||||
real(rk), parameter :: PRESSURE = 2.0_rk
|
||||
|
||||
call check_shell_pressure('S3', 3, HALF, 10)
|
||||
call check_shell_pressure('S4', 4, ONE, 40)
|
||||
call check_shell_pressure('S6', 6, HALF, 70)
|
||||
call check_shell_pressure('S8', 8, ONE, 100)
|
||||
|
||||
contains
|
||||
|
||||
subroutine check_shell_pressure(etype, nlocal, area, code)
|
||||
character(len=*), intent(in) :: etype
|
||||
integer, intent(in) :: nlocal
|
||||
real(rk), intent(in) :: area
|
||||
integer, intent(in) :: code
|
||||
integer :: ierr
|
||||
real(rk) :: total_force(NDIM)
|
||||
character(len=ELEM_TYPE_LEN) :: local_type
|
||||
|
||||
call setup_shell(etype, nlocal, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(code)
|
||||
|
||||
call boundary_apply_prescribed_loads(ZERO, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(code + 1)
|
||||
|
||||
call collect_total_force(total_force)
|
||||
call check_close(total_force(1), ZERO, code + 2)
|
||||
call check_close(total_force(2), ZERO, code + 3)
|
||||
call check_close(total_force(3), -PRESSURE * area, code + 4)
|
||||
call check_rotational_force_is_zero(code + 5)
|
||||
|
||||
local_type = adjustl(etype)
|
||||
select case (trim(local_type))
|
||||
case ('S3')
|
||||
call check_node_force_z(1, -PRESSURE * area / 3.0_rk, code + 6)
|
||||
call check_node_force_z(3, -PRESSURE * area / 3.0_rk, code + 7)
|
||||
case ('S4')
|
||||
call check_node_force_z(1, -PRESSURE * area / 4.0_rk, code + 6)
|
||||
call check_node_force_z(4, -PRESSURE * area / 4.0_rk, code + 7)
|
||||
case ('S6')
|
||||
call check_node_force_z(1, ZERO, code + 6)
|
||||
call check_node_force_z(4, -PRESSURE * area / 3.0_rk, code + 7)
|
||||
call check_node_force_z(6, -PRESSURE * area / 3.0_rk, code + 8)
|
||||
case ('S8')
|
||||
call check_node_force_z(1, PRESSURE / 12.0_rk, code + 6)
|
||||
call check_node_force_z(5, -PRESSURE / 3.0_rk, code + 7)
|
||||
call check_node_force_z(8, -PRESSURE / 3.0_rk, code + 8)
|
||||
end select
|
||||
|
||||
call database_finalize(ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(code + 20)
|
||||
end subroutine check_shell_pressure
|
||||
|
||||
subroutine setup_shell(etype, nlocal, ierr)
|
||||
character(len=*), intent(in) :: etype
|
||||
integer, intent(in) :: nlocal
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call database_allocate_model(nlocal, 1, 0, 1, 0, 1, 1, 0, 1, &
|
||||
0, 0, 0, 0, 1, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
call fill_common_model(etype, nlocal)
|
||||
call fill_shell_coordinates(etype)
|
||||
coord = coord0
|
||||
|
||||
dload_target(1) = '1'
|
||||
dload_label(1) = 'P'
|
||||
dload_value(1) = PRESSURE
|
||||
dload_amp(1) = 0
|
||||
|
||||
call database_assign_dofs(ierr)
|
||||
end subroutine setup_shell
|
||||
|
||||
subroutine fill_common_model(etype, nlocal)
|
||||
character(len=*), intent(in) :: etype
|
||||
integer, intent(in) :: nlocal
|
||||
integer :: i
|
||||
|
||||
do i = 1, nlocal
|
||||
node_id_ext(i) = i
|
||||
coord0(:,i) = ZERO
|
||||
coord(:,i) = ZERO
|
||||
elem_conn(i,1) = i
|
||||
end do
|
||||
|
||||
elem_id_ext(1) = 1
|
||||
elem_type(1) = etype
|
||||
elem_nnode(1) = nlocal
|
||||
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) = ONE
|
||||
mat_nu(1) = 0.25_rk
|
||||
|
||||
section_type(1) = 'SHELL'
|
||||
section_elset_name(1) = 'EALL'
|
||||
section_material_name(1) = 'MAT'
|
||||
section_thickness(1) = ONE
|
||||
end subroutine fill_common_model
|
||||
|
||||
subroutine fill_shell_coordinates(etype)
|
||||
character(len=*), intent(in) :: etype
|
||||
character(len=ELEM_TYPE_LEN) :: local_type
|
||||
|
||||
local_type = adjustl(etype)
|
||||
select case (trim(local_type))
|
||||
case ('S3')
|
||||
call fill_triangle3()
|
||||
case ('S4')
|
||||
call fill_quad4()
|
||||
case ('S6')
|
||||
call fill_triangle6()
|
||||
case ('S8')
|
||||
call fill_quad8()
|
||||
case default
|
||||
call fail(900)
|
||||
end select
|
||||
end subroutine fill_shell_coordinates
|
||||
|
||||
subroutine fill_triangle3()
|
||||
coord0(:,1) = (/ ZERO, ZERO, ZERO /)
|
||||
coord0(:,2) = (/ ONE, ZERO, ZERO /)
|
||||
coord0(:,3) = (/ ZERO, ONE, ZERO /)
|
||||
end subroutine fill_triangle3
|
||||
|
||||
subroutine fill_triangle6()
|
||||
call fill_triangle3()
|
||||
coord0(:,4) = HALF * (coord0(:,1) + coord0(:,2))
|
||||
coord0(:,5) = HALF * (coord0(:,2) + coord0(:,3))
|
||||
coord0(:,6) = HALF * (coord0(:,3) + coord0(:,1))
|
||||
end subroutine fill_triangle6
|
||||
|
||||
subroutine fill_quad4()
|
||||
coord0(:,1) = (/ ZERO, ZERO, ZERO /)
|
||||
coord0(:,2) = (/ ONE, ZERO, ZERO /)
|
||||
coord0(:,3) = (/ ONE, ONE, ZERO /)
|
||||
coord0(:,4) = (/ ZERO, ONE, ZERO /)
|
||||
end subroutine fill_quad4
|
||||
|
||||
subroutine fill_quad8()
|
||||
call fill_quad4()
|
||||
coord0(:,5) = HALF * (coord0(:,1) + coord0(:,2))
|
||||
coord0(:,6) = HALF * (coord0(:,2) + coord0(:,3))
|
||||
coord0(:,7) = HALF * (coord0(:,3) + coord0(:,4))
|
||||
coord0(:,8) = HALF * (coord0(:,4) + coord0(:,1))
|
||||
end subroutine fill_quad8
|
||||
|
||||
subroutine collect_total_force(total_force)
|
||||
real(rk), intent(out) :: total_force(NDIM)
|
||||
integer :: node
|
||||
integer :: idir
|
||||
|
||||
total_force = ZERO
|
||||
do node = 1, nnode
|
||||
do idir = 1, NDIM
|
||||
total_force(idir) = total_force(idir) + fext(dof_id(idir,node))
|
||||
end do
|
||||
end do
|
||||
end subroutine collect_total_force
|
||||
|
||||
subroutine check_rotational_force_is_zero(code)
|
||||
integer, intent(in) :: code
|
||||
integer :: node
|
||||
integer :: idir
|
||||
|
||||
do node = 1, nnode
|
||||
do idir = 4, NDOF_NODE
|
||||
if (abs(fext(dof_id(idir,node))) .gt. TOL) call fail(code)
|
||||
end do
|
||||
end do
|
||||
end subroutine check_rotational_force_is_zero
|
||||
|
||||
subroutine check_node_force_z(node, expected, code)
|
||||
integer, intent(in) :: node
|
||||
real(rk), intent(in) :: expected
|
||||
integer, intent(in) :: code
|
||||
|
||||
call check_close(fext(dof_id(3,node)), expected, code)
|
||||
end subroutine check_node_force_z
|
||||
|
||||
subroutine check_close(actual, expected, code)
|
||||
real(rk), intent(in) :: actual
|
||||
real(rk), intent(in) :: expected
|
||||
integer, intent(in) :: code
|
||||
|
||||
if (abs(actual - expected) .gt. TOL * max(ONE, abs(expected))) call fail(code)
|
||||
end subroutine check_close
|
||||
|
||||
subroutine fail(code)
|
||||
integer, intent(in) :: code
|
||||
|
||||
write(*,*) 'test_shell_pressure failed:', code
|
||||
stop 1
|
||||
end subroutine fail
|
||||
|
||||
end program test_shell_pressure
|
||||
Reference in New Issue
Block a user