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 // Private static data
//- Processor cluster offset index //- Processor cluster offset index
static const label procOffset = 1000000; static const label procOffset = 4000000;
public: public:

View file

@ -301,12 +301,26 @@ void Foam::pamgPolicy::calcChild()
// whole gang of processes; otherwise I may end up with a different // whole gang of processes; otherwise I may end up with a different
// number of agglomeration levels on different processors. // number of agglomeration levels on different processors.
if (nCoarseEqns_ > minCoarseEqns()) if (nCoarseEqns_ > minCoarseEqns() && 3*nCoarseEqns_ <= 2*nEqns)
{ {
coarsen_ = true; coarsen_ = true;
} }
reduce(coarsen_, andOp<bool>()); 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) if (rmUpperAddr == rmLowerAddr)
{ {
// For each fine coeff inside of a coarse cluster keep the address // For each fine coeff inside of a coarse cluster keep the address
// of the cluster corresponding to the coeff in th // of the cluster corresponding to the coeff in the
// e coeffRestrictAddr as a negative index // coeffRestrictAddr as a negative index
coeffRestrictAddr[fineCoeffi] = -(rmUpperAddr + 1); coeffRestrictAddr[fineCoeffi] = -(rmUpperAddr + 1);
} }
else else
@ -425,7 +439,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
label cOwn = rmUpperAddr; label cOwn = rmUpperAddr;
label cNei = rmLowerAddr; label cNei = rmLowerAddr;
// get coarse owner and neighbour // Get coarse owner and neighbour
if (rmUpperAddr > rmLowerAddr) if (rmUpperAddr > rmLowerAddr)
{ {
cOwn = rmLowerAddr; cOwn = rmLowerAddr;
@ -549,6 +563,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
// Add the coarse level // Add the coarse level
// Set the coarse ldu addressing onto the list
lduPrimitiveMesh* coarseAddrPtr = lduPrimitiveMesh* coarseAddrPtr =
new lduPrimitiveMesh new lduPrimitiveMesh
( (
@ -597,6 +612,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
} }
} }
// Create GAMG interfaces
forAll (interfaceFields, intI) forAll (interfaceFields, intI)
{ {
if (interfaceFields.set(intI)) if (interfaceFields.set(intI))
@ -665,7 +681,8 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
lduMatrix* coarseMatrixPtr = new lduMatrix(*coarseAddrPtr); lduMatrix* coarseMatrixPtr = new lduMatrix(*coarseAddrPtr);
lduMatrix& coarseMatrix = *coarseMatrixPtr; 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(); scalarField& coarseDiag = coarseMatrix.diag();
restrictResidual(matrix_.diag(), coarseDiag); restrictResidual(matrix_.diag(), coarseDiag);