Skip to content

Commit

Permalink
Contact bug fix
Browse files Browse the repository at this point in the history
In the competition between two faces, the wrong variable was being
used for the distance from one of the faces.  Instead of using the
distance for that face, we were always using 0.  I fixed that and
restructured the logic for better code readability. Addresses #852

r8480
  • Loading branch information
bwspenc authored and permcody committed Feb 14, 2014
1 parent a8f2c81 commit 8014b62
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions framework/src/geomsearch/PenetrationThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -204,26 +204,18 @@ PenetrationThread::operator() (const NodeIdRange & range)
Moose::findContactPoint(*pen_info, _fe, _fe_type, node,
true, contact_point_on_side);

if(contact_point_on_side && info &&
(
(std::abs(info->_distance) > std::abs(distance)) ||
(info->_distance < 0 && distance > 0)
)
)
if (contact_point_on_side)
{
delete info;
info = NULL;
}

if(contact_point_on_side && (!info ||
(
(std::abs(info->_distance) > std::abs(distance)) ||
(info->_distance < 0 && distance > 0)
)
)
)
{
info = pen_info;
if (!info)
{
info = pen_info;
}
else if ((std::abs(info->_distance) > std::abs(pen_info->_distance)) ||
(info->_distance < 0 && pen_info->_distance > 0))
{
delete info;
info = pen_info;
}
}
else
{
Expand All @@ -240,6 +232,7 @@ PenetrationThread::operator() (const NodeIdRange & range)
// No face is clearly above/below this node.
// See if we need to force a match.

//TODO: This won't work for tet/tri elements
// Restrict the parametric coordinates to the domain of the face
for ( unsigned int j(0); j < p_info.size(); ++j )
{
Expand All @@ -249,7 +242,7 @@ PenetrationThread::operator() (const NodeIdRange & range)
{
p_info[j]->_closest_point_ref(k) = -1;
}
if ( p_info[j]->_closest_point_ref(k) > 1 )
else if ( p_info[j]->_closest_point_ref(k) > 1 )
{
p_info[j]->_closest_point_ref(k) = 1;
}
Expand Down

0 comments on commit 8014b62

Please sign in to comment.