Feature: linear solver update: ILUp and two-level AMG smoothers

This commit is contained in:
Hrvoje Jasak 2015-10-11 12:41:19 +01:00
parent a3194d15c0
commit 0791bd9ba3
29 changed files with 200 additions and 217 deletions

View file

@ -25,7 +25,17 @@ Class
Foam::processorFvPatchField Foam::processorFvPatchField
Description Description
Foam::processorFvPatchField This boundary condition enables processor communication across patches.
\heading Patch usage
Example of the boundary condition specification:
\verbatim
myPatch
{
type processor;
}
\endverbatim
SourceFiles SourceFiles
processorFvPatchField.C processorFvPatchField.C
@ -45,7 +55,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class processorFvPatchField Declaration Class processorFvPatchField Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
@ -132,9 +142,8 @@ public:
} }
// Destructor //- Destructor
~processorFvPatchField();
~processorFvPatchField();
// Member functions // Member functions

View file

@ -910,7 +910,7 @@ void Foam::fvMeshSubset::setLargeCellSubset
// 3: face coupled and used by one cell only (so should become normal, // 3: face coupled and used by one cell only (so should become normal,
// non-coupled patch face) // non-coupled patch face)
// //
// Note that this is not really nessecary - but means we can size things // Note that this is not really necessary - but means we can size things
// correctly. Also makes handling coupled faces much easier. // correctly. Also makes handling coupled faces much easier.
labelList nCellsUsingFace(oldFaces.size(), 0); labelList nCellsUsingFace(oldFaces.size(), 0);

View file

@ -711,6 +711,7 @@ matrices/blockLduMatrix/BlockLduPrecons/BlockILUCpPrecon/blockILUCpPrecons.C
matrices/blockLduMatrix/BlockLduSmoothers/BlockLduSmoother/blockLduSmoothers.C matrices/blockLduMatrix/BlockLduSmoothers/BlockLduSmoother/blockLduSmoothers.C
matrices/blockLduMatrix/BlockLduSmoothers/BlockGaussSeidelSmoother/blockGaussSeidelSmoothers.C matrices/blockLduMatrix/BlockLduSmoothers/BlockGaussSeidelSmoother/blockGaussSeidelSmoothers.C
matrices/blockLduMatrix/BlockLduSmoothers/BlockILUSmoother/blockILUSmoothers.C matrices/blockLduMatrix/BlockLduSmoothers/BlockILUSmoother/blockILUSmoothers.C
matrices/blockLduMatrix/BlockLduSmoothers/BlockILUCpSmoother/blockILUCpSmoothers.C
/* compile blockVectorNSolvers earlier to exploit parallelismn */ /* compile blockVectorNSolvers earlier to exploit parallelismn */
matrices/blockLduMatrix/BlockLduSolvers/blockVectorNSolvers.C matrices/blockLduMatrix/BlockLduSolvers/blockVectorNSolvers.C

View file

@ -287,20 +287,20 @@ evaluate()
if if
( (
Pstream::defaultCommsType() == Pstream::blocking Pstream::defaultComms() == Pstream::blocking
|| Pstream::defaultCommsType() == Pstream::nonBlocking || Pstream::defaultComms() == Pstream::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
{ {
this->operator[](patchi).initEvaluate this->operator[](patchi).initEvaluate
( (
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()) Pstream::defaultComms()
); );
} }
// Block for any outstanding requests // Block for any outstanding requests
if (Pstream::defaultCommsType() == Pstream::nonBlocking) if (Pstream::defaultComms() == Pstream::nonBlocking)
{ {
IPstream::waitRequests(); IPstream::waitRequests();
OPstream::waitRequests(); OPstream::waitRequests();
@ -310,11 +310,11 @@ evaluate()
{ {
this->operator[](patchi).evaluate this->operator[](patchi).evaluate
( (
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()) Pstream::defaultComms()
); );
} }
} }
else if (Pstream::defaultCommsType() == Pstream::scheduled) else if (Pstream::defaultComms() == Pstream::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
bmesh_.mesh().globalData().patchSchedule(); bmesh_.mesh().globalData().patchSchedule();
@ -356,8 +356,8 @@ evaluateCoupled()
if if
( (
Pstream::defaultCommsType() == Pstream::blocking Pstream::defaultComms() == Pstream::blocking
|| Pstream::defaultCommsType() == Pstream::nonBlocking || Pstream::defaultComms() == Pstream::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -366,16 +366,13 @@ evaluateCoupled()
{ {
this->operator[](patchi).initEvaluate this->operator[](patchi).initEvaluate
( (
static_cast<Pstream::commsTypes> Pstream::defaultComms()
(
Pstream::defaultCommsType()
)
); );
} }
} }
// Block for any outstanding requests // Block for any outstanding requests
if (Pstream::defaultCommsType() == Pstream::nonBlocking) if (Pstream::defaultComms() == Pstream::nonBlocking)
{ {
IPstream::waitRequests(); IPstream::waitRequests();
OPstream::waitRequests(); OPstream::waitRequests();
@ -387,15 +384,12 @@ evaluateCoupled()
{ {
this->operator[](patchi).evaluate this->operator[](patchi).evaluate
( (
static_cast<Pstream::commsTypes> Pstream::defaultComms()
(
Pstream::defaultCommsType()
)
); );
} }
} }
} }
else if (Pstream::defaultCommsType() == Pstream::scheduled) else if (Pstream::defaultComms() == Pstream::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
bmesh_.mesh().globalData().patchSchedule(); bmesh_.mesh().globalData().patchSchedule();

View file

@ -76,7 +76,8 @@ Foam::coarseBlockAmgLevel<Type>::coarseBlockAmgLevel
BlockLduSmoother<Type>::New BlockLduSmoother<Type>::New
( (
matrixPtr_, matrixPtr_,
dict dict,
"coarseSmoother"
) )
), ),
Ax_() Ax_()

View file

@ -71,7 +71,8 @@ Foam::fineBlockAmgLevel<Type>::fineBlockAmgLevel
BlockLduSmoother<Type>::New BlockLduSmoother<Type>::New
( (
matrix, matrix,
dict dict,
"fineSmoother"
) )
), ),
Ax_() Ax_()

View file

@ -41,8 +41,8 @@ void Foam::BlockLduMatrix<Type>::initInterfaces
{ {
if if
( (
Pstream::defaultCommsType() == Pstream::blocking Pstream::defaultComms() == Pstream::blocking
|| Pstream::defaultCommsType() == Pstream::nonBlocking || Pstream::defaultComms() == Pstream::nonBlocking
) )
{ {
forAll (interfaces_, interfaceI) forAll (interfaces_, interfaceI)
@ -55,13 +55,13 @@ void Foam::BlockLduMatrix<Type>::initInterfaces
result, result,
*this, *this,
interfaceCoeffs[interfaceI], interfaceCoeffs[interfaceI],
static_cast<const Pstream::commsTypes>(Pstream::defaultCommsType()), Pstream::defaultComms(),
switchToLhs switchToLhs
); );
} }
} }
} }
else if (Pstream::defaultCommsType() == Pstream::scheduled) else if (Pstream::defaultComms() == Pstream::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();
@ -107,18 +107,29 @@ void Foam::BlockLduMatrix<Type>::updateInterfaces
const bool switchToLhs const bool switchToLhs
) const ) const
{ {
if if (Pstream::defaultComms() == Pstream::blocking)
( {
Pstream::defaultCommsType() == Pstream::blocking forAll (interfaces_, interfaceI)
|| Pstream::defaultCommsType() == Pstream::nonBlocking {
) if (interfaces_.set(interfaceI))
{
interfaces_[interfaceI].updateInterfaceMatrix
(
psi,
result,
*this,
interfaceCoeffs[interfaceI],
Pstream::defaultComms(),
switchToLhs
);
}
}
}
else if (Pstream::defaultComms() == Pstream::nonBlocking)
{ {
// Block until all sends/receives have been finished // Block until all sends/receives have been finished
if (Pstream::defaultCommsType() == Pstream::nonBlocking) IPstream::waitRequests();
{ OPstream::waitRequests();
IPstream::waitRequests();
OPstream::waitRequests();
}
forAll (interfaces_, interfaceI) forAll (interfaces_, interfaceI)
{ {
@ -130,13 +141,13 @@ void Foam::BlockLduMatrix<Type>::updateInterfaces
result, result,
*this, *this,
interfaceCoeffs[interfaceI], interfaceCoeffs[interfaceI],
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()), Pstream::defaultComms(),
switchToLhs switchToLhs
); );
} }
} }
} }
else if (Pstream::defaultCommsType() == Pstream::scheduled) else if (Pstream::defaultComms() == Pstream::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();

View file

@ -127,7 +127,8 @@ class BlockILUCpPrecon
const Field<Type>& b const Field<Type>& b
) const; ) const;
//- Execute preconditioning with matrix transpose, decoupled version //- Execute preconditioning with matrix transpose,
// decoupled version
void decoupledPreconditionT void decoupledPreconditionT
( (
Field<Type>& xT, Field<Type>& xT,

View file

@ -35,16 +35,17 @@ template<class Type>
Foam::autoPtr<Foam::BlockLduPrecon<Type> > Foam::BlockLduPrecon<Type>::New Foam::autoPtr<Foam::BlockLduPrecon<Type> > Foam::BlockLduPrecon<Type>::New
( (
const BlockLduMatrix<Type>& matrix, const BlockLduMatrix<Type>& matrix,
const dictionary& dict const dictionary& dict,
const word keyword
) )
{ {
word preconName; word preconName;
// handle primitive or dictionary entry // Handle primitive or dictionary entry
const entry& e = dict.lookupEntry("preconditioner", false, false); const entry& e = dict.lookupEntry(keyword, false, false);
if (e.isDict()) if (e.isDict())
{ {
e.dict().lookup("preconditioner") >> preconName; e.dict().lookup(keyword) >> preconName;
} }
else else
{ {
@ -99,26 +100,4 @@ Foam::autoPtr<Foam::BlockLduPrecon<Type> > Foam::BlockLduPrecon<Type>::New
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::word Foam::BlockLduPrecon<Type>::getName(const dictionary& dict)
{
word name;
// handle primitive or dictionary entry
const entry& e = dict.lookupEntry("preconditioner", false, false);
if (e.isDict())
{
e.dict().lookup("preconditioner") >> name;
}
else
{
e.stream() >> name;
}
return name;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -69,12 +69,6 @@ protected:
const BlockLduMatrix<Type>& matrix_; const BlockLduMatrix<Type>& matrix_;
// Protected member functions
//- Find the smoother name (directly or from a sub-dictionary)
static word getName(const dictionary&);
public: public:
//- Runtime type information //- Runtime type information
@ -114,7 +108,8 @@ public:
static autoPtr<BlockLduPrecon<Type> > New static autoPtr<BlockLduPrecon<Type> > New
( (
const BlockLduMatrix<Type>& matrix, const BlockLduMatrix<Type>& matrix,
const dictionary& dict const dictionary& dict,
const word keyword = word("preconditioner")
); );

View file

@ -25,7 +25,7 @@ Class
BlockILUSmoother BlockILUSmoother
Description Description
Gauss-Seidel smoother ILU smoother
SourceFiles SourceFiles
blockILUSmoothers.C blockILUSmoothers.C
@ -44,7 +44,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class BlockILUSmoother Declaration Class BlockILUSmoother Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>

View file

@ -40,13 +40,24 @@ template<class Type>
Foam::autoPtr<Foam::BlockLduSmoother<Type> > Foam::BlockLduSmoother<Type>::New Foam::autoPtr<Foam::BlockLduSmoother<Type> > Foam::BlockLduSmoother<Type>::New
( (
const BlockLduMatrix<Type>& matrix, const BlockLduMatrix<Type>& matrix,
const dictionary& dict const dictionary& dict,
const word keyword
) )
{ {
word smootherName = getName(dict); word smootherName;
// Not (yet?) needed: // Handle primitive or dictionary entry
// const dictionary& controls = e.isDict() ? e.dict() : dictionary::null; const entry& e = dict.lookupEntry(keyword, false, false);
if (e.isDict())
{
e.dict().lookup(keyword) >> smootherName;
}
else
{
e.stream() >> smootherName;
}
const dictionary& controls = e.isDict() ? e.dict() : dictionary::null;
typename dictionaryConstructorTable::iterator constructorIter = typename dictionaryConstructorTable::iterator constructorIter =
dictionaryConstructorTablePtr_->find(smootherName); dictionaryConstructorTablePtr_->find(smootherName);
@ -58,7 +69,8 @@ Foam::autoPtr<Foam::BlockLduSmoother<Type> > Foam::BlockLduSmoother<Type>::New
"autoPtr<BlockLduSmoother> BlockLduSmoother::New\n" "autoPtr<BlockLduSmoother> BlockLduSmoother::New\n"
"(\n" "(\n"
" const BlockLduMatrix<Type>& matrix,\n" " const BlockLduMatrix<Type>& matrix,\n"
" const dictionary& dict\n" " const dictionary& dict,\n"
" const word keyword\n"
")", ")",
dict dict
) << "Unknown matrix smoother " << smootherName ) << "Unknown matrix smoother " << smootherName
@ -73,32 +85,10 @@ Foam::autoPtr<Foam::BlockLduSmoother<Type> > Foam::BlockLduSmoother<Type>::New
constructorIter() constructorIter()
( (
matrix, matrix,
dict controls
) )
); );
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::word Foam::BlockLduSmoother<Type>::getName(const dictionary& dict)
{
word name;
// handle primitive or dictionary entry
const entry& e = dict.lookupEntry("smoother", false, false);
if (e.isDict())
{
e.dict().lookup("smoother") >> name;
}
else
{
e.stream() >> name;
}
return name;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -66,12 +66,6 @@ protected:
const BlockLduMatrix<Type>& matrix_; const BlockLduMatrix<Type>& matrix_;
// Protected member functions
//- Find the smoother name (directly or from a sub-dictionary)
static word getName(const dictionary&);
public: public:
//- Runtime type information //- Runtime type information
@ -111,7 +105,8 @@ public:
static autoPtr<BlockLduSmoother<Type> > New static autoPtr<BlockLduSmoother<Type> > New
( (
const BlockLduMatrix<Type>& matrix, const BlockLduMatrix<Type>& matrix,
const dictionary& dict const dictionary& dict,
const word keyword = word("smoother")
); );

View file

@ -36,6 +36,7 @@ License
#include "blockLduSmoothers.H" #include "blockLduSmoothers.H"
#include "blockGaussSeidelSmoothers.H" #include "blockGaussSeidelSmoothers.H"
#include "BlockILUSmoother.H" #include "BlockILUSmoother.H"
#include "BlockILUCpSmoother.H"
#include "blockLduSolvers.H" #include "blockLduSolvers.H"
#include "BlockDiagonalSolver.H" #include "BlockDiagonalSolver.H"
@ -98,6 +99,9 @@ makeBlockSmoother(block##Type##Smoother, block##Type##GaussSeidelSmoother); \
typedef BlockILUSmoother<type > block##Type##ILUSmoother; \ typedef BlockILUSmoother<type > block##Type##ILUSmoother; \
makeBlockSmoother(block##Type##Smoother, block##Type##ILUSmoother); \ makeBlockSmoother(block##Type##Smoother, block##Type##ILUSmoother); \
\ \
typedef BlockILUCpSmoother<type > block##Type##ILUCpSmoother; \
makeBlockSmoother(block##Type##Smoother, block##Type##ILUCpSmoother); \
\
\ \
/* Solvers */ \ /* Solvers */ \
typedef BlockLduSolver<type > block##Type##Solver; \ typedef BlockLduSolver<type > block##Type##Solver; \

View file

@ -128,7 +128,7 @@ void Foam::processorLduInterface::compressedSend
const UList<Type>& f const UList<Type>& f
) const ) const
{ {
if (sizeof(scalar) != sizeof(float) && Pstream::floatTransfer && f.size()) if (sizeof(scalar) != sizeof(float) && f.size())
{ {
static const label nCmpts = sizeof(Type)/sizeof(scalar); static const label nCmpts = sizeof(Type)/sizeof(scalar);
label nm1 = (f.size() - 1)*nCmpts; label nm1 = (f.size() - 1)*nCmpts;
@ -198,7 +198,7 @@ void Foam::processorLduInterface::compressedReceive
UList<Type>& f UList<Type>& f
) const ) const
{ {
if (sizeof(scalar) != sizeof(float) && Pstream::floatTransfer && f.size()) if (sizeof(scalar) != sizeof(float) && f.size())
{ {
static const label nCmpts = sizeof(Type)/sizeof(scalar); static const label nCmpts = sizeof(Type)/sizeof(scalar);
label nm1 = (f.size() - 1)*nCmpts; label nm1 = (f.size() - 1)*nCmpts;

View file

@ -59,6 +59,10 @@ class lduInterfaceField
//- Reference to the coupled patch this field is defined for //- Reference to the coupled patch this field is defined for
const lduInterface& coupledInterface_; const lduInterface& coupledInterface_;
//- Update index used so that updateInterfaceMatrix is called only once
// during the construction of the matrix
bool updatedMatrix_;
// Private Member Functions // Private Member Functions
@ -80,13 +84,13 @@ public:
//- Construct given coupled patch //- Construct given coupled patch
lduInterfaceField(const lduInterface& patch) lduInterfaceField(const lduInterface& patch)
: :
coupledInterface_(patch) coupledInterface_(patch),
updatedMatrix_(false)
{} {}
// Destructor //- Destructor
virtual ~lduInterfaceField();
virtual ~lduInterfaceField();
// Member Functions // Member Functions
@ -108,6 +112,24 @@ public:
// Coupled interface matrix update // Coupled interface matrix update
//- Whether matrix has been updated
bool updatedMatrix() const
{
return updatedMatrix_;
}
//- Whether matrix has been updated
bool& updatedMatrix()
{
return updatedMatrix_;
}
//- Is all data available
virtual bool ready() const
{
return true;
}
//- Transform neighbour field //- Transform neighbour field
virtual void transformCoupleField virtual void transformCoupleField
( (

View file

@ -165,6 +165,12 @@ public:
return solverName_; return solverName_;
} }
//- Return access to solver name
word& solverName()
{
return solverName_;
}
//- Return initial residual //- Return initial residual
scalar initialResidual() const scalar initialResidual() const
{ {
@ -485,9 +491,6 @@ public:
public: public:
//- Find the smoother name (directly or from a sub-dictionary)
static word getName(const dictionary&);
//- Runtime type information //- Runtime type information
virtual const word& type() const = 0; virtual const word& type() const = 0;
@ -553,7 +556,8 @@ public:
const FieldField<Field, scalar>& coupleBouCoeffs, const FieldField<Field, scalar>& coupleBouCoeffs,
const FieldField<Field, scalar>& coupleIntCoeffs, const FieldField<Field, scalar>& coupleIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const dictionary& dict const dictionary& dict,
const word keyword = word("smoother")
); );
@ -621,9 +625,6 @@ public:
public: public:
//- Find the preconditioner name (directly or from a sub-dictionary)
static word getName(const dictionary&);
//- Runtime type information //- Runtime type information
virtual const word& type() const = 0; virtual const word& type() const = 0;
@ -693,7 +694,8 @@ public:
const FieldField<Field, scalar>& coupleBouCoeffs, const FieldField<Field, scalar>& coupleBouCoeffs,
const FieldField<Field, scalar>& coupleIntCoeffs, const FieldField<Field, scalar>& coupleIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const dictionary& dict const dictionary& dict,
const word keyword = word("preconditioner")
); );

View file

@ -36,28 +36,6 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::word Foam::lduMatrix::preconditioner::getName
(
const dictionary& dict
)
{
word name;
// handle primitive or dictionary entry
const entry& e = dict.lookupEntry("preconditioner", false, false);
if (e.isDict())
{
e.dict().lookup("preconditioner") >> name;
}
else
{
e.stream() >> name;
}
return name;
}
Foam::autoPtr<Foam::lduPreconditioner> Foam::autoPtr<Foam::lduPreconditioner>
Foam::lduPreconditioner::New Foam::lduPreconditioner::New
( (
@ -65,16 +43,17 @@ Foam::lduPreconditioner::New
const FieldField<Field, scalar>& coupleBouCoeffs, const FieldField<Field, scalar>& coupleBouCoeffs,
const FieldField<Field, scalar>& coupleIntCoeffs, const FieldField<Field, scalar>& coupleIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const dictionary& dict const dictionary& dict,
const word keyword
) )
{ {
word preconName; word preconName;
// handle primitive or dictionary entry // handle primitive or dictionary entry
const entry& e = dict.lookupEntry("preconditioner", false, false); const entry& e = dict.lookupEntry(keyword, false, false);
if (e.isDict()) if (e.isDict())
{ {
e.dict().lookup("preconditioner") >> preconName; e.dict().lookup(keyword) >> preconName;
} }
else else
{ {
@ -98,7 +77,8 @@ Foam::lduPreconditioner::New
" const FieldField<Field, scalar>& coupleBouCoeffs,\n" " const FieldField<Field, scalar>& coupleBouCoeffs,\n"
" const FieldField<Field, scalar>& coupleIntCoeffs,\n" " const FieldField<Field, scalar>& coupleIntCoeffs,\n"
" const lduInterfaceFieldPtrsList& interfaces,\n" " const lduInterfaceFieldPtrsList& interfaces,\n"
" const dictionary& dict\n" " const dictionary& dict,\n"
" const word keyword\n"
")", ")",
dict dict
) << "Unknown symmetric matrix preconditioner " ) << "Unknown symmetric matrix preconditioner "

View file

@ -36,44 +36,23 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::word Foam::lduMatrix::smoother::getName
(
const dictionary& dict
)
{
word name;
// handle primitive or dictionary entry
const entry& e = dict.lookupEntry("smoother", false, false);
if (e.isDict())
{
e.dict().lookup("smoother") >> name;
}
else
{
e.stream() >> name;
}
return name;
}
Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
( (
const lduMatrix& matrix, const lduMatrix& matrix,
const FieldField<Field, scalar>& coupleBouCoeffs, const FieldField<Field, scalar>& coupleBouCoeffs,
const FieldField<Field, scalar>& coupleIntCoeffs, const FieldField<Field, scalar>& coupleIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const dictionary& dict const dictionary& dict,
const word keyword
) )
{ {
word smootherName; word smootherName;
// Handle primitive or dictionary entry // Handle primitive or dictionary entry
const entry& e = dict.lookupEntry("smoother", false, false); const entry& e = dict.lookupEntry(keyword, false, false);
if (e.isDict()) if (e.isDict())
{ {
e.dict().lookup("smoother") >> smootherName; e.dict().lookup(keyword) >> smootherName;
} }
else else
{ {

View file

@ -39,8 +39,8 @@ void Foam::lduMatrix::initMatrixInterfaces
{ {
if if
( (
Pstream::defaultCommsType() == Pstream::blocking Pstream::defaultComms() == Pstream::blocking
|| Pstream::defaultCommsType() == Pstream::nonBlocking || Pstream::defaultComms() == Pstream::nonBlocking
) )
{ {
forAll (interfaces, interfaceI) forAll (interfaces, interfaceI)
@ -54,16 +54,13 @@ void Foam::lduMatrix::initMatrixInterfaces
*this, *this,
coupleCoeffs[interfaceI], coupleCoeffs[interfaceI],
cmpt, cmpt,
static_cast<Pstream::commsTypes> Pstream::defaultComms(),
(
Pstream::defaultCommsType()
),
switchToLhs switchToLhs
); );
} }
} }
} }
else if (Pstream::defaultCommsType() == Pstream::scheduled) else if (Pstream::defaultComms() == Pstream::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();
@ -111,18 +108,32 @@ void Foam::lduMatrix::updateMatrixInterfaces
const bool switchToLhs const bool switchToLhs
) const ) const
{ {
if if (Pstream::defaultComms() == Pstream::blocking)
(
Pstream::defaultCommsType() == Pstream::blocking
|| Pstream::defaultCommsType() == Pstream::nonBlocking
)
{ {
// Block until all sends/receives have been finished forAll (interfaces, interfaceI)
if (Pstream::defaultCommsType() == Pstream::nonBlocking)
{ {
IPstream::waitRequests(); if (interfaces.set(interfaceI))
OPstream::waitRequests(); {
interfaces[interfaceI].updateInterfaceMatrix
(
psiif,
result,
*this,
coupleCoeffs[interfaceI],
cmpt,
Pstream::defaultComms(),
switchToLhs
);
}
} }
}
else if (Pstream::defaultComms() == Pstream::nonBlocking)
{
// FOAM-3.1 implementation
// Block until all sends/receives have been finished
IPstream::waitRequests();
OPstream::waitRequests();
forAll (interfaces, interfaceI) forAll (interfaces, interfaceI)
{ {
@ -135,16 +146,13 @@ void Foam::lduMatrix::updateMatrixInterfaces
*this, *this,
coupleCoeffs[interfaceI], coupleCoeffs[interfaceI],
cmpt, cmpt,
static_cast<Pstream::commsTypes> Pstream::defaultComms(),
(
Pstream::defaultCommsType()
),
switchToLhs switchToLhs
); );
} }
} }
} }
else if (Pstream::defaultCommsType() == Pstream::scheduled) else if (Pstream::defaultComms() == Pstream::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();

View file

@ -70,12 +70,7 @@ Foam::lduSolverPerformance Foam::PBiCG::solve
) const ) const
{ {
// --- Setup class containing solver performance data // --- Setup class containing solver performance data
lduSolverPerformance solverPerf lduSolverPerformance solverPerf(typeName, fieldName());
(
lduMatrix::preconditioner::getName(dict()) + typeName,
fieldName()
);
register label nCells = x.size(); register label nCells = x.size();
@ -134,6 +129,9 @@ Foam::lduSolverPerformance Foam::PBiCG::solve
dict() dict()
); );
// Rename the solver pefformance to include precon name
solverPerf.solverName() = preconPtr->type() + typeName;
// Solver iteration // Solver iteration
do do
{ {

View file

@ -70,11 +70,7 @@ Foam::lduSolverPerformance Foam::PCG::solve
) const ) const
{ {
// --- Setup class containing solver performance data // --- Setup class containing solver performance data
lduSolverPerformance solverPerf lduSolverPerformance solverPerf(typeName, fieldName());
(
lduMatrix::preconditioner::getName(dict()) + typeName,
fieldName()
);
register label nCells = x.size(); register label nCells = x.size();
@ -124,6 +120,9 @@ Foam::lduSolverPerformance Foam::PCG::solve
dict() dict()
); );
// Rename the solver pefformance to include precon name
solverPerf.solverName() = preconPtr->type() + typeName;
// Solver iteration // Solver iteration
do do
{ {

View file

@ -89,7 +89,11 @@ Foam::lduSolverPerformance Foam::bicgSolver::solve
) const ) const
{ {
// Prepare solver performance // Prepare solver performance
lduSolverPerformance solverPerf(typeName, fieldName()); lduSolverPerformance solverPerf
(
preconPtr_->type() + typeName,
fieldName()
);
scalarField wA(x.size()); scalarField wA(x.size());
scalarField rA(x.size()); scalarField rA(x.size());

View file

@ -89,7 +89,11 @@ Foam::lduSolverPerformance Foam::cgSolver::solve
) const ) const
{ {
// Prepare solver performance // Prepare solver performance
lduSolverPerformance solverPerf(typeName, fieldName()); lduSolverPerformance solverPerf
(
preconPtr_->type() + typeName,
fieldName()
);
scalarField wA(x.size()); scalarField wA(x.size());
scalarField rA(x.size()); scalarField rA(x.size());

View file

@ -125,7 +125,10 @@ Foam::lduSolverPerformance Foam::gmresSolver::solve
) const ) const
{ {
// Prepare solver performance // Prepare solver performance
lduSolverPerformance solverPerf(typeName, fieldName()); lduSolverPerformance solverPerf
(
preconPtr_->type() + typeName, fieldName()
);
scalarField wA(x.size()); scalarField wA(x.size());
scalarField rA(x.size()); scalarField rA(x.size());

View file

@ -3,7 +3,7 @@
| \\ / F ield | foam-extend: Open Source CFD | | \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 | | \\ / O peration | Version: 3.2 |
| \\ / A nd | Web: http://www.foam-extend.org | | \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | | | \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {

View file

@ -42,7 +42,8 @@ solvers
minCoarseEqns 4; minCoarseEqns 4;
nMaxLevels 100; nMaxLevels 100;
scale on; scale on;
smoother ILU; coarseSmoother ILU;
fineSmoother ILU;
minIter 0; minIter 0;
maxIter 100; maxIter 100;

View file

@ -42,7 +42,8 @@ solvers
// minCoarseEqns 4; // minCoarseEqns 4;
// nMaxLevels 100; // nMaxLevels 100;
// scale on; // scale on;
// smoother ILU; // fineSmoother ILU;
// coarseSmoother k ILU;
// minIter 0; // minIter 0;
// maxIter 100; // maxIter 100;

View file

@ -42,7 +42,8 @@ solvers
// minCoarseEqns 4; // minCoarseEqns 4;
// nMaxLevels 10; // nMaxLevels 10;
// scale on; // scale on;
// smoother ILU; // fineSmoother ILU;
// coarseSmoother k ILU;
// minIter 0; // minIter 0;
// maxIter 100; // maxIter 100;