Commit 427f2c65 authored by Henry Weller's avatar Henry Weller
Browse files

GAMGAgglomeration: Add support for nCellsInCoarsestLevel = 1 and better agglomeration termination

Patch provided by Mattijs Janssens
Resolves bug-report http://bugs.openfoam.org/view.php?id=2226
parent 41eeaaed
......@@ -206,13 +206,20 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
bool Foam::GAMGAgglomeration::continueAgglomerating
(
const label nFineCells,
const label nCoarseCells
) const
{
// Check the need for further agglomeration on all processors
bool contAgg = nCoarseCells >= nCellsInCoarsestLevel_;
mesh().reduce(contAgg, andOp<bool>());
return contAgg;
const label nTotalCoarseCells = returnReduce(nCoarseCells, sumOp<label>());
if (nTotalCoarseCells >= Pstream::nProcs()*nCellsInCoarsestLevel_)
{
return true;
}
else
{
const label nTotalFineCells = returnReduce(nFineCells, sumOp<label>());
return nTotalCoarseCells < nTotalFineCells;
}
}
......
......@@ -152,7 +152,11 @@ protected:
void compactLevels(const label nCreatedLevels);
//- Check the need for further agglomeration
bool continueAgglomerating(const label nCoarseCells) const;
bool continueAgglomerating
(
const label nCells,
const label nCoarseCells
) const;
//- Gather value from all procIDs onto procIDs[0]
template<class Type>
......
......@@ -54,7 +54,7 @@ void Foam::pairGAMGAgglomeration::agglomerate
*faceWeightsPtr
);
if (continueAgglomerating(nCoarseCells))
if (continueAgglomerating(finalAgglomPtr().size(), nCoarseCells))
{
nCells_[nCreatedLevels] = nCoarseCells;
restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment