https://mooseframework.inl.gov
PenetrationLocator.h
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 #pragma once
11 
12 // Moose includes
13 #include "MooseTypes.h"
14 #include "Restartable.h"
15 #include "PenetrationInfo.h"
16 #include "PerfGraphInterface.h"
17 
18 #include "libmesh/vector_value.h"
19 #include "libmesh/point.h"
20 #include "libmesh/fe_base.h"
21 
22 // Forward Declarations
23 class SubProblem;
24 class MooseMesh;
26 class NearestNodeLocator;
27 
29 {
30 public:
31  PenetrationLocator(SubProblem & subproblem,
32  GeometricSearchData & geom_search_data,
33  MooseMesh & mesh,
34  const unsigned int primary_id,
35  const unsigned int secondary_id,
36  Order order,
37  NearestNodeLocator & nearest_node);
39  void detectPenetration();
40 
45  void reinit();
46 
49 
51  {
54  };
55 
57 
58  Real normDistance(const Elem & elem,
59  const Elem & side,
60  const Node & p0,
61  Point & closest_point,
62  RealVectorValue & normal);
63 
64  int intersect2D_Segments(Point S1P0, Point S1P1, Point S2P0, Point S2P1, Point * I0, Point * I1);
65  int inSegment(Point P, Point SP0, Point SP1);
66 
70 
72 
73  // One FE for each thread and for each dimension
74  std::vector<std::vector<libMesh::FEBase *>> _fe;
75 
77 
79  std::map<dof_id_type, PenetrationInfo *> & _penetration_info;
80 
81  std::set<dof_id_type> &
82  _has_penetrated; // This is only hanging around for legacy code. Don't use it!
83 
84  void setCheckWhetherReasonable(bool state);
85  void setUpdate(bool update);
86  void setTangentialTolerance(Real tangential_tolerance);
87  void setNormalSmoothingDistance(Real normal_smoothing_distance);
88  void setNormalSmoothingMethod(std::string nsmString);
90 
91 protected:
94  bool & _update_location; // Update the penetration location for nodes found last time
95  Real _tangential_tolerance; // Tangential distance a node can be from a face and still be in
96  // contact
97  bool _do_normal_smoothing; // Should we do contact normal smoothing?
98  Real _normal_smoothing_distance; // Distance from edge (in parametric coords) within which to
99  // perform normal smoothing
101 
102  const Moose::PatchUpdateType _patch_update_strategy; // Contact patch update strategy
103 };
104 
109 template <>
110 inline void
111 dataLoad(std::istream & stream, std::map<dof_id_type, PenetrationInfo *> & m, void * context)
112 {
113  std::map<dof_id_type, PenetrationInfo *>::iterator it = m.begin();
114  std::map<dof_id_type, PenetrationInfo *>::iterator end = m.end();
115 
116  for (; it != end; ++it)
117  delete it->second;
118 
119  m.clear();
120 
121  // First read the size of the map
122  unsigned int size = 0;
123  stream.read((char *)&size, sizeof(size));
124 
125  for (unsigned int i = 0; i < size; i++)
126  {
127  dof_id_type key;
128  loadHelper(stream, key, context);
129  loadHelper(stream, m[key], context);
130  }
131 }
const Moose::PatchUpdateType _patch_update_strategy
Order
A class for creating restricted objects.
Definition: Restartable.h:28
BoundaryID _secondary_boundary
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...
libMesh::FEType _fe_type
Real normDistance(const Elem &elem, const Elem &side, const Node &p0, Point &closest_point, RealVectorValue &normal)
MeshBase & mesh
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
void setTangentialTolerance(Real tangential_tolerance)
bool _check_whether_reasonable
Check whether found candidates are reasonable.
boundary_id_type BoundaryID
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:88
Interface for objects interacting with the PerfGraph.
SubProblem & _subproblem
void setUpdate(bool update)
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...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
PenetrationLocator(SubProblem &subproblem, GeometricSearchData &geom_search_data, MooseMesh &mesh, const unsigned int primary_id, const unsigned int secondary_id, Order order, NearestNodeLocator &nearest_node)
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
PatchUpdateType
Type of patch update strategy for modeling node-face constraints or contact.
Definition: MooseTypes.h:952
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:985
std::set< dof_id_type > & _has_penetrated
void setCheckWhetherReasonable(bool state)
BoundaryID _primary_boundary
NORMAL_SMOOTHING_METHOD _normal_smoothing_method
int intersect2D_Segments(Point S1P0, Point S1P1, Point S2P0, Point S2P1, Point *I0, Point *I1)
uint8_t dof_id_type
NearestNodeLocator & _nearest_node
std::vector< std::vector< libMesh::FEBase * > > _fe