Skip to content
Snippets Groups Projects
Commit 39a8a088 authored by mattijs's avatar mattijs
Browse files

ENH: symmetryPolyPatch: handle zero faces case

parent c2f8fca5
Branches
Tags
No related merge requests found
......@@ -114,17 +114,26 @@ const Foam::vector& Foam::symmetryPlanePolyPatch::n() const
// as the average face-normal
if (magSqr(n_) < 0.5)
{
const vectorField& nf(faceNormals());
n_ = gAverage(nf);
// Check the symmetry plane is planar
forAll(nf, facei)
if (returnReduce(size(), sumOp<label>()) == 0)
{
// No faces in patch. Avoid gAverage complaining and set
// normal to nonsense value to catch any use
n_ = vector::rootMax;
}
else
{
if (magSqr(n_ - nf[facei]) > SMALL)
const vectorField& nf(faceNormals());
n_ = gAverage(nf);
// Check the symmetry plane is planar
forAll(nf, facei)
{
FatalErrorIn("symmetryPlanePolyPatch::n()")
<< "Symmetry plane '" << name() << "' is not planar"
<< exit(FatalError);
if (magSqr(n_ - nf[facei]) > SMALL)
{
FatalErrorIn("symmetryPlanePolyPatch::n()")
<< "Symmetry plane '" << name() << "' is not planar"
<< exit(FatalError);
}
}
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment