diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index ad0f7ade30..9414149d41 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -57,6 +57,7 @@ Description #include "MeshedSurface.H" #include "globalIndex.H" #include "IOmanip.H" +#include "fvMeshTools.H" using namespace Foam; @@ -571,6 +572,73 @@ scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol) } +void removeZeroSizedPatches(fvMesh& mesh) +{ + // Remove any zero-sized ones. Assumes + // - processor patches are already only there if needed + // - all other patches are available on all processors + // - but coupled ones might still be needed, even if zero-size + // (e.g. processorCyclic) + // See also logic in createPatch. + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + labelList oldToNew(pbm.size(), -1); + label newPatchi = 0; + forAll(pbm, patchi) + { + const polyPatch& pp = pbm[patchi]; + + if (!isA(pp)) + { + if + ( + isA(pp) + || returnReduce(pp.size(), sumOp