https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GapValueAux.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
10#include "GapValueAux.h"
11
12#include "MooseMesh.h"
13#include "SystemBase.h"
14#include "MooseEnum.h"
15#include "PenetrationLocator.h"
16
17#include "libmesh/string_to_enum.h"
18
20
23{
24 MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST");
25
28 "Return the nearest value of a variable on a boundary from across a gap.");
29 params.set<bool>("_dual_restrictable") = true;
30 params.addRequiredParam<BoundaryName>("paired_boundary",
31 "The boundary on the other side of a gap.");
32 params.addRequiredParam<VariableName>("paired_variable", "The variable to get the value of.");
33 params.set<bool>("use_displaced_mesh") = true;
34 params.addParam<Real>("tangential_tolerance",
35 "Tangential distance to extend edges of contact surfaces");
36 params.addParam<Real>(
37 "normal_smoothing_distance",
38 "Distance from edge in parametric coordinates over which to smooth contact normal");
39 params.addParam<std::string>("normal_smoothing_method",
40 "Method to use to smooth normals (edge_based|nodal_normal_based)");
41 params.addParam<MooseEnum>("order", orders, "The finite element order");
42 params.addParam<bool>(
43 "warnings", false, "Whether to output warning messages concerning nodes not being found");
44 return params;
45}
46
48 : AuxKernel(parameters),
49 _penetration_locator(
50 _nodal ? getPenetrationLocator(
51 parameters.get<BoundaryName>("paired_boundary"),
52 boundaryNames()[0],
53 Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")))
54 : getQuadraturePenetrationLocator(
55 parameters.get<BoundaryName>("paired_boundary"),
56 boundaryNames()[0],
57 Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")))),
58 _moose_var(_subproblem.getStandardVariable(_tid, getParam<VariableName>("paired_variable"))),
59 _serialized_solution(_moose_var.sys().currentSolution()),
60 _dof_map(_moose_var.dofMap()),
61 _warnings(getParam<bool>("warnings"))
62{
63 if (parameters.isParamValid("tangential_tolerance"))
64 _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));
65
66 if (parameters.isParamValid("normal_smoothing_distance"))
67 _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance"));
68
69 if (parameters.isParamValid("normal_smoothing_method"))
71 parameters.get<std::string>("normal_smoothing_method"));
72
73 Order pairedVarOrder(_moose_var.order());
74 Order gvaOrder(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")));
75 if (pairedVarOrder != gvaOrder && pairedVarOrder != CONSTANT)
76 mooseError("ERROR: specified order for GapValueAux (",
77 Utility::enum_to_string<Order>(gvaOrder),
78 ") does not match order for paired_variable \"",
80 "\" (",
81 Utility::enum_to_string<Order>(pairedVarOrder),
82 ")");
83}
84
85Real
87{
88 const Node * current_node = NULL;
89
90 if (_nodal)
91 current_node = _current_node;
92 else
94
95 PenetrationInfo * pinfo = _penetration_locator._penetration_info[current_node->id()];
96
97 Real gap_value = 0.0;
98
99 if (pinfo)
100 {
101 std::vector<std::vector<Real>> & side_phi = pinfo->_side_phi;
102 if (_moose_var.feType().order != CONSTANT)
103 gap_value = _moose_var.getValue(pinfo->_side, side_phi);
104 else
105 gap_value = _moose_var.getValue(pinfo->_elem, side_phi);
106 }
107 else
108 {
109 if (_warnings)
110 {
111 std::stringstream msg;
112 msg << "No gap value information found for node ";
113 msg << current_node->id();
114 msg << " on processor ";
115 msg << processor_id();
116 mooseWarning(msg.str());
117 }
118 }
119 return gap_value;
120}
registerMooseObject("MooseApp", GapValueAux)
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition MooseError.h:345
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
MooseMesh & _mesh
Mesh this kernel is active on.
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition AuxKernel.h:133
const Node *const & _current_node
Current node (valid only for nodal kernels)
Definition AuxKernel.h:143
const bool _nodal
Flag indicating if the AuxKernel is nodal.
Definition AuxKernel.h:116
const unsigned int & _current_side
current side of the current element
Definition AuxKernel.h:135
unsigned int _qp
Quadrature point index.
Definition AuxKernel.h:155
static InputParameters validParams()
Definition AuxKernel.C:27
PenetrationLocator & _penetration_locator
Definition GapValueAux.h:26
static InputParameters validParams()
Definition GapValueAux.C:22
const bool _warnings
Definition GapValueAux.h:34
virtual Real computeValue() override
Compute and return the value of the aux variable.
Definition GapValueAux.C:86
MooseVariable & _moose_var
Definition GapValueAux.h:28
GapValueAux(const InputParameters &parameters)
Definition GapValueAux.C:47
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another,...
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition MooseMesh.C:1649
const libMesh::FEType & feType() const
Get the type of finite element object.
libMesh::Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int.
OutputType getValue(const Elem *elem, const std::vector< std::vector< OutputShape > > &phi) const
Compute the variable value at a point on an element.
Data structure used to hold penetration information.
const Elem * _side
std::vector< std::vector< Real > > _side_phi
const Elem * _elem
void setNormalSmoothingMethod(std::string nsmString)
void setTangentialTolerance(Real tangential_tolerance)
void setNormalSmoothingDistance(Real normal_smoothing_distance)
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
OrderWrapper order
processor_id_type processor_id() const