741 lines
21 KiB
Fortran
741 lines
21 KiB
Fortran
program test_contact
|
|
use fem_precision
|
|
use fem_error
|
|
use fem_database
|
|
use fem_contact
|
|
use fem_api
|
|
use fem_assembly_csr
|
|
use fem_sparse_csr
|
|
use fem_output_csv
|
|
implicit none
|
|
|
|
real(rk), parameter :: TOL = 1.0e-10_rk
|
|
|
|
call check_plane_force()
|
|
call check_target_node_only()
|
|
call check_explicit_contact_step()
|
|
call check_surface_pair_force()
|
|
call check_surface_pair_shell_sides()
|
|
call check_surface_pair_tangent()
|
|
call check_surface_pair_friction()
|
|
call check_surface_pair_multimaster()
|
|
call check_pair_clipped()
|
|
call check_pair_grid()
|
|
|
|
contains
|
|
|
|
subroutine check_plane_force()
|
|
integer :: ierr
|
|
integer :: dof1
|
|
integer :: dof2
|
|
|
|
call setup_basic_nodes(2, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(1)
|
|
call database_allocate_contact(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(2)
|
|
|
|
contact_target(1) = 'ALL'
|
|
contact_normal(:,1) = (/ ZERO, ZERO, ONE /)
|
|
contact_offset(1) = ZERO
|
|
contact_penalty(1) = 100.0_rk
|
|
contact_damping(1) = 10.0_rk
|
|
|
|
dof1 = dof_id(3,1)
|
|
dof2 = dof_id(3,2)
|
|
u(dof1) = -0.02_rk
|
|
v(dof1) = -0.10_rk
|
|
u(dof2) = 0.02_rk
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3)
|
|
call check_close(fcontact(dof1), 3.0_rk, 4)
|
|
call check_close(fcontact(dof2), ZERO, 5)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(6)
|
|
end subroutine check_plane_force
|
|
|
|
subroutine check_target_node_only()
|
|
integer :: ierr
|
|
integer :: dof1
|
|
integer :: dof2
|
|
|
|
call setup_basic_nodes(2, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(10)
|
|
call database_allocate_contact(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(11)
|
|
|
|
contact_target(1) = '2'
|
|
contact_normal(:,1) = (/ ZERO, ZERO, 2.0_rk /)
|
|
contact_offset(1) = ZERO
|
|
contact_penalty(1) = 100.0_rk
|
|
contact_damping(1) = ZERO
|
|
|
|
dof1 = dof_id(3,1)
|
|
dof2 = dof_id(3,2)
|
|
u(dof1) = -0.02_rk
|
|
u(dof2) = -0.02_rk
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(12)
|
|
call check_close(fcontact(dof1), ZERO, 13)
|
|
call check_close(fcontact(dof2), 2.0_rk, 14)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(15)
|
|
end subroutine check_target_node_only
|
|
|
|
subroutine check_explicit_contact_step()
|
|
integer :: ierr
|
|
integer :: dof
|
|
integer :: active_count
|
|
real(rk) :: work_step
|
|
real(rk) :: work_total
|
|
real(rk) :: max_penetration
|
|
real(rk) :: force_norm
|
|
|
|
call fem_initialize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(20)
|
|
|
|
call setup_basic_nodes(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(21)
|
|
mass_diag = ONE
|
|
call database_allocate_contact(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(22)
|
|
|
|
contact_target(1) = 'ALL'
|
|
contact_normal(:,1) = (/ ZERO, ZERO, ONE /)
|
|
contact_offset(1) = ZERO
|
|
contact_penalty(1) = 10.0_rk
|
|
contact_damping(1) = ZERO
|
|
|
|
dof = dof_id(3,1)
|
|
u(dof) = -0.10_rk
|
|
|
|
call fem_advance_explicit(0.10_rk, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(23)
|
|
call check_close(a(dof), ONE, 24)
|
|
call check_close(v(dof), 0.10_rk, 25)
|
|
call check_close(u(dof), -0.095_rk, 26)
|
|
call fem_get_contact_summary(active_count, work_step, work_total, &
|
|
max_penetration, force_norm, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(27)
|
|
if (active_count .ne. 1) call fail(28)
|
|
call check_close(max_penetration, 0.10_rk, 29)
|
|
call check_close(force_norm, ONE, 30)
|
|
call check_close(work_step, 0.05_rk, 31)
|
|
|
|
call fem_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(32)
|
|
end subroutine check_explicit_contact_step
|
|
|
|
subroutine check_surface_pair_force()
|
|
integer :: ierr
|
|
integer :: node
|
|
integer :: dof
|
|
|
|
call setup_contact_shell_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(30)
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(31)
|
|
|
|
do node = 1, 4
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), -2.5_rk, 32)
|
|
end do
|
|
do node = 5, 8
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), 2.5_rk, 33)
|
|
end do
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(34)
|
|
end subroutine check_surface_pair_force
|
|
|
|
subroutine check_surface_pair_shell_sides()
|
|
integer :: ierr
|
|
integer :: node
|
|
integer :: dof
|
|
|
|
call setup_contact_shell_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(35)
|
|
call set_shell_surfaces('SLAVE_POS', 'SPOS', &
|
|
'MASTER_POS', 'SPOS', ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(36)
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(37)
|
|
|
|
do node = 1, 4
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), -2.5_rk, 38)
|
|
end do
|
|
do node = 5, 8
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), 2.5_rk, 39)
|
|
end do
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3400)
|
|
|
|
call setup_contact_shell_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3401)
|
|
call set_shell_surfaces('SLAVE_NEG', 'SNEG', &
|
|
'MASTER_POS', 'SPOS', ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3402)
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3403)
|
|
|
|
do node = 1, 8
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), ZERO, 3404)
|
|
end do
|
|
if (contact_active_count .ne. 0) call fail(3405)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3406)
|
|
|
|
call setup_contact_shell_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3407)
|
|
coord0(:,5) = (/ ZERO, ZERO, 0.01_rk /)
|
|
coord0(:,6) = (/ ONE, ZERO, 0.01_rk /)
|
|
coord0(:,7) = (/ ONE, ONE, 0.01_rk /)
|
|
coord0(:,8) = (/ ZERO, ONE, 0.01_rk /)
|
|
coord = coord0
|
|
call set_shell_surfaces('SLAVE_NEG', 'SNEG', &
|
|
'MASTER_NEG', 'SNEG', ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3408)
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3409)
|
|
|
|
do node = 1, 4
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), 2.5_rk, 3410)
|
|
end do
|
|
do node = 5, 8
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), -2.5_rk, 3411)
|
|
end do
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(3412)
|
|
end subroutine check_surface_pair_shell_sides
|
|
|
|
subroutine check_surface_pair_tangent()
|
|
type(csr_matrix) :: kmat
|
|
integer :: ierr
|
|
integer :: stat
|
|
integer :: row
|
|
integer :: col
|
|
real(rk) :: value
|
|
|
|
call setup_contact_shell_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(40)
|
|
|
|
call csr_init(kmat)
|
|
call assembly_build_csr_pattern(kmat, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(41)
|
|
call contact_apply_plane_tangent(kmat, ZERO, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(42)
|
|
|
|
row = dof_id(3,5)
|
|
col = dof_id(3,5)
|
|
call csr_get_value(kmat, row, col, value, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(43)
|
|
call check_close(value, 1000.0_rk / 9.0_rk, 44)
|
|
|
|
col = dof_id(3,1)
|
|
call csr_get_value(kmat, row, col, value, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(45)
|
|
call check_close(value, -1000.0_rk / 9.0_rk, 46)
|
|
|
|
call csr_free(kmat, stat)
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(47)
|
|
end subroutine check_surface_pair_tangent
|
|
|
|
subroutine check_surface_pair_friction()
|
|
type(csr_matrix) :: kmat
|
|
integer :: ierr
|
|
integer :: stat
|
|
integer :: node
|
|
integer :: dof
|
|
integer :: row
|
|
integer :: col
|
|
real(rk) :: value
|
|
|
|
call setup_contact_shell_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(50)
|
|
contact_pair_friction(1) = 0.2_rk
|
|
do node = 5, 8
|
|
dof = dof_id(1,node)
|
|
v(dof) = ONE
|
|
end do
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(51)
|
|
|
|
do node = 1, 4
|
|
dof = dof_id(1,node)
|
|
call check_close(fcontact(dof), 0.5_rk, 52)
|
|
end do
|
|
do node = 5, 8
|
|
dof = dof_id(1,node)
|
|
call check_close(fcontact(dof), -0.5_rk, 53)
|
|
end do
|
|
if (contact_pair_stick_count(1) .ne. 0) call fail(500)
|
|
if (contact_pair_slip_count(1) .ne. 1) call fail(501)
|
|
call check_close(contact_pair_slip(1), 0.998_rk, 502)
|
|
call check_close(contact_pair_tangent_force(1,1), -2.0_rk, 503)
|
|
|
|
call csr_init(kmat)
|
|
call assembly_build_csr_pattern(kmat, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(54)
|
|
call contact_apply_plane_tangent(kmat, ZERO, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(55)
|
|
|
|
row = dof_id(1,5)
|
|
col = dof_id(1,5)
|
|
call csr_get_value(kmat, row, col, value, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(56)
|
|
call check_close(value, 200.0_rk / 9.0_rk, 57)
|
|
|
|
call csr_free(kmat, stat)
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(58)
|
|
end subroutine check_surface_pair_friction
|
|
|
|
subroutine check_surface_pair_multimaster()
|
|
integer :: ierr
|
|
integer :: node
|
|
integer :: dof
|
|
|
|
call setup_contact_shell_multimaster(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(60)
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(61)
|
|
|
|
do node = 5, 8
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), 2.5_rk, 62)
|
|
end do
|
|
do node = 1, 4
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), -1.25_rk, 63)
|
|
end do
|
|
do node = 9, 12
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), -1.25_rk, 64)
|
|
end do
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(65)
|
|
end subroutine check_surface_pair_multimaster
|
|
|
|
subroutine check_pair_clipped()
|
|
integer :: ierr
|
|
integer :: node
|
|
|
|
call setup_contact_shell_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(70)
|
|
|
|
do node = 5, 8
|
|
coord0(1,node) = coord0(1,node) + 0.5_rk
|
|
end do
|
|
coord = coord0
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(71)
|
|
|
|
call check_close(fcontact(dof_id(3,5)), 1.875_rk, 72)
|
|
call check_close(fcontact(dof_id(3,6)), 0.625_rk, 73)
|
|
call check_close(fcontact(dof_id(3,7)), 0.625_rk, 74)
|
|
call check_close(fcontact(dof_id(3,8)), 1.875_rk, 75)
|
|
call check_close(fcontact(dof_id(3,1)), -0.625_rk, 76)
|
|
call check_close(fcontact(dof_id(3,2)), -1.875_rk, 77)
|
|
call check_close(fcontact(dof_id(3,3)), -1.875_rk, 78)
|
|
call check_close(fcontact(dof_id(3,4)), -0.625_rk, 79)
|
|
|
|
if (contact_active_count .ne. 1) call fail(80)
|
|
if (contact_pair_active(1) .ne. 1) call fail(81)
|
|
call check_close(contact_max_penetration, 0.01_rk, 82)
|
|
call check_close(contact_pair_max_penetration(1), 0.01_rk, 83)
|
|
call check_close(contact_force_norm, 5.0_rk, 84)
|
|
call check_close(contact_pair_force_norm(1), 5.0_rk, 85)
|
|
call check_close(contact_work_step, 0.025_rk, 86)
|
|
call check_close(contact_pair_work(1), 0.025_rk, 87)
|
|
|
|
call output_csv_write(910, ZERO, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(600)
|
|
call require_contains('contact_00000910.csv', &
|
|
'kind,pair_id,active_count,max_penetration,force_norm,work_estimate,'// &
|
|
'cumulative_work,stick_count,slip_count,accumulated_slip,ftx,fty,ftz', 601)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(88)
|
|
end subroutine check_pair_clipped
|
|
|
|
subroutine check_pair_grid()
|
|
type(csr_matrix) :: kmat
|
|
integer :: ierr
|
|
integer :: stat
|
|
integer :: node
|
|
integer :: dof
|
|
integer :: row
|
|
integer :: col
|
|
real(rk) :: value
|
|
|
|
call setup_contact_grid_pair(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(90)
|
|
|
|
call contact_apply_plane_forces(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(91)
|
|
|
|
do node = 73, 76
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), 2.5_rk, 92)
|
|
end do
|
|
do node = 1, 4
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), -2.5_rk, 93)
|
|
end do
|
|
do node = 5, 72
|
|
dof = dof_id(3,node)
|
|
call check_close(fcontact(dof), ZERO, 94)
|
|
end do
|
|
if (contact_active_count .ne. 1) call fail(95)
|
|
call check_close(contact_force_norm, 10.0_rk, 96)
|
|
|
|
call csr_init(kmat)
|
|
call assembly_build_csr_pattern(kmat, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(510)
|
|
call contact_apply_plane_tangent(kmat, ZERO, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(511)
|
|
row = dof_id(3,73)
|
|
col = dof_id(3,73)
|
|
call csr_get_value(kmat, row, col, value, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(512)
|
|
call check_close(value, 1000.0_rk / 9.0_rk, 513)
|
|
col = dof_id(3,1)
|
|
call csr_get_value(kmat, row, col, value, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(514)
|
|
call check_close(value, -1000.0_rk / 9.0_rk, 515)
|
|
call csr_free(kmat, stat)
|
|
|
|
call database_finalize(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) call fail(97)
|
|
end subroutine check_pair_grid
|
|
|
|
subroutine setup_basic_nodes(num_nodes, ierr)
|
|
integer, intent(in) :: num_nodes
|
|
integer, intent(out) :: ierr
|
|
integer :: node
|
|
integer :: idir
|
|
integer :: counter
|
|
|
|
call database_allocate_basic(num_nodes, 0, 3 * num_nodes, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
counter = 0
|
|
do node = 1, num_nodes
|
|
node_id_ext(node) = node
|
|
coord0(:,node) = ZERO
|
|
coord(:,node) = ZERO
|
|
do idir = 1, NDIM
|
|
counter = counter + 1
|
|
dof_id(idir,node) = counter
|
|
end do
|
|
end do
|
|
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_basic_nodes
|
|
|
|
subroutine setup_contact_shell_pair(ierr)
|
|
integer, intent(out) :: ierr
|
|
|
|
call database_allocate_model(8, 2, 0, 2, 0, 2, 1, 0, 1, &
|
|
0, 0, 0, 0, 0, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
node_id_ext(1:8) = (/ 1, 2, 3, 4, 5, 6, 7, 8 /)
|
|
coord0(:,1) = (/ ZERO, ZERO, ZERO /)
|
|
coord0(:,2) = (/ ONE, ZERO, ZERO /)
|
|
coord0(:,3) = (/ ONE, ONE, ZERO /)
|
|
coord0(:,4) = (/ ZERO, ONE, ZERO /)
|
|
coord0(:,5) = (/ ZERO, ZERO, -0.01_rk /)
|
|
coord0(:,6) = (/ ONE, ZERO, -0.01_rk /)
|
|
coord0(:,7) = (/ ONE, ONE, -0.01_rk /)
|
|
coord0(:,8) = (/ ZERO, ONE, -0.01_rk /)
|
|
coord = coord0
|
|
|
|
elem_id_ext(1) = 1
|
|
elem_type(1) = 'S4'
|
|
elem_nnode(1) = 4
|
|
elem_conn(:,1) = 0
|
|
elem_conn(1:4,1) = (/ 1, 2, 3, 4 /)
|
|
elem_mat(1) = 1
|
|
elem_sec(1) = 1
|
|
|
|
elem_id_ext(2) = 2
|
|
elem_type(2) = 'S4'
|
|
elem_nnode(2) = 4
|
|
elem_conn(:,2) = 0
|
|
elem_conn(1:4,2) = (/ 5, 6, 7, 8 /)
|
|
elem_mat(2) = 1
|
|
elem_sec(2) = 1
|
|
|
|
elset_name(1) = 'MASTER'
|
|
elset_start(1) = 1
|
|
elset_count(1) = 1
|
|
elset_items(1) = 1
|
|
elset_name(2) = 'SLAVE'
|
|
elset_start(2) = 2
|
|
elset_count(2) = 1
|
|
elset_items(2) = 2
|
|
|
|
mat_name(1) = 'MAT'
|
|
mat_density(1) = ONE
|
|
mat_e(1) = 30.0_rk
|
|
mat_nu(1) = 0.25_rk
|
|
|
|
section_type(1) = 'SHELL'
|
|
section_elset_name(1) = 'ALL'
|
|
section_material_name(1) = 'MAT'
|
|
section_thickness(1) = 0.1_rk
|
|
|
|
call database_assign_dofs(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
call database_allocate_contact_pair(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
contact_pair_slave(1) = 'SLAVE'
|
|
contact_pair_master(1) = 'MASTER'
|
|
contact_pair_penalty(1) = 1000.0_rk
|
|
contact_pair_damping(1) = ZERO
|
|
contact_pair_search(1) = 0.1_rk
|
|
contact_pair_friction(1) = ZERO
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_contact_shell_pair
|
|
|
|
subroutine set_shell_surfaces(slave_name, slave_face, &
|
|
master_name, master_face, ierr)
|
|
character(len=*), intent(in) :: slave_name
|
|
character(len=*), intent(in) :: slave_face
|
|
character(len=*), intent(in) :: master_name
|
|
character(len=*), intent(in) :: master_face
|
|
integer, intent(out) :: ierr
|
|
|
|
call database_allocate_surfaces(2, 2, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
surface_name(1) = master_name
|
|
surface_start(1) = 1
|
|
surface_count(1) = 1
|
|
surface_owner(1) = 1
|
|
surface_target(1) = 'MASTER'
|
|
surface_face(1) = master_face
|
|
|
|
surface_name(2) = slave_name
|
|
surface_start(2) = 2
|
|
surface_count(2) = 1
|
|
surface_owner(2) = 2
|
|
surface_target(2) = 'SLAVE'
|
|
surface_face(2) = slave_face
|
|
|
|
contact_pair_slave(1) = slave_name
|
|
contact_pair_master(1) = master_name
|
|
ierr = FEM_SUCCESS
|
|
end subroutine set_shell_surfaces
|
|
|
|
subroutine setup_contact_shell_multimaster(ierr)
|
|
integer, intent(out) :: ierr
|
|
|
|
call database_allocate_model(12, 3, 0, 2, 0, 3, 1, 0, 1, &
|
|
0, 0, 0, 0, 0, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
node_id_ext(1:12) = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 /)
|
|
coord0(:,1) = (/ ZERO, ZERO, ZERO /)
|
|
coord0(:,2) = (/ ONE, ZERO, ZERO /)
|
|
coord0(:,3) = (/ ONE, ONE, ZERO /)
|
|
coord0(:,4) = (/ ZERO, ONE, ZERO /)
|
|
coord0(:,5) = (/ ZERO, ZERO, -0.01_rk /)
|
|
coord0(:,6) = (/ ONE, ZERO, -0.01_rk /)
|
|
coord0(:,7) = (/ ONE, ONE, -0.01_rk /)
|
|
coord0(:,8) = (/ ZERO, ONE, -0.01_rk /)
|
|
coord0(:,9) = coord0(:,1)
|
|
coord0(:,10) = coord0(:,2)
|
|
coord0(:,11) = coord0(:,3)
|
|
coord0(:,12) = coord0(:,4)
|
|
coord = coord0
|
|
|
|
elem_id_ext(1:3) = (/ 1, 2, 3 /)
|
|
elem_type(1:3) = 'S4'
|
|
elem_nnode(1:3) = 4
|
|
elem_conn(:,1:3) = 0
|
|
elem_conn(1:4,1) = (/ 1, 2, 3, 4 /)
|
|
elem_conn(1:4,2) = (/ 5, 6, 7, 8 /)
|
|
elem_conn(1:4,3) = (/ 9, 10, 11, 12 /)
|
|
elem_mat(1:3) = 1
|
|
elem_sec(1:3) = 1
|
|
|
|
elset_name(1) = 'MASTER'
|
|
elset_start(1) = 1
|
|
elset_count(1) = 2
|
|
elset_items(1:2) = (/ 1, 3 /)
|
|
elset_name(2) = 'SLAVE'
|
|
elset_start(2) = 3
|
|
elset_count(2) = 1
|
|
elset_items(3) = 2
|
|
|
|
mat_name(1) = 'MAT'
|
|
mat_density(1) = ONE
|
|
mat_e(1) = 30.0_rk
|
|
mat_nu(1) = 0.25_rk
|
|
|
|
section_type(1) = 'SHELL'
|
|
section_elset_name(1) = 'ALL'
|
|
section_material_name(1) = 'MAT'
|
|
section_thickness(1) = 0.1_rk
|
|
|
|
call database_assign_dofs(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
call database_allocate_contact_pair(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
contact_pair_slave(1) = 'SLAVE'
|
|
contact_pair_master(1) = 'MASTER'
|
|
contact_pair_penalty(1) = 1000.0_rk
|
|
contact_pair_damping(1) = ZERO
|
|
contact_pair_search(1) = 0.1_rk
|
|
contact_pair_friction(1) = ZERO
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_contact_shell_multimaster
|
|
|
|
subroutine setup_contact_grid_pair(ierr)
|
|
integer, intent(out) :: ierr
|
|
integer :: master
|
|
integer :: node_base
|
|
integer :: xshift
|
|
|
|
call database_allocate_model(76, 19, 0, 2, 0, 19, 1, 0, 1, &
|
|
0, 0, 0, 0, 0, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
|
|
do master = 1, 18
|
|
node_base = 4 * (master - 1)
|
|
xshift = 10 * (master - 1)
|
|
node_id_ext(node_base+1:node_base+4) = &
|
|
(/ node_base + 1, node_base + 2, node_base + 3, node_base + 4 /)
|
|
coord0(:,node_base+1) = (/ real(xshift, rk), ZERO, ZERO /)
|
|
coord0(:,node_base+2) = (/ real(xshift, rk) + ONE, ZERO, ZERO /)
|
|
coord0(:,node_base+3) = (/ real(xshift, rk) + ONE, ONE, ZERO /)
|
|
coord0(:,node_base+4) = (/ real(xshift, rk), ONE, ZERO /)
|
|
elem_id_ext(master) = master
|
|
elem_type(master) = 'S4'
|
|
elem_nnode(master) = 4
|
|
elem_conn(:,master) = 0
|
|
elem_conn(1:4,master) = &
|
|
(/ node_base + 1, node_base + 2, node_base + 3, node_base + 4 /)
|
|
elem_mat(master) = 1
|
|
elem_sec(master) = 1
|
|
end do
|
|
|
|
node_id_ext(73:76) = (/ 73, 74, 75, 76 /)
|
|
coord0(:,73) = (/ ZERO, ZERO, -0.01_rk /)
|
|
coord0(:,74) = (/ ONE, ZERO, -0.01_rk /)
|
|
coord0(:,75) = (/ ONE, ONE, -0.01_rk /)
|
|
coord0(:,76) = (/ ZERO, ONE, -0.01_rk /)
|
|
coord = coord0
|
|
|
|
elem_id_ext(19) = 19
|
|
elem_type(19) = 'S4'
|
|
elem_nnode(19) = 4
|
|
elem_conn(:,19) = 0
|
|
elem_conn(1:4,19) = (/ 73, 74, 75, 76 /)
|
|
elem_mat(19) = 1
|
|
elem_sec(19) = 1
|
|
|
|
elset_name(1) = 'MASTER'
|
|
elset_start(1) = 1
|
|
elset_count(1) = 18
|
|
do master = 1, 18
|
|
elset_items(master) = master
|
|
end do
|
|
elset_name(2) = 'SLAVE'
|
|
elset_start(2) = 19
|
|
elset_count(2) = 1
|
|
elset_items(19) = 19
|
|
|
|
mat_name(1) = 'MAT'
|
|
mat_density(1) = ONE
|
|
mat_e(1) = 30.0_rk
|
|
mat_nu(1) = 0.25_rk
|
|
|
|
section_type(1) = 'SHELL'
|
|
section_elset_name(1) = 'ALL'
|
|
section_material_name(1) = 'MAT'
|
|
section_thickness(1) = 0.1_rk
|
|
|
|
call database_assign_dofs(ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
call database_allocate_contact_pair(1, ierr)
|
|
if (ierr .ne. FEM_SUCCESS) return
|
|
contact_pair_slave(1) = 'SLAVE'
|
|
contact_pair_master(1) = 'MASTER'
|
|
contact_pair_penalty(1) = 1000.0_rk
|
|
contact_pair_damping(1) = ZERO
|
|
contact_pair_search(1) = 0.1_rk
|
|
contact_pair_friction(1) = ZERO
|
|
ierr = FEM_SUCCESS
|
|
end subroutine setup_contact_grid_pair
|
|
|
|
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))) then
|
|
write(*,*) 'check_close actual expected:', actual, expected
|
|
call fail(code)
|
|
end if
|
|
end subroutine check_close
|
|
|
|
subroutine require_contains(filename, pattern, code)
|
|
character(len=*), intent(in) :: filename
|
|
character(len=*), intent(in) :: pattern
|
|
integer, intent(in) :: code
|
|
character(len=512) :: line
|
|
integer :: unit_id
|
|
integer :: ios
|
|
logical :: found
|
|
|
|
found = .false.
|
|
unit_id = 72
|
|
open(unit=unit_id, file=trim(filename), status='old', action='read', iostat=ios)
|
|
if (ios .ne. 0) call fail(code)
|
|
|
|
do
|
|
read(unit_id,'(A)',iostat=ios) line
|
|
if (ios .ne. 0) exit
|
|
if (index(line, trim(pattern)) .gt. 0) then
|
|
found = .true.
|
|
exit
|
|
end if
|
|
end do
|
|
|
|
close(unit_id)
|
|
if (.not. found) call fail(code)
|
|
end subroutine require_contains
|
|
|
|
subroutine fail(code)
|
|
integer, intent(in) :: code
|
|
|
|
write(*,*) 'test_contact failed:', code
|
|
stop 1
|
|
end subroutine fail
|
|
|
|
end program test_contact
|