https://mooseframework.inl.gov
TangentialMortarMechanicalContact.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
13 
15 
18 {
20 
21  MooseEnum component("x=0 y=1 z=2");
23  "component", component, "The force component constraint that this object is supplying");
24 
25  // This enum is used to pick the proper 'tangent' vector (i.e. tangent or binormal)
26  MooseEnum direction("direction_1 direction_2", "direction_1");
27  params.addParam<MooseEnum>("direction",
28  direction,
29  "Tangent direction to compute the residual due to frictional contact");
30  params.addClassDescription(
31  "Used to apply tangential stresses from frictional contact using lagrange multipliers");
32  params.addRequiredParam<UserObjectName>("weighted_velocities_uo",
33  "The weighted velocities user object.");
34  params.set<bool>("interpolate_normals") = false;
35  params.set<bool>("compute_lm_residual") = false;
36  return params;
37 }
38 
40  const InputParameters & parameters)
41  : ADMortarLagrangeConstraint(parameters),
42  _component(getParam<MooseEnum>("component")),
43  _direction(getParam<MooseEnum>("direction")),
44  _weighted_velocities_uo(const_cast<WeightedVelocitiesUserObject &>(
45  getUserObject<WeightedVelocitiesUserObject>("weighted_velocities_uo")))
46 {
47 }
48 
49 ADReal
51 {
52  const auto & nodal_tangents = amg().getNodalTangents(*_lower_secondary_elem);
53  MooseEnum direction("direction_1 direction_2", "direction_1");
54 
55  const auto tangential_pressure =
56  _direction.compareCurrent(direction)
59 
60  switch (type)
61  {
63  // We have taken the convention the lagrange multiplier must have the same sign as the
64  // relative slip velocity of the secondary face. So positive lambda indicates that force is
65  // being applied in the negative direction, so we want to decrease the momentum in the system,
66  // which means we want an outflow of momentum, which means we want the residual to be positive
67  // in that case. Negative lambda means force is being applied in the positive direction, so we
68  // want to increase momentum in the system, which means we want an inflow of momentum, which
69  // means we want the residual to be negative in that case. So the sign of this residual should
70  // be the same as the sign of lambda
71  {
72  const unsigned int tangent_index = libmesh_map_find(_secondary_ip_lowerd_map, _i);
73  return _test_secondary[_i][_qp] * tangential_pressure *
74  nodal_tangents[_direction][tangent_index](_component) /
75  nodal_tangents[_direction][tangent_index].norm();
76  }
78  {
79  const unsigned int tangent_index = libmesh_map_find(_primary_ip_lowerd_map, _i);
80  return -_test_primary[_i][_qp] * tangential_pressure *
81  nodal_tangents[_direction][tangent_index](_component) /
82  nodal_tangents[_direction][tangent_index].norm();
83  }
84  default:
85  return 0;
86  }
87 }
const VariableTestValue & _test_secondary
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
ADReal computeQpResidual(Moose::MortarType type) final
static const std::string component
Definition: NS.h:153
T & set(const std::string &name, bool quiet_mode=false)
const MooseEnum _component
Displacement component on which the residual will be computed.
Creates dof object to weighted tangential velocities map.
unsigned int _i
TangentialMortarMechanicalContact(const InputParameters &parameters)
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
const WeightedVelocitiesUserObject & _weighted_velocities_uo
The weighted velocities user object which supplies the contact pressure tangential vectors...
virtual const ADVariableValue & contactTangentialPressureDirTwo() const =0
Elem const *const & _lower_secondary_elem
const AutomaticMortarGeneration & amg() const
This class enforces mortar constraints on lower dimensional domains, skipping interior nodes...
const MooseEnum _direction
Tangent direction used for computing the residual.
const std::string & type() const
std::array< MooseUtils::SemidynamicVector< Point, 9 >, 2 > getNodalTangents(const Elem &secondary_elem) const
std::map< unsigned int, unsigned int > _primary_ip_lowerd_map
Nodal map from primary interior parent to lower dimensional domain.
auto norm(const T &a) -> decltype(std::abs(a))
registerMooseObject("ContactApp", TangentialMortarMechanicalContact)
std::map< unsigned int, unsigned int > _secondary_ip_lowerd_map
Nodal map from secondary interior parent to lower dimensional domain.
virtual const ADVariableValue & contactTangentialPressureDirOne() const =0
bool compareCurrent(const MooseEnum &other, CompareMode mode=CompareMode::COMPARE_NAME) const
void addClassDescription(const std::string &doc_string)
const VariableTestValue & _test_primary
unsigned int _qp