From 52c9cbf13815e5390073b5dc82e09c4a60ed7668 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 10 May 2017 21:12:51 +0100 Subject: [PATCH] Parallel block selective AMG interfaces --- .../processorSAMGInterfaceField.C | 1 - .../SAMGInterface/SAMGInterface.C | 4 ++-- .../processorSAMGInterface.C | 18 +++++++----------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/SAMGInterfaceFields/processorSAMGInterfaceField/processorSAMGInterfaceField.C b/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/SAMGInterfaceFields/processorSAMGInterfaceField/processorSAMGInterfaceField.C index ea74a82f5..509a78b63 100644 --- a/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/SAMGInterfaceFields/processorSAMGInterfaceField/processorSAMGInterfaceField.C +++ b/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/SAMGInterfaceFields/processorSAMGInterfaceField/processorSAMGInterfaceField.C @@ -58,7 +58,6 @@ Foam::processorSAMGInterfaceField::processorSAMGInterfaceField scalarSendBuf_(0), scalarReceiveBuf_(0) { - Pout<< "Creating processor SAMG interface field" << endl; const processorLduInterfaceField& p = refCast(fineInterfaceField); diff --git a/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/SAMGInterface/SAMGInterface.C b/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/SAMGInterface/SAMGInterface.C index 19fd718b9..5de1e6093 100644 --- a/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/SAMGInterface/SAMGInterface.C +++ b/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/SAMGInterface/SAMGInterface.C @@ -54,9 +54,9 @@ Foam::tmp Foam::SAMGInterface::selectCoeffs scalarField& coarseCoeffs = tcoarseCoeffs(); // Added weights to account for non-integral matching - forAll (fineAddressing_, ffi) + forAll (fineAddressing_, ffI) { - coarseCoeffs[ffi] = fineCoeffs[fineAddressing_[ffi]]; + coarseCoeffs[ffI] = fineWeights_[ffI]*fineCoeffs[fineAddressing_[ffI]]; } return tcoarseCoeffs; diff --git a/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/processorSAMGInterface/processorSAMGInterface.C b/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/processorSAMGInterface/processorSAMGInterface.C index 586c2200c..f3062aaf1 100644 --- a/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/processorSAMGInterface/processorSAMGInterface.C +++ b/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/processorSAMGInterface/processorSAMGInterface.C @@ -57,8 +57,6 @@ Foam::processorSAMGInterface::processorSAMGInterface comm_(fineProcInterface_.comm()), tag_(fineProcInterface_.tag()) { - Pout<< "Creating processor SAMG interface" << endl; - // Analyse the local and neighbour row label: // local coarse, remote coarse = regular coarse face // local coarse, remote fine = local expanded face: receive prolonged data @@ -98,7 +96,7 @@ Foam::processorSAMGInterface::processorSAMGInterface // Get fine faceCells const labelList& fineFaceCells = fineInterface.faceCells(); - Pout<< "fineFaceCells: " << fineFaceCells << endl; + // Collect local fine to neighbour coarse connections for communication forAll (localRowLabel, faceI) { @@ -115,7 +113,7 @@ Foam::processorSAMGInterface::processorSAMGInterface const label curStart = pRowStart[fineFaceCells[faceI]]; const label curEnd = pRowStart[fineFaceCells[faceI] + 1]; const label nCoarse = curEnd - curStart; - Pout<< "Eqn: " << fineFaceCells[faceI] << " Span: " << curStart << " " << curEnd << " = " << nCoarse << endl; + labelList nbrs(nCoarse); scalarField weights(nCoarse); @@ -124,7 +122,7 @@ Foam::processorSAMGInterface::processorSAMGInterface nbrs[i] = pColumn[curStart + i]; weights[i] = pCoeffs[curStart + i]; } - Pout<< "weights: " << weights << endl; + // Insert neighbours under remote coarse index neighboursFromLocalFine.insert(neighbourRowLabel[faceI], nbrs); weightsFromLocalFine.insert(neighbourRowLabel[faceI], weights); @@ -173,7 +171,7 @@ Foam::processorSAMGInterface::processorSAMGInterface ) { // Found local coarse to neighbour coarse face - Pout<< "face " << faceI << " CC" << endl; + // Create new coarse face faceCells_[nCoarseFaces] = localRowLabel[faceI]; fineAddressing_[nCoarseFaces] = faceI; @@ -196,8 +194,7 @@ Foam::processorSAMGInterface::processorSAMGInterface const scalarField& curLocalCoarseWeights = weightsFromLocalFine[neighbourRowLabel[faceI]]; - Pout<< "face " << faceI << " FC, size: " << curLocalCoarseNbrs.size() - << " W: " << curLocalCoarseWeights << endl; + forAll (curLocalCoarseNbrs, curNbrI) { // Create new coarse face @@ -223,8 +220,7 @@ Foam::processorSAMGInterface::processorSAMGInterface const scalarField& curNbrCoarseWeights = weightsFromRemoteFine[localRowLabel[faceI]]; - Pout<< "face " << faceI << " CF, size: " << curNbrCoarseNbrs.size() - << " W: " << curNbrCoarseWeights << endl; + forAll (curNbrCoarseNbrs, curNbrI) { // Create new coarse face @@ -249,7 +245,7 @@ Foam::processorSAMGInterface::processorSAMGInterface << " nFineFaces = " << fineProcInterface_.interfaceSize() << abort(FatalError); } - Pout<< "nCoarseFaces: " << nCoarseFaces << endl; + // Resize arrays to final size faceCells_.setSize(nCoarseFaces); fineAddressing_.setSize(nCoarseFaces);