https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
12
14
17{
19 // Mechanical contact residuals use only primal values and normals
20 params.set<bool>("_compute_primal_gradients") = false;
21
22 MooseEnum component("x=0 y=1 z=2");
24 "component", component, "The force component constraint that this object is supplying");
26 "This class is used to apply normal contact forces using lagrange multipliers");
27 params.set<bool>("compute_lm_residual") = false;
28 params.set<bool>("interpolate_normals") = false;
29 params.addRequiredParam<UserObjectName>("weighted_gap_uo", "The weighted gap user object.");
30 return params;
31}
32
34 : ADMortarLagrangeConstraint(parameters),
35 _component(getParam<MooseEnum>("component")),
36 _weighted_gap_uo(getUserObject<WeightedGapUserObject>("weighted_gap_uo"))
37{
38 if (getParam<bool>("interpolate_normals"))
39 paramError("interpolate_normals",
40 "Mechanical mortar contact uses normalized secondary nodal normals and cannot be "
41 "combined with quadrature-point normal interpolation.");
42}
43
44void
46{
48
50 return;
51
54 paramError("weighted_gap_uo",
55 "'weighted_gap_uo' must be defined on the same secondary/primary subdomain pair "
56 "as this constraint when nodal-normal derivatives are enabled.");
57
59 paramError("weighted_gap_uo",
60 "'weighted_gap_uo' must use the same displacement variable as this constraint's "
61 "'variable' when nodal-normal derivatives are enabled.");
62
63 if (getParam<bool>("use_displaced_mesh") !=
64 _weighted_gap_uo.parameters().get<bool>("use_displaced_mesh"))
66 "weighted_gap_uo",
67 "'weighted_gap_uo' must use the same 'use_displaced_mesh' setting as this constraint "
68 "when nodal-normal derivatives are enabled.");
69}
70
71void
73{
74 // Interpolating sum_j Phi_j z_j n_j is the transpose of the weighted gap and keeps the two sides
75 // of the interface in equilibrium.
76 const auto & phi = _weighted_gap_uo.tractionBasis();
79 for (const auto j : index_range(phi))
80 {
81 const auto nodal_pressure =
83
84 if (ad_normals)
86 phi[j][_qp] * nodal_pressure *
88 else
89 _qp_traction_component += phi[j][_qp] * nodal_pressure * _normals[j](_component);
90 }
91}
92
95{
96 switch (type)
97 {
98 case Moose::MortarType::Secondary:
99 // If the traction is positive, then this residual is positive, indicating that we have an
100 // outflow of momentum, which in turn indicates that the momentum will tend to decrease at
101 // this location with time, which is what we want because the force vector is in the negative
102 // direction (always opposite of the normals). Conversely, if the traction is negative, then
103 // this residual is negative, indicating that we have an inflow of momentum, which in turn
104 // indicates the momentum will tend to increase at this location with time, which is what we
105 // want because the force vector is in the positive direction (always opposite of the
106 // normals).
108
109 case Moose::MortarType::Primary:
110 // The traction is signed according to the secondary face, so we need to introduce a negative
111 // sign here
113
114 default:
115 return 0;
116 }
117}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ContactApp", NormalMortarMechanicalContact)
This class enforces mortar constraints on lower dimensional domains, skipping interior nodes.
static InputParameters validParams()
unsigned int _qp
unsigned int _i
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
const InputParameters & parameters() const
const std::string & type() const
void paramError(const std::string &param, Args... args) const
const VariableTestValue & _test_secondary
MooseVariableField< Real > & _secondary_var
const VariableTestValue & _test_primary
SubdomainID primarySubdomain() const
Elem const *const & _lower_secondary_elem
SubdomainID secondarySubdomain() const
std::vector< Point > _normals
const WeightedGapUserObject & _weighted_gap_uo
The weighted gap user object which supplies the contact force.
ADReal computeQpResidual(Moose::MortarType type) final
NormalMortarMechanicalContact(const InputParameters &parameters)
void precomputeQpQuantities() override
Compute quantities that depend on the quadrature point but not on the test function index.
ADReal _qp_traction_component
The interpolated normal traction component at the current quadrature point.
const MooseEnum _component
The displacement component that this object applies to.
Creates dof object to weighted gap map.
virtual bool usesNodalNormalDerivatives() const =0
Whether this formulation includes displacement derivatives of the secondary nodal normals.
bool shouldRecordNodalNormalDerivatives() const
Whether the current assembly records nodal-normal derivatives for this object's system.
virtual const VariableTestValue & tractionBasis() const
const MooseVariable * dispVar(unsigned int component) const
virtual ADReal nodalContactPressure(const Node &node) const
const ADRealVectorValue & contactNormal(const Elem &lower_secondary_elem, unsigned int nodal_index) const
Return the cached contact normal for the supplied lower-dimensional secondary element node.