https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
PenetrationThread Class Reference

#include <PenetrationThread.h>

Classes

struct  RidgeData
 
struct  RidgeSetData
 

Public Member Functions

 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, bool use_point_locator, std::vector< std::vector< libMesh::FEBase * > > &fes, libMesh::FEType &fe_type, NearestNodeLocator &nearest_node, const std::unordered_map< dof_id_type, std::vector< dof_id_type > > &node_to_elem_map)
 
 PenetrationThread (PenetrationThread &x, Threads::split split)
 
void operator() (const NodeIdRange &range)
 
void join (const PenetrationThread &other)
 

Public Attributes

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 patch has to be updated.
 

Protected Types

enum  CompeteInteractionResult { FIRST_WINS , SECOND_WINS , NEITHER_WINS }
 
enum  CommonEdgeResult { NO_COMMON , COMMON_EDGE , COMMON_NODE , EDGE_AND_COMMON_NODE }
 

Protected Member Functions

CompeteInteractionResult competeInteractions (PenetrationInfo *pi1, PenetrationInfo *pi2)
 When interactions are identified between a node and two faces, compete between the faces to determine whether first (pi1) or second (pi2) interaction is stronger.
 
CompeteInteractionResult competeInteractionsBothOnFace (PenetrationInfo *pi1, PenetrationInfo *pi2)
 Determine whether first (pi1) or second (pi2) interaction is stronger when it is known that the node projects to both of the two competing faces.
 
CommonEdgeResult interactionsOffCommonEdge (PenetrationInfo *pi1, PenetrationInfo *pi2)
 
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)
 
void getSideCornerNodes (const Elem *side, std::vector< const Node * > &corner_nodes)
 
bool restrictPointToSpecifiedEdgeOfFace (libMesh::Point &p, const Node *&closest_node, const Elem *side, const std::vector< const Node * > &edge_nodes)
 
bool restrictPointToFace (libMesh::Point &p, const Node *&closest_node, const Elem *side)
 
bool isFaceReasonableCandidate (const Elem *primary_elem, const Elem *side, libMesh::FEBase *fe, const libMesh::Point *secondary_point, const Real tangential_tolerance)
 
void smoothNormal (PenetrationInfo *info, std::vector< PenetrationInfo * > &p_info, const Node &node)
 
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)
 
void getSmoothingEdgeNodesAndWeights (const libMesh::Point &p, const Elem *side, std::vector< std::vector< const Node * > > &edge_nodes, std::vector< Real > &edge_face_weights)
 
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 getInfoForElem (std::vector< PenetrationInfo * > &thisElemInfo, std::vector< PenetrationInfo * > &p_info, const Elem *elem)
 
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 getSidesOnPrimaryBoundary (std::vector< unsigned int > &sides, const Elem *const elem)
 
void computeSlip (libMesh::FEBase &fe, PenetrationInfo &info)
 
void switchInfo (PenetrationInfo *&info, PenetrationInfo *&infoNew)
 

Protected Attributes

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
 
bool _use_point_locator
 
MooseVariable * _nodal_normal_x
 
MooseVariable * _nodal_normal_y
 
MooseVariable * _nodal_normal_z
 
std::vector< std::vector< libMesh::FEBase * > > & _fes
 
libMesh::FEType & _fe_type
 
NearestNodeLocator & _nearest_node
 
const std::unordered_map< dof_id_type, std::vector< dof_id_type > > & _node_to_elem_map
 
THREAD_ID _tid
 
libMesh::ElemSideBuilder _elem_side_builder
 Helper for building element sides without extraneous allocation.
 

Detailed Description

Definition at line 24 of file PenetrationThread.h.

Member Enumeration Documentation

◆ CommonEdgeResult

Enumerator
NO_COMMON 
COMMON_EDGE 
COMMON_NODE 
EDGE_AND_COMMON_NODE 

Definition at line 96 of file PenetrationThread.h.

◆ CompeteInteractionResult

Enumerator
FIRST_WINS 
SECOND_WINS 
NEITHER_WINS 

Definition at line 89 of file PenetrationThread.h.

Constructor & Destructor Documentation

◆ PenetrationThread() [1/2]

PenetrationThread::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,
bool  use_point_locator,
std::vector< std::vector< libMesh::FEBase * > > &  fes,
libMesh::FEType &  fe_type,
NearestNodeLocator &  nearest_node,
const std::unordered_map< dof_id_type, std::vector< dof_id_type > > &  node_to_elem_map 
)

◆ PenetrationThread() [2/2]

PenetrationThread::PenetrationThread ( PenetrationThread &  x,
Threads::split  split 
)

Definition at line 136 of file PenetrationThread.C.

138 _mesh(x._mesh),
149 _fes(x._fes),
153{
154}
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
const std::unordered_map< dof_id_type, std::vector< dof_id_type > > & _node_to_elem_map
std::vector< std::vector< libMesh::FEBase * > > & _fes
BoundaryID _secondary_boundary
const MooseMesh & _mesh
libMesh::FEType & _fe_type
NearestNodeLocator & _nearest_node
PenetrationLocator::NORMAL_SMOOTHING_METHOD _normal_smoothing_method
SubProblem & _subproblem
BoundaryID _primary_boundary

Member Function Documentation

◆ competeInteractions()

PenetrationThread::CompeteInteractionResult PenetrationThread::competeInteractions ( PenetrationInfo *  pi1,
PenetrationInfo *  pi2 
)
protected

When interactions are identified between a node and two faces, compete between the faces to determine whether first (pi1) or second (pi2) interaction is stronger.

Parameters
pi1Pointer to the PenetrationInfo object for the first face
pi2Pointer to the PenetrationInfo object for the second face
Returns
Appropriate ComputeInterationResult enum entry identifying which face is a better match

Definition at line 686 of file PenetrationThread.C.

687{
688
690
692 pi2->_tangential_distance > _tangential_tolerance) // out of tol on both faces
693 result = NEITHER_WINS;
694
695 else if (pi1->_tangential_distance == 0.0 &&
696 pi2->_tangential_distance > 0.0) // on face 1, off face 2
697 result = FIRST_WINS;
698
699 else if (pi2->_tangential_distance == 0.0 &&
700 pi1->_tangential_distance > 0.0) // on face 2, off face 1
701 result = SECOND_WINS;
702
704 pi2->_tangential_distance > _tangential_tolerance) // in face 1 tol, out of face 2 tol
705 result = FIRST_WINS;
706
708 pi1->_tangential_distance > _tangential_tolerance) // in face 2 tol, out of face 1 tol
709 result = SECOND_WINS;
710
711 else if (pi1->_tangential_distance == 0.0 && pi2->_tangential_distance == 0.0) // on both faces
712 result = competeInteractionsBothOnFace(pi1, pi2);
713
715 pi2->_tangential_distance <= _tangential_tolerance) // off but within tol of both faces
716 {
718 if (cer == COMMON_EDGE || cer == COMMON_NODE) // ridge case.
719 {
720 // We already checked for ridges, and it got rejected, so neither face must be valid
721 result = NEITHER_WINS;
722 // mooseError("Erroneously encountered ridge case");
723 }
724 else if (cer == EDGE_AND_COMMON_NODE) // off side of face, off corner of another face. Favor
725 // the off-side face
726 {
727 if (pi1->_off_edge_nodes.size() == pi2->_off_edge_nodes.size())
728 mooseError("Invalid off_edge_nodes counts");
729
730 else if (pi1->_off_edge_nodes.size() == 2)
731 result = FIRST_WINS;
732
733 else if (pi2->_off_edge_nodes.size() == 2)
734 result = SECOND_WINS;
735
736 else
737 mooseError("Invalid off_edge_nodes counts");
738 }
739 else // The node projects to both faces within tangential tolerance.
740 result = competeInteractionsBothOnFace(pi1, pi2);
741 }
742
743 return result;
744}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
std::vector< const Node * > _off_edge_nodes
CommonEdgeResult interactionsOffCommonEdge(PenetrationInfo *pi1, PenetrationInfo *pi2)
CompeteInteractionResult competeInteractionsBothOnFace(PenetrationInfo *pi1, PenetrationInfo *pi2)
Determine whether first (pi1) or second (pi2) interaction is stronger when it is known that the node ...

Referenced by operator()().

◆ competeInteractionsBothOnFace()

PenetrationThread::CompeteInteractionResult PenetrationThread::competeInteractionsBothOnFace ( PenetrationInfo *  pi1,
PenetrationInfo *  pi2 
)
protected

Determine whether first (pi1) or second (pi2) interaction is stronger when it is known that the node projects to both of the two competing faces.

Parameters
pi1Pointer to the PenetrationInfo object for the first face
pi2Pointer to the PenetrationInfo object for the second face
Returns
Appropriate ComputeInterationResult enum entry identifying which face is a better match

Definition at line 747 of file PenetrationThread.C.

748{
750
751 if (pi1->_distance >= 0.0 && pi2->_distance < 0.0)
752 result = FIRST_WINS; // favor face with positive distance (penetrated) -- first in this case
753
754 else if (pi2->_distance >= 0.0 && pi1->_distance < 0.0)
755 result = SECOND_WINS; // favor face with positive distance (penetrated) -- second in this case
756
757 // TODO: This logic below could cause an abrupt jump from one face to the other with small mesh
758 // movement. If there is some way to smooth the transition, we should do it.
759 else if (MooseUtils::relativeFuzzyLessThan(std::abs(pi1->_distance), std::abs(pi2->_distance)))
760 result = FIRST_WINS; // otherwise, favor the closer face -- first in this case
761
762 else if (MooseUtils::relativeFuzzyLessThan(std::abs(pi2->_distance), std::abs(pi1->_distance)))
763 result = SECOND_WINS; // otherwise, favor the closer face -- second in this case
764
765 else // Equal within tolerance. Favor the one with a smaller element id (for repeatibility)
766 {
767 if (pi1->_elem->id() < pi2->_elem->id())
768 result = FIRST_WINS;
769
770 else
771 result = SECOND_WINS;
772 }
773
774 return result;
775}
const Elem * _elem

Referenced by competeInteractions().

◆ computeSlip()

void PenetrationThread::computeSlip ( libMesh::FEBase &  fe,
PenetrationInfo &  info 
)
protected

Definition at line 1393 of file PenetrationThread.C.

1394{
1395 // Slip is current projected position of secondary node minus
1396 // original projected position of secondary node
1397 std::vector<Point> points(1);
1398 points[0] = info._starting_closest_point_ref;
1399 const Elem * const side =
1400 info._starting_side_num == libMesh::invalid_uint
1401 ? info._starting_elem
1402 : &_elem_side_builder(*info._starting_elem, info._starting_side_num);
1403 fe.reinit(side, &points);
1404 const std::vector<Point> & starting_point = fe.get_xyz();
1405 info._incremental_slip = info._closest_point - starting_point[0];
1406 if (info.isCaptured())
1407 {
1408 info._frictional_energy =
1409 info._frictional_energy_old + info._contact_force * info._incremental_slip;
1410 info._accumulated_slip = info._accumulated_slip_old + info._incremental_slip.norm();
1411 }
1412}
libMesh::ElemSideBuilder _elem_side_builder
Helper for building element sides without extraneous allocation.
virtual_for_inffe const std::vector< Point > & get_xyz() const
virtual void reinit(const Elem *elem, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)=0
MPI_Info info
const unsigned int invalid_uint

Referenced by operator()().

◆ createInfoForElem()

void PenetrationThread::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 
)
protected

Definition at line 1814 of file PenetrationThread.C.

1820{
1821 const BoundaryInfo & boundary_info = _mesh.getMesh().get_boundary_info();
1822
1823 // A primary surface element is its single contact face, with side number invalid_uint
1824 const bool surface_elem = _mesh.isSurfaceElemOnNodeset(*elem, _primary_boundary);
1825 std::vector<unsigned int> sides;
1826 if (surface_elem)
1827 sides.push_back(libMesh::invalid_uint);
1828 else
1829 for (auto s : elem->side_index_range())
1830 if (boundary_info.has_boundary_id(elem, s, _primary_boundary))
1831 sides.push_back(s);
1832
1833 for (const auto s : sides)
1834 {
1835 // Don't create info for this side if one already exists
1836 bool already_have_info_this_side = false;
1837 for (const auto & pi : thisElemInfo)
1838 if (pi->_side_num == s)
1839 {
1840 already_have_info_this_side = true;
1841 break;
1842 }
1843
1844 if (already_have_info_this_side)
1845 break;
1846
1847 const Elem * side = PenetrationInfo::buildSide(*elem, s, surface_elem).release();
1848
1849 // Only continue with creating info for this side if the side contains
1850 // all of the nodes in nodes_that_must_be_on_side
1851 std::vector<const Node *> nodevec;
1852 for (unsigned int ni = 0; ni < side->n_nodes(); ++ni)
1853 nodevec.push_back(side->node_ptr(ni));
1854
1855 std::sort(nodevec.begin(), nodevec.end());
1856 std::vector<const Node *> common_nodes;
1857 std::set_intersection(nodes_that_must_be_on_side.begin(),
1858 nodes_that_must_be_on_side.end(),
1859 nodevec.begin(),
1860 nodevec.end(),
1861 std::inserter(common_nodes, common_nodes.end()));
1862 if (common_nodes.size() != nodes_that_must_be_on_side.size())
1863 {
1864 delete side;
1865 break;
1866 }
1867
1868 FEBase * fe_elem = _fes[_tid][elem->dim()];
1869 FEBase * fe_side = _fes[_tid][side->dim()];
1870
1871 // Optionally check to see whether face is reasonable candidate based on an
1872 // estimate of how closely it is likely to project to the face
1873 if (check_whether_reasonable)
1874 if (!isFaceReasonableCandidate(elem, side, fe_side, secondary_node, _tangential_tolerance))
1875 {
1876 delete side;
1877 break;
1878 }
1879
1880 Point contact_phys;
1881 Point contact_ref;
1882 Point contact_on_face_ref;
1883 Real distance = 0.;
1884 Real tangential_distance = 0.;
1885 RealGradient normal;
1886 bool contact_point_on_side;
1887 std::vector<const Node *> off_edge_nodes;
1888 std::vector<std::vector<Real>> side_phi;
1889 std::vector<std::vector<RealGradient>> side_grad_phi;
1890 std::vector<RealGradient> dxyzdxi;
1891 std::vector<RealGradient> dxyzdeta;
1892 std::vector<RealGradient> d2xyzdxideta;
1893
1894 std::unique_ptr<PenetrationInfo> pen_info =
1895 std::make_unique<PenetrationInfo>(elem,
1896 side,
1897 s,
1898 normal,
1899 distance,
1900 tangential_distance,
1901 contact_phys,
1902 contact_ref,
1903 contact_on_face_ref,
1904 off_edge_nodes,
1905 side_phi,
1906 side_grad_phi,
1907 dxyzdxi,
1908 dxyzdeta,
1909 d2xyzdxideta);
1910
1911 bool search_succeeded = false;
1912 Moose::findContactPoint(*pen_info,
1913 fe_elem,
1914 fe_side,
1915 _fe_type,
1916 *secondary_node,
1917 true,
1919 contact_point_on_side,
1920 search_succeeded);
1921
1922 // Do not add contact info from failed searches
1923 if (search_succeeded)
1924 {
1925 thisElemInfo.push_back(pen_info.get());
1926 p_info.push_back(pen_info.release());
1927 }
1928 }
1929}
char ** sides
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3581
bool isSurfaceElemOnNodeset(const Elem &elem, BoundaryID bnd_id) const
Returns true if elem is a surface element without an interior parent, e.g.
Definition MooseMesh.C:3724
static std::unique_ptr< const Elem > buildSide(const Elem &elem, unsigned int side_num, bool elem_is_surface_elem)
Build the contact face for side side_num of a primary element, or copy elem directly when the element...
bool isFaceReasonableCandidate(const Elem *primary_elem, const Elem *side, libMesh::FEBase *fe, const libMesh::Point *secondary_point, const Real tangential_tolerance)
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)
const Real pi
RealVectorValue RealGradient
FEGenericBase< Real > FEBase
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real distance(const Point &p)

Referenced by getInfoForFacesWithCommonNodes(), and operator()().

◆ findRidgeContactPoint()

bool PenetrationThread::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 
)
protected

Definition at line 832 of file PenetrationThread.C.

840{
841 tangential_distance = 0.0;
842 closest_node = NULL;
843 PenetrationInfo * pi1 = p_info[index1];
844 PenetrationInfo * pi2 = p_info[index2];
845 const unsigned sidedim(pi1->_side->dim());
846 mooseAssert(sidedim == pi2->_side->dim(), "Incompatible dimensionalities");
847
848 // Nodes on faces for the two interactions
849 std::vector<const Node *> side1_nodes;
850 getSideCornerNodes(pi1->_side, side1_nodes);
851 std::vector<const Node *> side2_nodes;
852 getSideCornerNodes(pi2->_side, side2_nodes);
853
854 std::sort(side1_nodes.begin(), side1_nodes.end());
855 std::sort(side2_nodes.begin(), side2_nodes.end());
856
857 // Find nodes shared by the two faces
858 std::vector<const Node *> common_nodes;
859 std::set_intersection(side1_nodes.begin(),
860 side1_nodes.end(),
861 side2_nodes.begin(),
862 side2_nodes.end(),
863 std::inserter(common_nodes, common_nodes.end()));
864
865 if (common_nodes.size() != sidedim)
866 return false;
867
868 bool found_point1, found_point2;
869 Point closest_coor_ref1(pi1->_closest_point_ref);
870 const Node * closest_node1;
872 closest_coor_ref1, closest_node1, pi1->_side, common_nodes);
873
874 Point closest_coor_ref2(pi2->_closest_point_ref);
875 const Node * closest_node2;
877 closest_coor_ref2, closest_node2, pi2->_side, common_nodes);
878
879 if (!found_point1 || !found_point2)
880 return false;
881
882 // if (sidedim == 2)
883 // {
884 // TODO:
885 // We have the parametric coordinates of the closest intersection point for both faces.
886 // We need to find a point somewhere in the middle of them so there's not an abrupt jump.
887 // Find that point by taking dot products of vector from contact point to secondary node point
888 // with face normal vectors to see which face we're closer to.
889 // }
890
891 FEBase * fe = NULL;
892 std::vector<Point> points(1);
893
894 // We have to pick one of the two faces to own the contact point. Either one would
895 // generally work, but to avoid some corner-case numerical roundoff issues when
896 // determining signs of the normal and displacement, pick the one that the point is
897 // closer to projecting onto, which is the one with the larger projected distance.
898 // If that distance is the same for both faces (within numerical precision), pick the
899 // face with the lowest index for repeatability.
900 if (MooseUtils::absoluteFuzzyGreaterThan(std::abs(pi1->_distance), std::abs(pi2->_distance)) ||
901 (MooseUtils::absoluteFuzzyEqual(std::abs(pi1->_distance), std::abs(pi2->_distance)) &&
902 index1 < index2))
903 {
904 fe = _fes[_tid][pi1->_side->dim()];
905 contact_point_ref = closest_coor_ref1;
906 points[0] = closest_coor_ref1;
907 fe->reinit(pi1->_side, &points);
908 index = index1;
909 }
910 else
911 {
912 fe = _fes[_tid][pi2->_side->dim()];
913 contact_point_ref = closest_coor_ref2;
914 points[0] = closest_coor_ref2;
915 fe->reinit(pi2->_side, &points);
916 index = index2;
917 }
918
919 contact_point = fe->get_xyz()[0];
920
921 if (sidedim == 2)
922 {
923 if (closest_node1) // point is off the ridge between the two elements
924 {
925 mooseAssert((closest_node1 == closest_node2 || closest_node2 == NULL),
926 "If off edge of ridge, closest node must be the same on both elements");
927 closest_node = closest_node1;
928
929 RealGradient off_face = *closest_node1 - contact_point;
930 tangential_distance = off_face.norm();
931 }
932 }
933
934 return true;
935}
Data structure used to hold penetration information.
const Elem * _side
bool restrictPointToSpecifiedEdgeOfFace(libMesh::Point &p, const Node *&closest_node, const Elem *side, const std::vector< const Node * > &edge_nodes)
void getSideCornerNodes(const Elem *side, std::vector< const Node * > &corner_nodes)
auto norm() const

Referenced by operator()().

◆ getInfoForElem()

void PenetrationThread::getInfoForElem ( std::vector< PenetrationInfo * > &  thisElemInfo,
std::vector< PenetrationInfo * > &  p_info,
const Elem *  elem 
)
protected

Definition at line 1799 of file PenetrationThread.C.

1802{
1803 for (const auto & pi : p_info)
1804 {
1805 if (!pi)
1806 continue;
1807
1808 if (pi->_elem == elem)
1809 thisElemInfo.push_back(pi);
1810 }
1811}

Referenced by getInfoForFacesWithCommonNodes().

◆ getInfoForFacesWithCommonNodes()

void PenetrationThread::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 
)
protected

Definition at line 1709 of file PenetrationThread.C.

1715{
1716 // elems connected to a node on this edge, find one that has the same corners as this, and is not
1717 // the current elem
1718 auto node_to_elem_pair = _node_to_elem_map.find(edge_nodes[0]->id()); // just need one of the
1719 // nodes
1720 mooseAssert(node_to_elem_pair != _node_to_elem_map.end(), "Missing entry in node to elem map");
1721 const std::vector<dof_id_type> & elems_connected_to_node = node_to_elem_pair->second;
1722
1723 std::vector<const Elem *> elems_connected_to_edge;
1724
1725 for (unsigned int ecni = 0; ecni < elems_connected_to_node.size(); ecni++)
1726 {
1727 if (elems_to_exclude.find(elems_connected_to_node[ecni]) != elems_to_exclude.end())
1728 continue;
1729 const Elem * elem = _mesh.elemPtr(elems_connected_to_node[ecni]);
1730
1731 std::vector<const Node *> nodevec;
1732 for (unsigned int ni = 0; ni < elem->n_nodes(); ++ni)
1733 if (elem->is_vertex(ni))
1734 nodevec.push_back(elem->node_ptr(ni));
1735
1736 std::vector<const Node *> common_nodes;
1737 std::sort(nodevec.begin(), nodevec.end());
1738 std::set_intersection(edge_nodes.begin(),
1739 edge_nodes.end(),
1740 nodevec.begin(),
1741 nodevec.end(),
1742 std::inserter(common_nodes, common_nodes.end()));
1743
1744 if (common_nodes.size() == edge_nodes.size())
1745 elems_connected_to_edge.push_back(elem);
1746 }
1747
1748 if (elems_connected_to_edge.size() > 0)
1749 {
1750
1751 // There are potentially multiple elements that share a common edge
1752 // 2D:
1753 // There can only be one element on the same surface
1754 // 3D:
1755 // If there are two edge nodes, there can only be one element on the same surface
1756 // If there is only one edge node (a corner), there could be multiple elements on the same
1757 // surface
1758 bool allowMultipleNeighbors = false;
1759
1760 if (_mesh.dimension() == 3)
1761 {
1762 if (edge_nodes.size() == 1)
1763 {
1764 allowMultipleNeighbors = true;
1765 }
1766 }
1767
1768 for (unsigned int i = 0; i < elems_connected_to_edge.size(); ++i)
1769 {
1770 std::vector<PenetrationInfo *> thisElemInfo;
1771 getInfoForElem(thisElemInfo, p_info, elems_connected_to_edge[i]);
1772 if (thisElemInfo.size() > 0 && !allowMultipleNeighbors)
1773 {
1774 if (thisElemInfo.size() > 1)
1775 mooseError(
1776 "Found multiple neighbors to current edge/face on surface when only one is allowed");
1777 face_info_comm_edge.push_back(thisElemInfo[0]);
1778 break;
1779 }
1780
1782 thisElemInfo, p_info, secondary_node, elems_connected_to_edge[i], edge_nodes);
1783 if (thisElemInfo.size() > 0 && !allowMultipleNeighbors)
1784 {
1785 if (thisElemInfo.size() > 1)
1786 mooseError(
1787 "Found multiple neighbors to current edge/face on surface when only one is allowed");
1788 face_info_comm_edge.push_back(thisElemInfo[0]);
1789 break;
1790 }
1791
1792 for (unsigned int j = 0; j < thisElemInfo.size(); ++j)
1793 face_info_comm_edge.push_back(thisElemInfo[j]);
1794 }
1795 }
1796}
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Definition MooseMesh.C:2993
virtual Elem * elemPtr(const dof_id_type i)
Definition MooseMesh.C:3221
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 getInfoForElem(std::vector< PenetrationInfo * > &thisElemInfo, std::vector< PenetrationInfo * > &p_info, const Elem *elem)

Referenced by getSmoothingFacesAndWeights().

◆ getSideCornerNodes()

void PenetrationThread::getSideCornerNodes ( const Elem *  side,
std::vector< const Node * > &  corner_nodes 
)
protected

Definition at line 938 of file PenetrationThread.C.

939{
940 const ElemType t(side->type());
941 corner_nodes.clear();
942
943 corner_nodes.push_back(side->node_ptr(0));
944 corner_nodes.push_back(side->node_ptr(1));
945 switch (t)
946 {
947 case EDGE2:
948 case EDGE3:
949 case EDGE4:
950 {
951 break;
952 }
953
954 case TRI3:
955 case TRI6:
956 case TRI7:
957 {
958 corner_nodes.push_back(side->node_ptr(2));
959 break;
960 }
961
962 case QUAD4:
963 case QUAD8:
964 case QUAD9:
965 {
966 corner_nodes.push_back(side->node_ptr(2));
967 corner_nodes.push_back(side->node_ptr(3));
968 break;
969 }
970
971 default:
972 {
973 mooseError("Unsupported face type: ", t);
974 break;
975 }
976 }
977}

Referenced by findRidgeContactPoint().

◆ getSidesOnPrimaryBoundary()

void PenetrationThread::getSidesOnPrimaryBoundary ( std::vector< unsigned int > &  sides,
const Elem *const  elem 
)
protected

◆ getSmoothingEdgeNodesAndWeights()

void PenetrationThread::getSmoothingEdgeNodesAndWeights ( const libMesh::Point &  p,
const Elem *  side,
std::vector< std::vector< const Node * > > &  edge_nodes,
std::vector< Real > &  edge_face_weights 
)
protected

Definition at line 1568 of file PenetrationThread.C.

1573{
1574 const ElemType t(side->type());
1575 const Real & xi = p(0);
1576 const Real & eta = p(1);
1577
1578 Real smooth_limit = 1.0 - _normal_smoothing_distance;
1579
1580 switch (t)
1581 {
1582 case EDGE2:
1583 case EDGE3:
1584 case EDGE4:
1585 {
1586 if (xi < -smooth_limit)
1587 {
1588 std::vector<const Node *> en;
1589 en.push_back(side->node_ptr(0));
1590 edge_nodes.push_back(en);
1591 Real fw = 0.5 - (1.0 + xi) / (2.0 * _normal_smoothing_distance);
1592 if (fw > 0.5)
1593 fw = 0.5;
1594 edge_face_weights.push_back(fw);
1595 }
1596 else if (xi > smooth_limit)
1597 {
1598 std::vector<const Node *> en;
1599 en.push_back(side->node_ptr(1));
1600 edge_nodes.push_back(en);
1601 Real fw = 0.5 - (1.0 - xi) / (2.0 * _normal_smoothing_distance);
1602 if (fw > 0.5)
1603 fw = 0.5;
1604 edge_face_weights.push_back(fw);
1605 }
1606 break;
1607 }
1608
1609 case TRI3:
1610 case TRI6:
1611 case TRI7:
1612 {
1613 if (eta < -smooth_limit)
1614 {
1615 std::vector<const Node *> en;
1616 en.push_back(side->node_ptr(0));
1617 en.push_back(side->node_ptr(1));
1618 edge_nodes.push_back(en);
1619 Real fw = 0.5 - (1.0 + eta) / (2.0 * _normal_smoothing_distance);
1620 if (fw > 0.5)
1621 fw = 0.5;
1622 edge_face_weights.push_back(fw);
1623 }
1624 if ((xi + eta) > smooth_limit)
1625 {
1626 std::vector<const Node *> en;
1627 en.push_back(side->node_ptr(1));
1628 en.push_back(side->node_ptr(2));
1629 edge_nodes.push_back(en);
1630 Real fw = 0.5 - (1.0 - xi - eta) / (2.0 * _normal_smoothing_distance);
1631 if (fw > 0.5)
1632 fw = 0.5;
1633 edge_face_weights.push_back(fw);
1634 }
1635 if (xi < -smooth_limit)
1636 {
1637 std::vector<const Node *> en;
1638 en.push_back(side->node_ptr(2));
1639 en.push_back(side->node_ptr(0));
1640 edge_nodes.push_back(en);
1641 Real fw = 0.5 - (1.0 + xi) / (2.0 * _normal_smoothing_distance);
1642 if (fw > 0.5)
1643 fw = 0.5;
1644 edge_face_weights.push_back(fw);
1645 }
1646 break;
1647 }
1648
1649 case QUAD4:
1650 case QUAD8:
1651 case QUAD9:
1652 {
1653 if (eta < -smooth_limit)
1654 {
1655 std::vector<const Node *> en;
1656 en.push_back(side->node_ptr(0));
1657 en.push_back(side->node_ptr(1));
1658 edge_nodes.push_back(en);
1659 Real fw = 0.5 - (1.0 + eta) / (2.0 * _normal_smoothing_distance);
1660 if (fw > 0.5)
1661 fw = 0.5;
1662 edge_face_weights.push_back(fw);
1663 }
1664 if (xi > smooth_limit)
1665 {
1666 std::vector<const Node *> en;
1667 en.push_back(side->node_ptr(1));
1668 en.push_back(side->node_ptr(2));
1669 edge_nodes.push_back(en);
1670 Real fw = 0.5 - (1.0 - xi) / (2.0 * _normal_smoothing_distance);
1671 if (fw > 0.5)
1672 fw = 0.5;
1673 edge_face_weights.push_back(fw);
1674 }
1675 if (eta > smooth_limit)
1676 {
1677 std::vector<const Node *> en;
1678 en.push_back(side->node_ptr(2));
1679 en.push_back(side->node_ptr(3));
1680 edge_nodes.push_back(en);
1681 Real fw = 0.5 - (1.0 - eta) / (2.0 * _normal_smoothing_distance);
1682 if (fw > 0.5)
1683 fw = 0.5;
1684 edge_face_weights.push_back(fw);
1685 }
1686 if (xi < -smooth_limit)
1687 {
1688 std::vector<const Node *> en;
1689 en.push_back(side->node_ptr(3));
1690 en.push_back(side->node_ptr(0));
1691 edge_nodes.push_back(en);
1692 Real fw = 0.5 - (1.0 + xi) / (2.0 * _normal_smoothing_distance);
1693 if (fw > 0.5)
1694 fw = 0.5;
1695 edge_face_weights.push_back(fw);
1696 }
1697 break;
1698 }
1699
1700 default:
1701 {
1702 mooseError("Unsupported face type: ", t);
1703 break;
1704 }
1705 }
1706}
Point eta
Definition MortarUtils.C:60
Point xi
Definition MortarUtils.C:59

Referenced by getSmoothingFacesAndWeights().

◆ getSmoothingFacesAndWeights()

void PenetrationThread::getSmoothingFacesAndWeights ( PenetrationInfo *  info,
std::vector< PenetrationInfo * > &  edge_face_info,
std::vector< Real > &  edge_face_weights,
std::vector< PenetrationInfo * > &  p_info,
const Node &  secondary_node 
)
protected

Definition at line 1473 of file PenetrationThread.C.

1478{
1479 const Elem * side = info->_side;
1480 const Point & p = info->_closest_point_ref;
1481 std::set<dof_id_type> elems_to_exclude;
1482 elems_to_exclude.insert(info->_elem->id());
1483
1484 std::vector<std::vector<const Node *>> edge_nodes;
1485
1486 // Get the pairs of nodes along every edge that we are close enough to smooth with
1487 getSmoothingEdgeNodesAndWeights(p, side, edge_nodes, edge_face_weights);
1488 std::vector<Elem *> edge_neighbor_elems;
1489 edge_face_info.resize(edge_nodes.size(), NULL);
1490
1491 std::vector<unsigned int> edges_without_neighbors;
1492
1493 for (unsigned int i = 0; i < edge_nodes.size(); ++i)
1494 {
1495 // Sort all sets of edge nodes (needed for comparing edges)
1496 std::sort(edge_nodes[i].begin(), edge_nodes[i].end());
1497
1498 std::vector<PenetrationInfo *> face_info_comm_edge;
1500 &secondary_node, elems_to_exclude, edge_nodes[i], face_info_comm_edge, p_info);
1501
1502 if (face_info_comm_edge.size() == 0)
1503 edges_without_neighbors.push_back(i);
1504 else if (face_info_comm_edge.size() > 1)
1505 mooseError("Only one neighbor allowed per edge");
1506 else
1507 edge_face_info[i] = face_info_comm_edge[0];
1508 }
1509
1510 // Remove edges without neighbors from the vector, starting from end
1511 std::vector<unsigned int>::reverse_iterator rit;
1512 for (rit = edges_without_neighbors.rbegin(); rit != edges_without_neighbors.rend(); ++rit)
1513 {
1514 unsigned int index = *rit;
1515 edge_nodes.erase(edge_nodes.begin() + index);
1516 edge_face_weights.erase(edge_face_weights.begin() + index);
1517 edge_face_info.erase(edge_face_info.begin() + index);
1518 }
1519
1520 // Handle corner case
1521 if (edge_nodes.size() > 1)
1522 {
1523 if (edge_nodes.size() != 2)
1524 mooseError("Invalid number of smoothing edges");
1525
1526 // find common node
1527 std::vector<const Node *> common_nodes;
1528 std::set_intersection(edge_nodes[0].begin(),
1529 edge_nodes[0].end(),
1530 edge_nodes[1].begin(),
1531 edge_nodes[1].end(),
1532 std::inserter(common_nodes, common_nodes.end()));
1533
1534 if (common_nodes.size() != 1)
1535 mooseError("Invalid number of common nodes");
1536
1537 for (const auto & pinfo : edge_face_info)
1538 elems_to_exclude.insert(pinfo->_elem->id());
1539
1540 std::vector<PenetrationInfo *> face_info_comm_edge;
1542 &secondary_node, elems_to_exclude, common_nodes, face_info_comm_edge, p_info);
1543
1544 unsigned int num_corner_neighbors = face_info_comm_edge.size();
1545
1546 if (num_corner_neighbors > 0)
1547 {
1548 Real fw0 = edge_face_weights[0];
1549 Real fw1 = edge_face_weights[1];
1550
1551 // Corner weight is product of edge weights. Spread out over multiple neighbors.
1552 Real fw_corner = (fw0 * fw1) / static_cast<Real>(num_corner_neighbors);
1553
1554 // Adjust original edge weights
1555 edge_face_weights[0] *= (1.0 - fw1);
1556 edge_face_weights[1] *= (1.0 - fw0);
1557
1558 for (unsigned int i = 0; i < num_corner_neighbors; ++i)
1559 {
1560 edge_face_weights.push_back(fw_corner);
1561 edge_face_info.push_back(face_info_comm_edge[i]);
1562 }
1563 }
1564 }
1565}
void getSmoothingEdgeNodesAndWeights(const libMesh::Point &p, const Elem *side, std::vector< std::vector< const Node * > > &edge_nodes, std::vector< Real > &edge_face_weights)
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)

Referenced by smoothNormal().

◆ interactionsOffCommonEdge()

PenetrationThread::CommonEdgeResult PenetrationThread::interactionsOffCommonEdge ( PenetrationInfo *  pi1,
PenetrationInfo *  pi2 
)
protected

Definition at line 778 of file PenetrationThread.C.

779{
780 CommonEdgeResult common_edge(NO_COMMON);
781 const std::vector<const Node *> & off_edge_nodes1 = pi1->_off_edge_nodes;
782 const std::vector<const Node *> & off_edge_nodes2 = pi2->_off_edge_nodes;
783 const unsigned dim1 = pi1->_side->dim();
784
785 if (dim1 == 1)
786 {
787 mooseAssert(pi2->_side->dim() == 1, "Incompatible dimensions.");
788 mooseAssert(off_edge_nodes1.size() < 2 && off_edge_nodes2.size() < 2,
789 "off_edge_nodes size should be <2 for 2D contact");
790 if (off_edge_nodes1.size() == 1 && off_edge_nodes2.size() == 1 &&
791 off_edge_nodes1[0] == off_edge_nodes2[0])
792 common_edge = COMMON_EDGE;
793 }
794 else
795 {
796 mooseAssert(dim1 == 2 && pi2->_side->dim() == 2, "Incompatible dimensions.");
797 mooseAssert(off_edge_nodes1.size() < 3 && off_edge_nodes2.size() < 3,
798 "off_edge_nodes size should be <3 for 3D contact");
799 if (off_edge_nodes1.size() == 1)
800 {
801 if (off_edge_nodes2.size() == 1)
802 {
803 if (off_edge_nodes1[0] == off_edge_nodes2[0])
804 common_edge = COMMON_NODE;
805 }
806 else if (off_edge_nodes2.size() == 2)
807 {
808 if (off_edge_nodes1[0] == off_edge_nodes2[0] || off_edge_nodes1[0] == off_edge_nodes2[1])
809 common_edge = EDGE_AND_COMMON_NODE;
810 }
811 }
812 else if (off_edge_nodes1.size() == 2)
813 {
814 if (off_edge_nodes2.size() == 1)
815 {
816 if (off_edge_nodes1[0] == off_edge_nodes2[0] || off_edge_nodes1[1] == off_edge_nodes2[0])
817 common_edge = EDGE_AND_COMMON_NODE;
818 }
819 else if (off_edge_nodes2.size() == 2)
820 {
821 if ((off_edge_nodes1[0] == off_edge_nodes2[0] &&
822 off_edge_nodes1[1] == off_edge_nodes2[1]) ||
823 (off_edge_nodes1[1] == off_edge_nodes2[0] && off_edge_nodes1[0] == off_edge_nodes2[1]))
824 common_edge = COMMON_EDGE;
825 }
826 }
827 }
828 return common_edge;
829}

Referenced by competeInteractions().

◆ isFaceReasonableCandidate()

bool PenetrationThread::isFaceReasonableCandidate ( const Elem *  primary_elem,
const Elem *  side,
libMesh::FEBase *  fe,
const libMesh::Point *  secondary_point,
const Real  tangential_tolerance 
)
protected

Definition at line 1335 of file PenetrationThread.C.

1340{
1341 // Contact problem dimension; exceeds the element dimension for a primary surface element
1342 unsigned int dim = side->dim() + 1;
1343
1344 const std::vector<Point> & phys_point = fe->get_xyz();
1345
1346 const std::vector<RealGradient> & dxyz_dxi = fe->get_dxyzdxi();
1347 const std::vector<RealGradient> & dxyz_deta = fe->get_dxyzdeta();
1348
1349 Point ref_point;
1350
1351 std::vector<Point> points(1); // Default constructor gives us a point at 0,0,0
1352
1353 fe->reinit(side, &points);
1354
1355 RealGradient d = *secondary_point - phys_point[0];
1356
1357 const Real twosqrt2 = 2.8284; // way more precision than we actually need here
1358 Real max_face_length = side->hmax() + twosqrt2 * tangential_tolerance;
1359
1360 RealVectorValue normal;
1361 if (dim - 1 == 2)
1362 {
1363 normal = dxyz_dxi[0].cross(dxyz_deta[0]);
1364 }
1365 else if (dim - 1 == 1)
1366 normal = dxyz_dxi[0].cross(Moose::outOfPlaneNormal(*primary_elem));
1367 else
1368 {
1369 return true;
1370 }
1371 normal /= normal.norm();
1372
1373 const Real dot(d * normal);
1374
1375 const RealGradient normcomp = dot * normal;
1376 const RealGradient tangcomp = d - normcomp;
1377
1378 const Real tangdist = tangcomp.norm();
1379
1380 // Increase the size of the zone that we consider if the vector from the face
1381 // to the node has a larger normal component
1382 const Real faceExpansionFactor = 2.0 * (1.0 + normcomp.norm() / d.norm());
1383
1384 bool isReasonableCandidate = true;
1385 if (tangdist > faceExpansionFactor * max_face_length)
1386 {
1387 isReasonableCandidate = false;
1388 }
1389 return isReasonableCandidate;
1390}
unsigned int dim
virtual_for_inffe const std::vector< RealGradient > & get_dxyzdeta() const
virtual_for_inffe const std::vector< RealGradient > & get_dxyzdxi() const
TypeVector< typename CompareTypes< T, T2 >::supertype > cross(const TypeVector< T2 > &v) const
libMesh::Point outOfPlaneNormal(const libMesh::Elem &primary_elem)
VectorValue< Real > RealVectorValue
Definition SubProblem.h:34

Referenced by createInfoForElem().

◆ join()

void PenetrationThread::join ( const PenetrationThread &  other)

Definition at line 644 of file PenetrationThread.C.

645{
647 other._recheck_secondary_nodes.begin(),
648 other._recheck_secondary_nodes.end());
649}
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...

◆ operator()()

void PenetrationThread::operator() ( const NodeIdRange &  range)

Definition at line 157 of file PenetrationThread.C.

158{
159 ParallelUniqueId puid;
160 _tid = puid.id;
161
162 // Must get the variables every time this is run because _tid can change
165 {
169 }
170
171 const BoundaryInfo & boundary_info = _mesh.getMesh().get_boundary_info();
172 std::unique_ptr<PointLocatorBase> point_locator;
174 point_locator = _mesh.getPointLocator();
175
176 for (const auto & node_id : range)
177 {
178 const Node & node = _mesh.nodeRef(node_id);
179
180 // We're going to get a reference to the pointer for the pinfo for this node
181 // This will allow us to manipulate this pointer without having to go through
182 // the _penetration_info map... meaning this is the only mutex we'll have to do!
184 PenetrationInfo *& info = _penetration_info[node.id()];
186
187 std::vector<PenetrationInfo *> p_info;
188 bool info_set(false);
189
190 // See if we already have info about this node
191 if (info)
192 {
193 FEBase * fe_elem = _fes[_tid][info->_elem->dim()];
194 FEBase * fe_side = _fes[_tid][info->_side->dim()];
195
196 if (!_update_location && (info->_distance >= 0 || info->isCaptured()))
197 {
198 const Point contact_ref = info->_closest_point_ref;
199 bool contact_point_on_side(false);
200
201 // Secondary position must be the previous contact point
202 // Use the previous reference coordinates
203 std::vector<Point> points(1);
204 points[0] = contact_ref;
205 const std::vector<Point> & secondary_pos = fe_side->get_xyz();
206 bool search_succeeded = false;
207
209 fe_elem,
210 fe_side,
211 _fe_type,
212 secondary_pos[0],
213 false,
215 contact_point_on_side,
216 search_succeeded);
217
218 // Restore the original reference coordinates
219 info->_closest_point_ref = contact_ref;
220 // Just calculated as the distance of the contact point off the surface (0). Set to 0 to
221 // avoid round-off.
222 info->_distance = 0.0;
223 info_set = true;
224 }
225 else
226 {
227 Real old_tangential_distance(info->_tangential_distance);
228 bool contact_point_on_side(false);
229 bool search_succeeded = false;
230
232 fe_elem,
233 fe_side,
234 _fe_type,
235 node,
236 false,
238 contact_point_on_side,
239 search_succeeded);
240
241 if (contact_point_on_side)
242 {
243 if (info->_tangential_distance <= 0.0) // on the face
244 {
245 info_set = true;
246 }
247 else if (info->_tangential_distance > 0.0 && old_tangential_distance > 0.0)
248 { // off the face but within tolerance, was that way on the last step too
249 if (info->_side->dim() == 2 && info->_off_edge_nodes.size() < 2)
250 { // Closest point on face is on a node rather than an edge. Another
251 // face might be a better candidate.
252 }
253 else
254 {
255 info_set = true;
256 }
257 }
258 }
259 }
260 }
261
262 if (!info_set)
263 {
264 const Node * closest_node = _nearest_node.nearestNode(node.id());
265
266 std::vector<dof_id_type> located_elem_ids;
267 const std::vector<dof_id_type> * closest_elems;
268
270 {
271 std::set<const Elem *> candidate_elements;
272 (*point_locator)(*closest_node, candidate_elements);
273
274 if (candidate_elements.empty())
275 mooseError("No proximate elements found at node ",
276 closest_node->id(),
277 " at ",
278 cast_ref<const Point &>(*closest_node),
279 " on boundary ",
281 ". This should never happen.");
282
283 for (const Elem * elem : candidate_elements)
284 {
286 {
287 located_elem_ids.push_back(elem->id());
288 continue;
289 }
290 for (auto s : elem->side_index_range())
291 if (boundary_info.has_boundary_id(elem, s, _primary_boundary))
292 {
293 located_elem_ids.push_back(elem->id());
294 break;
295 }
296 }
297
298 if (located_elem_ids.empty())
299 mooseError("No proximate elements found at node ",
300 closest_node->id(),
301 " at ",
302 cast_ref<const Point &>(*closest_node),
303 " on boundary ",
305 " share that boundary. This may happen if the mesh uses the same boundary id "
306 "for a nodeset and an unrelated sideset.");
307
308 closest_elems = &located_elem_ids;
309 }
310 else
311 {
312 auto node_to_elem_pair = _node_to_elem_map.find(closest_node->id());
313 mooseAssert(node_to_elem_pair != _node_to_elem_map.end(),
314 "Missing entry in node to elem map");
315 closest_elems = &(node_to_elem_pair->second);
316 }
317
318 for (const auto & elem_id : *closest_elems)
319 {
320 const Elem * elem = _mesh.elemPtr(elem_id);
321
322 std::vector<PenetrationInfo *> thisElemInfo;
323
324 std::vector<const Node *> nodesThatMustBeOnSide;
325 // If we have a disconnected mesh, we might not have *any*
326 // nodes that must be on a side we check; we'll rely on
327 // boundary info to find valid sides, then rely on comparing
328 // closest points from each to find the best.
329 //
330 // If we don't have a disconnected mesh, then for maximum
331 // backwards compatibility we're still using the older ridge
332 // and peak detection code, which depends on us ruling out
333 // sides that don't touch closest_node.
335 nodesThatMustBeOnSide.push_back(closest_node);
337 thisElemInfo, p_info, &node, elem, nodesThatMustBeOnSide, _check_whether_reasonable);
338 }
339
341 {
342 Real min_distance_sq = std::numeric_limits<Real>::max();
343 Point best_point;
344 unsigned int best_i = invalid_uint;
345
346 // Find closest point in all p_info to the node of interest
347 for (unsigned int i = 0; i < p_info.size(); ++i)
348 {
349 const Point closest_point = closest_point_to_side(node, *p_info[i]->_side);
350 const Real distance_sq = (closest_point - node).norm_sq();
351 if (distance_sq < min_distance_sq)
352 {
353 min_distance_sq = distance_sq;
354 best_point = closest_point;
355 best_i = i;
356 }
357 }
358
359 p_info[best_i]->_closest_point = best_point;
360 p_info[best_i]->_distance =
361 (p_info[best_i]->_distance >= 0.0 ? 1.0 : -1.0) * std::sqrt(min_distance_sq);
363 mooseError("Normal smoothing not implemented with point locator code");
364 Point normal = (best_point - node).unit();
365 const Real dot = normal * p_info[best_i]->_normal;
366 if (dot < 0)
367 normal *= -1;
368 p_info[best_i]->_normal = normal;
369
370 switchInfo(info, p_info[best_i]);
371 info_set = true;
372 }
373 else
374 {
375 if (p_info.size() == 1)
376 {
377 if (p_info[0]->_tangential_distance <= _tangential_tolerance)
378 {
379 switchInfo(info, p_info[0]);
380 info_set = true;
381 }
382 }
383 else if (p_info.size() > 1)
384 {
385 // Loop through all pairs of faces, and check for contact on ridge between each face pair
386 std::vector<RidgeData> ridgeDataVec;
387 for (unsigned int i = 0; i + 1 < p_info.size(); ++i)
388 for (unsigned int j = i + 1; j < p_info.size(); ++j)
389 {
390 Point closest_coor;
391 Real tangential_distance(0.0);
392 const Node * closest_node_on_ridge = NULL;
393 unsigned int index = 0;
394 Point closest_coor_ref;
395 bool found_ridge_contact_point = findRidgeContactPoint(closest_coor,
396 tangential_distance,
397 closest_node_on_ridge,
398 index,
399 closest_coor_ref,
400 p_info,
401 i,
402 j);
403 if (found_ridge_contact_point)
404 {
405 RidgeData rpd;
406 rpd._closest_coor = closest_coor;
407 rpd._tangential_distance = tangential_distance;
408 rpd._closest_node = closest_node_on_ridge;
409 rpd._index = index;
410 rpd._closest_coor_ref = closest_coor_ref;
411 ridgeDataVec.push_back(rpd);
412 }
413 }
414
415 if (ridgeDataVec.size() > 0) // Either find the ridge pair that is the best or find a peak
416 {
417 // Group together ridges for which we are off the edge of a common node.
418 // Those are peaks.
419 std::vector<RidgeSetData> ridgeSetDataVec;
420 for (unsigned int i = 0; i < ridgeDataVec.size(); ++i)
421 {
422 bool foundSetWithMatchingNode = false;
423 for (unsigned int j = 0; j < ridgeSetDataVec.size(); ++j)
424 {
425 if (ridgeDataVec[i]._closest_node != NULL &&
426 ridgeDataVec[i]._closest_node == ridgeSetDataVec[j]._closest_node)
427 {
428 foundSetWithMatchingNode = true;
429 ridgeSetDataVec[j]._ridge_data_vec.push_back(ridgeDataVec[i]);
430 break;
431 }
432 }
433 if (!foundSetWithMatchingNode)
434 {
435 RidgeSetData rsd;
436 rsd._distance = std::numeric_limits<Real>::max();
437 rsd._ridge_data_vec.push_back(ridgeDataVec[i]);
438 rsd._closest_node = ridgeDataVec[i]._closest_node;
439 ridgeSetDataVec.push_back(rsd);
440 }
441 }
442 // Compute distance to each set of ridges
443 for (unsigned int i = 0; i < ridgeSetDataVec.size(); ++i)
444 {
445 if (ridgeSetDataVec[i]._closest_node !=
446 NULL) // Either a peak or off the edge of single ridge
447 {
448 if (ridgeSetDataVec[i]._ridge_data_vec.size() == 1) // off edge of single ridge
449 {
450 if (ridgeSetDataVec[i]._ridge_data_vec[0]._tangential_distance <=
451 _tangential_tolerance) // off within tolerance
452 {
453 ridgeSetDataVec[i]._closest_coor =
454 ridgeSetDataVec[i]._ridge_data_vec[0]._closest_coor;
455 Point contact_point_vec = node - ridgeSetDataVec[i]._closest_coor;
456 ridgeSetDataVec[i]._distance = contact_point_vec.norm();
457 }
458 }
459 else // several ridges join at common node to make a peak. The common node is the
460 // contact point
461 {
462 ridgeSetDataVec[i]._closest_coor = *ridgeSetDataVec[i]._closest_node;
463 Point contact_point_vec = node - ridgeSetDataVec[i]._closest_coor;
464 ridgeSetDataVec[i]._distance = contact_point_vec.norm();
465 }
466 }
467 else // on a single ridge
468 {
469 ridgeSetDataVec[i]._closest_coor =
470 ridgeSetDataVec[i]._ridge_data_vec[0]._closest_coor;
471 Point contact_point_vec = node - ridgeSetDataVec[i]._closest_coor;
472 ridgeSetDataVec[i]._distance = contact_point_vec.norm();
473 }
474 }
475 // Find the set of ridges closest to us.
476 unsigned int closest_ridge_set_index(0);
477 Real closest_distance(ridgeSetDataVec[0]._distance);
478 Point closest_point(ridgeSetDataVec[0]._closest_coor);
479 for (unsigned int i = 1; i < ridgeSetDataVec.size(); ++i)
480 {
481 if (ridgeSetDataVec[i]._distance < closest_distance)
482 {
483 closest_ridge_set_index = i;
484 closest_distance = ridgeSetDataVec[i]._distance;
485 closest_point = ridgeSetDataVec[i]._closest_coor;
486 }
487 }
488
489 if (closest_distance <
490 std::numeric_limits<Real>::max()) // contact point is on the closest ridge set
491 {
492 // find the face in the ridge set with the smallest index, assign that one to the
493 // interaction
494 // TODO: We may need to select the face with the largest projected distance
495 // rather than the smallest index, similar to what is done when picking the
496 // face in findRidgeContactPoint() to better condition corner-case checks for
497 // sign changes. That's less likely to be a problem here, though, and the
498 // code to do that would be messier.
499 unsigned int face_index(std::numeric_limits<unsigned int>::max());
500 for (unsigned int i = 0;
501 i < ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec.size();
502 ++i)
503 {
504 if (ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec[i]._index < face_index)
505 face_index = ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec[i]._index;
506 }
507
508 mooseAssert(face_index < std::numeric_limits<unsigned int>::max(),
509 "face_index invalid");
510
511 p_info[face_index]->_closest_point = closest_point;
512 p_info[face_index]->_distance =
513 (p_info[face_index]->_distance >= 0.0 ? 1.0 : -1.0) * closest_distance;
514 // Calculate the normal as the vector from the ridge to the point only if we're not
515 // doing normal
516 // smoothing. Normal smoothing will average out the normals on its own.
518 {
519 Point normal(closest_point - node);
520 const Real len(normal.norm());
521 if (len > 0)
522 {
523 normal /= len;
524 }
525 const Real dot(normal * p_info[face_index]->_normal);
526 if (dot < 0)
527 normal *= -1;
528 p_info[face_index]->_normal = normal;
529 }
530 p_info[face_index]->_tangential_distance = 0.0;
531
532 Point closest_point_ref;
533 if (ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec.size() ==
534 1) // contact with a single ridge rather than a peak
535 {
536 p_info[face_index]->_tangential_distance = ridgeSetDataVec[closest_ridge_set_index]
537 ._ridge_data_vec[0]
538 ._tangential_distance;
539 p_info[face_index]->_closest_point_ref =
540 ridgeSetDataVec[closest_ridge_set_index]._ridge_data_vec[0]._closest_coor_ref;
541 }
542 else
543 { // peak
544 const Node * closest_node_on_face;
545 bool restricted = restrictPointToFace(p_info[face_index]->_closest_point_ref,
546 closest_node_on_face,
547 p_info[face_index]->_side);
548 if (restricted)
549 {
550 if (closest_node_on_face !=
551 ridgeSetDataVec[closest_ridge_set_index]._closest_node)
552 {
553 mooseError("Closest node when restricting point to face != closest node from "
554 "RidgeSetData");
555 }
556 }
557 }
558
559 FEBase * fe = _fes[_tid][p_info[face_index]->_side->dim()];
560 std::vector<Point> points(1);
561 points[0] = p_info[face_index]->_closest_point_ref;
562 fe->reinit(p_info[face_index]->_side, &points);
563 p_info[face_index]->_side_phi = fe->get_phi();
564 p_info[face_index]->_side_grad_phi = fe->get_dphi();
565 p_info[face_index]->_dxyzdxi = fe->get_dxyzdxi();
566 p_info[face_index]->_dxyzdeta = fe->get_dxyzdeta();
567 p_info[face_index]->_d2xyzdxideta = fe->get_d2xyzdxideta();
568
569 switchInfo(info, p_info[face_index]);
570 info_set = true;
571 }
572 else
573 { // todo:remove invalid ridge cases so they don't mess up individual face
574 // competition????
575 }
576 }
577
578 if (!info_set) // contact wasn't on a ridge -- compete individual interactions
579 {
580 unsigned int best(0), i(1);
581 do
582 {
583 CompeteInteractionResult CIResult = competeInteractions(p_info[best], p_info[i]);
584 if (CIResult == FIRST_WINS)
585 {
586 i++;
587 }
588 else if (CIResult == SECOND_WINS)
589 {
590 best = i;
591 i++;
592 }
593 else if (CIResult == NEITHER_WINS)
594 {
595 best = i + 1;
596 i += 2;
597 }
598 } while (i < p_info.size() && best < p_info.size());
599 if (best < p_info.size())
600 {
601 // Ensure final info is within the tangential tolerance
602 if (p_info[best]->_tangential_distance <= _tangential_tolerance)
603 {
604 switchInfo(info, p_info[best]);
605 info_set = true;
606 }
607 }
608 }
609 }
610 }
611 }
612
613 if (!info_set)
614 {
615 // If penetration is not detected within the saved patch, it is possible
616 // that the secondary node has moved outside the saved patch. So, the patch
617 // for the secondary nodes saved in _recheck_secondary_nodes has to be updated
618 // and the penetration detection has to be re-run on the updated patch.
619
620 _recheck_secondary_nodes.push_back(node_id);
621
622 delete info;
623 info = NULL;
624 }
625 else
626 {
627 smoothNormal(info, p_info, node);
628 FEBase * fe = _fes[_tid][info->_side->dim()];
629 computeSlip(*fe, *info);
630 }
631
632 for (unsigned int j = 0; j < p_info.size(); ++j)
633 {
634 if (p_info[j])
635 {
636 delete p_info[j];
637 p_info[j] = NULL;
638 }
639 }
640 }
641}
Threads::spin_mutex pinfo_mutex
virtual const Node & nodeRef(const dof_id_type i) const
Definition MooseMesh.C:856
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default),...
Definition MooseMesh.C:3883
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.
void computeSlip(libMesh::FEBase &fe, PenetrationInfo &info)
MooseVariable * _nodal_normal_x
MooseVariable * _nodal_normal_z
MooseVariable * _nodal_normal_y
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)
void switchInfo(PenetrationInfo *&info, PenetrationInfo *&infoNew)
bool restrictPointToFace(libMesh::Point &p, const Node *&closest_node, const Elem *side)
void smoothNormal(PenetrationInfo *info, std::vector< PenetrationInfo * > &p_info, const Node &node)
CompeteInteractionResult competeInteractions(PenetrationInfo *pi1, PenetrationInfo *pi2)
When interactions are identified between a node and two faces, compete between the faces to determine...
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_DEVICE_INLINE auto norm_sq(const T &a)

◆ restrictPointToFace()

bool PenetrationThread::restrictPointToFace ( libMesh::Point &  p,
const Node *&  closest_node,
const Elem *  side 
)
protected

Definition at line 1154 of file PenetrationThread.C.

1155{
1156 const ElemType t(side->type());
1157 Real & xi = p(0);
1158 Real & eta = p(1);
1159 closest_node = NULL;
1160
1161 bool off_of_this_face(false);
1162
1163 switch (t)
1164 {
1165 case EDGE2:
1166 case EDGE3:
1167 case EDGE4:
1168 {
1169 if (xi < -1.0)
1170 {
1171 xi = -1.0;
1172 off_of_this_face = true;
1173 closest_node = side->node_ptr(0);
1174 }
1175 else if (xi > 1.0)
1176 {
1177 xi = 1.0;
1178 off_of_this_face = true;
1179 closest_node = side->node_ptr(1);
1180 }
1181 break;
1182 }
1183
1184 case TRI3:
1185 case TRI6:
1186 case TRI7:
1187 {
1188 if (eta < 0.0)
1189 {
1190 eta = 0.0;
1191 off_of_this_face = true;
1192 if (xi < 0.5)
1193 {
1194 closest_node = side->node_ptr(0);
1195 if (xi < 0.0)
1196 xi = 0.0;
1197 }
1198 else
1199 {
1200 closest_node = side->node_ptr(1);
1201 if (xi > 1.0)
1202 xi = 1.0;
1203 }
1204 }
1205 else if ((xi + eta) > 1.0)
1206 {
1207 Real delta = (xi + eta - 1.0) / 2.0;
1208 xi -= delta;
1209 eta -= delta;
1210 off_of_this_face = true;
1211 if (xi > 0.5)
1212 {
1213 closest_node = side->node_ptr(1);
1214 if (xi > 1.0)
1215 {
1216 xi = 1.0;
1217 eta = 0.0;
1218 }
1219 }
1220 else
1221 {
1222 closest_node = side->node_ptr(2);
1223 if (xi < 0.0)
1224 {
1225 xi = 0.0;
1226 eta = 1.0;
1227 }
1228 }
1229 }
1230 else if (xi < 0.0)
1231 {
1232 xi = 0.0;
1233 off_of_this_face = true;
1234 if (eta > 0.5)
1235 {
1236 closest_node = side->node_ptr(2);
1237 if (eta > 1.0)
1238 eta = 1.0;
1239 }
1240 else
1241 {
1242 closest_node = side->node_ptr(0);
1243 if (eta < 0.0)
1244 eta = 0.0;
1245 }
1246 }
1247 break;
1248 }
1249
1250 case QUAD4:
1251 case QUAD8:
1252 case QUAD9:
1253 {
1254 if (eta < -1.0)
1255 {
1256 eta = -1.0;
1257 off_of_this_face = true;
1258 if (xi < 0.0)
1259 {
1260 closest_node = side->node_ptr(0);
1261 if (xi < -1.0)
1262 xi = -1.0;
1263 }
1264 else
1265 {
1266 closest_node = side->node_ptr(1);
1267 if (xi > 1.0)
1268 xi = 1.0;
1269 }
1270 }
1271 else if (xi > 1.0)
1272 {
1273 xi = 1.0;
1274 off_of_this_face = true;
1275 if (eta < 0.0)
1276 {
1277 closest_node = side->node_ptr(1);
1278 if (eta < -1.0)
1279 eta = -1.0;
1280 }
1281 else
1282 {
1283 closest_node = side->node_ptr(2);
1284 if (eta > 1.0)
1285 eta = 1.0;
1286 }
1287 }
1288 else if (eta > 1.0)
1289 {
1290 eta = 1.0;
1291 off_of_this_face = true;
1292 if (xi < 0.0)
1293 {
1294 closest_node = side->node_ptr(3);
1295 if (xi < -1.0)
1296 xi = -1.0;
1297 }
1298 else
1299 {
1300 closest_node = side->node_ptr(2);
1301 if (xi > 1.0)
1302 xi = 1.0;
1303 }
1304 }
1305 else if (xi < -1.0)
1306 {
1307 xi = -1.0;
1308 off_of_this_face = true;
1309 if (eta < 0.0)
1310 {
1311 closest_node = side->node_ptr(0);
1312 if (eta < -1.0)
1313 eta = -1.0;
1314 }
1315 else
1316 {
1317 closest_node = side->node_ptr(3);
1318 if (eta > 1.0)
1319 eta = 1.0;
1320 }
1321 }
1322 break;
1323 }
1324
1325 default:
1326 {
1327 mooseError("Unsupported face type: ", t);
1328 break;
1329 }
1330 }
1331 return off_of_this_face;
1332}

Referenced by operator()().

◆ restrictPointToSpecifiedEdgeOfFace()

bool PenetrationThread::restrictPointToSpecifiedEdgeOfFace ( libMesh::Point &  p,
const Node *&  closest_node,
const Elem *  side,
const std::vector< const Node * > &  edge_nodes 
)
protected

Definition at line 980 of file PenetrationThread.C.

984{
985 const ElemType t = side->type();
986 Real & xi = p(0);
987 Real & eta = p(1);
988 closest_node = NULL;
989
990 std::vector<unsigned int> local_node_indices;
991 for (const auto & edge_node : edge_nodes)
992 {
993 unsigned int local_index = side->get_node_index(edge_node);
994 if (local_index == libMesh::invalid_uint)
995 mooseError("Side does not contain node");
996 local_node_indices.push_back(local_index);
997 }
998 mooseAssert(local_node_indices.size() == side->dim(),
999 "Number of edge nodes must match side dimensionality");
1000 std::sort(local_node_indices.begin(), local_node_indices.end());
1001
1002 bool off_of_this_edge = false;
1003
1004 switch (t)
1005 {
1006 case EDGE2:
1007 case EDGE3:
1008 case EDGE4:
1009 {
1010 if (local_node_indices[0] == 0)
1011 {
1012 if (xi <= -1.0)
1013 {
1014 xi = -1.0;
1015 off_of_this_edge = true;
1016 closest_node = side->node_ptr(0);
1017 }
1018 }
1019 else if (local_node_indices[0] == 1)
1020 {
1021 if (xi >= 1.0)
1022 {
1023 xi = 1.0;
1024 off_of_this_edge = true;
1025 closest_node = side->node_ptr(1);
1026 }
1027 }
1028 else
1029 {
1030 mooseError("Invalid local node indices");
1031 }
1032 break;
1033 }
1034
1035 case TRI3:
1036 case TRI6:
1037 case TRI7:
1038 {
1039 if ((local_node_indices[0] == 0) && (local_node_indices[1] == 1))
1040 {
1041 if (eta <= 0.0)
1042 {
1043 eta = 0.0;
1044 off_of_this_edge = true;
1045 if (xi < 0.0)
1046 closest_node = side->node_ptr(0);
1047 else if (xi > 1.0)
1048 closest_node = side->node_ptr(1);
1049 }
1050 }
1051 else if ((local_node_indices[0] == 1) && (local_node_indices[1] == 2))
1052 {
1053 if ((xi + eta) > 1.0)
1054 {
1055 Real delta = (xi + eta - 1.0) / 2.0;
1056 xi -= delta;
1057 eta -= delta;
1058 off_of_this_edge = true;
1059 if (xi > 1.0)
1060 closest_node = side->node_ptr(1);
1061 else if (xi < 0.0)
1062 closest_node = side->node_ptr(2);
1063 }
1064 }
1065 else if ((local_node_indices[0] == 0) && (local_node_indices[1] == 2))
1066 {
1067 if (xi <= 0.0)
1068 {
1069 xi = 0.0;
1070 off_of_this_edge = true;
1071 if (eta > 1.0)
1072 closest_node = side->node_ptr(2);
1073 else if (eta < 0.0)
1074 closest_node = side->node_ptr(0);
1075 }
1076 }
1077 else
1078 {
1079 mooseError("Invalid local node indices");
1080 }
1081
1082 break;
1083 }
1084
1085 case QUAD4:
1086 case QUAD8:
1087 case QUAD9:
1088 {
1089 if ((local_node_indices[0] == 0) && (local_node_indices[1] == 1))
1090 {
1091 if (eta <= -1.0)
1092 {
1093 eta = -1.0;
1094 off_of_this_edge = true;
1095 if (xi < -1.0)
1096 closest_node = side->node_ptr(0);
1097 else if (xi > 1.0)
1098 closest_node = side->node_ptr(1);
1099 }
1100 }
1101 else if ((local_node_indices[0] == 1) && (local_node_indices[1] == 2))
1102 {
1103 if (xi >= 1.0)
1104 {
1105 xi = 1.0;
1106 off_of_this_edge = true;
1107 if (eta < -1.0)
1108 closest_node = side->node_ptr(1);
1109 else if (eta > 1.0)
1110 closest_node = side->node_ptr(2);
1111 }
1112 }
1113 else if ((local_node_indices[0] == 2) && (local_node_indices[1] == 3))
1114 {
1115 if (eta >= 1.0)
1116 {
1117 eta = 1.0;
1118 off_of_this_edge = true;
1119 if (xi < -1.0)
1120 closest_node = side->node_ptr(3);
1121 else if (xi > 1.0)
1122 closest_node = side->node_ptr(2);
1123 }
1124 }
1125 else if ((local_node_indices[0] == 0) && (local_node_indices[1] == 3))
1126 {
1127 if (xi <= -1.0)
1128 {
1129 xi = -1.0;
1130 off_of_this_edge = true;
1131 if (eta < -1.0)
1132 closest_node = side->node_ptr(0);
1133 else if (eta > 1.0)
1134 closest_node = side->node_ptr(3);
1135 }
1136 }
1137 else
1138 {
1139 mooseError("Invalid local node indices");
1140 }
1141 break;
1142 }
1143
1144 default:
1145 {
1146 mooseError("Unsupported face type: ", t);
1147 break;
1148 }
1149 }
1150 return off_of_this_edge;
1151}

Referenced by findRidgeContactPoint().

◆ smoothNormal()

void PenetrationThread::smoothNormal ( PenetrationInfo *  info,
std::vector< PenetrationInfo * > &  p_info,
const Node &  node 
)
protected

Definition at line 1415 of file PenetrationThread.C.

1418{
1420 {
1422 {
1423 // If we are within the smoothing distance of any edges or corners, find the
1424 // corner nodes for those edges/corners, and weights from distance to edge/corner
1425 std::vector<Real> edge_face_weights;
1426 std::vector<PenetrationInfo *> edge_face_info;
1427
1428 getSmoothingFacesAndWeights(info, edge_face_info, edge_face_weights, p_info, node);
1429
1430 mooseAssert(edge_face_info.size() == edge_face_weights.size(),
1431 "edge_face_info.size() != edge_face_weights.size()");
1432
1433 if (edge_face_info.size() > 0)
1434 {
1435 // Smooth the normal using the weighting functions for all participating faces.
1436 RealVectorValue new_normal;
1437 Real this_face_weight = 1.0;
1438
1439 for (unsigned int efwi = 0; efwi < edge_face_weights.size(); ++efwi)
1440 {
1441 PenetrationInfo * npi = edge_face_info[efwi];
1442 if (npi)
1443 new_normal += npi->_normal * edge_face_weights[efwi];
1444
1445 this_face_weight -= edge_face_weights[efwi];
1446 }
1447 mooseAssert(this_face_weight >= (0.25 - 1e-8),
1448 "Sum of weights of other faces shouldn't exceed 0.75");
1449 new_normal += info->_normal * this_face_weight;
1450
1451 const Real len = new_normal.norm();
1452 if (len > 0)
1453 new_normal /= len;
1454
1455 info->_normal = new_normal;
1456 }
1457 }
1459 {
1460 // params.addParam<VariableName>("var_name","description");
1461 // getParam<VariableName>("var_name")
1462 info->_normal(0) = _nodal_normal_x->getValue(info->_side, info->_side_phi);
1463 info->_normal(1) = _nodal_normal_y->getValue(info->_side, info->_side_phi);
1464 info->_normal(2) = _nodal_normal_z->getValue(info->_side, info->_side_phi);
1465 const Real len(info->_normal.norm());
1466 if (len > 0)
1467 info->_normal /= len;
1468 }
1469 }
1470}
OutputType getValue(const Elem *elem, const std::vector< std::vector< OutputShape > > &phi) const
Compute the variable value at a point on an element.
RealVectorValue _normal
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)

Referenced by operator()().

◆ switchInfo()

void PenetrationThread::switchInfo ( PenetrationInfo *&  info,
PenetrationInfo *&  infoNew 
)
protected

Definition at line 652 of file PenetrationThread.C.

653{
654 mooseAssert(infoNew != NULL, "infoNew object is null");
655 if (info)
656 {
657 infoNew->_starting_elem = info->_starting_elem;
658 infoNew->_starting_side_num = info->_starting_side_num;
659 infoNew->_starting_closest_point_ref = info->_starting_closest_point_ref;
660 infoNew->_incremental_slip = info->_incremental_slip;
661 infoNew->_accumulated_slip = info->_accumulated_slip;
662 infoNew->_accumulated_slip_old = info->_accumulated_slip_old;
663 infoNew->_frictional_energy = info->_frictional_energy;
664 infoNew->_frictional_energy_old = info->_frictional_energy_old;
665 infoNew->_contact_force = info->_contact_force;
666 infoNew->_contact_force_old = info->_contact_force_old;
667 infoNew->_lagrange_multiplier = info->_lagrange_multiplier;
668 infoNew->_lagrange_multiplier_slip = info->_lagrange_multiplier_slip;
669 infoNew->_locked_this_step = info->_locked_this_step;
670 infoNew->_stick_locked_this_step = info->_stick_locked_this_step;
671 infoNew->_mech_status = info->_mech_status;
672 infoNew->_mech_status_old = info->_mech_status_old;
673 }
674 else
675 {
676 infoNew->_starting_elem = infoNew->_elem;
677 infoNew->_starting_side_num = infoNew->_side_num;
679 }
680 delete info;
681 info = infoNew;
682 infoNew = NULL; // Set this to NULL so that we don't delete it (now owned by _penetration_info).
683}
MECH_STATUS_ENUM _mech_status
RealVectorValue _contact_force_old
unsigned int _locked_this_step
MECH_STATUS_ENUM _mech_status_old
RealVectorValue _contact_force
unsigned int _starting_side_num
const Elem * _starting_elem
Point _starting_closest_point_ref
unsigned int _side_num
RealVectorValue _lagrange_multiplier_slip
unsigned int _stick_locked_this_step

Referenced by operator()().

Member Data Documentation

◆ _check_whether_reasonable

bool PenetrationThread::_check_whether_reasonable
protected

Definition at line 65 of file PenetrationThread.h.

Referenced by operator()().

◆ _do_normal_smoothing

bool PenetrationThread::_do_normal_smoothing
protected

Definition at line 68 of file PenetrationThread.h.

Referenced by operator()(), and smoothNormal().

◆ _elem_side_builder

libMesh::ElemSideBuilder PenetrationThread::_elem_side_builder
protected

Helper for building element sides without extraneous allocation.

Definition at line 87 of file PenetrationThread.h.

Referenced by computeSlip().

◆ _fe_type

libMesh::FEType& PenetrationThread::_fe_type
protected

Definition at line 78 of file PenetrationThread.h.

Referenced by createInfoForElem(), and operator()().

◆ _fes

std::vector<std::vector<libMesh::FEBase *> >& PenetrationThread::_fes
protected

Definition at line 76 of file PenetrationThread.h.

Referenced by createInfoForElem(), findRidgeContactPoint(), and operator()().

◆ _mesh

const MooseMesh& PenetrationThread::_mesh
protected

◆ _nearest_node

NearestNodeLocator& PenetrationThread::_nearest_node
protected

Definition at line 80 of file PenetrationThread.h.

Referenced by operator()().

◆ _nodal_normal_x

MooseVariable* PenetrationThread::_nodal_normal_x
protected

Definition at line 72 of file PenetrationThread.h.

Referenced by operator()(), and smoothNormal().

◆ _nodal_normal_y

MooseVariable* PenetrationThread::_nodal_normal_y
protected

Definition at line 73 of file PenetrationThread.h.

Referenced by operator()(), and smoothNormal().

◆ _nodal_normal_z

MooseVariable* PenetrationThread::_nodal_normal_z
protected

Definition at line 74 of file PenetrationThread.h.

Referenced by operator()(), and smoothNormal().

◆ _node_to_elem_map

const std::unordered_map<dof_id_type, std::vector<dof_id_type> >& PenetrationThread::_node_to_elem_map
protected

Definition at line 82 of file PenetrationThread.h.

Referenced by getInfoForFacesWithCommonNodes(), and operator()().

◆ _normal_smoothing_distance

Real PenetrationThread::_normal_smoothing_distance
protected

Definition at line 69 of file PenetrationThread.h.

Referenced by getSmoothingEdgeNodesAndWeights().

◆ _normal_smoothing_method

PenetrationLocator::NORMAL_SMOOTHING_METHOD PenetrationThread::_normal_smoothing_method
protected

Definition at line 70 of file PenetrationThread.h.

Referenced by operator()(), and smoothNormal().

◆ _penetration_info

std::map<dof_id_type, PenetrationInfo *>& PenetrationThread::_penetration_info
protected

Definition at line 63 of file PenetrationThread.h.

Referenced by operator()().

◆ _primary_boundary

BoundaryID PenetrationThread::_primary_boundary
protected

Definition at line 59 of file PenetrationThread.h.

Referenced by createInfoForElem(), and operator()().

◆ _recheck_secondary_nodes

std::vector<dof_id_type> PenetrationThread::_recheck_secondary_nodes

List of secondary nodes for which penetration was not detected in the current patch and for which patch has to be updated.

Definition at line 53 of file PenetrationThread.h.

Referenced by PenetrationLocator::detectPenetration(), join(), and operator()().

◆ _secondary_boundary

BoundaryID PenetrationThread::_secondary_boundary
protected

Definition at line 60 of file PenetrationThread.h.

◆ _subproblem

SubProblem& PenetrationThread::_subproblem
protected

Definition at line 56 of file PenetrationThread.h.

Referenced by operator()().

◆ _tangential_tolerance

Real PenetrationThread::_tangential_tolerance
protected

Definition at line 67 of file PenetrationThread.h.

Referenced by competeInteractions(), createInfoForElem(), and operator()().

◆ _tid

THREAD_ID PenetrationThread::_tid
protected

Definition at line 84 of file PenetrationThread.h.

Referenced by createInfoForElem(), findRidgeContactPoint(), and operator()().

◆ _update_location

bool PenetrationThread::_update_location
protected

Definition at line 66 of file PenetrationThread.h.

Referenced by operator()().

◆ _use_point_locator

bool PenetrationThread::_use_point_locator
protected

Definition at line 71 of file PenetrationThread.h.

Referenced by operator()().


The documentation for this class was generated from the following files: