ENH: snappyHexMesh: early exit of leak detection. See #2403

Changed behaviour to make it the default
This commit is contained in:
mattijs
2022-06-09 11:16:10 +01:00
parent 4f0166397e
commit c5cede38aa
6 changed files with 22 additions and 20 deletions

View File

@ -487,8 +487,8 @@ castellatedMeshControls
// Optional: same but in absolute number of cells. Default is 0. // Optional: same but in absolute number of cells. Default is 0.
//nMinCells 100; //nMinCells 100;
// Optional: disable of automatic leak closure and exit immediately // Optional: enable automatic leak closure (default is exit immediately)
//useLeakClosure false; //useLeakClosure true;
} }
// Settings for the snapping. // Settings for the snapping.

View File

@ -74,7 +74,7 @@ Foam::refinementParameters::refinementParameters
pointField(0) pointField(0)
) )
), ),
useLeakClosure_(dict.getOrDefault<bool>("useLeakClosure", true)), useLeakClosure_(dict.getOrDefault<bool>("useLeakClosure", false)),
faceZoneControls_(dict.subOrEmptyDict("faceZoneControls")), faceZoneControls_(dict.subOrEmptyDict("faceZoneControls")),
allowFreeStandingZoneFaces_ allowFreeStandingZoneFaces_
( (

View File

@ -199,8 +199,8 @@ public:
} }
//- Whether to attempt to close any 'leak' between //- Whether to attempt to close any 'leak' between
// locationsInsideMesh and locationsOutsideMesh or exit with // locationsInsideMesh and locationsOutsideMesh. Default is
// error. Default is true. // false (dump path and exit with error)
// (see also refinementSurfaces::leakLevel to force surfaces to // (see also refinementSurfaces::leakLevel to force surfaces to
// be checked for leaks early-on in the refinement) // be checked for leaks early-on in the refinement)
bool useLeakClosure() const bool useLeakClosure() const

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
cd "${0%/*}" || exit # Run from this directory cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
mkdir -p constant mkdir -p constant
@ -9,26 +10,23 @@ cp -rf \
"$FOAM_TUTORIALS"/resources/geometry/motorBike_leakDetection \ "$FOAM_TUTORIALS"/resources/geometry/motorBike_leakDetection \
constant/triSurface constant/triSurface
# Alternative decomposeParDict name:
decompDict="-decomposeParDict system/decomposeParDict.6"
## Standard decomposeParDict name:
# unset decompDict
runApplication surfaceFeatureExtract runApplication surfaceFeatureExtract
runApplication blockMesh runApplication blockMesh
runApplication $decompDict decomposePar runApplication decomposePar
# Using distributedTriSurfaceMesh? #- Run with leak-detection (writes postProcessing/leakPath) but no closure
if foamDictionary -entry geometry -value system/snappyHexMeshDict | \ foamDictionary system/snappyHexMeshDict \
grep -q distributedTriSurfaceMesh -entry castellatedMeshControls.useLeakClosure -set false
then runParallel -s leak snappyHexMesh
runParallel $decompDict surfaceRedistributePar motorBike.obj independent runParallel -s leak checkMesh
fi cleanTimeDirectories
runParallel $decompDict snappyHexMesh -overwrite #- Run with leak-detection (writes postProcessing/leakPath) and closure
foamDictionary system/snappyHexMeshDict \
runParallel $decompDict checkMesh -writeFields '(nonOrthoAngle)' -constant -entry castellatedMeshControls.useLeakClosure -set true
runParallel -s leak_and_closure snappyHexMesh
runParallel -s leak_and_closure checkMesh
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -175,6 +175,10 @@ castellatedMeshControls
// are only on the boundary of corresponding cellZones or also allow // are only on the boundary of corresponding cellZones or also allow
// free-standing zone faces. Not used if there are no faceZones. // free-standing zone faces. Not used if there are no faceZones.
allowFreeStandingZoneFaces true; allowFreeStandingZoneFaces true;
// Enable automatic leak closure (default is exit immediately)
useLeakClosure true;
} }