mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: GAMGAgglomeration: increase repeatability. Fixes #3450
This commit is contained in:
@ -221,9 +221,14 @@ Foam::tmp<Foam::labelField> Foam::pairGAMGAgglomeration::agglomerate
|
||||
auto tcoarseCellMap = tmp<labelField>::New(nFineCells, -1);
|
||||
auto& coarseCellMap = tcoarseCellMap.ref();
|
||||
|
||||
// Small tolerance to account for faces potentially having slightly
|
||||
// different truncation error in their weights from run to run
|
||||
// (e.g. due to offloading). If all the largest faces per cell are
|
||||
// within this tolerance use the first one. This guarantees repeatability.
|
||||
const scalar tol = 1E-10;
|
||||
|
||||
nCoarseCells = 0;
|
||||
label celli;
|
||||
|
||||
for (label cellfi=0; cellfi<nFineCells; cellfi++)
|
||||
{
|
||||
// Change cell ordering depending on direction for this level
|
||||
@ -250,7 +255,7 @@ Foam::tmp<Foam::labelField> Foam::pairGAMGAgglomeration::agglomerate
|
||||
(
|
||||
coarseCellMap[upperAddr[facei]] < 0
|
||||
&& coarseCellMap[lowerAddr[facei]] < 0
|
||||
&& faceWeights[facei] > maxFaceWeight
|
||||
&& faceWeights[facei] > maxFaceWeight*(1.0 + tol)
|
||||
)
|
||||
{
|
||||
// Match found. Pick up all the necessary data
|
||||
@ -282,7 +287,7 @@ Foam::tmp<Foam::labelField> Foam::pairGAMGAgglomeration::agglomerate
|
||||
{
|
||||
label facei = cellFaces[faceOs];
|
||||
|
||||
if (faceWeights[facei] > clusterMaxFaceCoeff)
|
||||
if (faceWeights[facei] > clusterMaxFaceCoeff*(1.0 + tol))
|
||||
{
|
||||
clusterMatchFaceNo = facei;
|
||||
clusterMaxFaceCoeff = faceWeights[facei];
|
||||
|
||||
Reference in New Issue
Block a user