20 #include "libmesh/threads.h" 34 std::map<dof_id_type, PenetrationInfo *> & penetration_info,
35 bool check_whether_reasonable,
37 Real tangential_tolerance,
38 bool do_normal_smoothing,
39 Real normal_smoothing_distance,
41 std::vector<std::vector<FEBase *>> & fes,
44 const std::map<
dof_id_type, std::vector<dof_id_type>> & node_to_elem_map,
45 const std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> & bc_tuples)
46 : _subproblem(subproblem),
48 _primary_boundary(primary_boundary),
49 _secondary_boundary(secondary_boundary),
50 _penetration_info(penetration_info),
51 _check_whether_reasonable(check_whether_reasonable),
52 _update_location(update_location),
53 _tangential_tolerance(tangential_tolerance),
54 _do_normal_smoothing(do_normal_smoothing),
55 _normal_smoothing_distance(normal_smoothing_distance),
56 _normal_smoothing_method(normal_smoothing_method),
57 _nodal_normal_x(NULL),
58 _nodal_normal_y(NULL),
59 _nodal_normal_z(NULL),
62 _nearest_node(nearest_node),
63 _node_to_elem_map(node_to_elem_map),
70 : _subproblem(x._subproblem),
72 _primary_boundary(x._primary_boundary),
73 _secondary_boundary(x._secondary_boundary),
74 _penetration_info(x._penetration_info),
75 _check_whether_reasonable(x._check_whether_reasonable),
76 _update_location(x._update_location),
77 _tangential_tolerance(x._tangential_tolerance),
78 _do_normal_smoothing(x._do_normal_smoothing),
79 _normal_smoothing_distance(x._normal_smoothing_distance),
80 _normal_smoothing_method(x._normal_smoothing_method),
83 _nearest_node(x._nearest_node),
84 _node_to_elem_map(x._node_to_elem_map),
85 _bc_tuples(x._bc_tuples)
104 for (
const auto & node_id : range)
115 std::vector<PenetrationInfo *> p_info;
116 bool info_set(
false);
126 const Point contact_ref =
info->_closest_point_ref;
127 bool contact_point_on_side(
false);
131 std::vector<Point> points(1);
132 points[0] = contact_ref;
133 const std::vector<Point> & secondary_pos = fe_side->
get_xyz();
134 bool search_succeeded =
false;
143 contact_point_on_side,
147 info->_closest_point_ref = contact_ref;
150 info->_distance = 0.0;
155 Real old_tangential_distance(
info->_tangential_distance);
156 bool contact_point_on_side(
false);
157 bool search_succeeded =
false;
166 contact_point_on_side,
169 if (contact_point_on_side)
171 if (
info->_tangential_distance <= 0.0)
175 else if (
info->_tangential_distance > 0.0 && old_tangential_distance > 0.0)
177 if (
info->_side->dim() == 2 &&
info->_off_edge_nodes.size() < 2)
195 "Missing entry in node to elem map");
196 const std::vector<dof_id_type> & closest_elems = node_to_elem_pair->second;
198 for (
const auto & elem_id : closest_elems)
202 std::vector<PenetrationInfo *> thisElemInfo;
203 std::vector<const Node *> nodesThatMustBeOnSide;
204 nodesThatMustBeOnSide.push_back(closest_node);
209 if (p_info.size() == 1)
217 else if (p_info.size() > 1)
221 std::vector<RidgeData> ridgeDataVec;
222 for (
unsigned int i = 0; i + 1 < p_info.size(); ++i)
223 for (
unsigned int j = i + 1; j < p_info.size(); ++j)
226 Real tangential_distance(0.0);
227 const Node * closest_node_on_ridge = NULL;
228 unsigned int index = 0;
229 Point closest_coor_ref;
232 closest_node_on_ridge,
238 if (found_ridge_contact_point)
246 ridgeDataVec.push_back(rpd);
250 if (ridgeDataVec.size() > 0)
254 std::vector<RidgeSetData> ridgeSetDataVec;
255 for (
unsigned int i = 0; i < ridgeDataVec.size(); ++i)
257 bool foundSetWithMatchingNode =
false;
258 for (
unsigned int j = 0; j < ridgeSetDataVec.size(); ++j)
260 if (ridgeDataVec[i]._closest_node != NULL &&
261 ridgeDataVec[i]._closest_node == ridgeSetDataVec[j]._closest_node)
263 foundSetWithMatchingNode =
true;
264 ridgeSetDataVec[j]._ridge_data_vec.push_back(ridgeDataVec[i]);
268 if (!foundSetWithMatchingNode)
274 ridgeSetDataVec.push_back(rsd);
278 for (
unsigned int i = 0; i < ridgeSetDataVec.size(); ++i)
280 if (ridgeSetDataVec[i]._closest_node !=
283 if (ridgeSetDataVec[i]._ridge_data_vec.size() == 1)
285 if (ridgeSetDataVec[i]._ridge_data_vec[0]._tangential_distance <=
288 ridgeSetDataVec[i]._closest_coor =
289 ridgeSetDataVec[i]._ridge_data_vec[0]._closest_coor;
290 Point contact_point_vec = node - ridgeSetDataVec[i]._closest_coor;
291 ridgeSetDataVec[i]._distance = contact_point_vec.
norm();
297 ridgeSetDataVec[i]._closest_coor = *ridgeSetDataVec[i]._closest_node;
298 Point contact_point_vec = node - ridgeSetDataVec[i]._closest_coor;
299 ridgeSetDataVec[i]._distance = contact_point_vec.
norm();
304 ridgeSetDataVec[i]._closest_coor =
305 ridgeSetDataVec[i]._ridge_data_vec[0]._closest_coor;
306 Point contact_point_vec = node - ridgeSetDataVec[i]._closest_coor;
307 ridgeSetDataVec[i]._distance = contact_point_vec.
norm();
311 unsigned int closest_ridge_set_index(0);
312 Real closest_distance(ridgeSetDataVec[0]._distance);
313 Point closest_point(ridgeSetDataVec[0]._closest_coor);
314 for (
unsigned int i = 1; i < ridgeSetDataVec.size(); ++i)
316 if (ridgeSetDataVec[i]._distance < closest_distance)
318 closest_ridge_set_index = i;
319 closest_distance = ridgeSetDataVec[i]._distance;
320 closest_point = ridgeSetDataVec[i]._closest_coor;
324 if (closest_distance <
330 for (
unsigned int i = 0;
331 i < ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec.size();
334 if (ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec[i]._index < face_index)
335 face_index = ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec[i]._index;
339 "face_index invalid");
341 p_info[face_index]->_closest_point = closest_point;
342 p_info[face_index]->_distance =
343 (p_info[face_index]->_distance >= 0.0 ? 1.0 : -1.0) * closest_distance;
349 Point normal(closest_point - node);
355 const Real dot(normal * p_info[face_index]->_normal);
360 p_info[face_index]->_normal = normal;
362 p_info[face_index]->_tangential_distance = 0.0;
364 Point closest_point_ref;
365 if (ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec.size() ==
368 p_info[face_index]->_tangential_distance =
369 ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec[0]._tangential_distance;
370 p_info[face_index]->_closest_point_ref =
371 ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec[0]._closest_coor_ref;
375 const Node * closest_node_on_face;
377 closest_node_on_face,
378 p_info[face_index]->_side);
381 if (closest_node_on_face != ridgeSetDataVec[closest_ridge_set_index]._closest_node)
383 mooseError(
"Closest node when restricting point to face != closest node from " 390 std::vector<Point> points(1);
391 points[0] = p_info[face_index]->_closest_point_ref;
392 fe->
reinit(p_info[face_index]->_side, &points);
393 p_info[face_index]->_side_phi = fe->
get_phi();
394 p_info[face_index]->_side_grad_phi = fe->
get_dphi();
409 unsigned int best(0), i(1);
427 }
while (i < p_info.size() && best < p_info.size());
428 if (best < p_info.size())
460 for (
unsigned int j = 0; j < p_info.size(); ++j)
482 mooseAssert(infoNew != NULL,
"infoNew object is null");
609 const std::vector<const Node *> & off_edge_nodes1 = pi1->
_off_edge_nodes;
610 const std::vector<const Node *> & off_edge_nodes2 = pi2->
_off_edge_nodes;
611 const unsigned dim1 = pi1->
_side->
dim();
615 mooseAssert(pi2->
_side->
dim() == 1,
"Incompatible dimensions.");
616 mooseAssert(off_edge_nodes1.size() < 2 && off_edge_nodes2.size() < 2,
617 "off_edge_nodes size should be <2 for 2D contact");
618 if (off_edge_nodes1.size() == 1 && off_edge_nodes2.size() == 1 &&
619 off_edge_nodes1[0] == off_edge_nodes2[0])
624 mooseAssert(dim1 == 2 && pi2->
_side->
dim() == 2,
"Incompatible dimensions.");
625 mooseAssert(off_edge_nodes1.size() < 3 && off_edge_nodes2.size() < 3,
626 "off_edge_nodes size should be <3 for 3D contact");
627 if (off_edge_nodes1.size() == 1)
629 if (off_edge_nodes2.size() == 1)
631 if (off_edge_nodes1[0] == off_edge_nodes2[0])
634 else if (off_edge_nodes2.size() == 2)
636 if (off_edge_nodes1[0] == off_edge_nodes2[0] || off_edge_nodes1[0] == off_edge_nodes2[1])
640 else if (off_edge_nodes1.size() == 2)
642 if (off_edge_nodes2.size() == 1)
644 if (off_edge_nodes1[0] == off_edge_nodes2[0] || off_edge_nodes1[1] == off_edge_nodes2[0])
647 else if (off_edge_nodes2.size() == 2)
649 if ((off_edge_nodes1[0] == off_edge_nodes2[0] &&
650 off_edge_nodes1[1] == off_edge_nodes2[1]) ||
651 (off_edge_nodes1[1] == off_edge_nodes2[0] && off_edge_nodes1[0] == off_edge_nodes2[1]))
661 Real & tangential_distance,
662 const Node *& closest_node,
663 unsigned int & index,
664 Point & contact_point_ref,
665 std::vector<PenetrationInfo *> & p_info,
666 const unsigned int index1,
667 const unsigned int index2)
669 tangential_distance = 0.0;
673 const unsigned sidedim(pi1->
_side->
dim());
674 mooseAssert(sidedim == pi2->
_side->
dim(),
"Incompatible dimensionalities");
677 std::vector<const Node *> side1_nodes;
679 std::vector<const Node *> side2_nodes;
682 std::sort(side1_nodes.begin(), side1_nodes.end());
683 std::sort(side2_nodes.begin(), side2_nodes.end());
686 std::vector<const Node *> common_nodes;
687 std::set_intersection(side1_nodes.begin(),
691 std::inserter(common_nodes, common_nodes.end()));
693 if (common_nodes.size() != sidedim)
696 bool found_point1, found_point2;
698 const Node * closest_node1;
700 closest_coor_ref1, closest_node1, pi1->
_side, common_nodes);
703 const Node * closest_node2;
705 closest_coor_ref2, closest_node2, pi2->
_side, common_nodes);
707 if (!found_point1 || !found_point2)
720 std::vector<Point> points(1);
727 contact_point_ref = closest_coor_ref1;
728 points[0] = closest_coor_ref1;
735 contact_point_ref = closest_coor_ref2;
736 points[0] = closest_coor_ref2;
741 contact_point = fe->
get_xyz()[0];
747 mooseAssert((closest_node1 == closest_node2 || closest_node2 == NULL),
748 "If off edge of ridge, closest node must be the same on both elements");
749 closest_node = closest_node1;
752 tangential_distance = off_face.
norm();
763 corner_nodes.clear();
765 corner_nodes.push_back(side->
node_ptr(0));
766 corner_nodes.push_back(side->
node_ptr(1));
780 corner_nodes.push_back(side->
node_ptr(2));
788 corner_nodes.push_back(side->
node_ptr(2));
789 corner_nodes.push_back(side->
node_ptr(3));
803 const Node *& closest_node,
805 const std::vector<const Node *> & edge_nodes)
812 std::vector<unsigned int> local_node_indices;
813 for (
const auto & edge_node : edge_nodes)
818 local_node_indices.push_back(local_index);
820 mooseAssert(local_node_indices.size() == side->
dim(),
821 "Number of edge nodes must match side dimensionality");
822 std::sort(local_node_indices.begin(), local_node_indices.end());
824 bool off_of_this_edge =
false;
832 if (local_node_indices[0] == 0)
837 off_of_this_edge =
true;
841 else if (local_node_indices[0] == 1)
846 off_of_this_edge =
true;
861 if ((local_node_indices[0] == 0) && (local_node_indices[1] == 1))
866 off_of_this_edge =
true;
873 else if ((local_node_indices[0] == 1) && (local_node_indices[1] == 2))
875 if ((xi + eta) > 1.0)
877 Real delta = (xi + eta - 1.0) / 2.0;
880 off_of_this_edge =
true;
887 else if ((local_node_indices[0] == 0) && (local_node_indices[1] == 2))
892 off_of_this_edge =
true;
911 if ((local_node_indices[0] == 0) && (local_node_indices[1] == 1))
916 off_of_this_edge =
true;
923 else if ((local_node_indices[0] == 1) && (local_node_indices[1] == 2))
928 off_of_this_edge =
true;
935 else if ((local_node_indices[0] == 2) && (local_node_indices[1] == 3))
940 off_of_this_edge =
true;
947 else if ((local_node_indices[0] == 0) && (local_node_indices[1] == 3))
952 off_of_this_edge =
true;
972 return off_of_this_edge;
983 bool off_of_this_face(
false);
994 off_of_this_face =
true;
1000 off_of_this_face =
true;
1013 off_of_this_face =
true;
1027 else if ((xi + eta) > 1.0)
1029 Real delta = (xi + eta - 1.0) / 2.0;
1032 off_of_this_face =
true;
1055 off_of_this_face =
true;
1079 off_of_this_face =
true;
1096 off_of_this_face =
true;
1113 off_of_this_face =
true;
1130 off_of_this_face =
true;
1153 return off_of_this_face;
1160 const Point * secondary_point,
1161 const Real tangential_tolerance)
1163 unsigned int dim = primary_elem->
dim();
1165 const std::vector<Point> & phys_point = fe->
get_xyz();
1167 const std::vector<RealGradient> & dxyz_dxi = fe->
get_dxyzdxi();
1168 const std::vector<RealGradient> & dxyz_deta = fe->
get_dxyzdeta();
1172 std::vector<Point> points(1);
1174 fe->
reinit(side, &points);
1178 const Real twosqrt2 = 2.8284;
1179 Real max_face_length = side->
hmax() + twosqrt2 * tangential_tolerance;
1184 normal = dxyz_dxi[0].
cross(dxyz_deta[0]);
1186 else if (
dim - 1 == 1)
1188 const Node *
const * elem_nodes = primary_elem->
get_nodes();
1189 const Point in_plane_vector1 = *elem_nodes[1] - *elem_nodes[0];
1190 const Point in_plane_vector2 = *elem_nodes[2] - *elem_nodes[0];
1192 Point out_of_plane_normal = in_plane_vector1.
cross(in_plane_vector2);
1193 out_of_plane_normal /= out_of_plane_normal.
norm();
1195 normal = dxyz_dxi[0].
cross(out_of_plane_normal);
1201 normal /= normal.
norm();
1203 const Real dot(d * normal);
1208 const Real tangdist = tangcomp.
norm();
1212 const Real faceExpansionFactor = 2.0 * (1.0 + normcomp.norm() / d.
norm());
1214 bool isReasonableCandidate =
true;
1215 if (tangdist > faceExpansionFactor * max_face_length)
1217 isReasonableCandidate =
false;
1219 return isReasonableCandidate;
1227 std::vector<Point> points(1);
1228 points[0] =
info._starting_closest_point_ref;
1230 fe.
reinit(&side, &points);
1231 const std::vector<Point> & starting_point = fe.
get_xyz();
1232 info._incremental_slip =
info._closest_point - starting_point[0];
1233 if (
info.isCaptured())
1235 info._frictional_energy =
1236 info._frictional_energy_old +
info._contact_force *
info._incremental_slip;
1237 info._accumulated_slip =
info._accumulated_slip_old +
info._incremental_slip.norm();
1243 std::vector<PenetrationInfo *> & p_info,
1252 std::vector<Real> edge_face_weights;
1253 std::vector<PenetrationInfo *> edge_face_info;
1257 mooseAssert(edge_face_info.size() == edge_face_weights.size(),
1258 "edge_face_info.size() != edge_face_weights.size()");
1260 if (edge_face_info.size() > 0)
1264 Real this_face_weight = 1.0;
1266 for (
unsigned int efwi = 0; efwi < edge_face_weights.size(); ++efwi)
1270 new_normal += npi->
_normal * edge_face_weights[efwi];
1272 this_face_weight -= edge_face_weights[efwi];
1274 mooseAssert(this_face_weight >= (0.25 - 1e-8),
1275 "Sum of weights of other faces shouldn't exceed 0.75");
1276 new_normal +=
info->_normal * this_face_weight;
1278 const Real len = new_normal.
norm();
1282 info->_normal = new_normal;
1292 const Real len(
info->_normal.norm());
1294 info->_normal /= len;
1301 std::vector<PenetrationInfo *> & edge_face_info,
1302 std::vector<Real> & edge_face_weights,
1303 std::vector<PenetrationInfo *> & p_info,
1304 const Node & secondary_node)
1307 const Point & p =
info->_closest_point_ref;
1308 std::set<dof_id_type> elems_to_exclude;
1309 elems_to_exclude.insert(
info->_elem->id());
1311 std::vector<std::vector<const Node *>> edge_nodes;
1315 std::vector<Elem *> edge_neighbor_elems;
1316 edge_face_info.resize(edge_nodes.size(), NULL);
1318 std::vector<unsigned int> edges_without_neighbors;
1320 for (
unsigned int i = 0; i < edge_nodes.size(); ++i)
1323 std::sort(edge_nodes[i].begin(), edge_nodes[i].end());
1325 std::vector<PenetrationInfo *> face_info_comm_edge;
1327 &secondary_node, elems_to_exclude, edge_nodes[i], face_info_comm_edge, p_info);
1329 if (face_info_comm_edge.size() == 0)
1330 edges_without_neighbors.push_back(i);
1331 else if (face_info_comm_edge.size() > 1)
1332 mooseError(
"Only one neighbor allowed per edge");
1334 edge_face_info[i] = face_info_comm_edge[0];
1338 std::vector<unsigned int>::reverse_iterator rit;
1339 for (rit = edges_without_neighbors.rbegin(); rit != edges_without_neighbors.rend(); ++rit)
1341 unsigned int index = *rit;
1342 edge_nodes.erase(edge_nodes.begin() + index);
1343 edge_face_weights.erase(edge_face_weights.begin() + index);
1344 edge_face_info.erase(edge_face_info.begin() + index);
1348 if (edge_nodes.size() > 1)
1350 if (edge_nodes.size() != 2)
1351 mooseError(
"Invalid number of smoothing edges");
1354 std::vector<const Node *> common_nodes;
1355 std::set_intersection(edge_nodes[0].begin(),
1356 edge_nodes[0].end(),
1357 edge_nodes[1].begin(),
1358 edge_nodes[1].end(),
1359 std::inserter(common_nodes, common_nodes.end()));
1361 if (common_nodes.size() != 1)
1362 mooseError(
"Invalid number of common nodes");
1364 for (
const auto & pinfo : edge_face_info)
1365 elems_to_exclude.insert(pinfo->_elem->id());
1367 std::vector<PenetrationInfo *> face_info_comm_edge;
1369 &secondary_node, elems_to_exclude, common_nodes, face_info_comm_edge, p_info);
1371 unsigned int num_corner_neighbors = face_info_comm_edge.size();
1373 if (num_corner_neighbors > 0)
1375 Real fw0 = edge_face_weights[0];
1376 Real fw1 = edge_face_weights[1];
1379 Real fw_corner = (fw0 * fw1) / static_cast<Real>(num_corner_neighbors);
1382 edge_face_weights[0] *= (1.0 - fw1);
1383 edge_face_weights[1] *= (1.0 - fw0);
1385 for (
unsigned int i = 0; i < num_corner_neighbors; ++i)
1387 edge_face_weights.push_back(fw_corner);
1388 edge_face_info.push_back(face_info_comm_edge[i]);
1398 std::vector<std::vector<const Node *>> & edge_nodes,
1399 std::vector<Real> & edge_face_weights)
1402 const Real & xi = p(0);
1403 const Real & eta = p(1);
1413 if (xi < -smooth_limit)
1415 std::vector<const Node *> en;
1417 edge_nodes.push_back(en);
1421 edge_face_weights.push_back(fw);
1423 else if (xi > smooth_limit)
1425 std::vector<const Node *> en;
1427 edge_nodes.push_back(en);
1431 edge_face_weights.push_back(fw);
1440 if (eta < -smooth_limit)
1442 std::vector<const Node *> en;
1445 edge_nodes.push_back(en);
1449 edge_face_weights.push_back(fw);
1451 if ((xi + eta) > smooth_limit)
1453 std::vector<const Node *> en;
1456 edge_nodes.push_back(en);
1460 edge_face_weights.push_back(fw);
1462 if (xi < -smooth_limit)
1464 std::vector<const Node *> en;
1467 edge_nodes.push_back(en);
1471 edge_face_weights.push_back(fw);
1480 if (eta < -smooth_limit)
1482 std::vector<const Node *> en;
1485 edge_nodes.push_back(en);
1489 edge_face_weights.push_back(fw);
1491 if (xi > smooth_limit)
1493 std::vector<const Node *> en;
1496 edge_nodes.push_back(en);
1500 edge_face_weights.push_back(fw);
1502 if (eta > smooth_limit)
1504 std::vector<const Node *> en;
1507 edge_nodes.push_back(en);
1511 edge_face_weights.push_back(fw);
1513 if (xi < -smooth_limit)
1515 std::vector<const Node *> en;
1518 edge_nodes.push_back(en);
1522 edge_face_weights.push_back(fw);
1537 const Node * secondary_node,
1538 const std::set<dof_id_type> & elems_to_exclude,
1539 const std::vector<const Node *> edge_nodes,
1540 std::vector<PenetrationInfo *> & face_info_comm_edge,
1541 std::vector<PenetrationInfo *> & p_info)
1547 mooseAssert(node_to_elem_pair !=
_node_to_elem_map.end(),
"Missing entry in node to elem map");
1548 const std::vector<dof_id_type> & elems_connected_to_node = node_to_elem_pair->second;
1550 std::vector<const Elem *> elems_connected_to_edge;
1552 for (
unsigned int ecni = 0; ecni < elems_connected_to_node.size(); ecni++)
1554 if (elems_to_exclude.find(elems_connected_to_node[ecni]) != elems_to_exclude.end())
1558 std::vector<const Node *> nodevec;
1559 for (
unsigned int ni = 0; ni < elem->
n_nodes(); ++ni)
1561 nodevec.push_back(elem->
node_ptr(ni));
1563 std::vector<const Node *> common_nodes;
1564 std::sort(nodevec.begin(), nodevec.end());
1565 std::set_intersection(edge_nodes.begin(),
1569 std::inserter(common_nodes, common_nodes.end()));
1571 if (common_nodes.size() == edge_nodes.size())
1572 elems_connected_to_edge.push_back(elem);
1575 if (elems_connected_to_edge.size() > 0)
1585 bool allowMultipleNeighbors =
false;
1587 if (elems_connected_to_edge[0]->
dim() == 3)
1589 if (edge_nodes.size() == 1)
1591 allowMultipleNeighbors =
true;
1595 for (
unsigned int i = 0; i < elems_connected_to_edge.size(); ++i)
1597 std::vector<PenetrationInfo *> thisElemInfo;
1598 getInfoForElem(thisElemInfo, p_info, elems_connected_to_edge[i]);
1599 if (thisElemInfo.size() > 0 && !allowMultipleNeighbors)
1601 if (thisElemInfo.size() > 1)
1603 "Found multiple neighbors to current edge/face on surface when only one is allowed");
1604 face_info_comm_edge.push_back(thisElemInfo[0]);
1609 thisElemInfo, p_info, secondary_node, elems_connected_to_edge[i], edge_nodes);
1610 if (thisElemInfo.size() > 0 && !allowMultipleNeighbors)
1612 if (thisElemInfo.size() > 1)
1614 "Found multiple neighbors to current edge/face on surface when only one is allowed");
1615 face_info_comm_edge.push_back(thisElemInfo[0]);
1619 for (
unsigned int j = 0; j < thisElemInfo.size(); ++j)
1620 face_info_comm_edge.push_back(thisElemInfo[j]);
1627 std::vector<PenetrationInfo *> & p_info,
1630 for (
const auto &
pi : p_info)
1635 if (
pi->_elem == elem)
1636 thisElemInfo.push_back(
pi);
1642 std::vector<PenetrationInfo *> & p_info,
1643 const Node * secondary_node,
1645 const std::vector<const Node *> & nodes_that_must_be_on_side,
1646 const bool check_whether_reasonable)
1648 std::vector<unsigned int>
sides;
1659 for (
unsigned int i = 0; i <
sides.size(); ++i)
1662 bool already_have_info_this_side =
false;
1663 for (
const auto &
pi : thisElemInfo)
1664 if (
pi->_side_num ==
sides[i])
1666 already_have_info_this_side =
true;
1670 if (already_have_info_this_side)
1677 std::vector<const Node *> nodevec;
1678 for (
unsigned int ni = 0; ni < side->
n_nodes(); ++ni)
1679 nodevec.push_back(side->
node_ptr(ni));
1681 std::sort(nodevec.begin(), nodevec.end());
1682 std::vector<const Node *> common_nodes;
1683 std::set_intersection(nodes_that_must_be_on_side.begin(),
1684 nodes_that_must_be_on_side.end(),
1687 std::inserter(common_nodes, common_nodes.end()));
1688 if (common_nodes.size() != nodes_that_must_be_on_side.size())
1699 if (check_whether_reasonable)
1708 Point contact_on_face_ref;
1710 Real tangential_distance = 0.;
1712 bool contact_point_on_side;
1713 std::vector<const Node *> off_edge_nodes;
1714 std::vector<std::vector<Real>> side_phi;
1715 std::vector<std::vector<RealGradient>> side_grad_phi;
1716 std::vector<RealGradient> dxyzdxi;
1717 std::vector<RealGradient> dxyzdeta;
1718 std::vector<RealGradient> d2xyzdxideta;
1720 std::unique_ptr<PenetrationInfo> pen_info =
1721 std::make_unique<PenetrationInfo>(elem,
1726 tangential_distance,
1729 contact_on_face_ref,
1737 bool search_succeeded =
false;
1745 contact_point_on_side,
1749 if (search_succeeded)
1751 thisElemInfo.push_back(pen_info.get());
1752 p_info.push_back(pen_info.release());
1761 const Elem *
const elem)
1769 return std::get<0>(tup) <
id;
1773 return id < std::get<0>(tup);
1779 for (
auto & t = range.first; t != range.second; ++t)
1781 sides.push_back(std::get<1>(*t));
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)
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
std::tuple< dof_id_type, unsigned short int, boundary_id_type > BCTuple
auto norm() const -> decltype(std::norm(Real()))
const unsigned int invalid_uint
unsigned int get_node_index(const Node *node_ptr) const
Real _accumulated_slip_old
virtual_for_inffe const std::vector< RealGradient > & get_dxyzdeta() const
virtual Elem * elemPtr(const dof_id_type i)
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)
OutputType getValue(const Elem *elem, const std::vector< std::vector< OutputShape >> &phi) const
Compute the variable value at a point on an element.
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
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.
NearestNodeLocator & _nearest_node
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
Real _normal_smoothing_distance
const Elem * _starting_elem
bool _check_whether_reasonable
const std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > & _bc_tuples
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
virtual_for_inffe const std::vector< RealGradient > & get_d2xyzdxideta() const
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)
unsigned int _stick_locked_this_step
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
void getSideCornerNodes(const Elem *side, std::vector< const Node *> &corner_nodes)
Threads::spin_mutex pinfo_mutex
virtual Real hmax() const
RealVectorValue _contact_force_old
Real distance(const Point &p)
virtual const Node & nodeRef(const dof_id_type i) const
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)
auto max(const L &left, const R &right)
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)
unsigned int _locked_this_step
BoundaryID _primary_boundary
Real _tangential_distance
const std::vector< std::vector< OutputGradient > > & get_dphi() const
virtual unsigned int n_nodes() const=0
unsigned int _starting_side_num
boundary_id_type BoundaryID
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)
const Node * _closest_node
const Node *const * get_nodes() const
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
void computeSlip(libMesh::FEBase &fe, PenetrationInfo &info)
const Node * _closest_node
virtual void reinit(const Elem *elem, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)=0
void findContactPoint(PenetrationInfo &p_info, libMesh::FEBase *fe_elem, libMesh::FEBase *fe_side, libMesh::FEType &fe_side_type, const libMesh::Point &secondary_point, bool start_with_centroid, const Real tangential_tolerance, bool &contact_point_on_side, bool &search_succeeded)
Finds the closest point (called the contact point) on the primary_elem on side "side" to the secondar...
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...
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name)=0
Returns the variable reference for requested MooseVariable which may be in any system.
libMesh::Point _closest_coor
virtual_for_inffe const std::vector< Point > & get_xyz() const
bool restrictPointToSpecifiedEdgeOfFace(libMesh::Point &p, const Node *&closest_node, const Elem *side, const std::vector< const Node *> &edge_nodes)
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
RealVectorValue _contact_force
Real _frictional_energy_old
MECH_STATUS_ENUM _mech_status
void join(const PenetrationThread &other)
Real _tangential_tolerance
std::vector< const Node * > _off_edge_nodes
Point _starting_closest_point_ref
Real _tangential_distance
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.
Real _lagrange_multiplier
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)
const Node * nearestNode(dof_id_type node_id)
Valid to call this after findNodes() has been called to get a pointer to the nearest node...
virtual unsigned short dim() const=0
MooseVariable * _nodal_normal_y
const Node * node_ptr(const unsigned int i) const
virtual bool is_vertex(const unsigned int i) const=0
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)
bool _do_normal_smoothing
MECH_STATUS_ENUM _mech_status_old
libMesh::Point _closest_coor_ref
const std::map< dof_id_type, std::vector< dof_id_type > > & _node_to_elem_map
void switchInfo(PenetrationInfo *&info, PenetrationInfo *&infoNew)
virtual_for_inffe const std::vector< RealGradient > & get_dxyzdxi() const
RealVectorValue _lagrange_multiplier_slip
MooseVariable * _nodal_normal_x
bool relativeFuzzyLessThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether a variable is less than another variable within a relative tolerance...
std::vector< std::vector< libMesh::FEBase * > > & _fes
virtual ElemType type() const=0
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
const std::vector< std::vector< OutputShape > > & get_phi() const
std::vector< RidgeData > _ridge_data_vec