Step 1 - First Contact
Continuing from the final step in the tensor mechanics tutorial we add a first attempt at mechanical contact.
#
# A first attempt at mechanical contact
# https://mooseframework.inl.gov/modules/contact/tutorials/introduction/step01.html
#
[GlobalParams]
displacements = 'disp_x disp_y'
[]
[Mesh]
[generated1]
type = GeneratedMeshGenerator
dim = 2
nx = 5
ny = 15
xmin = -0.6
xmax = -0.1
ymax = 5
bias_y = 0.9
boundary_name_prefix = pillar1
[]
[generated2]
type = GeneratedMeshGenerator
dim = 2
nx = 5
ny = 15
xmin = 0.1
xmax = 0.6
ymax = 5
bias_y = 0.9
boundary_name_prefix = pillar2
boundary_id_offset = 4
[]
[collect_meshes]
type = MeshCollectionGenerator
inputs = 'generated1 generated2'
[]
patch_update_strategy = iteration
[]
[Modules/TensorMechanics/Master]
[all]
add_variables = true
strain = FINITE
generate_output = 'vonmises_stress'
[]
[]
[Contact]
[pillars]
primary = pillar1_right
secondary = pillar2_left
model = frictionless
formulation = penalty
penalty = 1e9
normalize_penalty = true
[]
[]
[BCs]
[bottom_x]
type = DirichletBC
variable = disp_x
boundary = 'pillar1_bottom pillar2_bottom'
value = 0
[]
[bottom_y]
type = DirichletBC
variable = disp_y
boundary = 'pillar1_bottom pillar2_bottom'
value = 0
[]
[Pressure]
[sides]
boundary = 'pillar1_left pillar2_right'
# we square time here to get a more progressive loading curve
# (more pressure later on once contact is established)
function = 1e4*t^2
[]
[]
[]
[Materials]
[elasticity]
type = ComputeIsotropicElasticityTensor
youngs_modulus = 1e9
poissons_ratio = 0.3
[]
[stress]
type = ComputeFiniteStrainElasticStress
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
line_search = none
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
end_time = 5
dt = 0.5
[Predictor]
type = SimplePredictor
scale = 1
[]
[]
[Outputs]
exodus = true
print_linear_residuals = false
perf_graph = true
[]
(modules/contact/tutorials/introduction/step01.i)If you recall, in the final step of the mechanics tutorial we modeled two cantilevers that were bent towards eachother and ended up occupying the same space without interacting. We're about to change that.
Input file
Mesh
We add the "patch_update_strategy" parameter and set it to iteration
. MOOSE actually recommends this setting when you run the model without it. The parameter configures the geometric search that is required for modeling contact.
Contact
This is the major functional addition to the previous input. The [Contact]
action block is doing the heavy lifting for us in setting up all objects required to enforce mechanical contact in one of the numerous ways supported by MOOSE (penalty, kinematic, mortar - frictionless, glued, frictional).
We use the "primary" and "secondary" parameters to specify the two interfaces we want to interact through mechanical contact. The "model" parameter is set to select frictionless contact and as the "formulation" we chose the penalty method. Frictionless penalty based contact is a good initial choice for contact modeling as it exhibits benign convergence properties and works in 2D as well as 3D.
We select a "penalty" factor of 1e9. The choice of the penalty should be guided by the stiffness of your system. A factor close to the Young's modulus of the materials involved in contact, but not exceeding it, is recommended. Penalty contact allows for a non-zero interpenetration of the contact surfaces. Both the kinematic
and mortar
formulation will enforce penetrations as low as the solution convergence allows.
We utilize the "normalize_penalty" option here to compensate for mesh size effects.
BCs
Note that we've made a small change to the pressure BC, changing the applied pressure from 1e4*t
to 1e4*t^2
. This is simply for demonstration purposes to apply a stronger pressure later in the simulation to force the cantilevers to bend more and establish contact over a larger area.
Tasks and questions
First run the example and look at the output. You should see some new fields that can be visualized in Paraview (or the Exodus viewer of your choice). In particular please pay attention to contact_force
and penetration
.
Penetration
Visualize the penetration variable. You may have to rescale the visualization to start the color scale at 0. Negative penetrations are not of interest here (they effectively are the gap width)
You should see a maximum interpenetration of about 6e-4, which is about half a percent of the element width. It is application dependent whether this amount is acceptable.
Once you've answered the questions and run this example we will move on to Step 2 which introduces mortar based contact.