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 
12 
14 
17 {
19 
20  MooseEnum component("x=0 y=1 z=2");
22  "component", component, "The force component constraint that this object is supplying");
23 
24  // This enum is used to pick the proper 'tangent' vector (i.e. tangent or binormal)
25  MooseEnum direction("direction_1 direction_2", "direction_1");
26  params.addParam<MooseEnum>("direction",
27  direction,
28  "Tangent direction to compute the residual due to frictional contact");
29  params.addClassDescription(
30  "Used to apply tangential stresses from frictional contact using lagrange multipliers");
31  params.addRequiredParam<UserObjectName>("weighted_velocities_uo",
32  "The weighted velocities user object.");
33  params.set<bool>("interpolate_normals") = false;
34  params.set<bool>("compute_lm_residual") = false;
35  return params;
36 }
37 
39  const InputParameters & parameters)
40  : ADMortarLagrangeConstraint(parameters),
41  _component(getParam<MooseEnum>("component")),
42  _direction(getParam<MooseEnum>("direction")),
43  _weighted_velocities_uo(const_cast<WeightedVelocitiesUserObject &>(
44  getUserObject<WeightedVelocitiesUserObject>("weighted_velocities_uo")))
45 {
46 }
47 
48 ADReal
50 {
51  const auto & nodal_tangents = amg().getNodalTangents(*_lower_secondary_elem);
52  MooseEnum direction("direction_1 direction_2", "direction_1");
53 
54  const auto tangential_pressure =
55  _direction.compareCurrent(direction)
58 
59  switch (type)
60  {
62  // We have taken the convention the lagrange multiplier must have the same sign as the
63  // relative slip velocity of the secondary face. So positive lambda indicates that force is
64  // being applied in the negative direction, so we want to decrease the momentum in the system,
65  // which means we want an outflow of momentum, which means we want the residual to be positive
66  // in that case. Negative lambda means force is being applied in the positive direction, so we
67  // want to increase momentum in the system, which means we want an inflow of momentum, which
68  // means we want the residual to be negative in that case. So the sign of this residual should
69  // be the same as the sign of lambda
70  {
71  const unsigned int tangent_index = libmesh_map_find(_secondary_ip_lowerd_map, _i);
72  return _test_secondary[_i][_qp] * tangential_pressure *
73  nodal_tangents[_direction][tangent_index](_component) /
74  nodal_tangents[_direction][tangent_index].norm();
75  }
77  {
78  const unsigned int tangent_index = libmesh_map_find(_primary_ip_lowerd_map, _i);
79  return -_test_primary[_i][_qp] * tangential_pressure *
80  nodal_tangents[_direction][tangent_index](_component) /
81  nodal_tangents[_direction][tangent_index].norm();
82  }
83  default:
84  return 0;
85  }
86 }
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