diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C index 49b48f8df7c902d4d54aa954f347b68b4fc4b17b..5061538f4c64c5a63955fd2133167c4c2ffe8ebe 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C @@ -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); + } } } }