Skip to content

Commit

Permalink
Handle elements with 3 consecutive aligned nodes for non-planity check
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud authored and oanaoana committed Oct 19, 2023
1 parent 673766e commit 5ba53f9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions framework/src/meshgenerators/MeshDiagnosticsGenerator.C
Expand Up @@ -226,9 +226,21 @@ MeshDiagnosticsGenerator::generate()

if (nodes.size() <= 3)
continue;
RealVectorValue v1 = *nodes[0] - *nodes[1];
RealVectorValue v2 = *nodes[0] - *nodes[2];
bool aligned = MooseUtils::absoluteFuzzyEqual(v1 * v2 - v1.norm() * v2.norm(), 0);
// First vector of the base
const RealVectorValue v1 = *nodes[0] - *nodes[1];

// Find another node so that we can form a basis. It should just be node 0, 1, 2
// to form two independent vectors, but degenerate elements can make them aligned
bool aligned = true;
unsigned int third_node_index = 2;
RealVectorValue v2;
while (aligned && third_node_index < nodes.size())
{
v2 = *nodes[0] - *nodes[third_node_index++];
aligned = MooseUtils::absoluteFuzzyEqual(v1 * v2 - v1.norm() * v2.norm(), 0);
}

// Degenerate element, could not find a third node that is not aligned
if (aligned)
continue;

Expand Down Expand Up @@ -332,7 +344,7 @@ MeshDiagnosticsGenerator::generate()
}
if (elements.size() > 0)
{
for (auto & elem : mesh->active_element_ptr_range())
for (auto & elem : elements())
{
for (auto i : make_range(elem->n_sides()))
{
Expand Down

0 comments on commit 5ba53f9

Please sign in to comment.