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 : #include "LMWeightedGapUserObject.h" 11 : #include "MooseVariableFE.h" 12 : #include "SystemBase.h" 13 : 14 : registerMooseObject("ContactApp", LMWeightedGapUserObject); 15 : 16 : InputParameters 17 850 : LMWeightedGapUserObject::validParams() 18 : { 19 850 : InputParameters params = WeightedGapUserObject::validParams(); 20 850 : params.addClassDescription( 21 : "Provides the mortar normal Lagrange multiplier for constraint enforcement."); 22 1700 : params.addRequiredCoupledVar( 23 : "lm_variable", "The Lagrange multiplier variable representing the contact pressure."); 24 1700 : params.addParam<bool>( 25 1700 : "use_petrov_galerkin", false, "Whether to use the Petrov-Galerkin approach."); 26 1700 : params.addCoupledVar("aux_lm", 27 : "Auxiliary Lagrange multiplier variable that is utilized together with the " 28 : "Petrov-Galerkin approach."); 29 850 : return params; 30 0 : } 31 : 32 425 : LMWeightedGapUserObject::LMWeightedGapUserObject(const InputParameters & parameters) 33 : : WeightedGapUserObject(parameters), 34 425 : _lm_var(getVar("lm_variable", 0)), 35 850 : _use_petrov_galerkin(getParam<bool>("use_petrov_galerkin")), 36 886 : _aux_lm_var(isCoupled("aux_lm") ? getVar("aux_lm", 0) : nullptr) 37 : { 38 850 : if (isCoupledConstant("lm_variable")) 39 0 : paramError("lm_variable", 40 : "The Lagrange multiplier variable must be an actual variable and not a constant."); 41 425 : else if (!_lm_var) 42 0 : paramError("lm_variable", 43 : "The Lagrange multiplier variable must be provided and be an actual variable."); 44 : 45 425 : if (!_lm_var->isNodal()) 46 0 : 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 497 : if (_use_petrov_galerkin && ((!isParamValid("aux_lm")) || _aux_lm_var == nullptr)) 51 0 : paramError("use_petrov_galerkin", 52 : "We need to specify an auxiliary variable `aux_lm` while using the Petrov-Galerkin " 53 : "approach"); 54 : 55 425 : if (_use_petrov_galerkin && _aux_lm_var->useDual()) 56 0 : paramError("aux_lm", 57 : "Auxiliary LM variable needs to use standard shape function, i.e., set `use_dual = " 58 : "false`."); 59 425 : } 60 : 61 : const VariableTestValue & 62 411 : LMWeightedGapUserObject::test() const 63 : { 64 411 : return _use_petrov_galerkin ? _aux_lm_var->phiLower() : _lm_var->phiLower(); 65 : } 66 : 67 : const ADVariableValue & 68 110920748 : LMWeightedGapUserObject::contactPressure() const 69 : { 70 110920748 : return _lm_var->adSlnLower(); 71 : }