27 const unsigned int primary_id,
28 const unsigned int secondary_id,
32 Moose::stringify(primary_id) +
"to" +
Moose::stringify(secondary_id),
36 "PenetrationLocator_" +
Moose::stringify(primary_id) +
"_" +
37 Moose::stringify(secondary_id)),
38 _subproblem(subproblem),
40 _primary_boundary(primary_id),
41 _secondary_boundary(secondary_id),
43 _nearest_node(nearest_node),
45 "penetration_info", &_mesh)),
46 _has_penetrated(declareRestartableData<
std::set<
dof_id_type>>(
"has_penetrated")),
47 _check_whether_reasonable(true),
48 _update_location(declareRestartableData<bool>(
"update_location", true)),
49 _tangential_tolerance(0.0),
50 _do_normal_smoothing(false),
51 _normal_smoothing_distance(0.0),
52 _normal_smoothing_method(NSM_EDGE_BASED),
53 _use_point_locator(false),
54 _patch_update_strategy(_mesh.getPatchUpdateStrategy())
63 _fe[i].resize(n_dims + 1);
64 for (
unsigned int dim = 0;
dim <= n_dims; ++
dim)
70 _fe[i][
dim]->get_dxyzdxi();
71 _fe[i][
dim]->get_d2xyzdxi2();
72 _fe[i][
dim]->get_d2xyzdxideta();
73 _fe[i][
dim]->get_dxyzdeta();
74 _fe[i][
dim]->get_d2xyzdeta2();
75 _fe[i][
dim]->get_d2xyzdxideta();
86 "To use nodal-normal-based smoothing, the nodal_normal_x, nodal_normal_y, and "
87 "nodal_normal_z variables must exist. Are you missing the \\[NodalNormals\\] block?");
105 TIME_SECTION(
"detectPenetration", 3,
"Detecting Penetration");
146 recheck_secondary_nodes.begin(), recheck_secondary_nodes.end(), 1);
153 mooseDoOnce(
mooseWarning(
"Warning in PenetrationLocator. Penetration is not "
154 "detected for one or more secondary nodes. This could be because "
155 "those secondary nodes simply do not project to faces on the primary "
156 "surface. However, this could also be because contact should be "
157 "enforced on those nodes, but the faces that they project to "
158 "are outside the contact patch, which will give an erroneous "
159 "result. Use appropriate options for 'patch_size' and "
160 "'patch_update_strategy' in the Mesh block to avoid this issue. "
161 "Setting 'patch_update_strategy=iteration' is recommended because "
162 "it completely avoids this potential issue. Also note that this "
163 "warning is printed only once, so a similar situation could occur "
164 "multiple times during the simulation but this warning is printed "
165 "only at the first occurrence."));
171 TIME_SECTION(
"reinit", 3,
"Reinitializing PenetrationLocator");
191 return info->_distance;
199 std::map<dof_id_type, PenetrationInfo *>::const_iterator found_it =
203 return found_it->second->_normal;
243 if (nsmString ==
"edge_based")
245 else if (nsmString ==
"nodal_normal_based")
248 mooseError(
"Invalid normal_smoothing_method: ", nsmString);
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
const std::unordered_map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected.
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default),...
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around.
NodeIdRange & secondaryNodeRange()
Returns the NodeIdRange of secondary nodes to be used for calling threaded functions operating on the...
void updatePatch(std::vector< dof_id_type > &secondary_nodes)
Reconstructs the KDtree, updates the patch for the nodes in secondary_nodes, and updates the closest ...
Data structure used to hold penetration information.
NORMAL_SMOOTHING_METHOD _normal_smoothing_method
bool _check_whether_reasonable
Check whether found candidates are reasonable.
void setNormalSmoothingMethod(std::string nsmString)
BoundaryID _secondary_boundary
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)
PenetrationLocator(SubProblem &subproblem, GeometricSearchData &geom_search_data, MooseMesh &mesh, const unsigned int primary_id, const unsigned int secondary_id, Order order, NearestNodeLocator &nearest_node)
void setCheckWhetherReasonable(bool state)
void setNormalSmoothingDistance(Real normal_smoothing_distance)
bool _do_normal_smoothing
std::vector< std::vector< libMesh::FEBase * > > _fe
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
Real _normal_smoothing_distance
std::set< dof_id_type > & _has_penetrated
Real penetrationDistance(dof_id_type node_id)
BoundaryID _primary_boundary
const Moose::PatchUpdateType _patch_update_strategy
Real _tangential_tolerance
NearestNodeLocator & _nearest_node
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...
Interface for objects interacting with the PerfGraph.
A class for creating restricted objects.
Generic class for solving transient nonlinear problems.
const bool & currentlyComputingJacobian() const
Returns true if the problem is in the process of computing the Jacobian.
virtual bool hasVariable(const std::string &var_name) const =0
Whether or not this problem has the variable.
std::unique_ptr< FEGenericBase< Real > > build(const unsigned int dim, const FEType &fet)
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
void parallel_reduce(const Range &range, Body &body, unsigned int n_threads=libMesh::n_threads())
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
VectorValue< Real > RealVectorValue
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real