15 #include "libmesh/string_to_enum.h" 30 rm_params.
set<
bool>(
"use_displaced_mesh") =
31 obj_params.
get<
bool>(
"use_displaced_mesh");
32 rm_params.
set<BoundaryName>(
"secondary_boundary") =
33 obj_params.
get<BoundaryName>(
"secondary_boundary");
34 rm_params.
set<BoundaryName>(
"primary_boundary") =
35 obj_params.
get<BoundaryName>(
"primary_boundary");
36 rm_params.
set<SubdomainName>(
"secondary_subdomain") =
37 obj_params.
get<SubdomainName>(
"secondary_subdomain");
38 rm_params.
set<SubdomainName>(
"primary_subdomain") =
39 obj_params.
get<SubdomainName>(
"primary_subdomain");
40 rm_params.
set<
bool>(
"ghost_higher_d_neighbors") =
41 obj_params.
get<
bool>(
"ghost_higher_d_neighbors");
62 params.
addParam<VariableName>(
"secondary_variable",
"Primal variable on secondary surface.");
65 "Primal variable on primary surface. If this parameter is not provided then the primary " 66 "variable will be initialized to the secondary variable");
70 "The name of the lagrange multiplier variable that this constraint is applied to. This " 71 "parameter may not be supplied in the case of using penalty methods for example");
73 "compute_primal_residuals",
true,
"Whether to compute residuals for the primal variable.");
75 "compute_lm_residuals",
true,
"Whether to compute Lagrange Multiplier residuals");
78 MooseEnum(
"DEFAULT FIRST SECOND THIRD FOURTH",
"DEFAULT"),
79 "Polynomial basis order (think Variable order) to assume when building quadrature rules to " 80 "use on mortar segments. " 81 "For 2D mortar DEFAULT is recommended. " 82 "For 3D mortar, QUAD meshes are integrated using triangular mortar segments. " 83 "While DEFAULT order is typically sufficiently accurate, exact integration of " 84 "QUAD mortar faces with first order polynomial bases (bilinears) requires building a " 85 "quadrature rule based off of a *quadratic* (SECOND) polynomial basis on triangles. " 86 "Similarly, exact integration of QUAD mortar faces with second order polynomial bases " 87 "(biquadratics) requires building a quadrature rule based off of a *quartic* (FOURTH) " 88 "polynomial basis on triangles. Note that the actual quadrature order will be double this " 89 "parameter plus one.",
90 "This parameter is deprecated in favor of " 91 "'segment_quadrature' which directly specifies the quadrature order.");
94 MooseEnum(
"DEFAULT FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH NINTH",
"DEFAULT"),
95 "Mortar segment quadrature order. " 96 "For 2D mortar DEFAULT is recommended. " 97 "For 3D mortar, quad faces are integrated using triangular mortar segments. " 98 "A finite element family of order p based on a quadrilateral element actually has polynomial " 99 "order of 2*p because of the tensor-product nature of the element. Consequently, for exact " 100 "integraton of something like a mass matrix term, if one is using a first order Lagrange " 101 "variable (as an example), the 'segment_quadrature' should be set to 'fourth' because we " 102 "double the polynomial order on the triangle to match the tensor product order on the quad, " 103 "and then double again since we are multiplying the test and trial (shape) function " 104 "polynomials for the mass matrix term.");
106 "use_petrov_galerkin",
108 "Whether to use the Petrov-Galerkin approach for the mortar-based constraints. If set to " 109 "true, we use the standard basis as the test function and dual basis as " 110 "the shape function for the interpolation of the Lagrange multiplier variable.");
112 "Auxiliary Lagrange multiplier variable that is utilized together with the " 113 "Petrov-Galerkin approach.");
124 isParamValid(
"variable") ?
"variable" :
"secondary_variable",
127 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
128 _var(isParamValid(
"variable")
129 ? &_subproblem.getStandardVariable(_tid, parameters.getMooseType(
"variable"))
132 isParamValid(
"secondary_variable")
133 ? _sys.getActualFieldVariable<
Real>(_tid, parameters.getMooseType(
"secondary_variable"))
134 : _sys.getActualFieldVariable<
Real>(_tid, parameters.getMooseType(
"primary_variable"))),
136 isParamValid(
"primary_variable")
137 ? _sys.getActualFieldVariable<
Real>(_tid, parameters.getMooseType(
"primary_variable"))
140 _compute_primal_residuals(getParam<bool>(
"compute_primal_residuals")),
141 _compute_lm_residuals(!_var ? false : getParam<bool>(
"compute_lm_residuals")),
143 _use_dual(_var ? _var->useDual() : false),
144 _tangents(_assembly.tangents()),
145 _coord(_assembly.mortarCoordTransformation()),
146 _q_point(_assembly.qPointsMortar()),
147 _use_petrov_galerkin(getParam<bool>(
"use_petrov_galerkin")),
148 _aux_lm_var(isCoupled(
"aux_lm") ? getVar(
"aux_lm", 0) : nullptr),
150 ? ((_use_petrov_galerkin && _aux_lm_var) ? _aux_lm_var->phiLower() : _var->phiLower())
152 _test_secondary(_secondary_var.phiFace()),
153 _test_primary(_primary_var.phiFaceNeighbor()),
154 _grad_test_secondary(_secondary_var.gradPhiFace()),
155 _grad_test_primary(_primary_var.gradPhiFaceNeighbor()),
156 _interior_secondary_elem(_assembly.elem()),
157 _interior_primary_elem(_assembly.neighbor()),
158 _displaced(getParam<bool>(
"use_displaced_mesh"))
165 "We need to set `use_dual = true` while using the Petrov-Galerkin approach");
169 "We need to specify an auxiliary variable `aux_lm` while using the Petrov-Galerkin " 174 "Auxiliary LM variable needs to use standard shape function, i.e., set `use_dual = " 177 paramError(
"quadrature",
"Only one of 'quadrature' and 'segment_quadrature' should be set.");
180 const auto & p_order = getParam<MooseEnum>(
"quadrature");
182 if (p_order !=
"DEFAULT")
184 const Order q_order =
static_cast<Order>(2 * Utility::string_to_enum<Order>(p_order) + 1);
187 const auto & q_order_enum = getParam<MooseEnum>(
"segment_quadrature");
188 if (q_order_enum !=
"DEFAULT")
190 const Order q_order = Utility::string_to_enum<Order>(q_order_enum);
240 const std::unordered_set<const Elem *> & inactive_lm_elems)
252 for (
const auto node : inactive_lm_nodes)
255 if (!node->n_comp(sn, vn))
258 const auto dof_index = node->dof_number(sn, vn, 0);
267 std::array<Real, 1>{{lm_value}},
268 std::array<dof_id_type, 1>{{dof_index}},
276 for (
const auto el : inactive_lm_elems)
278 const auto n_comp = el->n_comp(sn, vn);
282 const auto dof_index = el->dof_number(sn, vn, comp);
291 std::array<Real, 1>{{lm_value}},
292 std::array<dof_id_type, 1>{{dof_index}},
MooseVariableField< Real > & _secondary_var
Reference to the secondary variable.
void setMortarQRule(Order order)
Specifies a custom qrule for integration on mortar segment mesh.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
unsigned int number() const
Get variable number coming from libMesh.
void zeroInactiveLMDofs(const std::unordered_set< const Node *> &inactive_lm_nodes, const std::unordered_set< const Elem *> &inactive_lm_elems)
A post routine for zeroing all inactive LM DoFs.
Base class for all Constraint types.
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals corresponding to the provided dof indices.
virtual void precalculateResidual()
const bool _compute_primal_residuals
Whether to compute primal residuals.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
MortarConstraintBase(const InputParameters ¶meters)
virtual void computeResidual() override
Method for computing the residual.
An interface for accessing mortar mesh data.
static InputParameters validParams()
SystemBase & _sys
Reference to the EquationSystem object.
bool useDual() const
Get dual mortar option.
VarKindType
Framework-wide stuff.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::vector< BoundaryID > getBoundaryIDs(const libMesh::MeshBase &mesh, const std::vector< BoundaryName > &boundary_name, bool generate_unknown, const std::set< BoundaryID > &mesh_boundary_ids)
Gets the boundary IDs with their names.
unsigned int number() const
Gets the number of this system.
const bool _use_dual
Whether to use the dual motar approach.
Assembly & _assembly
Reference to this Kernel's assembly object.
bool isNodal() const override
Is this variable nodal.
MooseVariable *const _var
Pointer to the lagrange multipler variable. nullptr if none.
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
const bool _use_petrov_galerkin
Whether to use Petrov-Galerkin approach.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const std::set< SubdomainID > EMPTY_BLOCK_IDS
bool computingResidual() const
const MooseVariable *const _aux_lm_var
The auxiliary Lagrange multiplier variable (used together whith the Petrov-Galerkin approach) ...
void activateDual()
Indicates that dual shape functions are used for mortar constraint.
static InputParameters validParams()
static InputParameters validParams()
DofValue getNodalValue(const Node &node) const
Get the value of this variable at given node.
virtual void computeJacobian() override
Method for computing the Jacobian.
Interface for objects that need to get values of MooseVariables.
IntRange< T > make_range(T beg, T end)
This interface is designed for DGKernel, InternalSideUserObject, InterfaceUserObject, where material properties on a side of both its primary side (face) and its secondary side (neighbor) all required.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
bool computingJacobian() const
void addJacobianElement(Assembly &assembly, Real value, dof_id_type row_index, dof_id_type column_index, Real scaling_factor)
Add into a single Jacobian element.
DofValue getElementalValue(const Elem *elem, unsigned int idx=0) const
Get the current value of this variable on an element.
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
static InputParameters validParams()
const bool _compute_lm_residuals
Whether to compute lagrange multiplier residuals.
MooseVariableField< Real > & _primary_var
Reference to the primary variable.