27 const unsigned int primary_id,
28 const unsigned int 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 _patch_update_strategy(_mesh.getPatchUpdateStrategy())
62 _fe[i].resize(n_dims + 1);
63 for (
unsigned int dim = 0;
dim <= n_dims; ++
dim)
69 _fe[i][
dim]->get_dxyzdxi();
70 _fe[i][
dim]->get_d2xyzdxi2();
71 _fe[i][
dim]->get_d2xyzdxideta();
72 _fe[i][
dim]->get_dxyzdeta();
73 _fe[i][
dim]->get_d2xyzdeta2();
74 _fe[i][
dim]->get_d2xyzdxideta();
85 "To use nodal-normal-based smoothing, the nodal_normal_x, nodal_normal_y, and " 86 "nodal_normal_z variables must exist. Are you missing the \\[NodalNormals\\] block?");
104 TIME_SECTION(
"detectPenetration", 3,
"Detecting Penetration");
107 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> bc_tuples =
130 Threads::parallel_reduce(secondary_node_range, pt);
132 std::vector<dof_id_type> recheck_secondary_nodes = pt._recheck_secondary_nodes;
145 recheck_secondary_nodes.begin(), recheck_secondary_nodes.end(), 1);
147 Threads::parallel_reduce(recheck_secondary_node_range, pt);
152 mooseDoOnce(
mooseWarning(
"Warning in PenetrationLocator. Penetration is not " 153 "detected for one or more secondary nodes. This could be because " 154 "those secondary nodes simply do not project to faces on the primary " 155 "surface. However, this could also be because contact should be " 156 "enforced on those nodes, but the faces that they project to " 157 "are outside the contact patch, which will give an erroneous " 158 "result. Use appropriate options for 'patch_size' and " 159 "'patch_update_strategy' in the Mesh block to avoid this issue. " 160 "Setting 'patch_update_strategy=iteration' is recommended because " 161 "it completely avoids this potential issue. Also note that this " 162 "warning is printed only once, so a similar situation could occur " 163 "multiple times during the simulation but this warning is printed " 164 "only at the first occurrence."));
170 TIME_SECTION(
"reinit", 3,
"Reinitializing PenetrationLocator");
190 return info->_distance;
198 std::map<dof_id_type, PenetrationInfo *>::const_iterator found_it =
202 return found_it->second->_normal;
236 if (nsmString ==
"edge_based")
238 else if (nsmString ==
"nodal_normal_based")
241 mooseError(
"Invalid normal_smoothing_method: ", nsmString);
const Moose::PatchUpdateType _patch_update_strategy
bool _do_normal_smoothing
std::unique_ptr< FEGenericBase< Real > > build(const unsigned int dim, const FEType &fet)
A class for creating restricted objects.
BoundaryID _secondary_boundary
RealVectorValue penetrationNormal(dof_id_type node_id)
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > buildActiveSideList() const
Calls BoundaryInfo::build_active_side_list.
void setNormalSmoothingDistance(Real normal_smoothing_distance)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Data structure used to hold penetration information.
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
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 ...
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Real _tangential_tolerance
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
void setTangentialTolerance(Real tangential_tolerance)
Real _normal_smoothing_distance
NodeIdRange & secondaryNodeRange()
Returns the NodeIdRange of secondary nodes to be used for calling threaded functions operating on the...
bool _check_whether_reasonable
Check whether found candidates are reasonable.
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
std::string stringify(const T &t)
conversion to string
virtual bool hasVariable(const std::string &var_name) const =0
Whether or not this problem has the variable.
Interface for objects interacting with the PerfGraph.
void setUpdate(bool update)
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.
Real penetrationDistance(dof_id_type node_id)
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
void setNormalSmoothingMethod(std::string nsmString)
const bool & currentlyComputingJacobian() const
Returns true if the problem is in the process of computing the Jacobian.
void reinit()
Completely redo the search from scratch.
std::set< dof_id_type > & _has_penetrated
void setCheckWhetherReasonable(bool state)
BoundaryID _primary_boundary
NORMAL_SMOOTHING_METHOD _normal_smoothing_method
NearestNodeLocator & _nearest_node
const std::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...
std::vector< std::vector< libMesh::FEBase * > > _fe