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 "ContactPressureAux.h" 11 : 12 : #include "NodalArea.h" 13 : #include "PenetrationLocator.h" 14 : 15 : #include "libmesh/string_to_enum.h" 16 : 17 : registerMooseObject("ContactApp", ContactPressureAux); 18 : 19 : InputParameters 20 2534 : ContactPressureAux::validParams() 21 : { 22 2534 : InputParameters params = AuxKernel::validParams(); 23 5068 : params.addRequiredCoupledVar("nodal_area", "The nodal area"); 24 5068 : params.addRequiredParam<std::vector<BoundaryName>>( 25 : "paired_boundary", 26 : "The set of boundaries in contact with those specified in 'boundary'. Ordering must be " 27 : "consistent with that in 'boundary'."); 28 2534 : params.set<ExecFlagEnum>("execute_on") = EXEC_NONLINEAR; 29 5068 : MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST"); 30 5068 : params.addParam<MooseEnum>("order", orders, "The finite element order: " + orders.getRawNames()); 31 : 32 2534 : params.addClassDescription("Computes the contact pressure from the contact force and nodal area"); 33 : 34 2534 : return params; 35 2534 : } 36 : 37 1363 : ContactPressureAux::ContactPressureAux(const InputParameters & params) 38 : : AuxKernel(params), 39 1363 : _nodal_area(coupledValue("nodal_area")), 40 2726 : _number_pairs(getParam<std::vector<BoundaryName>>("paired_boundary").size()), 41 2726 : _penetration_locators(_number_pairs) 42 : { 43 2726 : if (_number_pairs != getParam<std::vector<BoundaryName>>("boundary").size()) 44 0 : paramError("boundary", 45 : "Boundary and paired boundary vectors are not the same size in the contact pressure " 46 : "auxiliary kernel. Please check your input"); 47 : 48 2886 : for (const auto i : make_range(_number_pairs)) 49 1523 : _penetration_locators[i] = 50 6092 : &getPenetrationLocator(getParam<std::vector<BoundaryName>>("paired_boundary")[i], 51 3046 : getParam<std::vector<BoundaryName>>("boundary")[i], 52 3046 : Utility::string_to_enum<Order>(getParam<MooseEnum>("order"))); 53 1363 : } 54 : 55 1363 : ContactPressureAux::~ContactPressureAux() {} 56 : 57 : Real 58 218953 : ContactPressureAux::computeValue() 59 : { 60 : Real value(0); 61 218953 : const Real area = _nodal_area[_qp]; 62 : const PenetrationInfo * penetration_info(nullptr); 63 : 64 530638 : for (const auto i : make_range(_number_pairs)) 65 : { 66 311685 : const auto it = _penetration_locators[i]->_penetration_info.find(_current_node->id()); 67 311685 : if (it != _penetration_locators[i]->_penetration_info.end()) 68 238693 : penetration_info = it->second; 69 : 70 238693 : if (penetration_info && area != 0) 71 230306 : value -= (penetration_info->_contact_force * penetration_info->_normal) / area; 72 : 73 : penetration_info = nullptr; 74 : } 75 : 76 218953 : return value; 77 : }