https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
23class SubProblem;
24class MooseMesh;
27
29{
30public:
31 PenetrationLocator(SubProblem & subproblem,
32 GeometricSearchData & geom_search_data,
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
47 Real penetrationDistance(dof_id_type node_id);
48 RealVectorValue penetrationNormal(dof_id_type node_id);
49
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 void setUsePointLocator(bool state);
65
66 int intersect2D_Segments(Point S1P0, Point S1P1, Point S2P0, Point S2P1, Point * I0, Point * I1);
67 int inSegment(Point P, Point SP0, Point SP1);
68
72
74
75 // One FE for each thread and for each dimension
76 std::vector<std::vector<libMesh::FEBase *>> _fe;
77
79
81 std::map<dof_id_type, PenetrationInfo *> & _penetration_info;
82
83 std::set<dof_id_type> &
84 _has_penetrated; // This is only hanging around for legacy code. Don't use it!
85
86 void setCheckWhetherReasonable(bool state);
87 void setUpdate(bool update);
88 void setTangentialTolerance(Real tangential_tolerance);
89 void setNormalSmoothingDistance(Real normal_smoothing_distance);
90 void setNormalSmoothingMethod(std::string nsmString);
92
93protected:
96 bool & _update_location; // Update the penetration location for nodes found last time
97 Real _tangential_tolerance; // Tangential distance a node can be from a face and still be in
98 // contact
99 bool _do_normal_smoothing; // Should we do contact normal smoothing?
100 Real _normal_smoothing_distance; // Distance from edge (in parametric coords) within which to
101 // perform normal smoothing
103 bool _use_point_locator; // Use a PointLocator rather than relying on mesh connectivity to
104 // find element patches
105
106 const Moose::PatchUpdateType _patch_update_strategy; // Contact patch update strategy
107};
108
113template <>
114inline void
115dataLoad(std::istream & stream, std::map<dof_id_type, PenetrationInfo *> & m, void * context)
116{
117 std::map<dof_id_type, PenetrationInfo *>::iterator it = m.begin();
118 std::map<dof_id_type, PenetrationInfo *>::iterator end = m.end();
119
120 for (; it != end; ++it)
121 delete it->second;
122
123 m.clear();
124
125 // First read the size of the map
126 unsigned int size = 0;
127 stream.read((char *)&size, sizeof(size));
128
129 for (unsigned int i = 0; i < size; i++)
130 {
131 dof_id_type key;
132 loadHelper(stream, key, context);
133 loadHelper(stream, m[key], context);
134 }
135}
boundary_id_type BoundaryID
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition DataIO.h:1081
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...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around.
NORMAL_SMOOTHING_METHOD _normal_smoothing_method
int inSegment(Point P, Point SP0, Point SP1)
bool _check_whether_reasonable
Check whether found candidates are reasonable.
void setNormalSmoothingMethod(std::string nsmString)
RealVectorValue penetrationNormal(dof_id_type node_id)
void setUsePointLocator(bool state)
void setUpdate(bool update)
void reinit()
Completely redo the search from scratch.
void setTangentialTolerance(Real tangential_tolerance)
Real normDistance(const Elem &elem, const Elem &side, const Node &p0, Point &closest_point, RealVectorValue &normal)
libMesh::FEType _fe_type
int intersect2D_Segments(Point S1P0, Point S1P1, Point S2P0, Point S2P1, Point *I0, Point *I1)
void setCheckWhetherReasonable(bool state)
void setNormalSmoothingDistance(Real normal_smoothing_distance)
std::vector< std::vector< libMesh::FEBase * > > _fe
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
std::set< dof_id_type > & _has_penetrated
Real penetrationDistance(dof_id_type node_id)
const Moose::PatchUpdateType _patch_update_strategy
NearestNodeLocator & _nearest_node
Interface for objects interacting with the PerfGraph.
A class for creating restricted objects.
Definition Restartable.h:29
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
MeshBase & mesh
PatchUpdateType
Type of patch update strategy for modeling node-face constraints or contact.