www.mooseframework.org
PenetrationLocator.h
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 #ifndef PENETRATIONLOCATOR_H
16 #define PENETRATIONLOCATOR_H
17 
18 // Moose includes
19 #include "Restartable.h"
20 #include "PenetrationInfo.h"
21 
22 #include "libmesh/vector_value.h"
23 #include "libmesh/point.h"
24 #include "libmesh/fe_base.h"
25 
26 // Forward Declarations
27 class SubProblem;
28 class MooseMesh;
30 class NearestNodeLocator;
31 
33 {
34 public:
35  PenetrationLocator(SubProblem & subproblem,
36  GeometricSearchData & geom_search_data,
37  MooseMesh & mesh,
38  const unsigned int master_id,
39  const unsigned int slave_id,
40  Order order,
41  NearestNodeLocator & nearest_node);
43  void detectPenetration();
44 
49  void reinit();
50 
51  Real penetrationDistance(dof_id_type node_id);
52  RealVectorValue penetrationNormal(dof_id_type node_id);
53 
55  {
58  };
59 
61 
62  Real normDistance(const Elem & elem,
63  const Elem & side,
64  const Node & p0,
65  Point & closest_point,
66  RealVectorValue & normal);
67 
68  int intersect2D_Segments(Point S1P0, Point S1P1, Point S2P0, Point S2P1, Point * I0, Point * I1);
69  int inSegment(Point P, Point SP0, Point SP1);
70 
74 
75  FEType _fe_type;
76 
77  // One FE for each thread and for each dimension
78  std::vector<std::vector<FEBase *>> _fe;
79 
81 
83  std::map<dof_id_type, PenetrationInfo *> & _penetration_info;
84 
85  std::set<dof_id_type> &
86  _has_penetrated; // This is only hanging around for legacy code. Don't use it!
87 
88  void setCheckWhetherReasonable(bool state);
89  void setUpdate(bool update);
90  void setTangentialTolerance(Real tangential_tolerance);
91  void setNormalSmoothingDistance(Real normal_smoothing_distance);
92  void setNormalSmoothingMethod(std::string nsmString);
94 
95 protected:
98  bool & _update_location; // Update the penetration location for nodes found last time
99  Real _tangential_tolerance; // Tangential distance a node can be from a face and still be in
100  // contact
101  bool _do_normal_smoothing; // Should we do contact normal smoothing?
102  Real _normal_smoothing_distance; // Distance from edge (in parametric coords) within which to
103  // perform normal smoothing
105 };
106 
111 template <>
112 inline void
113 dataLoad(std::istream & stream, std::map<dof_id_type, PenetrationInfo *> & m, void * context)
114 {
115  std::map<dof_id_type, PenetrationInfo *>::iterator it = m.begin();
116  std::map<dof_id_type, PenetrationInfo *>::iterator end = m.end();
117 
118  for (; it != end; ++it)
119  delete it->second;
120 
121  m.clear();
122 
123  // First read the size of the map
124  unsigned int size = 0;
125  stream.read((char *)&size, sizeof(size));
126 
127  for (unsigned int i = 0; i < size; i++)
128  {
129  dof_id_type key;
130  loadHelper(stream, key, context);
131  loadHelper(stream, m[key], context);
132  }
133 }
134 
135 #endif // PENETRATIONLOCATOR_H
A class for creating restricted objects.
Definition: Restartable.h:31
VectorValue< Real > RealVectorValue
Definition: Assembly.h:40
RealVectorValue penetrationNormal(dof_id_type node_id)
void setNormalSmoothingDistance(Real normal_smoothing_distance)
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
Real normDistance(const Elem &elem, const Elem &side, const Node &p0, Point &closest_point, RealVectorValue &normal)
PenetrationLocator(SubProblem &subproblem, GeometricSearchData &geom_search_data, MooseMesh &mesh, const unsigned int master_id, const unsigned int slave_id, Order order, NearestNodeLocator &nearest_node)
std::vector< std::vector< FEBase * > > _fe
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
void setTangentialTolerance(Real tangential_tolerance)
void dataLoad(std::istream &stream, std::map< dof_id_type, PenetrationInfo * > &m, void *context)
We have to have a specialization for this map because the PenetrationInfo objects MUST get deleted be...
bool _check_whether_reasonable
Check whether found candidates are reasonable.
PetscInt m
int inSegment(Point P, Point SP0, Point SP1)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
SubProblem & _subproblem
void setUpdate(bool update)
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
Real penetrationDistance(dof_id_type node_id)
void setNormalSmoothingMethod(std::string nsmString)
void reinit()
Completely redo the search from scratch.
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:592
std::set< dof_id_type > & _has_penetrated
void setCheckWhetherReasonable(bool state)
NORMAL_SMOOTHING_METHOD _normal_smoothing_method
int intersect2D_Segments(Point S1P0, Point S1P1, Point S2P0, Point S2P1, Point *I0, Point *I1)
boundary_id_type BoundaryID
Definition: MooseTypes.h:75
NearestNodeLocator & _nearest_node