www.mooseframework.org
PenetrationAux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // MOOSE includes
16 #include "PenetrationAux.h"
17 #include "PenetrationLocator.h"
18 #include "DisplacedProblem.h"
19 #include "MooseEnum.h"
20 #include "MooseMesh.h"
21 
22 #include "libmesh/string_to_enum.h"
23 
24 const Real PenetrationAux::NotPenetrated = -999999;
25 
26 template <>
29 {
30  MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST");
31 
33  params.addClassDescription("Auxililary Kernel for computing several geometry related quantities "
34  "between two contacting bodies.");
35 
36  params.addRequiredParam<BoundaryName>("paired_boundary", "The boundary to be penetrated");
37  params.addParam<Real>("tangential_tolerance",
38  "Tangential distance to extend edges of contact surfaces");
39  params.addParam<Real>(
40  "normal_smoothing_distance",
41  "Distance from edge in parametric coordinates over which to smooth contact normal");
42  params.addParam<std::string>("normal_smoothing_method",
43  "Method to use to smooth normals (edge_based|nodal_normal_based)");
44  params.addParam<MooseEnum>("order", orders, "The finite element order");
45 
46  params.set<bool>("use_displaced_mesh") = true;
47 
48  // To avoid creating a conversion routine we will list the enumeration options in the same order
49  // as the class-based enum.
50  // Care must be taken to ensure that this list stays in sync with the enum in the .h file.
51  MooseEnum quantity(
52  "distance tangential_distance normal_x normal_y normal_z closest_point_x closest_point_y "
53  "closest_point_z element_id side incremental_slip_magnitude incremental_slip_x "
54  "incremental_slip_y incremental_slip_z accumulated_slip force_x force_y force_z "
55  "normal_force_magnitude normal_force_x normal_force_y normal_force_z "
56  "tangential_force_magnitude "
57  "tangential_force_x tangential_force_y tangential_force_z frictional_energy "
58  "lagrange_multiplier "
59  "mechanical_status",
60  "distance");
61 
62  params.addParam<MooseEnum>(
63  "quantity", quantity, "The quantity to recover from the available penetration information");
64  return params;
65 }
66 
68  : AuxKernel(parameters),
69 
70  // Here we cast the value of the MOOSE enum to an integer to the class-based enum.
71  _quantity(getParam<MooseEnum>("quantity").getEnum<PenetrationAux::PA_ENUM>()),
72  _penetration_locator(
73  _nodal ? getPenetrationLocator(
74  parameters.get<BoundaryName>("paired_boundary"),
75  boundaryNames()[0],
76  Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")))
77  : getQuadraturePenetrationLocator(
78  parameters.get<BoundaryName>("paired_boundary"),
79  boundaryNames()[0],
80  Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order"))))
81 {
82  if (parameters.isParamValid("tangential_tolerance"))
83  _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));
84 
85  if (parameters.isParamValid("normal_smoothing_distance"))
86  _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance"));
87 
88  if (parameters.isParamValid("normal_smoothing_method"))
90  parameters.get<std::string>("normal_smoothing_method"));
91 }
92 
93 Real
95 {
96  const Node * current_node = NULL;
97 
98  if (_nodal)
99  current_node = _current_node;
100  else
102 
103  PenetrationInfo * pinfo = _penetration_locator._penetration_info[current_node->id()];
104 
105  Real retVal(NotPenetrated);
106 
107  if (pinfo)
108  switch (_quantity)
109  {
110  case PA_DISTANCE:
111  retVal = pinfo->_distance;
112  break;
113  case PA_TANG_DISTANCE:
114  retVal = pinfo->_tangential_distance;
115  break;
116  case PA_NORMAL_X:
117  retVal = pinfo->_normal(0);
118  break;
119  case PA_NORMAL_Y:
120  retVal = pinfo->_normal(1);
121  break;
122  case PA_NORMAL_Z:
123  retVal = pinfo->_normal(2);
124  break;
125  case PA_CLOSEST_POINT_X:
126  retVal = pinfo->_closest_point(0);
127  break;
128  case PA_CLOSEST_POINT_Y:
129  retVal = pinfo->_closest_point(1);
130  break;
131  case PA_CLOSEST_POINT_Z:
132  retVal = pinfo->_closest_point(2);
133  break;
134  case PA_ELEM_ID:
135  retVal = static_cast<Real>(pinfo->_elem->id() + 1);
136  break;
137  case PA_SIDE:
138  retVal = static_cast<Real>(pinfo->_side_num);
139  break;
141  retVal = pinfo->isCaptured() ? pinfo->_incremental_slip.norm() : 0;
142  break;
144  retVal = pinfo->isCaptured() ? pinfo->_incremental_slip(0) : 0;
145  break;
147  retVal = pinfo->isCaptured() ? pinfo->_incremental_slip(1) : 0;
148  break;
150  retVal = pinfo->isCaptured() ? pinfo->_incremental_slip(2) : 0;
151  break;
152  case PA_ACCUMULATED_SLIP:
153  retVal = pinfo->_accumulated_slip;
154  break;
155  case PA_FORCE_X:
156  retVal = pinfo->_contact_force(0);
157  break;
158  case PA_FORCE_Y:
159  retVal = pinfo->_contact_force(1);
160  break;
161  case PA_FORCE_Z:
162  retVal = pinfo->_contact_force(2);
163  break;
164  case PA_NORMAL_FORCE_MAG:
165  retVal = -pinfo->_contact_force * pinfo->_normal;
166  break;
167  case PA_NORMAL_FORCE_X:
168  retVal = (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(0);
169  break;
170  case PA_NORMAL_FORCE_Y:
171  retVal = (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(1);
172  break;
173  case PA_NORMAL_FORCE_Z:
174  retVal = (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(2);
175  break;
177  {
178  RealVectorValue contact_force_normal((pinfo->_contact_force * pinfo->_normal) *
179  pinfo->_normal);
180  RealVectorValue contact_force_tangential(pinfo->_contact_force - contact_force_normal);
181  retVal = contact_force_tangential.norm();
182  break;
183  }
185  retVal =
186  pinfo->_contact_force(0) - (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(0);
187  break;
189  retVal =
190  pinfo->_contact_force(1) - (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(1);
191  break;
193  retVal =
194  pinfo->_contact_force(2) - (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(2);
195  break;
197  retVal = pinfo->_frictional_energy;
198  break;
200  retVal = pinfo->_lagrange_multiplier;
201  break;
202  case PA_MECH_STATUS:
203  retVal = pinfo->_mech_status;
204  break;
205  default:
206  mooseError("Unknown PA_ENUM");
207  } // switch
208 
209  return retVal;
210 }
VectorValue< Real > RealVectorValue
Definition: Assembly.h:40
RealVectorValue _normal
void setNormalSmoothingDistance(Real normal_smoothing_distance)
Data structure used to hold penetration information.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
const Elem *& _current_elem
Current element (valid only for elemental kernels)
Definition: AuxKernel.h:176
unsigned int & _current_side
current side of the current element
Definition: AuxKernel.h:178
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool isCaptured() const
PenetrationAux(const InputParameters &parameters)
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
void setTangentialTolerance(Real tangential_tolerance)
MooseMesh & _mesh
Mesh this kernel is active on.
Definition: AuxKernel.h:154
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...
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
const Elem * _elem
PenetrationLocator & _penetration_locator
InputParameters validParams< AuxKernel >()
Definition: AuxKernel.C:30
const Node *& _current_node
Current node (valid only for nodal kernels)
Definition: AuxKernel.h:186
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:37
unsigned int _side_num
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:192
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:51
RealVectorValue _contact_force
bool _nodal
true if the kernel is nodal, false if it is elemental
Definition: AuxKernel.h:150
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition: MooseMesh.C:938
MECH_STATUS_ENUM _mech_status
virtual Real computeValue() override
static const Real NotPenetrated
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...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
void setNormalSmoothingMethod(std::string nsmString)
InputParameters validParams< PenetrationAux >()