mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -2514,6 +2514,7 @@ Foam::label Foam::meshRefinement::findRegions
|
|||||||
const vector& perturbVec,
|
const vector& perturbVec,
|
||||||
const pointField& locationsInMesh,
|
const pointField& locationsInMesh,
|
||||||
const pointField& locationsOutsideMesh,
|
const pointField& locationsOutsideMesh,
|
||||||
|
const bool exitIfLeakPath,
|
||||||
const writer<scalar>& leakPathFormatter,
|
const writer<scalar>& leakPathFormatter,
|
||||||
const label nRegions,
|
const label nRegions,
|
||||||
labelList& cellRegion,
|
labelList& cellRegion,
|
||||||
@ -2725,13 +2726,25 @@ Foam::label Foam::meshRefinement::findRegions
|
|||||||
|
|
||||||
Pstream::scatter(fName);
|
Pstream::scatter(fName);
|
||||||
|
|
||||||
FatalErrorInFunction
|
if (exitIfLeakPath)
|
||||||
<< "Location in mesh " << locationsInMesh[index]
|
{
|
||||||
<< " is inside same mesh region " << regioni
|
FatalErrorInFunction
|
||||||
<< " as one of the locations outside mesh "
|
<< "Location in mesh " << locationsInMesh[index]
|
||||||
<< locationsOutsideMesh
|
<< " is inside same mesh region " << regioni
|
||||||
<< nl << " Dumped leak path to " << fName
|
<< " as one of the locations outside mesh "
|
||||||
<< exit(FatalError);
|
<< locationsOutsideMesh
|
||||||
|
<< 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 labelList& globalToSlavePatch,
|
||||||
const pointField& locationsInMesh,
|
const pointField& locationsInMesh,
|
||||||
const pointField& locationsOutsideMesh,
|
const pointField& locationsOutsideMesh,
|
||||||
|
const bool exitIfLeakPath,
|
||||||
const writer<scalar>& leakPathFormatter
|
const writer<scalar>& leakPathFormatter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -2783,6 +2797,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
|||||||
mergeDistance_ * vector::one, // perturbVec
|
mergeDistance_ * vector::one, // perturbVec
|
||||||
locationsInMesh,
|
locationsInMesh,
|
||||||
locationsOutsideMesh,
|
locationsOutsideMesh,
|
||||||
|
exitIfLeakPath,
|
||||||
leakPathFormatter,
|
leakPathFormatter,
|
||||||
cellRegion.nRegions(),
|
cellRegion.nRegions(),
|
||||||
cellRegion,
|
cellRegion,
|
||||||
|
|||||||
@ -1439,6 +1439,7 @@ public:
|
|||||||
const vector& perturbVec,
|
const vector& perturbVec,
|
||||||
const pointField& locationsInMesh,
|
const pointField& locationsInMesh,
|
||||||
const pointField& locationsOutsideMesh,
|
const pointField& locationsOutsideMesh,
|
||||||
|
const bool exitIfLeakPath,
|
||||||
const writer<scalar>& leakPathFormatter,
|
const writer<scalar>& leakPathFormatter,
|
||||||
const label nRegions,
|
const label nRegions,
|
||||||
labelList& cellRegion,
|
labelList& cellRegion,
|
||||||
@ -1453,6 +1454,7 @@ public:
|
|||||||
const labelList& globalToSlavePatch,
|
const labelList& globalToSlavePatch,
|
||||||
const pointField& locationsInMesh,
|
const pointField& locationsInMesh,
|
||||||
const pointField& locationsOutsideMesh,
|
const pointField& locationsOutsideMesh,
|
||||||
|
const bool exitIfLeakPath,
|
||||||
const writer<scalar>& leakPathFormatter
|
const writer<scalar>& leakPathFormatter
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -4258,6 +4258,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
globalToSlavePatch,
|
globalToSlavePatch,
|
||||||
locationsInMesh,
|
locationsInMesh,
|
||||||
locationsOutsideMesh,
|
locationsOutsideMesh,
|
||||||
|
true, // Exit if any connection between inside and outside
|
||||||
leakPathFormatter
|
leakPathFormatter
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -4368,6 +4369,7 @@ void Foam::meshRefinement::mergeFreeStandingBaffles
|
|||||||
globalToSlavePatch,
|
globalToSlavePatch,
|
||||||
locationsInMesh,
|
locationsInMesh,
|
||||||
locationsOutsideMesh,
|
locationsOutsideMesh,
|
||||||
|
true, // Exit if any connection between inside and outside
|
||||||
leakPathFormatter
|
leakPathFormatter
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -4443,6 +4445,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
|||||||
mergeDistance_ * vector::one, // perturbVec
|
mergeDistance_ * vector::one, // perturbVec
|
||||||
locationsInMesh,
|
locationsInMesh,
|
||||||
locationsOutsideMesh,
|
locationsOutsideMesh,
|
||||||
|
false, // do not exit if outside location found
|
||||||
leakPathFormatter,
|
leakPathFormatter,
|
||||||
cellRegion.nRegions(),
|
cellRegion.nRegions(),
|
||||||
cellRegion,
|
cellRegion,
|
||||||
|
|||||||
@ -2700,6 +2700,7 @@ void Foam::snappyRefineDriver::splitAndMergeBaffles
|
|||||||
globalToSlavePatch_,
|
globalToSlavePatch_,
|
||||||
refineParams.locationsInMesh(),
|
refineParams.locationsInMesh(),
|
||||||
refineParams.locationsOutsideMesh(),
|
refineParams.locationsOutsideMesh(),
|
||||||
|
true, // exit if any path to outside points
|
||||||
setFormatter_
|
setFormatter_
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -119,7 +119,7 @@ castellatedMeshControls
|
|||||||
"motorBike.*"
|
"motorBike.*"
|
||||||
{
|
{
|
||||||
// Surface-wise min and max refinement level
|
// Surface-wise min and max refinement level
|
||||||
level (5 6);
|
level (6 6);
|
||||||
|
|
||||||
// Optional specification of patch type (default is wall). No
|
// Optional specification of patch type (default is wall). No
|
||||||
// constraint types (cyclic, symmetry) etc. are allowed.
|
// constraint types (cyclic, symmetry) etc. are allowed.
|
||||||
|
|||||||
Reference in New Issue
Block a user