mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: symmetryPolyPatch: handle zero faces case
This commit is contained in:
@ -114,17 +114,26 @@ const Foam::vector& Foam::symmetryPlanePolyPatch::n() const
|
|||||||
// as the average face-normal
|
// as the average face-normal
|
||||||
if (magSqr(n_) < 0.5)
|
if (magSqr(n_) < 0.5)
|
||||||
{
|
{
|
||||||
const vectorField& nf(faceNormals());
|
if (returnReduce(size(), sumOp<label>()) == 0)
|
||||||
n_ = gAverage(nf);
|
|
||||||
|
|
||||||
// Check the symmetry plane is planar
|
|
||||||
forAll(nf, facei)
|
|
||||||
{
|
{
|
||||||
if (magSqr(n_ - nf[facei]) > SMALL)
|
// No faces in patch. Avoid gAverage complaining and set
|
||||||
|
// normal to nonsense value to catch any use
|
||||||
|
n_ = vector::rootMax;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const vectorField& nf(faceNormals());
|
||||||
|
n_ = gAverage(nf);
|
||||||
|
|
||||||
|
// Check the symmetry plane is planar
|
||||||
|
forAll(nf, facei)
|
||||||
{
|
{
|
||||||
FatalErrorIn("symmetryPlanePolyPatch::n()")
|
if (magSqr(n_ - nf[facei]) > SMALL)
|
||||||
<< "Symmetry plane '" << name() << "' is not planar"
|
{
|
||||||
<< exit(FatalError);
|
FatalErrorIn("symmetryPlanePolyPatch::n()")
|
||||||
|
<< "Symmetry plane '" << name() << "' is not planar"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user