https://mooseframework.inl.gov
NormalMortarMechanicalContact.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 
11 #include "WeightedGapUserObject.h"
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  params.addClassDescription(
24  "This class is used to apply normal contact forces using lagrange multipliers");
25  params.set<bool>("compute_lm_residual") = false;
26  params.set<bool>("interpolate_normals") = false;
27  params.addRequiredParam<UserObjectName>("weighted_gap_uo", "The weighted gap user object.");
28  return params;
29 }
30 
32  : ADMortarLagrangeConstraint(parameters),
33  _component(getParam<MooseEnum>("component")),
34  _weighted_gap_uo(const_cast<WeightedGapUserObject &>(
35  getUserObject<WeightedGapUserObject>("weighted_gap_uo")))
36 {
37 }
38 
39 ADReal
41 {
42  switch (type)
43  {
45  // If normals is positive, then this residual is positive, indicating that we have an outflow
46  // of momentum, which in turn indicates that the momentum will tend to decrease at this
47  // location with time, which is what we want because the force vector is in the negative
48  // direction (always opposite of the normals). Conversely, if the normals is negative, then
49  // this residual is negative, indicating that we have an inflow of momentum, which in turn
50  // indicates the momentum will tend to increase at this location with time, which is what we
51  // want because the force vector is in the positive direction (always opposite of the
52  // normals).
53  // Get the _dof_to_weighted_gap map
54  {
55  const auto normal_index = libmesh_map_find(_secondary_ip_lowerd_map, _i);
57  _normals[normal_index](_component);
58  }
59 
61  // The normal vector is signed according to the secondary face, so we need to introduce a
62  // negative sign here
63  {
64  const auto normal_index = libmesh_map_find(_primary_ip_lowerd_map, _i);
66  _normals[normal_index](_component);
67  }
68  default:
69  return 0;
70  }
71 }
ADReal computeQpResidual(Moose::MortarType type) final
NormalMortarMechanicalContact(const InputParameters &parameters)
const VariableTestValue & _test_secondary
virtual const ADVariableValue & contactPressure() const =0
static const std::string component
Definition: NS.h:153
T & set(const std::string &name, bool quiet_mode=false)
WeightedGapUserObject & _weighted_gap_uo
The weighted gap user object which supplies the contact force.
unsigned int _i
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
const MooseEnum _component
The displacement component that this object applies to.
This class enforces mortar constraints on lower dimensional domains, skipping interior nodes...
std::vector< Point > _normals
const std::string & type() const
std::map< unsigned int, unsigned int > _primary_ip_lowerd_map
Nodal map from primary interior parent to lower dimensional domain.
std::map< unsigned int, unsigned int > _secondary_ip_lowerd_map
Nodal map from secondary interior parent to lower dimensional domain.
Creates dof object to weighted gap map.
registerMooseObject("ContactApp", NormalMortarMechanicalContact)
void addClassDescription(const std::string &doc_string)
const VariableTestValue & _test_primary
unsigned int _qp