https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LMWeightedVelocitiesUserObject.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 "MooseVariableFE.h"
12#include "SystemBase.h"
13
15
18{
21 params.addClassDescription("Provides the mortar contact Lagrange multipliers (normal and "
22 "tangential) for constraint enforcement.");
24 params.suppressParameter<bool>("ghost_point_neighbors");
25 params.renameCoupledVar("lm_variable", "lm_variable_normal", "");
27 "lm_variable_tangential_one",
28 "The Lagrange multiplier variable representing the tangential contact pressure along the "
29 "first tangential direction (the only one in two dimensions).");
30 params.addCoupledVar("lm_variable_tangential_two",
31 "The Lagrange multiplier variable representing the tangential contact "
32 "pressure along the second tangential direction.");
33 return params;
34}
35
37 : WeightedGapUserObject(parameters),
39 LMWeightedGapUserObject(parameters),
40 _lm_variable_tangential_one(getVar("lm_variable_tangential_one", 0)),
41 _lm_variable_tangential_two(isParamValid("lm_variable_tangential_two")
42 ? getVar("lm_variable_tangential_two", 0)
43 : nullptr)
44{
45 // Check that user inputted a variable
46 checkInput(_lm_variable_tangential_one, "lm_variable_tangential_one");
48 checkInput(_lm_variable_tangential_two, "lm_variable_tangential_two");
49
50 // Each tangential Lagrange multiplier must share the normal multiplier's finite element type and
51 // dual/standard basis choice. tangentialTractionBasis() requires matching node counts and dof
52 // numbering for node-for-node interpolation.
54 *_lm_variable_tangential_one, "lm_variable_tangential_one", *_lm_var, "lm_variable_normal");
57 *_lm_variable_tangential_two, "lm_variable_tangential_two", *_lm_var, "lm_variable_normal");
58}
59
60void
62{
63 // Takes care of WeightedGapUserObject::initialize() as well
66}
67
68void
74
75void
81
84 const unsigned int direction) const
85{
86 mooseAssert(direction < 2, "There are at most two tangent directions.");
87 const auto * const lm_var =
89 mooseAssert(lm_var, "The tangential Lagrange multiplier for this direction must exist.");
90
91 const auto sys_num = lm_var->sys().number();
92 const auto var_num = lm_var->number();
93 mooseAssert(node.n_dofs(sys_num, var_num),
94 "The tangential Lagrange multiplier must have a degree of freedom at this node.");
95
96 // Seed the lower-dimensional nodal Lagrange multiplier derivative explicitly. Nodal scaling
97 // applies only to the normal complementarity row; the tangential dof value is the physical
98 // pressure lambda_t.
99 const auto dof_index = node.dof_number(sys_num, var_num, 0);
100 ADReal nodal_pressure = (*lm_var->sys().currentSolution())(dof_index);
102 Moose::derivInsert(nodal_pressure.derivatives(), dof_index, 1.);
103 return nodal_pressure;
104}
105
106const VariableTestValue &
108{
109 mooseAssert(direction < 2, "There are at most two tangent directions.");
110 const auto * const lm_var =
112 mooseAssert(lm_var, "The tangential Lagrange multiplier for this direction must exist.");
113 return lm_var->phiLower();
114}
115
116const ADVariableValue &
121
122const ADVariableValue &
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ContactApp", LMWeightedVelocitiesUserObject)
void suppressParameter(const std::string &name)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void renameCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &new_docstring)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
User object for computing weighted gaps and contact pressure for Lagrange multipler based mortar cons...
void initializeNodalScaling()
The node-based scaling steps, kept out of initialize()/finalize()/computeQpIProperties() so that a cl...
void verifyLagrange(const MooseVariable &var, const std::string &var_name) const
Verify that the provided variables have degrees of freedom at nodes.
void checkInput(const MooseVariable *const var, const std::string &var_name) const
Check user input validity for provided variable.
const MooseVariableFE< Real > *const _lm_var
The Lagrange multiplier variable representing the contact pressure.
static InputParameters newParams()
New parameters that this sub-class introduces.
Nodal-based mortar contact user object for frictional problem.
virtual const VariableTestValue & tangentialTractionBasis(unsigned int direction) const override
virtual void initialize() override
This class inherits WeightedGapUserObject through both of its bases, each of which overrides these me...
virtual void computeQpIProperties() override
Computes properties that are functions both of _qp and _i, for example the weighted gap.
virtual const ADVariableValue & contactTangentialPressureDirTwo() const override
virtual const ADVariableValue & contactTangentialPressureDirOne() const override
const MooseVariableFE< Real > *const _lm_variable_tangential_two
const MooseVariableFE< Real > *const _lm_variable_tangential_one
The Lagrange multiplier variables representing the tangential contact pressure.
virtual ADReal nodalTangentialPressure(const Node &node, unsigned int direction) const override
LMWeightedVelocitiesUserObject(const InputParameters &parameters)
const ADTemplateVariableValue< OutputType > & adSlnLower() const
SubProblem & _subproblem
Creates dof object to weighted gap map.
static void addNodalNormalCoupling(InputParameters &params)
Request the secondary face point-neighbor matrix coupling that nodal-normal derivatives need.
Creates dof object to weighted tangential velocities map.
virtual void computeQpIProperties() override
Computes properties that are functions both of _qp and _i, for example the weighted gap.
SystemBase & _sys
Reference to the EquationSystem object.
VariableShapeValue< true > VariableTestValue
VariableValueTempl< true > ADVariableValue
bool doDerivatives(const SubProblem &subproblem, const SystemBase &sys)
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N > > &derivs, libMesh::dof_id_type index, Real value)