Bugfix: keep cyclic patch face pairs processor-local in parallel decomposition. Author: Henrik Rusche. Merge: Hrvoje Jasak.

This commit is contained in:
Hrvoje Jasak 2015-09-11 16:26:56 +01:00
commit 6697eff307
6 changed files with 89 additions and 0 deletions

View file

@ -369,6 +369,61 @@ void Foam::decompositionMethod::calcCellCells
} }
void Foam::decompositionMethod::fixCyclics
(
const polyMesh& mesh,
labelList& decomp
)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
label nFixedCyclics = 0;
// Coupled faces. Only cyclics done.
do
{
nFixedCyclics = 0;
forAll(pbm, patchi)
{
if (isA<cyclicPolyPatch>(pbm[patchi]))
{
const unallocLabelList& faceCells = pbm[patchi].faceCells();
const label sizeby2 = faceCells.size()/2;
for (label facei=0; facei<sizeby2; facei++)
{
const label own = faceCells[facei];
const label nei = faceCells[facei + sizeby2];
if(decomp[own] < decomp[nei])
{
decomp[own] = decomp[nei];
nFixedCyclics++;
}
else if(decomp[own] > decomp[nei])
{
decomp[nei] = decomp[own];
nFixedCyclics++;
}
}
}
}
if(nFixedCyclics > 0)
{
WarningIn
(
"decompositionMethod::fixCyclics"
"(const polyMesh& mesh, labelList& decomp)"
) << "Fixed " << nFixedCyclics << " disconnected cyclic faces";
}
}
while (nFixedCyclics > 0);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New

View file

@ -96,6 +96,12 @@ protected:
labelListList& cellCells labelListList& cellCells
); );
static void fixCyclics
(
const polyMesh& mesh,
labelList& decomp
);
private: private:

View file

@ -116,6 +116,8 @@ Foam::labelList Foam::patchConstrainedDecomp::decompose
} }
} }
fixCyclics(mesh_, finalDecomp);
return finalDecomp; return finalDecomp;
} }

View file

@ -316,10 +316,14 @@ Foam::labelList Foam::metisDecomp::decompose
// Copy back to labelList // Copy back to labelList
labelList decomp(finalDecomp.size()); labelList decomp(finalDecomp.size());
forAll(decomp, i) forAll(decomp, i)
{ {
decomp[i] = finalDecomp[i]; decomp[i] = finalDecomp[i];
} }
fixCyclics(mesh_, decomp);
return decomp; return decomp;
} }
@ -374,6 +378,8 @@ Foam::labelList Foam::metisDecomp::decompose
fineDistribution[i] = finalDecomp[fineToCoarse[i]]; fineDistribution[i] = finalDecomp[fineToCoarse[i]];
} }
fixCyclics(mesh_, fineDistribution);
return fineDistribution; return fineDistribution;
} }
@ -417,6 +423,8 @@ Foam::labelList Foam::metisDecomp::decompose
decomp[i] = finalDecomp[i]; decomp[i] = finalDecomp[i];
} }
fixCyclics(mesh_, decomp);
return decomp; return decomp;
} }

View file

@ -595,10 +595,14 @@ Foam::labelList Foam::parMetisDecomp::decompose
// Copy back to labelList // Copy back to labelList
labelList decomp(finalDecomp.size()); labelList decomp(finalDecomp.size());
forAll(decomp, i) forAll(decomp, i)
{ {
decomp[i] = finalDecomp[i]; decomp[i] = finalDecomp[i];
} }
fixCyclics(mesh_, decomp);
return decomp; return decomp;
} }
@ -738,6 +742,8 @@ Foam::labelList Foam::parMetisDecomp::decompose
cellDistribution[cellI] = regionDecomp[cellToRegion[cellI]]; cellDistribution[cellI] = regionDecomp[cellToRegion[cellI]];
} }
fixCyclics(mesh_, cellDistribution);
return cellDistribution; return cellDistribution;
} }
@ -868,10 +874,14 @@ Foam::labelList Foam::parMetisDecomp::decompose
// Copy back to labelList // Copy back to labelList
labelList decomp(finalDecomp.size()); labelList decomp(finalDecomp.size());
forAll(decomp, i) forAll(decomp, i)
{ {
decomp[i] = finalDecomp[i]; decomp[i] = finalDecomp[i];
} }
fixCyclics(mesh_, decomp);
return decomp; return decomp;
} }

View file

@ -453,10 +453,14 @@ Foam::labelList Foam::scotchDecomp::decompose
// Copy back to labelList // Copy back to labelList
labelList decomp(finalDecomp.size()); labelList decomp(finalDecomp.size());
forAll(decomp, i) forAll(decomp, i)
{ {
decomp[i] = finalDecomp[i]; decomp[i] = finalDecomp[i];
} }
fixCyclics(mesh_, decomp);
return decomp; return decomp;
} }
@ -510,6 +514,8 @@ Foam::labelList Foam::scotchDecomp::decompose
fineDistribution[i] = finalDecomp[fineToCoarse[i]]; fineDistribution[i] = finalDecomp[fineToCoarse[i]];
} }
fixCyclics(mesh_, fineDistribution);
return fineDistribution; return fineDistribution;
} }
@ -553,6 +559,8 @@ Foam::labelList Foam::scotchDecomp::decompose
decomp[i] = finalDecomp[i]; decomp[i] = finalDecomp[i];
} }
fixCyclics(mesh_, decomp);
return decomp; return decomp;
} }