https://mooseframework.inl.gov
PenetrationThread.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 "PenetrationLocator.h"
15 
16 #include "libmesh/elem_side_builder.h"
17 
18 // Forward declarations
19 template <typename>
23 
25 {
26 public:
28  SubProblem & subproblem,
29  const MooseMesh & mesh,
30  BoundaryID primary_boundary,
31  BoundaryID secondary_boundary,
32  std::map<dof_id_type, PenetrationInfo *> & penetration_info,
33  bool check_whether_reasonable,
34  bool update_location,
35  Real tangential_tolerance,
36  bool do_normal_smoothing,
37  Real normal_smoothing_distance,
38  PenetrationLocator::NORMAL_SMOOTHING_METHOD normal_smoothing_method,
39  std::vector<std::vector<libMesh::FEBase *>> & fes,
40  libMesh::FEType & fe_type,
41  NearestNodeLocator & nearest_node,
42  const std::map<dof_id_type, std::vector<dof_id_type>> & node_to_elem_map,
43  const std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> & bc_tuples);
44 
45  // Splitting Constructor
47 
48  void operator()(const NodeIdRange & range);
49 
50  void join(const PenetrationThread & other);
51 
53  std::vector<dof_id_type> _recheck_secondary_nodes;
54 
55 protected:
57  // The Mesh
58  const MooseMesh & _mesh;
61 
62  // This is the info map we're actually filling here
63  std::map<dof_id_type, PenetrationInfo *> & _penetration_info;
64 
74 
75  std::vector<std::vector<libMesh::FEBase *>> & _fes;
76 
78 
80 
81  const std::map<dof_id_type, std::vector<dof_id_type>> & _node_to_elem_map;
82 
83  // Each boundary condition tuple has three entries, (0=elem-id, 1=side-id, 2=bc-id)
84  const std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> & _bc_tuples;
85 
87 
90 
92  {
96  };
97 
99  {
104  };
105 
114 
123  PenetrationInfo * pi2);
124 
126 
127  bool findRidgeContactPoint(libMesh::Point & contact_point,
128  Real & tangential_distance,
129  const Node *& closest_node,
130  unsigned int & index,
131  libMesh::Point & contact_point_ref,
132  std::vector<PenetrationInfo *> & p_info,
133  const unsigned int index1,
134  const unsigned int index2);
135 
136  void getSideCornerNodes(const Elem * side, std::vector<const Node *> & corner_nodes);
137 
139  const Node *& closest_node,
140  const Elem * side,
141  const std::vector<const Node *> & edge_nodes);
142  bool restrictPointToFace(libMesh::Point & p, const Node *& closest_node, const Elem * side);
143 
144  bool isFaceReasonableCandidate(const Elem * primary_elem,
145  const Elem * side,
146  libMesh::FEBase * fe,
147  const libMesh::Point * secondary_point,
148  const Real tangential_tolerance);
149 
150  void
151  smoothNormal(PenetrationInfo * info, std::vector<PenetrationInfo *> & p_info, const Node & node);
152 
154  std::vector<PenetrationInfo *> & edge_face_info,
155  std::vector<Real> & edge_face_weights,
156  std::vector<PenetrationInfo *> & p_info,
157  const Node & secondary_node);
159  const Elem * side,
160  std::vector<std::vector<const Node *>> & edge_nodes,
161  std::vector<Real> & edge_face_weights);
162 
163  void getInfoForFacesWithCommonNodes(const Node * secondary_node,
164  const std::set<dof_id_type> & elems_to_exclude,
165  const std::vector<const Node *> edge_nodes,
166  std::vector<PenetrationInfo *> & face_info_comm_edge,
167  std::vector<PenetrationInfo *> & p_info);
168 
169  void getInfoForElem(std::vector<PenetrationInfo *> & thisElemInfo,
170  std::vector<PenetrationInfo *> & p_info,
171  const Elem * elem);
172 
173  void createInfoForElem(std::vector<PenetrationInfo *> & thisElemInfo,
174  std::vector<PenetrationInfo *> & p_info,
175  const Node * secondary_node,
176  const Elem * elem,
177  const std::vector<const Node *> & nodes_that_must_be_on_side,
178  const bool check_whether_reasonable = false);
179 
180  void getSidesOnPrimaryBoundary(std::vector<unsigned int> & sides, const Elem * const elem);
181 
183 
184  void switchInfo(PenetrationInfo *& info, PenetrationInfo *& infoNew);
185 
186  struct RidgeData
187  {
188  unsigned int _index;
192  const Node * _closest_node;
193  };
194 
196  {
199  const Node * _closest_node;
200  std::vector<RidgeData> _ridge_data_vec;
201  };
202 };
void getSidesOnPrimaryBoundary(std::vector< unsigned int > &sides, const Elem *const elem)
MooseVariable * _nodal_normal_z
void getSmoothingEdgeNodesAndWeights(const libMesh::Point &p, const Elem *side, std::vector< std::vector< const Node *>> &edge_nodes, std::vector< Real > &edge_face_weights)
Class for stuff related to variables.
Definition: Adaptivity.h:31
MooseVariableFE< libMesh::VectorValue< Real > > VectorMooseVariable
MPI_Info info
bool findRidgeContactPoint(libMesh::Point &contact_point, Real &tangential_distance, const Node *&closest_node, unsigned int &index, libMesh::Point &contact_point_ref, std::vector< PenetrationInfo *> &p_info, const unsigned int index1, const unsigned int index2)
Data structure used to hold penetration information.
NearestNodeLocator & _nearest_node
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
const std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > & _bc_tuples
MeshBase & mesh
void createInfoForElem(std::vector< PenetrationInfo *> &thisElemInfo, std::vector< PenetrationInfo *> &p_info, const Node *secondary_node, const Elem *elem, const std::vector< const Node *> &nodes_that_must_be_on_side, const bool check_whether_reasonable=false)
void getSideCornerNodes(const Elem *side, std::vector< const Node *> &corner_nodes)
void smoothNormal(PenetrationInfo *info, std::vector< PenetrationInfo *> &p_info, const Node &node)
libMesh::FEType & _fe_type
void getInfoForFacesWithCommonNodes(const Node *secondary_node, const std::set< dof_id_type > &elems_to_exclude, const std::vector< const Node *> edge_nodes, std::vector< PenetrationInfo *> &face_info_comm_edge, std::vector< PenetrationInfo *> &p_info)
void getSmoothingFacesAndWeights(PenetrationInfo *info, std::vector< PenetrationInfo *> &edge_face_info, std::vector< Real > &edge_face_weights, std::vector< PenetrationInfo *> &p_info, const Node &secondary_node)
BoundaryID _primary_boundary
SubProblem & _subproblem
const MooseMesh & _mesh
char ** sides
boundary_id_type BoundaryID
BoundaryID _secondary_boundary
CompeteInteractionResult competeInteractions(PenetrationInfo *pi1, PenetrationInfo *pi2)
When interactions are identified between a node and two faces, compete between the faces to determine...
void operator()(const NodeIdRange &range)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
void computeSlip(libMesh::FEBase &fe, PenetrationInfo &info)
std::vector< dof_id_type > _recheck_secondary_nodes
List of secondary nodes for which penetration was not detected in the current patch and for which pat...
bool restrictPointToSpecifiedEdgeOfFace(libMesh::Point &p, const Node *&closest_node, const Elem *side, const std::vector< const Node *> &edge_nodes)
void join(const PenetrationThread &other)
tbb::split split
bool restrictPointToFace(libMesh::Point &p, const Node *&closest_node, const Elem *side)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
PenetrationThread(SubProblem &subproblem, const MooseMesh &mesh, BoundaryID primary_boundary, BoundaryID secondary_boundary, std::map< dof_id_type, PenetrationInfo *> &penetration_info, bool check_whether_reasonable, bool update_location, Real tangential_tolerance, bool do_normal_smoothing, Real normal_smoothing_distance, PenetrationLocator::NORMAL_SMOOTHING_METHOD normal_smoothing_method, std::vector< std::vector< libMesh::FEBase *>> &fes, libMesh::FEType &fe_type, NearestNodeLocator &nearest_node, const std::map< dof_id_type, std::vector< dof_id_type >> &node_to_elem_map, const std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type >> &bc_tuples)
MooseVariable * _nodal_normal_y
libMesh::ElemSideBuilder _elem_side_builder
Helper for building element sides without extraneous allocation.
void getInfoForElem(std::vector< PenetrationInfo *> &thisElemInfo, std::vector< PenetrationInfo *> &p_info, const Elem *elem)
const std::map< dof_id_type, std::vector< dof_id_type > > & _node_to_elem_map
void switchInfo(PenetrationInfo *&info, PenetrationInfo *&infoNew)
MooseVariable * _nodal_normal_x
std::vector< std::vector< libMesh::FEBase * > > & _fes
CompeteInteractionResult competeInteractionsBothOnFace(PenetrationInfo *pi1, PenetrationInfo *pi2)
Determine whether first (pi1) or second (pi2) interaction is stronger when it is known that the node ...
CommonEdgeResult interactionsOffCommonEdge(PenetrationInfo *pi1, PenetrationInfo *pi2)
bool isFaceReasonableCandidate(const Elem *primary_elem, const Elem *side, libMesh::FEBase *fe, const libMesh::Point *secondary_point, const Real tangential_tolerance)
PenetrationLocator::NORMAL_SMOOTHING_METHOD _normal_smoothing_method
unsigned int THREAD_ID
Definition: MooseTypes.h:209
uint8_t dof_id_type
std::vector< RidgeData > _ridge_data_vec
MooseVariableFE< Real > MooseVariable