This example demonstrates the use of frictional contact between two objects.
The soft body is gradually displaced against the rigid body and frictional
contact provides resistance between two bodies, resulting in shear deformation
of the soft body.
# If the example path is not set, default to current directory
if (!defined $example) {
$example = "./";
}
# Drop off the trailing / in the example path
$chopped = chop $example;
if ($chopped ne "/") {
$example .= $chopped;
}
$LOAD=30; # define number of load steps
$OVER_LAP=1; # initial overlap to solve contact
set echo
fem def para;r;contact;example # memory allocation
fem def coord 3,1 # 3D model
fem def reg;r;regi;example # define two regions
fem def base;r;Base;example # define basis functions.
# Tricubic for geometry, trilinear for incompressibility (see .ipequa)
# define slave geometry
fem def node;r;Slave_1by1by1;example reg 1
fem def elem;r;Slave_1by1by1;example reg 1
fem def fibr;r;Slave_1by1by1;example reg 1
fem def elem;r;Slave_1by1by1;example fib reg 1
# define master geometry
fem def node;r;Master_1by1by1;example reg 2
fem def elem;r;Master_1by1by1;example reg 2
fem def fibr;r;Master_1by1by1;example reg 2
fem def elem;r;Master_1by1by1;example fib reg 2
# re-size and re-position master body
fem change node scale by 5,5,1 reg 2
fem change node translate by -5,-5,2 reg 2
# must update scale factors after using 'fem change node scale' command
fem update scale normalise reg 2
# export slave and master bodies
#fem export node;Undeformed_Slave as Undeformed_Slave reg 1
#fem export elem;Undeformed_Slave as Undeformed_Slave reg 1
#fem export node;Undeformed_Master as Undeformed_Master reg 2
#fem export elem;Undeformed_Master as Undeformed_Master reg 2
# group element, node, faces for boundary conditions
fem group elem all s3=1 external as SLAVE_TOP reg 1
fem group elem all s3=0 external as SLAVE_BOTTOM reg 1
fem group node elem SLAVE_BOTTOM xi3=0 external as SLAVE_FIXED reg 1
fem group face all elem SLAVE_TOP xi3 high external as SLAVE_FACE reg 1
fem group elem all as MASTER_TOP reg 2
fem group node elem MASTER_TOP xi3=1 as TEMP1 reg 2
fem group node elem MASTER_TOP xi3=0 as TEMP2 reg 2
fem group node TEMP1,TEMP2 as MASTER reg 2
fem group node elem MASTER_TOP xi3=1 external as MASTER_FIXED reg 2
fem group face all elem MASTER_TOP xi3 low external as MASTER_FACE reg 2
# 3D finite elasticity with contact, neo-hookean material, and fixed boundary conditions for both bodies
# For slave body, non-contact nodes are displaced in both x, y coordinates to shift the body
# Contact mechanics will provide resistance to the contact nodes of the slave body
fem def equa;r;slave;example reg 1
fem def mate;r;slave_neo;example reg 1
fem def init;r;slave;example reg 1
fem def equa;r;master;example reg 2
fem def mate;r;master_neo;example reg 2
fem def init;r;master;example reg 2
# define contact parameter values
fem def contact;r;contact;example
# define LU solver for coupled problem.
fem def solv;r;LU;example coupled reg 1,2
for ($i=1;$i<=$LOAD;$i++){
# for the 1st load step, move slave body to create overlap with master body
if ($i==1) {
# Copy YP1 into XP
fem update geom from sol YP_index 1 to 1..3 reg 1
# Translate XP
fem change node translate by 0,0,$OVER_LAP reg 1
# update YP1 from the translated XP
fem update solution geometry substitute reg 1
# Update XP from YP3
fem update geom from sol YP_index 3 to 1..3 reg 1
}
# contact newton loop
$CONVERGED=0;
while ($CONVERGED==0){
print " \n";
print " ==================== \n";
print " Load step = $i \n";
print " ==================== \n";
print " \n";
### Projection ###
# update XP from YP
FEM up geom from sol to 1..3 reg 1,2
fem def xi;c contact_friction faces SLAVE_FACE points 4 boundary reg 1
# Define data at xi positions
fem def data;c from_xi
# Update slave info
fem update data field to slave
# Project onto target face (Region 2)
fem def xi;c closest_face faces MASTER_FACE region 2
# store projection gap in data fields
fem update data field from gap region 2
# Update master info
fem update data field to master
# Place initial geometry YP(ny,3) into XP
fem up geom from sol YP_index 3 to 1..3 reg 1,2
##################
# Solve finite elasticity/contact problem
fem solve coupled error 0.1D-03 iterate 20 reg 1,2
} # NEWTON STEP
} # LOAD STEP
# write out contact residual, which is stored in YP(ny,6)
# WARNING: The contact residual written out here contains residual
# for reg 1 (under nc=1) and reg 2 (under nc=2) due to the
# different array setting for YP(ny,6) (no class is defined)
# It is the same case for finite elasticity residual stored in
# YP(ny,4), so reg 2 residual is stored under nc=2 in reg 1.
fem list variable;contact_residual number 6
# save solution
fem def init;w;conv_soln