Block SAMG solver updates

This commit is contained in:
Hrvoje Jasak 2017-05-09 08:35:49 +01:00
parent 32621068ae
commit f600c863c4
5 changed files with 68 additions and 8 deletions

View file

@ -459,7 +459,7 @@ void Foam::BlockMatrixClustering<Type>::calcClustering()
agglomIndex_[rowI] = agglomIndex_[nextGrouped]; agglomIndex_[rowI] = agglomIndex_[nextGrouped];
sizeOfGroups[agglomIndex_[nextGrouped]]++; sizeOfGroups[agglomIndex_[nextGrouped]]++;
} }
else else
{ {
// No group and no solo group. Make its own group // No group and no solo group. Make its own group
sizeOfGroups[agglomIndex_[rowI]]++; sizeOfGroups[agglomIndex_[rowI]]++;

View file

@ -34,7 +34,7 @@ Author
#include "BlockMatrixSelection.H" #include "BlockMatrixSelection.H"
#include "coeffFields.H" #include "coeffFields.H"
#include "BlockAMGInterfaceField.H" #include "BlockSAMGInterfaceField.H"
#include "coarseBlockAMGLevel.H" #include "coarseBlockAMGLevel.H"
#include "PriorityList.H" #include "PriorityList.H"
#include "crMatrix.H" #include "crMatrix.H"
@ -1055,7 +1055,7 @@ Foam::BlockMatrixSelection<Type>::restrictMatrix() const
coarseInterfaces.set coarseInterfaces.set
( (
intI, intI,
AMGInterface::New SAMGInterface::New
( (
coarseAddrPtr(), coarseAddrPtr(),
coarseInterfaces, coarseInterfaces,
@ -1067,7 +1067,6 @@ Foam::BlockMatrixSelection<Type>::restrictMatrix() const
} }
} }
//HJ: Add interface fields
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// CREATE COARSE MATRIX // CREATE COARSE MATRIX
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1343,6 +1342,65 @@ Foam::BlockMatrixSelection<Type>::restrictMatrix() const
} }
} }
} }
// Get interfaces from coarse matrix
typename BlockLduInterfaceFieldPtrsList<Type>::Type&
coarseInterfaceFieldsTransfer = coarseMatrix.interfaces();
// Aggolmerate the upper and lower coupled coefficients
forAll (interfaceFields, intI)
{
if (interfaceFields.set(intI))
{
const SAMGInterface& coarseInterface =
refCast<const SAMGInterface>(coarseInterfaces[intI]);
coarseInterfaceFieldsTransfer.set
(
intI,
BlockSAMGInterfaceField<Type>::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<Type>& coarseField =
refCast<const BlockSAMGInterfaceField<Type> >
(
coarseInterfaceFieldsTransfer[intI]
);
coarseMatrix.coupleUpper().set
(
intI,
coarseField.selectBlockCoeffs
(
matrix_.coupleUpper()[intI]
)
);
coarseMatrix.coupleLower().set
(
intI,
coarseField.selectBlockCoeffs
(
matrix_.coupleLower()[intI]
)
);
}
}
} }
else else
{ {

View file

@ -39,7 +39,7 @@ Foam::BlockSAMGInterfaceField<Type>::selectBlockCoeffs
( (
new CoeffField<Type>(interface_.size()) new CoeffField<Type>(interface_.size())
); );
CoeffField<Type>& coarseCoeffs = tcoarseCoeffs(); // CoeffField<Type>& coarseCoeffs = tcoarseCoeffs();
/* HJ, code missing /* HJ, code missing
typedef CoeffField<Type> TypeCoeffField; typedef CoeffField<Type> TypeCoeffField;

View file

@ -45,12 +45,12 @@ namespace Foam
Foam::processorSAMGInterfaceField::processorSAMGInterfaceField Foam::processorSAMGInterfaceField::processorSAMGInterfaceField
( (
const SAMGInterface& AMGCp, const SAMGInterface& SAMGCp,
const lduInterfaceField& fineInterfaceField const lduInterfaceField& fineInterfaceField
) )
: :
SAMGInterfaceField(AMGCp, fineInterfaceField), SAMGInterfaceField(SAMGCp, fineInterfaceField),
procInterface_(refCast<const processorSAMGInterface>(AMGCp)), procInterface_(refCast<const processorSAMGInterface>(SAMGCp)),
doTransform_(false), doTransform_(false),
rank_(0), rank_(0),
outstandingSendRequest_(-1), outstandingSendRequest_(-1),
@ -58,6 +58,7 @@ Foam::processorSAMGInterfaceField::processorSAMGInterfaceField
scalarSendBuf_(0), scalarSendBuf_(0),
scalarReceiveBuf_(0) scalarReceiveBuf_(0)
{ {
Pout<< "Creating processor SAMG interface field" << endl;
const processorLduInterfaceField& p = const processorLduInterfaceField& p =
refCast<const processorLduInterfaceField>(fineInterfaceField); refCast<const processorLduInterfaceField>(fineInterfaceField);

View file

@ -56,6 +56,7 @@ Foam::processorSAMGInterface::processorSAMGInterface
comm_(fineProcInterface_.comm()), comm_(fineProcInterface_.comm()),
tag_(fineProcInterface_.tag()) tag_(fineProcInterface_.tag())
{ {
Pout<< "Creating processor SAMG interface" << endl;
/* HJ, Code missing here /* HJ, Code missing here
// Make a lookup table of entries for owner/neighbour // Make a lookup table of entries for owner/neighbour