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 "TangentialMortarMechanicalContact.h" 11 : #include "WeightedVelocitiesUserObject.h" 12 : #include "AutomaticMortarGeneration.h" 13 : 14 : registerMooseObject("ContactApp", TangentialMortarMechanicalContact); 15 : 16 : InputParameters 17 1735 : TangentialMortarMechanicalContact::validParams() 18 : { 19 1735 : InputParameters params = ADMortarLagrangeConstraint::validParams(); 20 : 21 3470 : MooseEnum component("x=0 y=1 z=2"); 22 3470 : params.addRequiredParam<MooseEnum>( 23 : "component", component, "The force component constraint that this object is supplying"); 24 : 25 : // This enum is used to pick the proper 'tangent' vector (i.e. tangent or binormal) 26 3470 : MooseEnum direction("direction_1 direction_2", "direction_1"); 27 3470 : params.addParam<MooseEnum>("direction", 28 : direction, 29 : "Tangent direction to compute the residual due to frictional contact"); 30 1735 : params.addClassDescription( 31 : "Used to apply tangential stresses from frictional contact using lagrange multipliers"); 32 3470 : params.addRequiredParam<UserObjectName>("weighted_velocities_uo", 33 : "The weighted velocities user object."); 34 1735 : params.set<bool>("interpolate_normals") = false; 35 1735 : params.set<bool>("compute_lm_residual") = false; 36 1735 : return params; 37 1735 : } 38 : 39 956 : TangentialMortarMechanicalContact::TangentialMortarMechanicalContact( 40 956 : const InputParameters & parameters) 41 : : ADMortarLagrangeConstraint(parameters), 42 956 : _component(getParam<MooseEnum>("component")), 43 1912 : _direction(getParam<MooseEnum>("direction")), 44 956 : _weighted_velocities_uo(const_cast<WeightedVelocitiesUserObject &>( 45 1912 : getUserObject<WeightedVelocitiesUserObject>("weighted_velocities_uo"))) 46 : { 47 956 : } 48 : 49 : ADReal 50 135684224 : TangentialMortarMechanicalContact::computeQpResidual(Moose::MortarType type) 51 : { 52 135684224 : const auto & nodal_tangents = amg().getNodalTangents(*_lower_secondary_elem); 53 271368448 : MooseEnum direction("direction_1 direction_2", "direction_1"); 54 : 55 : const auto tangential_pressure = 56 135684224 : _direction.compareCurrent(direction) 57 70439456 : ? _weighted_velocities_uo.contactTangentialPressureDirOne()[_qp] 58 206123680 : : _weighted_velocities_uo.contactTangentialPressureDirTwo()[_qp]; 59 : 60 135684224 : switch (type) 61 : { 62 67842112 : case Moose::MortarType::Secondary: 63 : // We have taken the convention the lagrange multiplier must have the same sign as the 64 : // relative slip velocity of the secondary face. So positive lambda indicates that force is 65 : // being applied in the negative direction, so we want to decrease the momentum in the system, 66 : // which means we want an outflow of momentum, which means we want the residual to be positive 67 : // in that case. Negative lambda means force is being applied in the positive direction, so we 68 : // want to increase momentum in the system, which means we want an inflow of momentum, which 69 : // means we want the residual to be negative in that case. So the sign of this residual should 70 : // be the same as the sign of lambda 71 : { 72 67842112 : const unsigned int tangent_index = libmesh_map_find(_secondary_ip_lowerd_map, _i); 73 135684224 : return _test_secondary[_i][_qp] * tangential_pressure * 74 67842112 : nodal_tangents[_direction][tangent_index](_component) / 75 135684224 : nodal_tangents[_direction][tangent_index].norm(); 76 : } 77 67842112 : case Moose::MortarType::Primary: 78 : { 79 67842112 : const unsigned int tangent_index = libmesh_map_find(_primary_ip_lowerd_map, _i); 80 135684224 : return -_test_primary[_i][_qp] * tangential_pressure * 81 67842112 : nodal_tangents[_direction][tangent_index](_component) / 82 135684224 : nodal_tangents[_direction][tangent_index].norm(); 83 : } 84 0 : default: 85 0 : return 0; 86 : } 87 135684224 : }