https://mooseframework.inl.gov
LMWeightedGapUserObject.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 {
20  params.addClassDescription(
21  "Provides the mortar normal Lagrange multiplier for constraint enforcement.");
22  params.addRequiredCoupledVar(
23  "lm_variable", "The Lagrange multiplier variable representing the contact pressure.");
24  params.addParam<bool>(
25  "use_petrov_galerkin", false, "Whether to use the Petrov-Galerkin approach.");
26  params.addCoupledVar("aux_lm",
27  "Auxiliary Lagrange multiplier variable that is utilized together with the "
28  "Petrov-Galerkin approach.");
29  return params;
30 }
31 
33  : WeightedGapUserObject(parameters),
34  _lm_var(getVar("lm_variable", 0)),
35  _use_petrov_galerkin(getParam<bool>("use_petrov_galerkin")),
36  _aux_lm_var(isCoupled("aux_lm") ? getVar("aux_lm", 0) : nullptr)
37 {
38  if (isCoupledConstant("lm_variable"))
39  paramError("lm_variable",
40  "The Lagrange multiplier variable must be an actual variable and not a constant.");
41  else if (!_lm_var)
42  paramError("lm_variable",
43  "The Lagrange multiplier variable must be provided and be an actual variable.");
44 
45  if (!_lm_var->isNodal())
46  paramError("lm_variable",
47  "The Lagrange multiplier variable must have its degrees of freedom exclusively on "
48  "nodes, e.g. it should probably be of finite element type 'Lagrange'.");
49 
50  if (_use_petrov_galerkin && ((!isParamValid("aux_lm")) || _aux_lm_var == nullptr))
51  paramError("use_petrov_galerkin",
52  "We need to specify an auxiliary variable `aux_lm` while using the Petrov-Galerkin "
53  "approach");
54 
56  paramError("aux_lm",
57  "Auxiliary LM variable needs to use standard shape function, i.e., set `use_dual = "
58  "false`.");
59 }
60 
61 const VariableTestValue &
63 {
65 }
66 
67 const ADVariableValue &
69 {
70  return _lm_var->adSlnLower();
71 }
registerMooseObject("ContactApp", LMWeightedGapUserObject)
virtual bool isCoupledConstant(const std::string &var_name) const
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
const MooseVariable *const _aux_lm_var
The auxiliary Lagrange multiplier variable (used together whith the Petrov-Galerkin approach) ...
const MooseVariableFE< Real > *const _lm_var
The Lagrange multiplier variable representing the contact pressure.
bool isParamValid(const std::string &name) const
virtual const ADVariableValue & contactPressure() const override
const bool _use_petrov_galerkin
Whether to use Petrov-Galerkin approach.
OutputTools< Real >::VariableTestValue VariableTestValue
User object for computing weighted gaps and contact pressure for Lagrange multipler based mortar cons...
void paramError(const std::string &param, Args... args) const
void addCoupledVar(const std::string &name, const std::string &doc_string)
bool isNodal() const override
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
Creates dof object to weighted gap map.
virtual const FieldVariablePhiValue & phiLower() const override
void addClassDescription(const std::string &doc_string)
const ADTemplateVariableValue< Real > & adSlnLower() const
virtual const VariableTestValue & test() const override
static InputParameters validParams()
LMWeightedGapUserObject(const InputParameters &parameters)