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 "GapHeatPointSourceMaster.h" 11 : #include "SystemBase.h" 12 : #include "PenetrationInfo.h" 13 : #include "MooseMesh.h" 14 : 15 : #include "libmesh/string_to_enum.h" 16 : 17 : registerMooseObject("HeatTransferApp", GapHeatPointSourceMaster); 18 : 19 : InputParameters 20 461 : GapHeatPointSourceMaster::validParams() 21 : { 22 922 : MooseEnum orders("CONSTANT FIRST SECOND THIRD FOURTH", "FIRST"); 23 : 24 461 : InputParameters params = DiracKernel::validParams(); 25 922 : params.addParam<BoundaryName>("boundary", "The primary boundary"); 26 922 : params.addParam<BoundaryName>("secondary", "The secondary boundary"); 27 922 : params.addParam<MooseEnum>("order", orders, "The finite element order"); 28 461 : params.set<bool>("use_displaced_mesh") = true; 29 922 : params.addParam<Real>("tangential_tolerance", 30 : "Tangential distance to extend edges of contact surfaces"); 31 922 : params.addParam<Real>( 32 : "normal_smoothing_distance", 33 : "Distance from edge in parametric coordinates over which to smooth contact normal"); 34 922 : params.addParam<std::string>("normal_smoothing_method", 35 : "Method to use to smooth normals (edge_based|nodal_normal_based)"); 36 461 : params.addClassDescription( 37 : "Dirac kernel to create a heat source on the primary contact surface in thermal contact."); 38 : 39 461 : return params; 40 461 : } 41 : 42 243 : GapHeatPointSourceMaster::GapHeatPointSourceMaster(const InputParameters & parameters) 43 : : DiracKernel(parameters), 44 243 : _penetration_locator( 45 972 : getPenetrationLocator(getParam<BoundaryName>("boundary"), 46 : getParam<BoundaryName>("secondary"), 47 243 : Utility::string_to_enum<Order>(getParam<MooseEnum>("order")))), 48 486 : _secondary_flux(_sys.getVector("secondary_flux")) 49 : { 50 486 : if (parameters.isParamValid("tangential_tolerance")) 51 0 : _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance")); 52 : 53 486 : if (parameters.isParamValid("normal_smoothing_distance")) 54 0 : _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance")); 55 : 56 486 : if (parameters.isParamValid("normal_smoothing_method")) 57 0 : _penetration_locator.setNormalSmoothingMethod( 58 : parameters.get<std::string>("normal_smoothing_method")); 59 243 : } 60 : 61 : void 62 20209 : GapHeatPointSourceMaster::addPoints() 63 : { 64 : point_to_node.clear(); 65 20209 : _secondary_flux.close(); 66 : 67 203687 : for (const auto & [id, pinfo] : _penetration_locator._penetration_info) 68 : { 69 183478 : if (!pinfo) 70 0 : continue; 71 : 72 183478 : const auto & node = _mesh.nodeRef(id); 73 : // Skip this pinfo if there are no DOFs on this node. 74 183478 : if (node.n_comp(_sys.number(), _var.number()) < 1) 75 0 : continue; 76 : 77 183478 : addPoint(pinfo->_elem, pinfo->_closest_point); 78 183478 : point_to_node[pinfo->_closest_point] = &node; 79 : } 80 20209 : } 81 : 82 : Real 83 1775257 : GapHeatPointSourceMaster::computeQpResidual() 84 : { 85 1775257 : const Node & node = *point_to_node[_current_point]; 86 1775257 : const auto dof_number = node.dof_number(_sys.number(), _var.number(), 0); 87 : 88 1775257 : return -_test[_i][_qp] * _secondary_flux(dof_number); 89 : } 90 : 91 : Real 92 4674763 : GapHeatPointSourceMaster::computeQpJacobian() 93 : { 94 4674763 : return 0.0; 95 : }