www.mooseframework.org
TangentialMortarLMMechanicalContact.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "SubProblem.h"
12 
14 
17  ADMortarConstraint,
18  params.addRequiredParam<NonlinearVariableName>("slave_disp_y",
19  "The y displacement variable on the slave face");
20  params.addParam<NonlinearVariableName>("master_disp_y",
21  "The y displacement variable on the master face");
22  params.addRequiredParam<NonlinearVariableName>(
23  "contact_pressure",
24  "The normal contact pressure; oftentimes this may be a separate lagrange multiplier "
25  "variable");
26  params.addRequiredParam<Real>("friction_coefficient", "The friction coefficient");
27 
28  MooseEnum ncp_type("min fb", "fb");
29  params.addParam<MooseEnum>("ncp_function_type",
30  ncp_type,
31  "The type of the nonlinear complimentarity function; options are "
32  "min or fb where fb stands for Fischer-Burmeister");
33  params.addParam<Real>("c",
34  1,
35  "Parameter for balancing the size of the velocity and the pressures");
36  params.set<bool>("compute_primal_residuals") = false;
37  params.addClassDescription("Ensures that the Karush-Kuhn-Tucker conditions of Coulomb "
38  "frictional contact are satisfied"););
39 
40 template <ComputeStage compute_stage>
42  const InputParameters & parameters)
43  : ADMortarConstraint<compute_stage>(parameters),
44  _slave_disp_y(
45  this->_subproblem.getStandardVariable(_tid, parameters.getMooseType("slave_disp_y"))),
46  _master_disp_y(
47  isParamValid("master_disp_y")
48  ? this->_subproblem.getStandardVariable(_tid, parameters.getMooseType("master_disp_y"))
49  : this->_subproblem.getStandardVariable(_tid, parameters.getMooseType("slave_disp_y"))),
50  _contact_pressure_var(
51  this->_subproblem.getStandardVariable(_tid, parameters.getMooseType("contact_pressure"))),
52  _contact_pressure(_contact_pressure_var.template adSlnLower<compute_stage>()),
53  _slave_x_dot(_slave_var.template adUDot<compute_stage>()),
54  _master_x_dot(_master_var.template adUDotNeighbor<compute_stage>()),
55  _slave_y_dot(_slave_disp_y.template adUDot<compute_stage>()),
56  _master_y_dot(_master_disp_y.template adUDotNeighbor<compute_stage>()),
57  _friction_coeff(getParam<Real>("friction_coefficient")),
58  _epsilon(std::numeric_limits<Real>::epsilon()),
59  _ncp_type(getParam<MooseEnum>("ncp_function_type")),
60  _c(getParam<Real>("c"))
61 {
62 }
63 
64 template <ComputeStage compute_stage>
65 ADReal
67 {
68  switch (mortar_type)
69  {
70  case Moose::MortarType::Lower:
71  {
72  // Check whether we project onto a master face
73  if (_has_master)
74  {
75  // Check whether we are actually in contact
76  if (_contact_pressure[_qp] > TOLERANCE * TOLERANCE)
77  {
78  // Build the velocity vector
79  ADRealVectorValue relative_velocity(
80  _slave_x_dot[_qp] - _master_x_dot[_qp], _slave_y_dot[_qp] - _master_y_dot[_qp], 0);
81 
82  // Get the component in the tangential direction
83  auto tangential_velocity = relative_velocity * _tangents[_qp][0];
84 
85  // NCP part 1: requirement that either there is no slip **or** slip velocity and
86  // frictional force exerted **by** the slave side are in the same direction
87  ADReal a;
88  if (tangential_velocity * _lambda[_qp] < 0)
89  a = -std::abs(tangential_velocity);
90  else
91  a = std::abs(tangential_velocity);
92  a *= _c;
93 
94  // NCP part 2: require that the frictional force can never exceed the frictional
95  // coefficient times the normal force
96  auto b = _friction_coeff * _contact_pressure[_qp] - std::abs(_lambda[_qp]);
97 
98  ADReal fb_function;
99  if (_ncp_type == "fb")
100  // The FB function (in its pure form) is not differentiable at (0, 0) but if we add some
101  // constant > 0 into the root function, then it is
102  fb_function = a + b - std::sqrt(a * a + b * b + _epsilon);
103  else
104  fb_function = std::min(a, b);
105 
106  return _test[_i][_qp] * fb_function;
107  }
108  else
109  // If not in contact then we force the tangential lagrange multiplier to zero
110  return _test[_i][_qp] * _lambda[_qp];
111  }
112  else
113  // If not in contact then we force the tangential lagrange multiplier to zero (if we don't
114  // project onto a master face, then we're definitely not in contact)
115  return _test[_i][_qp] * _lambda[_qp];
116  }
117 
118  default:
119  return 0;
120  }
121 }
TangentialMortarLMMechanicalContact::computeQpResidual
ADReal computeQpResidual(Moose::MortarType) final
Definition: TangentialMortarLMMechanicalContact.C:66
TangentialMortarLMMechanicalContact.h
registerADMooseObject
registerADMooseObject("MooseApp", TangentialMortarLMMechanicalContact)
TangentialMortarLMMechanicalContact
Definition: TangentialMortarLMMechanicalContact.h:15
defineADValidParams
defineADValidParams(TangentialMortarLMMechanicalContact, ADMortarConstraint, params.addRequiredParam< NonlinearVariableName >("slave_disp_y", "The y displacement variable on the slave face");params.addParam< NonlinearVariableName >("master_disp_y", "The y displacement variable on the master face");params.addRequiredParam< NonlinearVariableName >("contact_pressure", "The normal contact pressure; oftentimes this may be a separate lagrange multiplier " "variable");params.addRequiredParam< Real >("friction_coefficient", "The friction coefficient");MooseEnum ncp_type("min fb", "fb");params.addParam< MooseEnum >("ncp_function_type", ncp_type, "The type of the nonlinear complimentarity function; options are " "min or fb where fb stands for Fischer-Burmeister");params.addParam< Real >("c", 1, "Parameter for balancing the size of the velocity and the pressures");params.set< bool >("compute_primal_residuals")=false;params.addClassDescription("Ensures that the Karush-Kuhn-Tucker conditions of Coulomb " "frictional contact are satisfied");)
TangentialMortarLMMechanicalContact::TangentialMortarLMMechanicalContact
TangentialMortarLMMechanicalContact(const InputParameters &parameters)
Definition: TangentialMortarLMMechanicalContact.C:41