www.mooseframework.org
GapHeatPointSourceMaster.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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)");
36 
37  return params;
38 }
39 
41  : DiracKernel(parameters),
42  _penetration_locator(
43  getPenetrationLocator(getParam<BoundaryName>("boundary"),
44  getParam<BoundaryName>("secondary"),
45  Utility::string_to_enum<Order>(getParam<MooseEnum>("order")))),
46  _secondary_flux(_sys.getVector("secondary_flux"))
47 {
48  if (parameters.isParamValid("tangential_tolerance"))
49  _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));
50 
51  if (parameters.isParamValid("normal_smoothing_distance"))
52  _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance"));
53 
54  if (parameters.isParamValid("normal_smoothing_method"))
56  parameters.get<std::string>("normal_smoothing_method"));
57 }
58 
59 void
61 {
62  point_to_node.clear();
64 
65  for (const auto & [id, pinfo] : _penetration_locator._penetration_info)
66  {
67  if (!pinfo)
68  continue;
69 
70  const auto & node = _mesh.nodeRef(id);
71  // Skip this pinfo if there are no DOFs on this node.
72  if (node.n_comp(_sys.number(), _var.number()) < 1)
73  continue;
74 
75  addPoint(pinfo->_elem, pinfo->_closest_point);
76  point_to_node[pinfo->_closest_point] = &node;
77  }
78 }
79 
80 Real
82 {
83  const Node & node = *point_to_node[_current_point];
84  const auto dof_number = node.dof_number(_sys.number(), _var.number(), 0);
85 
86  return -_test[_i][_qp] * _secondary_flux(dof_number);
87 }
88 
89 Real
91 {
92  return 0.0;
93 }
MooseMesh & _mesh
Order
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)
void setNormalSmoothingDistance(Real normal_smoothing_distance)
unsigned int number() const
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
T & set(const std::string &name, bool quiet_mode=false)
void addPoint(const Elem *elem, Point p, unsigned id=libMesh::invalid_uint)
const OutputTools< T >::VariableTestValue & _test
registerMooseObject("HeatTransferApp", GapHeatPointSourceMaster)
std::map< dof_id_type, PenetrationInfo *> & _penetration_info
void setTangentialTolerance(Real tangential_tolerance)
virtual const Node & nodeRef(const dof_id_type i) const
SystemBase & _sys
static InputParameters validParams()
PenetrationLocator & _penetration_locator
T string_to_enum(const std::string &s)
MooseVariableField< T > & _var
unsigned int number() const
virtual void close()=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _qp
const InputParameters & parameters() const
void setNormalSmoothingMethod(std::string nsmString)
NumericVector< Number > & _secondary_flux
unsigned int _i
GapHeatPointSourceMaster(const InputParameters &parameters)
static InputParameters validParams()
bool isParamValid(const std::string &name) const