From 274d1df8a472fdb235af5c469a4ba0098ca5063c Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 13 May 2016 17:47:38 +0100 Subject: [PATCH] snappyHexMesh: Automatically remove zero-sized patches All patches are preserved if the 'keepPatches' option is set true. Patch contributed by Mattijs Janssens --- .../generation/snappyHexMesh/snappyHexMesh.C | 86 +++++++++++++++++++ .../snappyHexMesh/snappyHexMeshDict | 5 ++ src/dynamicMesh/fvMeshTools/fvMeshTools.H | 3 +- .../simpleFoam/rotorDisk/Allrun | 1 - .../rotorDisk/system/createPatchDict | 29 ------- .../ras/mixerVesselAMI/Allrun.pre | 3 - .../ras/mixerVesselAMI/system/createPatchDict | 27 ------ 7 files changed, 92 insertions(+), 62 deletions(-) delete mode 100644 tutorials/incompressible/simpleFoam/rotorDisk/system/createPatchDict delete mode 100644 tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/createPatchDict 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