Parallel selective AMG - work in progress

This commit is contained in:
Hrvoje Jasak 2017-05-10 13:20:05 +01:00
parent bae31764dc
commit 89ab032da4
3 changed files with 59 additions and 23 deletions

View file

@ -100,7 +100,7 @@ public:
//- Construct from AMG interface and fine level interface field //- Construct from AMG interface and fine level interface field
processorSAMGInterfaceField processorSAMGInterfaceField
( (
const SAMGInterface& AMGCp, const SAMGInterface& SAMGCp,
const lduInterfaceField& fineInterfaceField const lduInterfaceField& fineInterfaceField
); );
@ -116,7 +116,7 @@ public:
//- Return size //- Return size
label size() const label size() const
{ {
return procInterface_.size(); return procInterface_.interfaceSize();
} }

View file

@ -32,7 +32,7 @@ Author
SourceFiles SourceFiles
SAMGInterface.C SAMGInterface.C
newAmgInterface.C newSAMGInterface.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -42,7 +42,7 @@ SourceFiles
#include "lduInterface.H" #include "lduInterface.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "lduPrimitiveMesh.H" #include "lduPrimitiveMesh.H"
#include "coeffFields.H" #include "crMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,17 +62,24 @@ class SAMGInterface
//- Reference to ldu addressing //- Reference to ldu addressing
const lduPrimitiveMesh& lduMesh_; const lduPrimitiveMesh& lduMesh_;
//- Reference to prolongation matrix
const crMatrix& prolongation_;
protected: protected:
// Protected data // Protected data
//- Face-cell addressing. Contains coarse level addressing //- Local face-cell addressing. Contains local coarse level addressing
// Detected as coarse cells on local side
labelField faceCells_; labelField faceCells_;
//- Fine addressing. Contains fine index for each coarse face //- Fine addressing. Contains fine index for each coarse face
labelField fineAddressing_; labelField fineAddressing_;
//- Fine weights
scalarField fineWeights_;
private: private:
@ -100,17 +107,19 @@ public:
lduInterface, lduInterface,
( (
const lduPrimitiveMesh& lduMesh, const lduPrimitiveMesh& lduMesh,
const crMatrix& prolongation,
const lduInterfacePtrsList& coarseInterfaces, const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localSelectAddressing, const labelField& localRowLabel,
const labelField& neighbourSelectAddressing const labelField& neighbourRowLabel
), ),
( (
lduMesh, lduMesh,
prolongation,
coarseInterfaces, coarseInterfaces,
fineInterface, fineInterface,
localSelectAddressing, localRowLabel,
neighbourSelectAddressing neighbourRowLabel
) )
); );
@ -122,10 +131,11 @@ public:
static autoPtr<SAMGInterface> New static autoPtr<SAMGInterface> New
( (
const lduPrimitiveMesh& lduMesh, const lduPrimitiveMesh& lduMesh,
const crMatrix& prolongation,
const lduInterfacePtrsList& coarseInterfaces, const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localSelectAddressing, const labelField& localRowLabel,
const labelField& neighbourSelectAddressing const labelField& neighbourRowLabel
); );
@ -133,9 +143,14 @@ public:
//- Construct from fine-level interface, //- Construct from fine-level interface,
// local and neighbour select addressing // local and neighbour select addressing
SAMGInterface(const lduPrimitiveMesh& lduMesh) SAMGInterface
(
const lduPrimitiveMesh& lduMesh,
const crMatrix& prolongation
)
: :
lduMesh_(lduMesh) lduMesh_(lduMesh),
prolongation_(prolongation)
{} {}
@ -154,24 +169,42 @@ public:
return lduMesh_; return lduMesh_;
} }
//- Return size //- Return reference to prolongation matrix
const crMatrix& prolongation() const
{
return prolongation_;
}
//- Return local size
virtual label size() const virtual label size() const
{ {
return faceCells_.size(); return faceCells_.size();
} }
//- Return faceCell addressing //- Return interface size
virtual label interfaceSize() const
{
return faceCells_.size();
}
//- Return local faceCell addressing
virtual const unallocLabelList& faceCells() const virtual const unallocLabelList& faceCells() const
{ {
return faceCells_; return faceCells_;
} }
//- Return fine addressing //- Return fine addressing: fine index for each coarse face
const labelField& fineAddressing() const const labelField& fineAddressing() const
{ {
return fineAddressing_; return fineAddressing_;
} }
//- Return fine weights
const scalarField& fineWeights() const
{
return fineWeights_;
}
//- Return the interface internal field of the given field //- Return the interface internal field of the given field
template<class Type> template<class Type>
tmp<Field<Type> > interfaceInternalField tmp<Field<Type> > interfaceInternalField
@ -187,7 +220,7 @@ public:
) const; ) const;
// Agglomeration // Coefficient selection
//- Select the given fine-level coefficients and return //- Select the given fine-level coefficients and return
virtual tmp<scalarField> selectCoeffs virtual tmp<scalarField> selectCoeffs

View file

@ -32,10 +32,11 @@ License
Foam::autoPtr<Foam::SAMGInterface> Foam::SAMGInterface::New Foam::autoPtr<Foam::SAMGInterface> Foam::SAMGInterface::New
( (
const lduPrimitiveMesh& lduMesh, const lduPrimitiveMesh& lduMesh,
const crMatrix& prolongation,
const lduInterfacePtrsList& coarseInterfaces, const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface, const lduInterface& fineInterface,
const labelField& localRestrictAddressing, const labelField& localRowLabel,
const labelField& neighbourRestrictAddressing const labelField& neighbourRowLabel
) )
{ {
word coupleType(fineInterface.type()); word coupleType(fineInterface.type());
@ -50,10 +51,11 @@ Foam::autoPtr<Foam::SAMGInterface> Foam::SAMGInterface::New
"SAMGInterface::New\n" "SAMGInterface::New\n"
"(\n" "(\n"
" const lduPrimitiveMesh& lduMesh,\n" " const lduPrimitiveMesh& lduMesh,\n"
" const crMatrix& prolongation,\n"
" const lduInterfacePtrsList& coarseInterfaces,\n" " const lduInterfacePtrsList& coarseInterfaces,\n"
" const lduInterface& fineInterface,\n" " const lduInterface& fineInterface,\n"
" const labelField& localRestrictAddressing,\n" " const labelField& localRowLabel,\n"
" const labelField& neighbourRestrictAddressing\n" " const labelField& neighbourRowLabel\n"
")" ")"
) << "Unknown SAMGInterface type " << coupleType << ".\n" ) << "Unknown SAMGInterface type " << coupleType << ".\n"
<< "Valid SAMGInterface types are :" << "Valid SAMGInterface types are :"
@ -66,10 +68,11 @@ Foam::autoPtr<Foam::SAMGInterface> Foam::SAMGInterface::New
cstrIter() cstrIter()
( (
lduMesh, lduMesh,
prolongation,
coarseInterfaces, coarseInterfaces,
fineInterface, fineInterface,
localRestrictAddressing, localRowLabel,
neighbourRestrictAddressing neighbourRowLabel
) )
); );
} }