ENH: leak-detection. Fixes #1572.

The final leak can only be decided once all cells have been
deleted. So only exit on final invocation and give warning-only
beforehand. This avoids a lot of false positives.
The tutorial itself didn't actually produce a mesh with leakage
with the old settings. Upped the refinement level to force it
to go through the hole in the geometry.
This commit is contained in:
mattijs
2020-05-18 12:40:08 +01:00
parent 2fa0a2ea9a
commit 3d746e8ac9
5 changed files with 29 additions and 8 deletions

View File

@ -2514,6 +2514,7 @@ Foam::label Foam::meshRefinement::findRegions
const vector& perturbVec,
const pointField& locationsInMesh,
const pointField& locationsOutsideMesh,
const bool exitIfLeakPath,
const writer<scalar>& leakPathFormatter,
const label nRegions,
labelList& cellRegion,
@ -2725,6 +2726,8 @@ Foam::label Foam::meshRefinement::findRegions
Pstream::scatter(fName);
if (exitIfLeakPath)
{
FatalErrorInFunction
<< "Location in mesh " << locationsInMesh[index]
<< " is inside same mesh region " << regioni
@ -2733,6 +2736,16 @@ Foam::label Foam::meshRefinement::findRegions
<< nl << " Dumped leak path to " << fName
<< exit(FatalError);
}
else
{
WarningInFunction
<< "Location in mesh " << locationsInMesh[index]
<< " is inside same mesh region " << regioni
<< " as one of the locations outside mesh "
<< locationsOutsideMesh
<< nl << "Dumped leak path to " << fName << endl;
}
}
}
}
@ -2763,6 +2776,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
const labelList& globalToSlavePatch,
const pointField& locationsInMesh,
const pointField& locationsOutsideMesh,
const bool exitIfLeakPath,
const writer<scalar>& leakPathFormatter
)
{
@ -2783,6 +2797,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
mergeDistance_ * vector::one, // perturbVec
locationsInMesh,
locationsOutsideMesh,
exitIfLeakPath,
leakPathFormatter,
cellRegion.nRegions(),
cellRegion,

View File

@ -1439,6 +1439,7 @@ public:
const vector& perturbVec,
const pointField& locationsInMesh,
const pointField& locationsOutsideMesh,
const bool exitIfLeakPath,
const writer<scalar>& leakPathFormatter,
const label nRegions,
labelList& cellRegion,
@ -1453,6 +1454,7 @@ public:
const labelList& globalToSlavePatch,
const pointField& locationsInMesh,
const pointField& locationsOutsideMesh,
const bool exitIfLeakPath,
const writer<scalar>& leakPathFormatter
);

View File

@ -4258,6 +4258,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
globalToSlavePatch,
locationsInMesh,
locationsOutsideMesh,
true, // Exit if any connection between inside and outside
leakPathFormatter
);
@ -4368,6 +4369,7 @@ void Foam::meshRefinement::mergeFreeStandingBaffles
globalToSlavePatch,
locationsInMesh,
locationsOutsideMesh,
true, // Exit if any connection between inside and outside
leakPathFormatter
);
@ -4443,6 +4445,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
mergeDistance_ * vector::one, // perturbVec
locationsInMesh,
locationsOutsideMesh,
false, // do not exit if outside location found
leakPathFormatter,
cellRegion.nRegions(),
cellRegion,

View File

@ -2700,6 +2700,7 @@ void Foam::snappyRefineDriver::splitAndMergeBaffles
globalToSlavePatch_,
refineParams.locationsInMesh(),
refineParams.locationsOutsideMesh(),
true, // exit if any path to outside points
setFormatter_
);

View File

@ -119,7 +119,7 @@ castellatedMeshControls
"motorBike.*"
{
// Surface-wise min and max refinement level
level (5 6);
level (6 6);
// Optional specification of patch type (default is wall). No
// constraint types (cyclic, symmetry) etc. are allowed.