diff --git a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixClustering/BlockMatrixClustering.C b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixClustering/BlockMatrixClustering.C index d7f02cf6c..c5752bba9 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixClustering/BlockMatrixClustering.C +++ b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixClustering/BlockMatrixClustering.C @@ -459,7 +459,7 @@ void Foam::BlockMatrixClustering::calcClustering() agglomIndex_[rowI] = agglomIndex_[nextGrouped]; sizeOfGroups[agglomIndex_[nextGrouped]]++; } - else + else { // No group and no solo group. Make its own group sizeOfGroups[agglomIndex_[rowI]]++; diff --git a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixSelection/BlockMatrixSelection.C b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixSelection/BlockMatrixSelection.C index fb2c84d1b..b9b9389c7 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixSelection/BlockMatrixSelection.C +++ b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockMatrixCoarsening/BlockMatrixSelection/BlockMatrixSelection.C @@ -34,7 +34,7 @@ Author #include "BlockMatrixSelection.H" #include "coeffFields.H" -#include "BlockAMGInterfaceField.H" +#include "BlockSAMGInterfaceField.H" #include "coarseBlockAMGLevel.H" #include "PriorityList.H" #include "crMatrix.H" @@ -1055,7 +1055,7 @@ Foam::BlockMatrixSelection::restrictMatrix() const coarseInterfaces.set ( intI, - AMGInterface::New + SAMGInterface::New ( coarseAddrPtr(), coarseInterfaces, @@ -1067,7 +1067,6 @@ Foam::BlockMatrixSelection::restrictMatrix() const } } - //HJ: Add interface fields //------------------------------------------------------------------------------ // CREATE COARSE MATRIX //------------------------------------------------------------------------------ @@ -1343,6 +1342,65 @@ Foam::BlockMatrixSelection::restrictMatrix() const } } } + + // Get interfaces from coarse matrix + typename BlockLduInterfaceFieldPtrsList::Type& + coarseInterfaceFieldsTransfer = coarseMatrix.interfaces(); + + // Aggolmerate the upper and lower coupled coefficients + forAll (interfaceFields, intI) + { + if (interfaceFields.set(intI)) + { + const SAMGInterface& coarseInterface = + refCast(coarseInterfaces[intI]); + + coarseInterfaceFieldsTransfer.set + ( + intI, + BlockSAMGInterfaceField::New + ( + coarseInterface, + interfaceFields[intI] + ).ptr() + ); + + // Since the type of clustering is now templated, clustering + // of block coefficients must be done by a FIELD (not interface) + // via a new set of virtual functions + // HJ, 16/Mar/2016 + + // Note: in the scalar AMG, clustering is done by the interface + // (always scalar) but in the block matrix it is done by a + // templated block interface field + // HJ, 16/Mar/2016 + + // Cast the interface into AMG type + const BlockSAMGInterfaceField& coarseField = + refCast > + ( + coarseInterfaceFieldsTransfer[intI] + ); + + coarseMatrix.coupleUpper().set + ( + intI, + coarseField.selectBlockCoeffs + ( + matrix_.coupleUpper()[intI] + ) + ); + + coarseMatrix.coupleLower().set + ( + intI, + coarseField.selectBlockCoeffs + ( + matrix_.coupleLower()[intI] + ) + ); + } + } } else { diff --git a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockSAMGInterfaceFields/BlockSAMGInterfaceField/BlockSAMGInterfaceField.C b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockSAMGInterfaceFields/BlockSAMGInterfaceField/BlockSAMGInterfaceField.C index eed21a98e..ab8a097aa 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockSAMGInterfaceFields/BlockSAMGInterfaceField/BlockSAMGInterfaceField.C +++ b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockSAMGInterfaceFields/BlockSAMGInterfaceField/BlockSAMGInterfaceField.C @@ -39,7 +39,7 @@ Foam::BlockSAMGInterfaceField::selectBlockCoeffs ( new CoeffField(interface_.size()) ); - CoeffField& coarseCoeffs = tcoarseCoeffs(); + // CoeffField& coarseCoeffs = tcoarseCoeffs(); /* HJ, code missing typedef CoeffField TypeCoeffField; 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 a6d789753..ea74a82f5 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 @@ -45,12 +45,12 @@ namespace Foam Foam::processorSAMGInterfaceField::processorSAMGInterfaceField ( - const SAMGInterface& AMGCp, + const SAMGInterface& SAMGCp, const lduInterfaceField& fineInterfaceField ) : - SAMGInterfaceField(AMGCp, fineInterfaceField), - procInterface_(refCast(AMGCp)), + SAMGInterfaceField(SAMGCp, fineInterfaceField), + procInterface_(refCast(SAMGCp)), doTransform_(false), rank_(0), outstandingSendRequest_(-1), @@ -58,6 +58,7 @@ 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/processorSAMGInterface/processorSAMGInterface.C b/src/foam/matrices/lduMatrix/solvers/AMG/interfaces/SAMGInterfaces/processorSAMGInterface/processorSAMGInterface.C index 915512111..769e1e571 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 @@ -56,6 +56,7 @@ Foam::processorSAMGInterface::processorSAMGInterface comm_(fineProcInterface_.comm()), tag_(fineProcInterface_.tag()) { + Pout<< "Creating processor SAMG interface" << endl; /* HJ, Code missing here // Make a lookup table of entries for owner/neighbour