https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GapHeatPointSourceMaster.C
Go to the documentation of this file.
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
11#include "SystemBase.h"
12#include "PenetrationInfo.h"
13#include "MooseMesh.h"
14
15#include "libmesh/string_to_enum.h"
16
18
21{
22 MooseEnum orders("CONSTANT FIRST SECOND THIRD FOURTH", "FIRST");
23
25 params.addParam<BoundaryName>("boundary", "The primary boundary");
26 params.addParam<BoundaryName>("secondary", "The secondary boundary");
27 params.addParam<MooseEnum>("order", orders, "The finite element order");
28 params.set<bool>("use_displaced_mesh") = true;
29 params.addParam<Real>("tangential_tolerance",
30 "Tangential distance to extend edges of contact surfaces");
31 params.addParam<Real>(
32 "normal_smoothing_distance",
33 "Distance from edge in parametric coordinates over which to smooth contact normal");
34 params.addParam<std::string>("normal_smoothing_method",
35 "Method to use to smooth normals (edge_based|nodal_normal_based)");
37 "Dirac kernel to create a heat source on the primary contact surface in thermal contact.");
38
39 return params;
40}
41
43 : DiracKernel(parameters),
44 _penetration_locator(
45 getPenetrationLocator(getParam<BoundaryName>("boundary"),
46 getParam<BoundaryName>("secondary"),
47 Utility::string_to_enum<Order>(getParam<MooseEnum>("order")))),
48 _secondary_flux(_sys.getVector("secondary_flux"))
49{
50 if (parameters.isParamValid("tangential_tolerance"))
51 _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));
52
53 if (parameters.isParamValid("normal_smoothing_distance"))
54 _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance"));
55
56 if (parameters.isParamValid("normal_smoothing_method"))
58 parameters.get<std::string>("normal_smoothing_method"));
59}
60
61void
63{
64 point_to_node.clear();
66
67 for (const auto & [id, pinfo] : _penetration_locator._penetration_info)
68 {
69 if (!pinfo)
70 continue;
71
72 const auto & node = _mesh.nodeRef(id);
73 // Skip this pinfo if there are no DOFs on this node.
74 if (node.n_comp(_sys.number(), _var.number()) < 1)
75 continue;
76
77 addPoint(pinfo->_elem, pinfo->_closest_point);
78 point_to_node[pinfo->_closest_point] = &node;
79 }
80}
81
82Real
84{
85 const Node & node = *point_to_node[_current_point];
86 const auto dof_number = node.dof_number(_sys.number(), _var.number(), 0);
87
88 return -_test[_i][_qp] * _secondary_flux(dof_number);
89}
90
91Real
registerMooseObject("HeatTransferApp", GapHeatPointSourceMaster)
unsigned int _i
unsigned int _qp
void addPoint(const Elem *elem, Point p, unsigned id=libMesh::invalid_uint, Real value=1.0)
static InputParameters validParams()
MooseVariableField< T > & _var
const OutputTools< T >::VariableTestValue & _test
GapHeatPointSourceMaster(const InputParameters &parameters)
PenetrationLocator & _penetration_locator
NumericVector< Number > & _secondary_flux
static InputParameters validParams()
std::map< Point, const Node * > point_to_node
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
bool isParamValid(const std::string &name) const
const InputParameters & parameters() const
virtual const Node & nodeRef(const dof_id_type i) const
unsigned int number() const
void setNormalSmoothingMethod(std::string nsmString)
void setTangentialTolerance(Real tangential_tolerance)
void setNormalSmoothingDistance(Real normal_smoothing_distance)
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
MooseMesh & _mesh
SystemBase & _sys
unsigned int number() const
virtual void close()=0