www.mooseframework.org
PenetrationInfo.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 #include "PenetrationInfo.h"
16 #include "ArbitraryQuadrature.h"
17 #include "LineSegment.h"
18 #include "NearestNodeLocator.h"
19 #include "MooseMesh.h"
20 #include "SubProblem.h"
21 #include "GeometricSearchData.h"
22 #include "PenetrationThread.h"
23 #include "Moose.h"
24 #include "MooseMesh.h"
25 
27  const Elem * elem,
28  const Elem * side,
29  unsigned int side_num,
30  RealVectorValue norm,
31  Real norm_distance,
32  Real tangential_distance,
33  const Point & closest_point,
34  const Point & closest_point_ref,
35  const Point & closest_point_on_face_ref,
36  std::vector<const Node *> off_edge_nodes,
37  const std::vector<std::vector<Real>> & side_phi,
38  const std::vector<std::vector<RealGradient>> & side_grad_phi,
39  const std::vector<RealGradient> & dxyzdxi,
40  const std::vector<RealGradient> & dxyzdeta,
41  const std::vector<RealGradient> & d2xyzdxideta)
42  : _node(node),
43  _elem(elem),
44  _side(side),
45  _side_num(side_num),
46  _normal(norm),
47  _distance(norm_distance),
48  _tangential_distance(tangential_distance),
49  _closest_point(closest_point),
50  _closest_point_ref(closest_point_ref),
51  _closest_point_on_face_ref(closest_point_on_face_ref),
52  _off_edge_nodes(off_edge_nodes),
53  _side_phi(side_phi),
54  _side_grad_phi(side_grad_phi),
55  _dxyzdxi(dxyzdxi),
56  _dxyzdeta(dxyzdeta),
57  _d2xyzdxideta(d2xyzdxideta),
58  _starting_elem(NULL),
59  _starting_side_num(libMesh::invalid_uint),
60  _starting_closest_point_ref(0),
61  _incremental_slip(0),
62  _accumulated_slip(0.0),
63  _accumulated_slip_old(0.0),
64  _frictional_energy(0.0),
65  _frictional_energy_old(0.0),
66  _contact_force(0),
67  _contact_force_old(0),
68  _lagrange_multiplier(0),
69  _lagrange_multiplier_slip(0),
70  _locked_this_step(0),
71  _mech_status(MS_NO_CONTACT),
72  _mech_status_old(MS_NO_CONTACT),
73  _incremental_slip_prev_iter(0),
74  _slip_reversed(false),
75  _slip_tol(0)
76 {
77 }
78 
79 /*
80 PenetrationInfo::PenetrationInfo(const PenetrationInfo & p)
81  : _node(p._node),
82  _elem(p._elem),
83  _side(p._side), // Which one now owns _side? There will be trouble if (when)
84  // both delete _side
85  _side_num(p._side_num),
86  _normal(p._normal),
87  _distance(p._distance),
88  _tangential_distance(p._tangential_distance),
89  _closest_point(p._closest_point),
90  _closest_point_ref(p._closest_point_ref),
91  _closest_point_on_face_ref(p._closest_point_on_face_ref),
92  _off_edge_nodes(p._off_edge_nodes),
93  _side_phi(p._side_phi),
94  _side_grad_phi(p._side_grad_phi),
95  _dxyzdxi(p._dxyzdxi),
96  _dxyzdeta(p._dxyzdeta),
97  _d2xyzdxideta(p._d2xyzdxideta),
98  _starting_elem(p._starting_elem),
99  _starting_side_num(p._starting_side_num),
100  _starting_closest_point_ref(p._starting_closest_point_ref),
101  _incremental_slip(p._incremental_slip),
102  _accumulated_slip(p._accumulated_slip),
103  _accumulated_slip_old(p._accumulated_slip_old),
104  _frictional_energy(p._frictional_energy),
105  _frictional_energy_old(p._frictional_energy_old),
106  _contact_force(p._contact_force),
107  _contact_force_old(p._contact_force_old),
108  _lagrange_multiplier(p._lagrange_multiplier),
109  _lagrange_multiplier_slip(p._lagrange_multiplier_slip),
110 
111  _locked_this_step(p._locked_this_step),
112  _mech_status(p._mech_status),
113  _mech_status_old(p._mech_status_old),
114  _incremental_slip_prev_iter(p._incremental_slip_prev_iter),
115  _slip_reversed(p._slip_reversed),
116  _slip_tol(p._slip_tol)
117 {
118 }
119 */
120 
122  : _node(NULL),
123  _elem(NULL),
124  _side(NULL),
125  _side_num(0),
126  _normal(0),
127  _distance(0),
129  _closest_point(0),
132  _off_edge_nodes(0),
133  _side_phi(0),
134  _side_grad_phi(0),
135  _dxyzdxi(0),
136  _dxyzdeta(0),
137  _d2xyzdxideta(0),
138  _starting_elem(NULL),
139  _starting_side_num(libMesh::invalid_uint),
142  _accumulated_slip(0.0),
144  _frictional_energy(0.0),
146  _contact_force(0),
154  _slip_reversed(false),
155  _slip_tol(0)
156 {
157 }
158 
160 
161 template <>
162 void
163 dataStore(std::ostream & stream, PenetrationInfo *& pinfo, void * context)
164 {
165  if (!context)
166  mooseError("Can only store PenetrationInfo objects using a MooseMesh context!");
167 
168  if (pinfo)
169  {
170  // Store 1 so that we know that this pinfo really exists!
171  unsigned int i = 1;
172  storeHelper(stream, i, context);
173 
174  storeHelper(stream, pinfo->_node, context);
175  storeHelper(stream, pinfo->_elem, context);
176  // Not storing the side element as we will need to recreate it on load
177  storeHelper(stream, pinfo->_side_num, context);
178  storeHelper(stream, pinfo->_normal, context);
179  storeHelper(stream, pinfo->_distance, context);
180  storeHelper(stream, pinfo->_tangential_distance, context);
181  storeHelper(stream, pinfo->_closest_point, context);
182  storeHelper(stream, pinfo->_closest_point_ref, context);
183  storeHelper(stream, pinfo->_closest_point_on_face_ref, context);
184  storeHelper(stream, pinfo->_off_edge_nodes, context);
185  storeHelper(stream, pinfo->_side_phi, context);
186  storeHelper(stream, pinfo->_side_grad_phi, context);
187  storeHelper(stream, pinfo->_dxyzdxi, context);
188  storeHelper(stream, pinfo->_dxyzdeta, context);
189  storeHelper(stream, pinfo->_d2xyzdxideta, context);
190  storeHelper(stream, pinfo->_starting_elem, context);
191  storeHelper(stream, pinfo->_starting_side_num, context);
192  storeHelper(stream, pinfo->_starting_closest_point_ref, context);
193  storeHelper(stream, pinfo->_incremental_slip, context);
194  storeHelper(stream, pinfo->_accumulated_slip, context);
195  storeHelper(stream, pinfo->_frictional_energy, context);
196  storeHelper(stream, pinfo->_contact_force, context);
197  storeHelper(stream, pinfo->_lagrange_multiplier, context);
198  storeHelper(stream, pinfo->_lagrange_multiplier_slip, context);
199  storeHelper(stream, pinfo->_mech_status, context);
200  storeHelper(stream, pinfo->_mech_status_old, context);
201 
202  // Don't need frictional_energy_old, accumulated_slip_old, contact_force_old, or
203  // locked_this_step
204  // because they are always set by the constraints at the beginning of a new time step.
205  }
206  else
207  {
208  // Store 0 so that we know that this pinfo is NULL
209  unsigned int i = 0;
210  storeHelper(stream, i, context);
211  }
212 }
213 
214 template <>
215 void
216 dataLoad(std::istream & stream, PenetrationInfo *& pinfo, void * context)
217 {
218  if (!context)
219  mooseError("Can only load PenetrationInfo objects using a MooseMesh context!");
220 
221  // First, see if this is supposed to be NULL
222  unsigned int i = 0;
223  loadHelper(stream, i, context);
224  if (i)
225  {
226  pinfo = new PenetrationInfo();
227 
228  loadHelper(stream, pinfo->_node, context);
229  loadHelper(stream, pinfo->_elem, context);
230  loadHelper(stream, pinfo->_side_num, context);
231  // Rebuild the side element.
232  pinfo->_side = pinfo->_elem->build_side_ptr(pinfo->_side_num, false).release();
233 
234  loadHelper(stream, pinfo->_normal, context);
235  loadHelper(stream, pinfo->_distance, context);
236  loadHelper(stream, pinfo->_tangential_distance, context);
237  loadHelper(stream, pinfo->_closest_point, context);
238  loadHelper(stream, pinfo->_closest_point_ref, context);
239  loadHelper(stream, pinfo->_closest_point_on_face_ref, context);
240  loadHelper(stream, pinfo->_off_edge_nodes, context);
241  loadHelper(stream, pinfo->_side_phi, context);
242  loadHelper(stream, pinfo->_side_grad_phi, context);
243  loadHelper(stream, pinfo->_dxyzdxi, context);
244  loadHelper(stream, pinfo->_dxyzdeta, context);
245  loadHelper(stream, pinfo->_d2xyzdxideta, context);
246  loadHelper(stream, pinfo->_starting_elem, context);
247  loadHelper(stream, pinfo->_starting_side_num, context);
248  loadHelper(stream, pinfo->_starting_closest_point_ref, context);
249  loadHelper(stream, pinfo->_incremental_slip, context);
250  loadHelper(stream, pinfo->_accumulated_slip, context);
251  loadHelper(stream, pinfo->_frictional_energy, context);
252  loadHelper(stream, pinfo->_contact_force, context);
253  loadHelper(stream, pinfo->_lagrange_multiplier, context);
254  loadHelper(stream, pinfo->_lagrange_multiplier_slip, context);
255  loadHelper(stream, pinfo->_mech_status, context);
256  loadHelper(stream, pinfo->_mech_status_old, context);
257 
258  // Don't need frictional_energy_old, accumulated_slip_old, contact_force_old, or
259  // locked_this_step
260  // because they are always set by the constraints at the beginning of a new time step.
261  }
262  else
263  pinfo = NULL;
264 }
std::vector< RealGradient > _d2xyzdxideta
VectorValue< Real > RealVectorValue
Definition: Assembly.h:40
RealVectorValue _normal
Data structure used to hold penetration information.
void dataStore(std::ostream &stream, PenetrationInfo *&pinfo, void *context)
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
const Elem * _starting_elem
Point _closest_point_on_face_ref
std::vector< std::vector< RealGradient > > _side_grad_phi
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::vector< std::vector< Real > > _side_phi
RealVectorValue _contact_force_old
Point _incremental_slip_prev_iter
unsigned int _locked_this_step
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:528
const Elem * _elem
unsigned int _starting_side_num
unsigned int _side_num
std::vector< RealGradient > _dxyzdxi
const Elem * _side
RealVectorValue _contact_force
MECH_STATUS_ENUM _mech_status
std::vector< const Node * > _off_edge_nodes
Point _starting_closest_point_ref
std::vector< RealGradient > _dxyzdeta
void dataLoad(std::istream &stream, PenetrationInfo *&pinfo, void *context)
MECH_STATUS_ENUM _mech_status_old
RealVectorValue _lagrange_multiplier_slip
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:592
const Node * _node