ENH: symmetryPlane: inherit normal

This commit is contained in:
mattijs
2014-02-03 15:00:42 +00:00
parent 7c350b0f6d
commit b8e1317eb7

View File

@ -42,17 +42,20 @@ namespace Foam
void Foam::symmetryPlanePolyPatch::calcGeometry(PstreamBuffers&)
{
if (returnReduce(size(), sumOp<label>()) == 0)
if (n_ == vector::rootMax)
{
// No faces in patch. Avoid gAverage complaining and set
// normal to nonsense value to catch any use
n_ = vector::rootMax;
}
else
if (returnReduce(size(), sumOp<label>()))
{
const vectorField& nf(faceNormals());
n_ = gAverage(nf);
if (debug)
{
Info<< "Patch " << name() << " calculated average normal "
<< n_ << endl;
}
// Check the symmetry plane is planar
forAll(nf, facei)
{
@ -61,13 +64,19 @@ void Foam::symmetryPlanePolyPatch::calcGeometry(PstreamBuffers&)
FatalErrorIn("symmetryPlanePolyPatch::n()")
<< "Symmetry plane '" << name() << "' is not planar."
<< endl
<< " Either split the patch into planar parts"
<< "At local face at "
<< primitivePatch::faceCentres()[facei]
<< " the normal " << nf[facei]
<< " differs from the average normal " << n_
<< " by " << magSqr(n_ - nf[facei]) << endl
<< "Either split the patch into planar parts"
<< " or use the " << symmetryPolyPatch::typeName
<< " patch type"
<< exit(FatalError);
}
}
}
}
}
@ -109,7 +118,7 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch
)
:
polyPatch(pp, bm),
n_(vector::rootMax)
n_(pp.n_)
{}
@ -123,7 +132,7 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch
)
:
polyPatch(pp, bm, index, newSize, newStart),
n_(vector::rootMax)
n_(pp.n_)
{}
@ -137,7 +146,7 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch
)
:
polyPatch(pp, bm, index, mapAddressing, newStart),
n_(vector::rootMax)
n_(pp.n_)
{}