Merge remote-tracking branch 'origin/BUGFIX/coarseningAndAgglomeration' into nextRelease

This commit is contained in:
Hrvoje Jasak 2014-05-28 10:38:34 +01:00
commit 09f257eeab
22 changed files with 190 additions and 183 deletions

View file

@ -661,8 +661,8 @@ $(BlockLduInterfaceField)/blockVectorNGAMGInterfaceFields.C
matrices/blockLduMatrix/BlockAmg/blockAmgCycles.C
matrices/blockLduMatrix/BlockAmg/blockAmgLevels.C
matrices/blockLduMatrix/BlockAmg/BlockAmgPolicy/blockAmgPolicies.C
matrices/blockLduMatrix/BlockAmg/BlockAmgPolicy/blockAamgPolicies.C
matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/blockMatrixCoarsenings.C
matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/blockMatrixAgglomerations.C
matrices/blockLduMatrix/BlockLduPrecons/BlockLduPrecon/blockLduPrecons.C
matrices/blockLduMatrix/BlockLduPrecons/BlockNoPrecon/blockNoPrecons.C

View file

@ -55,7 +55,7 @@ template<class Type>
class coarseBlockAmgLevel;
template<class Type>
class BlockAmgPolicy;
class BlockMatrixCoarsening;
template<class Type>
class BlockAmgLevel;

View file

@ -39,7 +39,7 @@ SourceFiles
#define BlockAmgLevel_H
#include "BlockLduMatrix.H"
#include "BlockAmgPolicy.H"
#include "BlockMatrixCoarsening.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ template<class Type>
class BlockAmgCycle;
template<class Type>
class BlockAmgPolicy;
class BlockMatrixCoarsening;
template<class Type>
class BlockAmgSolver;

View file

@ -22,17 +22,17 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAamgPolicy
BlockMatrixAgglomeration
Description
Agglomerative AMG policy, adjusted for BlockLduMatrix
Agglomerative block matrix AMG corsening, adjusted for BlockLduMatrix
Author
Klas Jareteg, 2012-12-13
\*---------------------------------------------------------------------------*/
#include "BlockAamgPolicy.H"
#include "BlockMatrixAgglomeration.H"
#include "coeffFields.H"
#include "addToRunTimeSelectionTable.H"
#include "BlockGAMGInterfaceField.H"
@ -41,13 +41,13 @@ Author
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class Type>
const Foam::scalar Foam::BlockAamgPolicy<Type>::weightFactor_ = 0.65;
const Foam::scalar Foam::BlockMatrixAgglomeration<Type>::weightFactor_ = 0.65;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::BlockAamgPolicy<Type>::calcChild()
void Foam::BlockMatrixAgglomeration<Type>::calcChild()
{
// Algorithm:
// 1) Create temporary equation addressing using a double-pass algorithm.
@ -249,7 +249,7 @@ void Foam::BlockAamgPolicy<Type>::calcChild()
if
(
nCoarseEqns_ > BlockAmgPolicy<Type>::minCoarseEqns()
nCoarseEqns_ > BlockMatrixCoarsening<Type>::minCoarseEqns()
&& 3*nCoarseEqns_ <= 2*nRows
)
{
@ -264,7 +264,7 @@ void Foam::BlockAamgPolicy<Type>::calcChild()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::BlockAamgPolicy<Type>::BlockAamgPolicy
Foam::BlockMatrixAgglomeration<Type>::BlockMatrixAgglomeration
(
const BlockLduMatrix<Type>& matrix,
const dictionary& dict,
@ -272,7 +272,7 @@ Foam::BlockAamgPolicy<Type>::BlockAamgPolicy
const label minCoarseEqns
)
:
BlockAmgPolicy<Type>(matrix, dict, groupSize, minCoarseEqns),
BlockMatrixCoarsening<Type>(matrix, dict, groupSize, minCoarseEqns),
matrix_(matrix),
normPtr_
(
@ -292,7 +292,7 @@ Foam::BlockAamgPolicy<Type>::BlockAamgPolicy
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::BlockAamgPolicy<Type>::~BlockAamgPolicy()
Foam::BlockMatrixAgglomeration<Type>::~BlockMatrixAgglomeration()
{}
@ -300,13 +300,14 @@ Foam::BlockAamgPolicy<Type>::~BlockAamgPolicy()
template<class Type>
Foam::autoPtr<Foam::BlockLduMatrix<Type> >
Foam::BlockAamgPolicy<Type>::restrictMatrix() const
Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
{
if (!coarsen_)
{
FatalErrorIn
(
"autoPtr<amgMatrix> BlockAamgPolicy<Type>::restrictMatrix() const"
"autoPtr<amgMatrix> "
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
) << "Requesting coarse matrix when it cannot be created"
<< abort(FatalError);
}
@ -335,7 +336,7 @@ Foam::BlockAamgPolicy<Type>::restrictMatrix() const
{
FatalErrorIn
(
"autoPtr<BlockLduMatrix<Type> > BlockAamgPolicy<Type>::"
"autoPtr<BlockLduMatrix<Type> > BlockMatrixAgglomeration<Type>::"
"restrictMatrix() const"
) << "Child array does not correspond to fine level. " << endl
<< " Child size: " << child_.size()
@ -671,39 +672,42 @@ Foam::BlockAamgPolicy<Type>::restrictMatrix() const
if (cCoeff >= 0)
{
activeCoarseUpper[cCoeff] += activeFineUpper[fineCoeffI];
activeCoarseLower[cCoeff] += activeFineLower[fineCoeffI];
activeCoarseUpper[cCoeff]
+= activeFineUpper[fineCoeffI];
activeCoarseLower[cCoeff]
+= activeFineLower[fineCoeffI];
}
else
{
// Add the fine face coefficients into the diagonal.
activeCoarseDiag[-1 - cCoeff] +=
activeFineUpper[fineCoeffI] + activeFineLower[fineCoeffI];
activeFineUpper[fineCoeffI]
+ activeFineLower[fineCoeffI];
}
}
}
else if (fineUpper.activeType() == blockCoeffBase::LINEAR)
{
FatalErrorIn("autoPtr<amgMatrix> BlockAamgPolicy<Type>::restrictMatrix() const")
FatalErrorIn("autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::restrictMatrix() const")
<< "Matrix diagonal of square type and upper of linear type is not implemented"
<< abort(FatalError);
}
else
{
FatalErrorIn("autoPtr<amgMatrix> BlockAamgPolicy<Type>::restrictMatrix() const")
FatalErrorIn("autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::restrictMatrix() const")
<< "Matrix diagonal of square type and upper of scalar type is not implemented"
<< abort(FatalError);
}
}
else if (fineDiag.activeType() == blockCoeffBase::LINEAR)
{
FatalErrorIn("autoPtr<amgMatrix> BlockAamgPolicy<Type>::restrictMatrix() const")
FatalErrorIn("autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::restrictMatrix() const")
<< "Matrix diagonal of linear type not implemented"
<< abort(FatalError);
}
else
{
FatalErrorIn("autoPtr<amgMatrix> BlockAamgPolicy<Type>::restrictMatrix() const")
FatalErrorIn("autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::restrictMatrix() const")
<< "Matrix diagonal of scalar type not implemented"
<< abort(FatalError);
}
@ -726,24 +730,26 @@ Foam::BlockAamgPolicy<Type>::restrictMatrix() const
if (cCoeff >= 0)
{
activeCoarseUpper[cCoeff] += activeFineUpper[fineCoeffI];
activeCoarseUpper[cCoeff]
+= activeFineUpper[fineCoeffI];
}
else
{
// Add the fine face coefficient into the diagonal.
activeCoarseDiag[-1 - cCoeff] += 2*activeFineUpper[fineCoeffI];
activeCoarseDiag[-1 - cCoeff]
+= 2*activeFineUpper[fineCoeffI];
}
}
}
else if (fineUpper.activeType() == blockCoeffBase::LINEAR)
{
FatalErrorIn("autoPtr<amgMatrix> BlockAamgPolicy<Type>::restrictMatrix() const")
FatalErrorIn("autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::restrictMatrix() const")
<< "Matrix diagonal of square type and upper of linear type is not implemented"
<< abort(FatalError);
}
else
{
FatalErrorIn("autoPtr<amgMatrix> BlockAamgPolicy<Type>::restrictMatrix() const")
FatalErrorIn("autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::restrictMatrix() const")
<< "Matrix diagonal of square type and upper of scalar type is not implemented"
<< abort(FatalError);
}
@ -753,7 +759,7 @@ Foam::BlockAamgPolicy<Type>::restrictMatrix() const
{
FatalErrorIn
(
"autoPtr<amgMatrix> BlockAamgPolicy<Type>::"
"autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::"
"restrictMatrix() const"
) << "Matrix diagonal of linear type not implemented"
<< abort(FatalError);
@ -762,7 +768,7 @@ Foam::BlockAamgPolicy<Type>::restrictMatrix() const
{
FatalErrorIn
(
"autoPtr<amgMatrix> BlockAamgPolicy<Type>::"
"autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::"
"restrictMatrix() const"
) << "Matrix diagonal of scalar type not implemented"
<< abort(FatalError);
@ -780,7 +786,7 @@ Foam::BlockAamgPolicy<Type>::restrictMatrix() const
template<class Type>
void Foam::BlockAamgPolicy<Type>::restrictResidual
void Foam::BlockMatrixAgglomeration<Type>::restrictResidual
(
const CoeffField<Type>& res,
CoeffField<Type>& coarseRes
@ -809,7 +815,7 @@ void Foam::BlockAamgPolicy<Type>::restrictResidual
}
else
{
FatalErrorIn("void BlockAamgPolicy<Type>::restrictResidual() const")
FatalErrorIn("void BlockMatrixAgglomeration<Type>::restrictResidual() const")
<< "Only present for square type coeff type"
<< abort(FatalError);
}
@ -817,7 +823,7 @@ void Foam::BlockAamgPolicy<Type>::restrictResidual
template<class Type>
void Foam::BlockAamgPolicy<Type>::restrictResidual
void Foam::BlockMatrixAgglomeration<Type>::restrictResidual
(
const Field<Type>& res,
Field<Type>& coarseRes
@ -833,7 +839,7 @@ void Foam::BlockAamgPolicy<Type>::restrictResidual
template<class Type>
void Foam::BlockAamgPolicy<Type>::prolongateCorrection
void Foam::BlockMatrixAgglomeration<Type>::prolongateCorrection
(
Field<Type>& x,
const Field<Type>& coarseX

View file

@ -22,23 +22,23 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAamgPolicy
BlockMatrixAgglomeration
Description
Agglomerative AMG policy
Agglomerative block matrix AMG coarsening
Author
Klas Jareteg, 2013-04-15
SourceFiles
BlockAamgPolicy.C
BlockMatrixAgglomeration.C
\*---------------------------------------------------------------------------*/
#ifndef BlockAamgPolicy_H
#define BlockAamgPolicy_H
#ifndef BlockMatrixAgglomeration_H
#define BlockMatrixAgglomeration_H
#include "BlockAmgPolicy.H"
#include "BlockMatrixCoarsening.H"
#include "BlockLduMatrix.H"
#include "BlockCoeffNorm.H"
#include "BlockCoeff.H"
@ -51,13 +51,13 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/*---------------------------------------------------------------------------*\
Class BlockAamgPolicy Declaration
Class BlockMatrixAgglomeration Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class BlockAamgPolicy
class BlockMatrixAgglomeration
:
public BlockAmgPolicy<Type>
public BlockMatrixCoarsening<Type>
{
public:
@ -85,10 +85,10 @@ public:
// Private Member Functions
//- Disallow default bitwise copy construct
BlockAamgPolicy(const BlockAamgPolicy<Type>&);
BlockMatrixAgglomeration(const BlockMatrixAgglomeration<Type>&);
// Disallow default bitwise assignment
void operator=(const BlockAamgPolicy<Type>&);
void operator=(const BlockMatrixAgglomeration<Type>&);
//- Calculate child
void calcChild();
@ -109,7 +109,7 @@ public:
// Constructors
//- Construct from matrix and group size
BlockAamgPolicy
BlockMatrixAgglomeration
(
const BlockLduMatrix<Type>& matrix,
const dictionary& dict,
@ -119,7 +119,7 @@ public:
// Destructor
virtual ~BlockAamgPolicy();
virtual ~BlockMatrixAgglomeration();
// Member Functions
@ -165,7 +165,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "BlockAamgPolicy.C"
# include "BlockMatrixAgglomeration.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -22,18 +22,18 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAmgPolicy
BlockMatrixCoarsening
\*---------------------------------------------------------------------------*/
#include "BlockAmgPolicy.H"
#include "BlockMatrixCoarsening.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class Type>
Foam::autoPtr<Foam::BlockAmgPolicy<Type> > Foam::BlockAmgPolicy<Type>::New
Foam::autoPtr<Foam::BlockMatrixCoarsening<Type> > Foam::BlockMatrixCoarsening<Type>::New
(
const word& policyType,
const word& coarseningType,
const BlockLduMatrix<Type>& matrix,
const dictionary& dict,
const label groupSize,
@ -41,27 +41,27 @@ Foam::autoPtr<Foam::BlockAmgPolicy<Type> > Foam::BlockAmgPolicy<Type>::New
)
{
typename matrixConstructorTable::iterator constructorIter =
matrixConstructorTablePtr_->find(policyType);
matrixConstructorTablePtr_->find(coarseningType);
if (constructorIter == matrixConstructorTablePtr_->end())
{
FatalErrorIn
(
"autoPtr<BlockAmgPolicy<Type> > BlockAmgPolicy<Type>::New\n"
"autoPtr<BlockMatrixCoarsening<Type> > BlockMatrixCoarsening<Type>::New\n"
"(\n"
" const word& policyType,\n"
" const word& coarseningType,\n"
" const lduMatrix& matrix,\n"
" const label groupSize\n"
" const label nCoarseCells\n"
")"
) << "Unknown AMG policy " << policyType
) << "Unknown AMG coarsening type. " << coarseningType
<< endl << endl
<< "Valid AMG policies are :" << endl
<< "Valid AMG coarsening types are :" << endl
<< matrixConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<BlockAmgPolicy<Type> >
return autoPtr<BlockMatrixCoarsening<Type> >
(
constructorIter()
(

View file

@ -22,22 +22,22 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAmgPolicy
BlockMatrixCoarsening
Description
Virtual base class for AMG coarsening policy, implemented for
Virtual base class for block matrix AMG coarsening, implemented for
BlockLduMatrix
Author
Klas Jareteg, 2012-12-15
SourceFiles
BlockAmgPolicy.C
BlockMatrixCoarsening.C
\*---------------------------------------------------------------------------*/
#ifndef BlockAmgPolicy_H
#define BlockAmgPolicy_H
#ifndef BlockMatrixCoarsening_H
#define BlockMatrixCoarsening_H
#include "runTimeSelectionTables.H"
#include "primitiveFieldsFwd.H"
@ -62,11 +62,11 @@ template<class Type>
class BlockAmgLevel;
/*---------------------------------------------------------------------------*\
Class BlockAmgPolicy Declaration
Class BlockMatrixCoarsening Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class BlockAmgPolicy
class BlockMatrixCoarsening
{
// Private Data
@ -82,16 +82,16 @@ class BlockAmgPolicy
// Private Member Functions
//- Disallow default bitwise copy construct
BlockAmgPolicy(const BlockAmgPolicy&);
BlockMatrixCoarsening(const BlockMatrixCoarsening&);
//- Disallow default bitwise assignment
void operator=(const BlockAmgPolicy&);
void operator=(const BlockMatrixCoarsening&);
public:
//- Runtime type information
TypeName("BlockAmgPolicy");
TypeName("BlockMatrixCoarsening");
// KRJ: 2012-12-15: Replaced by the above function
//- Runtime type information
@ -103,7 +103,7 @@ public:
declareRunTimeSelectionTable
(
autoPtr,
BlockAmgPolicy,
BlockMatrixCoarsening,
matrix,
(
const BlockLduMatrix<Type>& matrix,
@ -118,9 +118,9 @@ public:
// Selectors
//- Select given name, group size and matrix
static autoPtr<BlockAmgPolicy<Type> > New
static autoPtr<BlockMatrixCoarsening<Type> > New
(
const word& policyType,
const word& coarseningType,
const BlockLduMatrix<Type>& matrix,
const dictionary& dict,
const label groupSize,
@ -131,7 +131,7 @@ public:
// Constructors
//- Construct from components
BlockAmgPolicy
BlockMatrixCoarsening
(
const BlockLduMatrix<Type>& matrix,
const dictionary& dict,
@ -147,7 +147,7 @@ public:
// Destructor
virtual ~BlockAmgPolicy()
virtual ~BlockMatrixCoarsening()
{}
@ -196,20 +196,20 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "BlockAmgPolicy.C"
# include "BlockMatrixCoarsening.C"
#endif
#define makeBlockAmgPolicy(BlockAmgPolicyType, typeBlockAmgPolicyType) \
#define makeBlockMatrixCoarsening(BlockMatrixCoarseningType, typeBlockMatrixCoarseningType) \
\
defineNamedTemplateTypeNameAndDebug(typeBlockAmgPolicyType, 0); \
defineNamedTemplateTypeNameAndDebug(typeBlockMatrixCoarseningType, 0); \
\
addToRunTimeSelectionTable(BlockAmgPolicyType, typeBlockAmgPolicyType, matrix);
addToRunTimeSelectionTable(BlockMatrixCoarseningType, typeBlockMatrixCoarseningType, matrix);
#define makeBlockAmgPolicys(blockAmgPolicyType) \
#define makeBlockMatrixCoarsenings(blockAmgCoarseningType) \
\
makeBlockAmgPolicy(blockScalarAmgPolicy, blockAmgPolicyType##Scalar); \
makeBlockAmgPolicy(blockVectorAmgPolicy, blockAmgPolicyType##Vector); \
makeBlockAmgPolicy(blockTensorAmgPolicy, blockAmgPolicyType##Tensor);
makeBlockMatrixCoarsening(blockScalarMatrixCoarsening, blockAmgCoarseningType##Scalar); \
makeBlockMatrixCoarsening(blockVectorMatrixCoarsening, blockAmgCoarseningType##Vector); \
makeBlockMatrixCoarsening(blockTensorMatrixCoarsening, blockAmgCoarseningType##Tensor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "blockAamgPolicies.H"
#include "blockAmgPolicies.H"
#include "blockMatrixAgglomerations.H"
#include "blockMatrixCoarsenings.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -33,7 +33,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeBlockAmgPolicys(blockAamgPolicy);
makeBlockMatrixCoarsenings(blockMatrixAgglomeration);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -22,27 +22,27 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAamgPolicy
BlockMatrixAgglomeration
Description
Typedefs for block AMG policies.
Typedefs for block matrix AMG coarsening.
Author
Klas Jareteg, 2012-12-15
SourceFiles
blockAamgPolicies.C
blockMatrixAgglomeration.C
\*---------------------------------------------------------------------------*/
#ifndef blockAamgPolicies_H
#define blockAamgPolicies_H
#ifndef blockMatrixAgglomerations_H
#define blockMatrixAgglomerations_H
// Disabled instantiation for primitive types by force. HJ, 15/Apr/2013
#include "scalarBlockAamgPolicy.H"
#include "vectorBlockAamgPolicy.H"
#include "tensorBlockAamgPolicy.H"
#include "BlockAamgPolicy.H"
#include "scalarBlockMatrixAgglomeration.H"
#include "vectorBlockMatrixAgglomeration.H"
#include "tensorBlockMatrixAgglomeration.H"
#include "BlockMatrixAgglomeration.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,9 +51,9 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef BlockAamgPolicy<scalar> blockAamgPolicyScalar;
typedef BlockAamgPolicy<vector> blockAamgPolicyVector;
typedef BlockAamgPolicy<tensor> blockAamgPolicyTensor;
typedef BlockMatrixAgglomeration<scalar> blockMatrixAgglomerationScalar;
typedef BlockMatrixAgglomeration<vector> blockMatrixAgglomerationVector;
typedef BlockMatrixAgglomeration<tensor> blockMatrixAgglomerationTensor;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "blockAmgPolicies.H"
#include "blockMatrixCoarsenings.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -32,25 +32,25 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineNamedTemplateTypeNameAndDebug(blockScalarAmgPolicy, 0);
defineNamedTemplateTypeNameAndDebug(blockVectorAmgPolicy, 0);
defineNamedTemplateTypeNameAndDebug(blockTensorAmgPolicy, 0);
defineNamedTemplateTypeNameAndDebug(blockScalarMatrixCoarsening, 0);
defineNamedTemplateTypeNameAndDebug(blockVectorMatrixCoarsening, 0);
defineNamedTemplateTypeNameAndDebug(blockTensorMatrixCoarsening, 0);
defineTemplateRunTimeSelectionTable
(
blockScalarAmgPolicy,
blockScalarMatrixCoarsening,
matrix
);
defineTemplateRunTimeSelectionTable
(
blockVectorAmgPolicy,
blockVectorMatrixCoarsening,
matrix
);
defineTemplateRunTimeSelectionTable
(
blockTensorAmgPolicy,
blockTensorMatrixCoarsening,
matrix
);

View file

@ -22,23 +22,23 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAmgPolicy
BlockMatrixCoarsening
Description
Typedefs for block AMG policies.
Typedefs for block matrix AMG coarsening.
Author
Klas Jareteg, 2012-12-15
SourceFiles
blockAmgPolicies.C
blockMatrixCoarsenings.C
\*---------------------------------------------------------------------------*/
#ifndef blockAmgPolicies_H
#define blockAmgPolicies_H
#ifndef blockMatrixCoarsenings_H
#define blockMatrixCoarsenings_H
#include "BlockAmgPolicy.H"
#include "BlockMatrixCoarsening.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,9 +47,9 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef BlockAmgPolicy<scalar> blockScalarAmgPolicy;
typedef BlockAmgPolicy<vector> blockVectorAmgPolicy;
typedef BlockAmgPolicy<tensor> blockTensorAmgPolicy;
typedef BlockMatrixCoarsening<scalar> blockScalarMatrixCoarsening;
typedef BlockMatrixCoarsening<vector> blockVectorMatrixCoarsening;
typedef BlockMatrixCoarsening<tensor> blockTensorMatrixCoarsening;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -22,23 +22,23 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAamgPolicy
BlockMatrixAgglomeration
Description
Specialisation of the BlockAamgPolicy for scalars.
Specialisation of the BlockMatrixAgglomeration for scalars.
Author
Klas Jareteg, 2013-01-31
\*---------------------------------------------------------------------------*/
#ifndef scalarBlockAamgPolicy_H
#define scalarBlockAamgPolicy_H
#ifndef scalarBlockMatrixAgglomeration_H
#define scalarBlockMatrixAgglomeration_H
#include "blockAmgPolicies.H"
#include "blockAamgPolicies.H"
#include "BlockAamgPolicy.H"
#include "BlockAmgPolicy.H"
#include "blockMatrixCoarsenings.H"
#include "blockMatrixAgglomerations.H"
#include "BlockMatrixAgglomeration.H"
#include "BlockMatrixCoarsening.H"
#include "runTimeSelectionTables.H"
#include "scalarBlockLduMatrix.H"
#include "scalarBlockConstraint.H"
@ -52,19 +52,19 @@ namespace Foam
/*---------------------------------------------------------------------------*\
Class BlockAamgPolicy Declaration
Class BlockMatrixAgglomeration Declaration
\*---------------------------------------------------------------------------*/
//- Restrict matrix
template<>
inline autoPtr<BlockLduMatrix<scalar> >
BlockAamgPolicy<scalar>::restrictMatrix() const
BlockMatrixAgglomeration<scalar>::restrictMatrix() const
{
FatalErrorIn
(
"autoPtr<BlockLduMatrix<scalar> > "
"BlockAamgPolicy<Type>::restrictMatrix() const"
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
) << "Function not implemented for Type=scalar. " << endl
<< abort(FatalError);

View file

@ -22,22 +22,22 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAamgPolicy
BlockMatrixAgglomeration
Description
Specialisation of the BlockAamgPolicy for tensors.
Specialisation of the BlockMatrixAgglomeration for tensors.
Author
Klas Jareteg, 2013-01-31
\*---------------------------------------------------------------------------*/
#ifndef tensorBlockAamgPolicy_H
#define tensorBlockAamgPolicy_H
#ifndef tensorBlockMatrixAgglomeration_H
#define tensorBlockMatrixAgglomeration_H
#include "blockAmgPolicies.H"
#include "blockAamgPolicies.H"
#include "BlockAamgPolicy.H"
#include "blockMatrixCoarsenings.H"
#include "blockMatrixAgglomerations.H"
#include "BlockMatrixAgglomeration.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,18 +46,18 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class BlockAamgPolicy Declaration
Class BlockMatrixAgglomeration Declaration
\*---------------------------------------------------------------------------*/
//- Restrict matrix
template<>
inline autoPtr<BlockLduMatrix<tensor> > BlockAamgPolicy<tensor>::restrictMatrix
inline autoPtr<BlockLduMatrix<tensor> > BlockMatrixAgglomeration<tensor>::restrictMatrix
() const
{
FatalErrorIn
(
"autoPtr<BlockLduMatrix<tensor> > BlockAamgPolicy<Type>::"
"autoPtr<BlockLduMatrix<tensor> > BlockMatrixAgglomeration<Type>::"
"restrictMatrix() const"
) << "Function not implemented for Type=tensor. " << endl
<< abort(FatalError);

View file

@ -22,22 +22,22 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
BlockAamgPolicy
BlockMatrixAgglomeration
Description
Specialisation of the BlockAamgPolicy for vectors.
Specialisation of the BlockMatrixAgglomeration for vectors.
Author
Klas Jareteg, 2013-01-31
\*---------------------------------------------------------------------------*/
#ifndef vectorBlockAamgPolicy_H
#define vectorBlockAamgPolicy_H
#ifndef vectorBlockMatrixAgglomeration_H
#define vectorBlockMatrixAgglomeration_H
#include "blockAmgPolicies.H"
#include "blockAamgPolicies.H"
#include "BlockAamgPolicy.H"
#include "blockMatrixCoarsenings.H"
#include "blockMatrixAgglomerations.H"
#include "BlockMatrixAgglomeration.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,18 +46,19 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class BlockAamgPolicy Declaration
Class BlockMatrixAgglomeration Declaration
\*---------------------------------------------------------------------------*/
//- Restrict matrix
template<>
inline autoPtr<BlockLduMatrix<vector> > BlockAamgPolicy<vector>::restrictMatrix
inline autoPtr<BlockLduMatrix<vector> >
BlockMatrixAgglomeration<vector>::restrictMatrix
() const
{
FatalErrorIn
(
"autoPtr<BlockLduMatrix<vector> > BlockAamgPolicy<Type>::"
"autoPtr<BlockLduMatrix<vector> > BlockMatrixAgglomeration<Type>::"
"restrictMatrix() const"
) << "Function not implemented for Type=vector. " << endl
<< abort(FatalError);

View file

@ -50,7 +50,7 @@ Foam::coarseBlockAmgLevel<Type>::coarseBlockAmgLevel
(
autoPtr<BlockLduMatrix<Type> > matrixPtr,
const dictionary& dict,
const word& policyType,
const word& coarseningType,
const label groupSize,
const label minCoarseEqns,
const word& smootherType
@ -60,11 +60,11 @@ Foam::coarseBlockAmgLevel<Type>::coarseBlockAmgLevel
x_(matrixPtr_->diag().size(),pTraits<Type>::zero),
b_(matrixPtr_->diag().size(),pTraits<Type>::zero),
dict_(dict),
policyPtr_
coarseningPtr_
(
BlockAmgPolicy<Type>::New
BlockMatrixCoarsening<Type>::New
(
policyType,
coarseningType,
matrixPtr_,
dict_,
groupSize,
@ -148,13 +148,13 @@ void Foam::coarseBlockAmgLevel<Type>::restrictResidual
residual(x, b, res);
policyPtr_->restrictResidual(res, coarseRes);
coarseningPtr_->restrictResidual(res, coarseRes);
}
else
{
// No pre-sweeps done: x = 0 and residual = b
policyPtr_->restrictResidual(b, coarseRes);
coarseningPtr_->restrictResidual(b, coarseRes);
}
}
@ -166,7 +166,7 @@ void Foam::coarseBlockAmgLevel<Type>::prolongateCorrection
const Field<Type>& coarseX
) const
{
policyPtr_->prolongateCorrection(x, coarseX);
coarseningPtr_->prolongateCorrection(x, coarseX);
}
@ -279,17 +279,17 @@ void Foam::coarseBlockAmgLevel<Type>::scaleX
template<class Type>
Foam::autoPtr<Foam::BlockAmgLevel<Type> > Foam::coarseBlockAmgLevel<Type>::makeNextLevel() const
{
if (policyPtr_->coarsen())
if (coarseningPtr_->coarsen())
{
return autoPtr<Foam::BlockAmgLevel<Type> >
(
new coarseBlockAmgLevel
(
policyPtr_->restrictMatrix(),
coarseningPtr_->restrictMatrix(),
dict(),
policyPtr_->type(),
policyPtr_->groupSize(),
policyPtr_->minCoarseEqns(),
coarseningPtr_->type(),
coarseningPtr_->groupSize(),
coarseningPtr_->minCoarseEqns(),
smootherPtr_->type()
)
);

View file

@ -70,8 +70,8 @@ class coarseBlockAmgLevel
//- Dictionary
const dictionary& dict_;
//- AMG policy
autoPtr<BlockAmgPolicy<Type> > policyPtr_;
//- AMG coarsening
autoPtr<BlockMatrixCoarsening<Type> > coarseningPtr_;
//- Smoother
autoPtr<BlockLduSmoother<Type> > smootherPtr_;
@ -96,7 +96,7 @@ public:
(
autoPtr<BlockLduMatrix<Type> > matrixPtr,
const dictionary& dict,
const word& policyType,
const word& coarseningType,
const label groupSize,
const label minCoarseEqns,
const word& smootherType

View file

@ -49,7 +49,7 @@ Foam::fineBlockAmgLevel<Type>::fineBlockAmgLevel
(
const BlockLduMatrix<Type>& matrix,
const dictionary& dict,
const word& policyType,
const word& coarseningType,
const label groupSize,
const label minCoarseEqns,
const word& smootherType
@ -57,11 +57,11 @@ Foam::fineBlockAmgLevel<Type>::fineBlockAmgLevel
:
matrix_(matrix),
dict_(dict),
policyPtr_
coarseningPtr_
(
BlockAmgPolicy<Type>::New
BlockMatrixCoarsening<Type>::New
(
policyType,
coarseningType,
matrix_,
dict_,
groupSize,
@ -145,7 +145,7 @@ void Foam::fineBlockAmgLevel<Type>::restrictResidual
// Here x != 0. It is assumed that the buffer will contain the residual
// if no pre-sweeps have been done. HJ, 4/Sep/2006
policyPtr_->restrictResidual(xBuffer, coarseRes);
coarseningPtr_->restrictResidual(xBuffer, coarseRes);
}
@ -156,7 +156,7 @@ void Foam::fineBlockAmgLevel<Type>::prolongateCorrection
const Field<Type>& coarseX
) const
{
policyPtr_->prolongateCorrection(x, coarseX);
coarseningPtr_->prolongateCorrection(x, coarseX);
}
@ -267,17 +267,17 @@ template<class Type>
Foam::autoPtr<Foam::BlockAmgLevel<Type> >
Foam::fineBlockAmgLevel<Type>::makeNextLevel() const
{
if (policyPtr_->coarsen())
if (coarseningPtr_->coarsen())
{
return autoPtr<Foam::BlockAmgLevel<Type> >
(
new coarseBlockAmgLevel<Type>
(
policyPtr_->restrictMatrix(),
coarseningPtr_->restrictMatrix(),
dict(),
policyPtr_->type(),
policyPtr_->groupSize(),
policyPtr_->minCoarseEqns(),
coarseningPtr_->type(),
coarseningPtr_->groupSize(),
coarseningPtr_->minCoarseEqns(),
smootherPtr_->type()
)
);

View file

@ -55,7 +55,7 @@ template<class Type>
class coarseBlockAmgLevel;
template<class Type>
class BlockAmgPolicy;
class BlockMatrixCoarsening;
/*---------------------------------------------------------------------------*\
Class fineBlockAmgLevel Declaration
@ -74,8 +74,8 @@ class fineBlockAmgLevel
//- Dictionary
const dictionary& dict_;
//- AMG policy
autoPtr<BlockAmgPolicy<Type> > policyPtr_;
//- AMG coarsening
autoPtr<BlockMatrixCoarsening<Type> > coarseningPtr_;
//- Smoother
autoPtr<BlockLduSmoother<Type> > smootherPtr_;
@ -101,7 +101,7 @@ public:
(
const BlockLduMatrix<Type>& matrix,
const dictionary& dict,
const word& policyType,
const word& coarseningType,
const label groupSize,
const label minCoarseEqns,
const word& smootherType

View file

@ -68,7 +68,7 @@ Foam::BlockAmgPrecon<Type>::BlockAmgPrecon
(
matrix,
dict,
dict.lookup("policy"),
dict.lookup("coarseningType"),
readLabel(dict.lookup("groupSize")),
readLabel(dict.lookup("minCoarseEqns")),
dict.lookup("smoother")

View file

@ -22,7 +22,7 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
Algebraic Multigrid solver with run-time selection of policy and cycle
Algebraic Multigrid solver with run-time selection of coarsening and cycle
Author
Klas Jareteg, 2013-04-15

View file

@ -25,7 +25,7 @@ Class
BlockAmgSolver
Description
Algebraic Multigrid solver with run-time selection of policy and cycle
Algebraic Multigrid solver with run-time selection of coarsening and cycle
adjusted for BlockLduMatrix.
Author

View file

@ -46,8 +46,8 @@ License
// KRJ: 2012-12-15: Multigrid solver
#include "blockAmgSolvers.H"
#include "blockAmgPrecons.H"
#include "blockAmgPolicies.H"
#include "blockAamgPolicies.H"
#include "blockMatrixCoarsenings.H"
#include "blockMatrixAgglomerations.H"
#include "blockCoeffNorms.H"
#include "blockCoeffTwoNorms.H"
#include "blockCoeffMaxNorms.H"
@ -132,12 +132,12 @@ makeBlockSolverTypeName(block##Type##GMRESSolver); \
addSolverToBlockMatrix(Type, block##Type##GMRESSolver, symMatrix); \
addSolverToBlockMatrix(Type, block##Type##GMRESSolver, asymMatrix); \
\
typedef BlockAmgPolicy<type > block##Type##AmgPolicy; \
defineNamedTemplateTypeNameAndDebug(block##Type##AmgPolicy, 0); \
defineTemplateRunTimeSelectionTable(block##Type##AmgPolicy, matrix); \
typedef BlockMatrixCoarsening<type > block##Type##MatrixCoarsening; \
defineNamedTemplateTypeNameAndDebug(block##Type##MatrixCoarsening, 0); \
defineTemplateRunTimeSelectionTable(block##Type##MatrixCoarsening, matrix); \
\
typedef BlockAamgPolicy<type > block##Type##AamgPolicy; \
makeBlockAmgPolicy(block##Type##AmgPolicy, block##Type##AamgPolicy); \
typedef BlockMatrixAgglomeration<type > block##Type##MatrixAgglomeration; \
makeBlockMatrixCoarsening(block##Type##MatrixCoarsening, block##Type##MatrixAgglomeration); \
\
typedef BlockCoeffNorm<type > block##Type##CoeffNorm; \
defineNamedTemplateTypeNameAndDebug(block##Type##CoeffNorm, 0); \