Minor updates

This commit is contained in:
Hrvoje Jasak 2014-09-26 15:06:26 +01:00 committed by Dominik Christ
parent 407760308d
commit d45105a082

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;
@ -438,7 +452,7 @@ Foam::autoPtr<Foam::amgMatrix> Foam::pamgPolicy::restrictMatrix
bool nbrFound = false; bool nbrFound = false;
label& ccnCoeffs = blockNnbrs[cOwn]; label& ccnCoeffs = blockNnbrs[cOwn];
for (int i=0; i<ccnCoeffs; i++) for (int i = 0; i < ccnCoeffs; i++)
{ {
if (initCoarseNeighb[ccCoeffs[i]] == cNei) if (initCoarseNeighb[ccCoeffs[i]] == cNei)
{ {
@ -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);