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 4450 : ContactPressureAux::validParams() 21 : { 22 4450 : InputParameters params = AuxKernel::validParams(); 23 8900 : params.addRequiredCoupledVar("nodal_area", "The nodal area"); 24 8900 : 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 4450 : params.set<ExecFlagEnum>("execute_on") = EXEC_NONLINEAR; 29 8900 : MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST"); 30 8900 : params.addParam<MooseEnum>("order", orders, "The finite element order: " + orders.getRawNames()); 31 : 32 4450 : params.addClassDescription("Computes the contact pressure from the contact force and nodal area"); 33 : 34 4450 : return params; 35 4450 : } 36 : 37 2373 : ContactPressureAux::ContactPressureAux(const InputParameters & params) 38 : : AuxKernel(params), 39 2373 : _nodal_area(coupledValue("nodal_area")), 40 4746 : _number_pairs(getParam<std::vector<BoundaryName>>("paired_boundary").size()), 41 4746 : _penetration_locators(_number_pairs) 42 : { 43 4746 : 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 5070 : for (const auto i : make_range(_number_pairs)) 49 2697 : _penetration_locators[i] = 50 10788 : &getPenetrationLocator(getParam<std::vector<BoundaryName>>("paired_boundary")[i], 51 5394 : getParam<std::vector<BoundaryName>>("boundary")[i], 52 5394 : Utility::string_to_enum<Order>(getParam<MooseEnum>("order"))); 53 2373 : } 54 : 55 4746 : ContactPressureAux::~ContactPressureAux() {} 56 : 57 : Real 58 330833 : ContactPressureAux::computeValue() 59 : { 60 : Real value(0); 61 330833 : const Real area = _nodal_area[_qp]; 62 : const PenetrationInfo * penetration_info(nullptr); 63 : 64 789882 : for (const auto i : make_range(_number_pairs)) 65 : { 66 459049 : const auto it = _penetration_locators[i]->_penetration_info.find(_current_node->id()); 67 459049 : if (it != _penetration_locators[i]->_penetration_info.end()) 68 357734 : penetration_info = it->second; 69 : 70 357734 : if (penetration_info && area != 0) 71 346777 : value -= (penetration_info->_contact_force * penetration_info->_normal) / area; 72 : 73 : penetration_info = nullptr; 74 : } 75 : 76 330833 : return value; 77 : }