mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user