diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C index d3b63e7b9d7c0f60537a9b39667db9f7316fe055..b507253a199f86104df0135be773f54cf2a961b7 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -265,6 +265,14 @@ Foam::GAMGAgglomeration::GAMGAgglomeration meshLevels_(maxLevels_) { + // Limit the cells in the coarsest level based on the local number of + // cells. Note: 2 for pair-wise + nCellsInCoarsestLevel_ = + max(1, min(mesh.lduAddr().size()/2, nCellsInCoarsestLevel_)); + + // Ensure all procs see the same nCellsInCoarsestLevel_ + reduce(nCellsInCoarsestLevel_, minOp<label>()); + procCommunicator_.setSize(maxLevels_ + 1, -1); if (processorAgglomerate()) { diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H index 9a8bb8c05c71db4b96ee5405047672e7bfedec4c..d258e7f8c58035e4fa26099a49edde2d5e96832f 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H @@ -71,7 +71,7 @@ protected: const label maxLevels_; //- Number of cells in coarsest level - const label nCellsInCoarsestLevel_; + label nCellsInCoarsestLevel_; //- Cached mesh interfaces const lduInterfacePtrsList meshInterfaces_; @@ -242,7 +242,7 @@ public: ); //- Runtime selection table for matrix or mixed geometric/matrix - // agglomerators + //- agglomerators declareRunTimeSelectionTable ( autoPtr, @@ -259,7 +259,7 @@ public: ); //- Runtime selection table for matrix or mixed geometric/matrix - // agglomerators + //- agglomerators declareRunTimeSelectionTable ( autoPtr, @@ -378,7 +378,7 @@ public: } //- Return number of coarse patch faces (before processor - // agglomeration) + //- agglomeration) const labelList& nPatchFaces(const label leveli) const { return nPatchFaces_[leveli]; @@ -452,14 +452,14 @@ public: } //- Mapping from processor to agglomerated processor (global, all - // processors have the same information). Note that level is - // the fine, not the coarse, level index. This is to be - // consistent with the way the restriction is stored + //- processors have the same information). Note that level is + //- the fine, not the coarse, level index. This is to be + //- consistent with the way the restriction is stored const labelList& procAgglomMap(const label fineLeveli) const; //- Set of processors to agglomerate. Element 0 is the - // master processor. (local, same only on those processors that - // agglomerate) + //- master processor. (local, same only on those processors that + //- agglomerate) const labelList& agglomProcIDs(const label fineLeveli) const; //- Check that level has combined mesh