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 "LMWeightedVelocitiesUserObject.h" 11 : #include "MooseVariableFE.h" 12 : #include "SystemBase.h" 13 : 14 : registerMooseObject("ContactApp", LMWeightedVelocitiesUserObject); 15 : 16 : InputParameters 17 478 : LMWeightedVelocitiesUserObject::validParams() 18 : { 19 478 : InputParameters params = WeightedVelocitiesUserObject::validParams(); 20 478 : params += LMWeightedGapUserObject::newParams(); 21 478 : params.addClassDescription("Provides the mortar contact Lagrange multipliers (normal and " 22 : "tangential) for constraint enforcement."); 23 478 : params.set<bool>("allow_nodal_normal_derivatives") = true; 24 956 : params.renameCoupledVar("lm_variable", "lm_variable_normal", ""); 25 956 : params.addRequiredCoupledVar( 26 : "lm_variable_tangential_one", 27 : "The Lagrange multiplier variable representing the tangential contact pressure along the " 28 : "first tangential direction (the only one in two dimensions)."); 29 956 : params.addCoupledVar("lm_variable_tangential_two", 30 : "The Lagrange multiplier variable representing the tangential contact " 31 : "pressure along the second tangential direction."); 32 478 : return params; 33 0 : } 34 : 35 239 : LMWeightedVelocitiesUserObject::LMWeightedVelocitiesUserObject(const InputParameters & parameters) 36 : : WeightedGapUserObject(parameters), 37 : WeightedVelocitiesUserObject(parameters), 38 : LMWeightedGapUserObject(parameters), 39 239 : _lm_variable_tangential_one(getVar("lm_variable_tangential_one", 0)), 40 239 : _lm_variable_tangential_two(isParamValid("lm_variable_tangential_two") 41 312 : ? getVar("lm_variable_tangential_two", 0) 42 239 : : nullptr) 43 : { 44 : // Check that user inputted a variable 45 239 : checkInput(_lm_variable_tangential_one, "lm_variable_tangential_one"); 46 239 : if (_lm_variable_tangential_two) 47 146 : checkInput(_lm_variable_tangential_two, "lm_variable_tangential_two"); 48 : 49 : // Check that user inputted the right type of variable 50 239 : verifyLagrange(*_lm_variable_tangential_one, "lm_variable_tangential_one"); 51 239 : if (_lm_variable_tangential_two) 52 146 : verifyLagrange(*_lm_variable_tangential_two, "lm_variable_tangential_two"); 53 239 : } 54 : 55 : const ADVariableValue & 56 65383136 : LMWeightedVelocitiesUserObject::contactTangentialPressureDirOne() const 57 : { 58 65383136 : return _lm_variable_tangential_one->adSlnLower(); 59 : } 60 : 61 : const ADVariableValue & 62 61647552 : LMWeightedVelocitiesUserObject::contactTangentialPressureDirTwo() const 63 : { 64 61647552 : return _lm_variable_tangential_two->adSlnLower(); 65 : }