diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index ef6b70f424..06070f01a9 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -314,8 +314,9 @@ castellatedMeshControls // refinement (from features, refinementSurfaces, refinementRegions) // in a given geometric region. The syntax is exactly the same as for the // refinementRegions; the cell level now specifies the upper limit - // for any cell. Note that it does not override the refinement constraints - // given by the nCellsBetweenLevels setting. + // for any cell. (a special setting is cell level -1 which will remove + // any cells inside the region). Note that it does not override the + // refinement constraints given by the nCellsBetweenLevels setting. limitRegions { } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H index 0c12143384..d3c068f72e 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H @@ -522,6 +522,16 @@ private: labelList& neiPatch ) const; + autoPtr splitMesh + ( + const label nBufferLayers, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, + labelList& cellRegion, + labelList& ownPatch, + labelList& neiPatch + ); + //- Repatches external face or creates baffle for internal face // with user specified patches (might be different for both sides). // Returns label of added face. @@ -861,6 +871,12 @@ public: return shells_; } + //- Reference to limit shells (regions) + const shellSurfaces& limitShells() const + { + return limitShells_; + } + //- Reference to meshcutting engine const hexRef8& meshCutter() const { @@ -1108,6 +1124,17 @@ public: const pointField& locationsOutsideMesh ); + //- Remove cells from limitRegions if level -1 + autoPtr removeLimitShells + ( + const label nBufferLayers, + const label nErodeCellZones, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, + const pointField& locationsInMesh, + const wordList& regionsInMesh + ); + //- Find boundary points that connect to more than one cell // region and split them. autoPtr dupNonManifoldPoints(const localPointRegion&); diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index 9a560ff3dd..34ae55b76e 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,7 +48,7 @@ License #include "polyMeshAdder.H" #include "IOmanip.H" #include "refinementParameters.H" - +#include "shellSurfaces.H" #include "zeroGradientFvPatchFields.H" #include "volFields.H" @@ -3874,7 +3874,28 @@ Foam::autoPtr Foam::meshRefinement::splitMesh cellRegion ); + return splitMesh + ( + nBufferLayers, + globalToMasterPatch, + globalToSlavePatch, + cellRegion, + ownPatch, + neiPatch + ); +} +Foam::autoPtr Foam::meshRefinement::splitMesh +( + const label nBufferLayers, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, + + labelList& cellRegion, + labelList& ownPatch, + labelList& neiPatch +) +{ // Walk out nBufferlayers from region boundary // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // (modifies cellRegion, ownPatch) @@ -4049,7 +4070,7 @@ Foam::autoPtr Foam::meshRefinement::splitMesh label nCellsToKeep = mesh_.nCells() - cellsToRemove.size(); reduce(nCellsToKeep, sumOp