mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: symmetryPlane: inherit normal
This commit is contained in:
@ -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_)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user