BUGFIX: Increase viable second-level size for AMG coarsening in large parallel cases. Author: Hrvoje Jasak. Merge: Dominik Christ.

This commit is contained in:
Dominik Christ 2014-09-30 16:12:45 +01:00
commit f6f114d3e0
2 changed files with 24 additions and 7 deletions

View file

@ -108,7 +108,7 @@ class ggiGAMGInterface
// Private static data
//- Processor cluster offset index
static const label procOffset = 1000000;
static const label procOffset = 4000000;
public:

View file

@ -301,12 +301,26 @@ void Foam::pamgPolicy::calcChild()
// whole gang of processes; otherwise I may end up with a different
// number of agglomeration levels on different processors.
if (nCoarseEqns_ > minCoarseEqns())
if (nCoarseEqns_ > minCoarseEqns() && 3*nCoarseEqns_ <= 2*nEqns)
{
coarsen_ = true;
}
reduce(coarsen_, andOp<bool>());
if (lduMatrix::debug >= 2)
{
Pout << "Coarse level size: " << nCoarseEqns_;
if (coarsen_)
{
Pout << ". Accepted" << endl;
}
else
{
Pout << ". Rejected" << endl;
}
}
}
@ -414,8 +428,8 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
if (rmUpperAddr == rmLowerAddr)
{
// For each fine coeff inside of a coarse cluster keep the address
// of the cluster corresponding to the coeff in th
// e coeffRestrictAddr as a negative index
// of the cluster corresponding to the coeff in the
// coeffRestrictAddr as a negative index
coeffRestrictAddr[fineCoeffi] = -(rmUpperAddr + 1);
}
else
@ -425,7 +439,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
label cOwn = rmUpperAddr;
label cNei = rmLowerAddr;
// get coarse owner and neighbour
// Get coarse owner and neighbour
if (rmUpperAddr > rmLowerAddr)
{
cOwn = rmLowerAddr;
@ -438,7 +452,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
bool nbrFound = false;
label& ccnCoeffs = blockNnbrs[cOwn];
for (int i=0; i<ccnCoeffs; i++)
for (int i = 0; i < ccnCoeffs; i++)
{
if (initCoarseNeighb[ccCoeffs[i]] == cNei)
{
@ -549,6 +563,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
// Add the coarse level
// Set the coarse ldu addressing onto the list
lduPrimitiveMesh* coarseAddrPtr =
new lduPrimitiveMesh
(
@ -597,6 +612,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
}
}
// Create GAMG interfaces
forAll (interfaceFields, intI)
{
if (interfaceFields.set(intI))
@ -665,7 +681,8 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
lduMatrix* coarseMatrixPtr = new lduMatrix(*coarseAddrPtr);
lduMatrix& coarseMatrix = *coarseMatrixPtr;
// Coarse matrix diagonal initialised by restricting the finer mesh diagonal
// Coarse matrix diagonal initialised by restricting the
// finer mesh diagonal
scalarField& coarseDiag = coarseMatrix.diag();
restrictResidual(matrix_.diag(), coarseDiag);