diff --git a/etc/caseDicts/annotated/snappyHexMeshDict b/etc/caseDicts/annotated/snappyHexMeshDict index 7a5f88f5d5..7adc851a4d 100644 --- a/etc/caseDicts/annotated/snappyHexMeshDict +++ b/etc/caseDicts/annotated/snappyHexMeshDict @@ -225,6 +225,11 @@ castellatedMeshControls //- Optional removal of cells in thin gaps. Start removing cells // if at refinement level 10 we're detecting thin gaps. //blockLevel 10; + + //- Optional early detection of connections between inside and + // outside locations. Default is only after all refinement has + // been done. + //leakLevel 10; } } @@ -481,6 +486,9 @@ castellatedMeshControls //minCellFraction 0.001; // Optional: same but in absolute number of cells. Default is 0. //nMinCells 100; + + // Optional: disable of automatic leak closure and exit immediately + //useLeakClosure false; } // Settings for the snapping. diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H index 872e0bb8c8..fb0d7305d0 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H @@ -586,6 +586,7 @@ private: const pointField& locationsInMesh, const wordList& regionsInMesh, const pointField& locationsOutsideMesh, + const bool exitIfLeakPath, const refPtr& leakPathFormatter, const labelList& neiLevel, @@ -845,6 +846,7 @@ private: const pointField& locationsInMesh, const wordList& zonesInMesh, const pointField& locationsOutsideMesh, + const bool exitIfLeakPath, const refPtr& leakPathFormatter, labelList& cellToZone, @@ -1302,6 +1304,7 @@ public: const pointField& locationsInMesh, const wordList& regionsInMesh, const pointField& locationsOutsideMesh, + const bool exitIfLeakPath, const refPtr& leakPathFormatter ); @@ -1333,6 +1336,7 @@ public: const pointField& locationsInMesh, const wordList& regionsInMesh, const pointField& locationsOutsideMesh, + const bool exitIfLeakPath, const refPtr& leakPathFormatter ); @@ -1435,6 +1439,7 @@ public: const pointField& locationsInMesh, const wordList& regionsInMesh, const pointField& locationsOutsideMesh, + const bool exitIfLeakPath, const refPtr& leakPathFormatter, wordPairHashTable& zonesToFaceZone ); diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index 4db8f39532..62c47952ad 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -292,6 +292,7 @@ void Foam::meshRefinement::getBafflePatches const pointField& locationsInMesh, const wordList& zonesInMesh, const pointField& locationsOutsideMesh, + const bool exitIfLeakPath, const refPtr& leakPathFormatter, const labelList& neiLevel, const pointField& neiCc, @@ -326,6 +327,7 @@ void Foam::meshRefinement::getBafflePatches locationsInMesh, zonesInMesh, locationsOutsideMesh, + exitIfLeakPath, leakPathFormatter, cellToZone, @@ -2848,6 +2850,7 @@ void Foam::meshRefinement::zonify const pointField& locationsInMesh, const wordList& zonesInMesh, const pointField& locationsOutsideMesh, + const bool exitIfLeakPath, const refPtr& leakPathFormatter, labelList& cellToZone, @@ -2961,11 +2964,6 @@ void Foam::meshRefinement::zonify // Add to unnamedRegion1, unnamedRegion2 if (unnamedMapPtr.valid()) { - WarningInFunction - << "Detected and closed leak path from " - << locationsInMesh << " to " << locationsOutsideMesh - << endl; - // Dump leak path if (leakPathFormatter) { @@ -2985,6 +2983,23 @@ void Foam::meshRefinement::zonify Info<< "Dumped leak path to " << fName << endl; } + auto& err = + ( + exitIfLeakPath + ? FatalErrorInFunction + : WarningInFunction + ); + + err << "Locations in mesh " << locationsInMesh + << " connect to one of the locations outside mesh " + << locationsOutsideMesh << endl; + + if (exitIfLeakPath) + { + FatalError << exit(FatalError); + } + + labelList packedRegion1 ( UIndirectList