Add analytical rigid plane contact

This commit is contained in:
shenw
2026-06-24 19:26:51 +08:00
parent 10777d836c
commit 29d4280236
10 changed files with 703 additions and 91 deletions
+49
View File
@@ -13,6 +13,7 @@ program test_contact
call check_plane_force()
call check_target_node_only()
call check_analytic_pair_plane_force()
call check_explicit_contact_step()
call check_surface_pair_force()
call check_surface_pair_shell_sides()
@@ -85,6 +86,54 @@ contains
if (ierr .ne. FEM_SUCCESS) call fail(15)
end subroutine check_target_node_only
subroutine check_analytic_pair_plane_force()
integer :: ierr
integer :: dof1
integer :: dof2
call setup_basic_nodes(2, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(16)
call database_allocate_surfaces(2, 2, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(17)
call database_allocate_contact_pair(1, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(18)
surface_name(1) = 'SLAVE_NODES'
surface_type(1) = 'NODE'
surface_start(1) = 1
surface_count(1) = 1
surface_owner(1) = 1
surface_target(1) = '1'
surface_name(2) = 'RIGID_PLANE'
surface_type(2) = 'ANALYTICAL'
surface_start(2) = 2
surface_count(2) = 1
surface_owner(2) = 2
surface_target(2) = 'PLANE'
surface_plane_normal(:,2) = (/ ZERO, ZERO, ONE /)
surface_plane_offset(2) = ZERO
contact_pair_slave(1) = 'SLAVE_NODES'
contact_pair_master(1) = 'RIGID_PLANE'
contact_pair_penalty(1) = 100.0_rk
contact_pair_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(19)
call check_close(fcontact(dof1), 3.0_rk, 120)
call check_close(fcontact(dof2), ZERO, 121)
if (contact_active_count .ne. 1) call fail(122)
call check_close(contact_pair_force_norm(1), 3.0_rk, 123)
call database_finalize(ierr)
if (ierr .ne. FEM_SUCCESS) call fail(124)
end subroutine check_analytic_pair_plane_force
subroutine check_explicit_contact_step()
integer :: ierr
integer :: dof
+35 -1
View File
@@ -8,6 +8,7 @@ program test_implicit_inp
contact_pair_friction, n_surface, surface_name, &
surface_start, surface_count, surface_target, &
surface_face, surface_owner, surface_type, &
surface_plane_normal, surface_plane_offset, &
n_contact_property, contact_property_name, &
contact_property_penalty, contact_property_damping, &
contact_property_search, contact_property_friction, &
@@ -462,9 +463,41 @@ contains
call check_node_surface_inp()
call check_contact_property_inp()
call check_contact_analytical_inp()
call check_contact_pair_input_errors()
end subroutine check_contact_pair_inp
subroutine check_contact_analytical_inp()
integer :: ierr
integer :: node_count
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(560)
call fem_read_inp('tests/data/s4_contact_analytical_plane.inp', ierr)
if (ierr .ne. 0) call fail(561)
if (n_surface .ne. 2) call fail(562)
if (trim(surface_type(1)) .ne. 'NODE') call fail(563)
if (trim(surface_type(2)) .ne. 'ANALYTICAL') call fail(564)
if (trim(surface_target(2)) .ne. 'PLANE') call fail(565)
call check_close(surface_plane_normal(1,2), ZERO, 566)
call check_close(surface_plane_normal(2,2), ZERO, 567)
call check_close(surface_plane_normal(3,2), ONE, 568)
call check_close(surface_plane_offset(2), ZERO, 569)
if (trim(contact_pair_slave(1)) .ne. 'SLAVE_NODES') call fail(570)
if (trim(contact_pair_master(1)) .ne. 'RIGID_PLANE') call fail(571)
call fem_get_surface_node_count('SLAVE_NODES', node_count, ierr)
if (ierr .ne. 0) call fail(572)
if (node_count .ne. 1) call fail(573)
call fem_build_model(ierr)
if (ierr .ne. 0) call fail(574)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(575)
end subroutine check_contact_analytical_inp
subroutine check_contact_property_inp()
integer :: ierr
@@ -497,7 +530,8 @@ contains
call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_master.inp', 404)
call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_penalty.inp', 407)
call check_contact_pair_build_error('tests/data/s4_contact_pair_surface_bad_face.inp', 415)
call check_contact_pair_inp_error('tests/data/s4_contact_pair_surface_bad_type.inp', 445)
call check_contact_pair_inp_error( &
'tests/data/s4_contact_pair_surface_bad_analytical_line.inp', 445)
call check_contact_pair_build_error('tests/data/s4_contact_pair_unknown_property.inp', 548)
end subroutine check_contact_pair_input_errors