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];
sizeOfGroups[agglomIndex_[nextGrouped]]++;
}
else
else
{
// No group and no solo group. Make its own group
sizeOfGroups[agglomIndex_[rowI]]++;

View file

@ -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<Type>::restrictMatrix() const
coarseInterfaces.set
(
intI,
AMGInterface::New
SAMGInterface::New
(
coarseAddrPtr(),
coarseInterfaces,
@ -1067,7 +1067,6 @@ Foam::BlockMatrixSelection<Type>::restrictMatrix() const
}
}
//HJ: Add interface fields
//------------------------------------------------------------------------------
// 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
{

View file

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

View file

@ -45,12 +45,12 @@ namespace Foam
Foam::processorSAMGInterfaceField::processorSAMGInterfaceField
(
const SAMGInterface& AMGCp,
const SAMGInterface& SAMGCp,
const lduInterfaceField& fineInterfaceField
)
:
SAMGInterfaceField(AMGCp, fineInterfaceField),
procInterface_(refCast<const processorSAMGInterface>(AMGCp)),
SAMGInterfaceField(SAMGCp, fineInterfaceField),
procInterface_(refCast<const processorSAMGInterface>(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<const processorLduInterfaceField>(fineInterfaceField);

View file

@ -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