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 
17 registerMooseObject("HeatConductionApp", GapHeatPointSourceMaster);
18 
20 
21 InputParameters
23 {
24  MooseEnum orders("CONSTANT FIRST SECOND THIRD FOURTH", "FIRST");
25 
26  InputParameters params = DiracKernel::validParams();
27  params.addRequiredParam<BoundaryName>("boundary", "The master boundary");
28  params.addRequiredParam<BoundaryName>("slave", "The slave boundary");
29  params.addParam<MooseEnum>("order", orders, "The finite element order");
30  params.set<bool>("use_displaced_mesh") = true;
31  params.addParam<Real>("tangential_tolerance",
32  "Tangential distance to extend edges of contact surfaces");
33  params.addParam<Real>(
34  "normal_smoothing_distance",
35  "Distance from edge in parametric coordinates over which to smooth contact normal");
36  params.addParam<std::string>("normal_smoothing_method",
37  "Method to use to smooth normals (edge_based|nodal_normal_based)");
38 
39  return params;
40 }
41 
42 GapHeatPointSourceMaster::GapHeatPointSourceMaster(const InputParameters & parameters)
43  : DiracKernel(parameters),
44  _penetration_locator(
45  getPenetrationLocator(getParam<BoundaryName>("boundary"),
46  getParam<BoundaryName>("slave"),
47  Utility::string_to_enum<Order>(getParam<MooseEnum>("order")))),
48  _slave_flux(_sys.getVector("slave_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"))
57  _penetration_locator.setNormalSmoothingMethod(
58  parameters.get<std::string>("normal_smoothing_method"));
59 }
60 
61 void
63 {
64  point_to_info.clear();
65  _slave_flux.close();
66 
67  std::map<dof_id_type, PenetrationInfo *>::iterator
68  it = _penetration_locator._penetration_info.begin(),
69  end = _penetration_locator._penetration_info.end();
70 
71  for (; it != end; ++it)
72  {
73  PenetrationInfo * pinfo = it->second;
74 
75  // Skip this pinfo if there are no DOFs on this node.
76  if (!pinfo || pinfo->_node->n_comp(_sys.number(), _var.number()) < 1)
77  continue;
78 
79  addPoint(pinfo->_elem, pinfo->_closest_point);
80  point_to_info[pinfo->_closest_point] = pinfo;
81  }
82 }
83 
84 Real
86 {
87  PenetrationInfo * pinfo = point_to_info[_current_point];
88  const Node * node = pinfo->_node;
89  long int dof_number = node->dof_number(_sys.number(), _var.number(), 0);
90 
91  return -_test[_i][_qp] * _slave_flux(dof_number);
92 }
93 
94 Real
96 {
97  return 0.0;
98 }
GapHeatPointSourceMaster::validParams
static InputParameters validParams()
Definition: GapHeatPointSourceMaster.C:22
registerMooseObject
registerMooseObject("HeatConductionApp", GapHeatPointSourceMaster)
GapHeatPointSourceMaster::_penetration_locator
PenetrationLocator & _penetration_locator
Definition: GapHeatPointSourceMaster.h:34
GapHeatPointSourceMaster::point_to_info
std::map< Point, PenetrationInfo * > point_to_info
Definition: GapHeatPointSourceMaster.h:35
GapHeatPointSourceMaster::computeQpResidual
virtual Real computeQpResidual()
Definition: GapHeatPointSourceMaster.C:85
GapHeatPointSourceMaster.h
GapHeatPointSourceMaster::addPoints
virtual void addPoints()
Definition: GapHeatPointSourceMaster.C:62
validParams
InputParameters validParams()
GapHeatPointSourceMaster::_slave_flux
NumericVector< Number > & _slave_flux
Definition: GapHeatPointSourceMaster.h:36
GapHeatPointSourceMaster::computeQpJacobian
virtual Real computeQpJacobian()
Definition: GapHeatPointSourceMaster.C:95
defineLegacyParams
defineLegacyParams(GapHeatPointSourceMaster)
GapHeatPointSourceMaster
Definition: GapHeatPointSourceMaster.h:22
GapHeatPointSourceMaster::GapHeatPointSourceMaster
GapHeatPointSourceMaster(const InputParameters &parameters)
Definition: GapHeatPointSourceMaster.C:42