Line data Source code
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 : 10 : #pragma once 11 : 12 : // MOOSE includes 13 : #include "Constraint.h" 14 : #include "NeighborCoupleableMooseVariableDependencyIntermediateInterface.h" 15 : #include "MooseMesh.h" 16 : #include "MooseVariableInterface.h" 17 : #include "MortarConsumerInterface.h" 18 : #include "TwoMaterialPropertyInterface.h" 19 : 20 : // Forward Declarations 21 : class FEProblemBase; 22 : namespace libMesh 23 : { 24 : class QBase; 25 : } 26 : 27 : /** 28 : * User for mortar methods 29 : * 30 : * Indexing: 31 : * 32 : * T_m T_s lambda 33 : * +--------------+-------------+-------------+ 34 : * T_m | K_1 | | SecondaryPrimary | 35 : * +--------------+-------------+-------------+ 36 : * T_s | | K_2 | SecondarySecondary | 37 : * +--------------+-------------+-------------+ 38 : * lambda | PrimaryPrimary | PrimarySecondary | | 39 : * +--------------+-------------+-------------+ 40 : * 41 : */ 42 : class MortarConstraintBase : public Constraint, 43 : public NeighborCoupleableMooseVariableDependencyIntermediateInterface, 44 : public MortarConsumerInterface, 45 : public TwoMaterialPropertyInterface, 46 : public MooseVariableInterface<Real> 47 : { 48 : public: 49 : static InputParameters validParams(); 50 : 51 : MortarConstraintBase(const InputParameters & parameters); 52 : 53 : /** 54 : * Method for computing the residual 55 : */ 56 : virtual void computeResidual() override; 57 : 58 : /** 59 : * Method for computing the Jacobian 60 : */ 61 : virtual void computeJacobian() override; 62 : 63 : /** 64 : * compute the residual for the specified element type 65 : */ 66 : virtual void computeResidual(Moose::MortarType mortar_type) = 0; 67 : 68 : /** 69 : * compute the residual for the specified element type 70 : */ 71 : virtual void computeJacobian(Moose::MortarType mortar_type) = 0; 72 : 73 : /** 74 : * The variable number that this object operates on. 75 : */ 76 0 : const MooseVariable & variable() const override { return *_var; } 77 : 78 : /** 79 : * The variable number that this object operates on (pointer). 80 : */ 81 486 : const MooseVariable * variablePtr() const { return _var; } 82 : 83 : /** 84 : * Whether to use dual mortar 85 : */ 86 : bool useDual() const { return _use_dual; } 87 : 88 : /** 89 : * This method will be called after the loop over the mortar segment mesh 90 : */ 91 8841 : virtual void post() {} 92 : 93 : /** 94 : * This method will be called after the loop over the mortar segment mesh 95 : */ 96 6900 : virtual void incorrectEdgeDroppingPost(const std::unordered_set<const Node *> &) {} 97 : 98 : /** 99 : * A post routine for zeroing all inactive LM DoFs 100 : */ 101 : void zeroInactiveLMDofs(const std::unordered_set<const Node *> & inactive_lm_nodes, 102 : const std::unordered_set<const Elem *> & inactive_lm_elems); 103 : 104 : protected: 105 : const FEProblemBase & feProblem() const { return _fe_problem; } 106 : 107 : /// Reference to the finite element problem 108 : FEProblemBase & _fe_problem; 109 : 110 : /// Pointer to the lagrange multipler variable. nullptr if none 111 : MooseVariable * const _var; 112 : 113 : /// Reference to the secondary variable 114 : MooseVariableField<Real> & _secondary_var; 115 : 116 : /// Reference to the primary variable 117 : MooseVariableField<Real> & _primary_var; 118 : 119 : /// Whether to compute primal residuals 120 : const bool _compute_primal_residuals; 121 : 122 : /// Whether to compute lagrange multiplier residuals 123 : const bool _compute_lm_residuals; 124 : 125 : /// A dummy object useful for constructing _test when not using Lagrange multipliers 126 : const VariableTestValue _test_dummy; 127 : 128 : /// Whether to use the dual motar approach 129 : const bool _use_dual; 130 : 131 : /// Tangent vectors on the secondary faces (libmesh) 132 : const MooseArray<std::vector<Point>> & _tangents; 133 : 134 : /// Member for handling change of coordinate systems (xyz, rz, spherical) 135 : const MooseArray<Real> & _coord; 136 : 137 : /// The quadrature points in physical space 138 : const std::vector<Point> & _q_point; 139 : 140 : /// Whether to use Petrov-Galerkin approach 141 : const bool _use_petrov_galerkin; 142 : 143 : /// The auxiliary Lagrange multiplier variable (used together whith the Petrov-Galerkin approach) 144 : const MooseVariable * const _aux_lm_var; 145 : 146 : /// The shape functions corresponding to the lagrange multiplier variable 147 : const VariableTestValue & _test; 148 : 149 : /// The shape functions corresponding to the secondary interior primal variable 150 : const VariableTestValue & _test_secondary; 151 : 152 : /// The shape functions corresponding to the primary interior primal variable 153 : const VariableTestValue & _test_primary; 154 : 155 : /// The shape function gradients corresponding to the secondary interior primal variable 156 : const VariableTestGradient & _grad_test_secondary; 157 : 158 : /// The shape function gradients corresponding to the primary interior primal variable 159 : const VariableTestGradient & _grad_test_primary; 160 : 161 : /// the higher-dimensional secondary face element 162 : const Elem * const & _interior_secondary_elem; 163 : 164 : /// the higher-dimensional primary face element 165 : const Elem * const & _interior_primary_elem; 166 : 167 : /// Whether this object operates on the displaced mesh 168 : const bool _displaced; 169 : };