Experimental block clustering algorithms
This commit is contained in:
parent
2bbc8d86ce
commit
89c063083d
14 changed files with 3621 additions and 0 deletions
|
@ -702,6 +702,8 @@ BlockMatrixCoarsening = $(BlockAMG)/BlockMatrixCoarsening
|
||||||
$(BlockMatrixCoarsening)/BlockMatrixCoarsening/blockMatrixCoarsenings.C
|
$(BlockMatrixCoarsening)/BlockMatrixCoarsening/blockMatrixCoarsenings.C
|
||||||
$(BlockMatrixCoarsening)/BlockMatrixAgglomeration/blockMatrixAgglomerations.C
|
$(BlockMatrixCoarsening)/BlockMatrixAgglomeration/blockMatrixAgglomerations.C
|
||||||
$(BlockMatrixCoarsening)/BlockMatrixClustering/blockMatrixClusterings.C
|
$(BlockMatrixCoarsening)/BlockMatrixClustering/blockMatrixClusterings.C
|
||||||
|
$(BlockMatrixCoarsening)/BlockSelectiveAMG/blockSelectiveAMGs.C
|
||||||
|
$(BlockMatrixCoarsening)/BlockMatrixSelection/blockMatrixSelections.C
|
||||||
|
|
||||||
BlockLduPrecons = matrices/blockLduMatrix/BlockLduPrecons
|
BlockLduPrecons = matrices/blockLduMatrix/BlockLduPrecons
|
||||||
$(BlockLduPrecons)/BlockLduPrecon/blockLduPrecons.C
|
$(BlockLduPrecons)/BlockLduPrecon/blockLduPrecons.C
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,186 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockMatrixSelection
|
||||||
|
|
||||||
|
Description
|
||||||
|
Selective AMG policy for block matrices
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FMENA
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
BlockMatrixSelection.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef BlockMatrixSelection_H
|
||||||
|
#define BlockMatrixSelection_H
|
||||||
|
|
||||||
|
#include "BlockMatrixCoarsening.H"
|
||||||
|
#include "BlockLduMatrix.H"
|
||||||
|
#include "BlockCoeffNorm.H"
|
||||||
|
#include "BlockCoeff.H"
|
||||||
|
#include "crMatrix.H"
|
||||||
|
#include "tolerancesSwitch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class BlockMatrixSelection Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class BlockMatrixSelection
|
||||||
|
:
|
||||||
|
public BlockMatrixCoarsening<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Reference to matrix
|
||||||
|
const BlockLduMatrix<Type>& matrix_;
|
||||||
|
|
||||||
|
//- Reference to a templated norm calculator
|
||||||
|
//- INFO: Component norm is recommended, based on the pressure equation
|
||||||
|
autoPtr<BlockCoeffNorm<Type> > normPtr_;
|
||||||
|
|
||||||
|
//- Number of coarse equations
|
||||||
|
label nCoarseEqns_;
|
||||||
|
|
||||||
|
//- Can a coarse level be constructed?
|
||||||
|
bool coarsen_;
|
||||||
|
|
||||||
|
//- Prolongation matrix
|
||||||
|
crMatrix* Pptr_;
|
||||||
|
|
||||||
|
//- Restriction matrix
|
||||||
|
crMatrix* Rptr_;
|
||||||
|
|
||||||
|
//- Coarsening array - array with labels of coarse/fine equations
|
||||||
|
labelList rowLabel_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
BlockMatrixSelection(const BlockMatrixSelection<Type>&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const BlockMatrixSelection<Type>&);
|
||||||
|
|
||||||
|
//- Calculate restriction and prolongation
|
||||||
|
void calcCoarsening();
|
||||||
|
|
||||||
|
|
||||||
|
// Private enumerations
|
||||||
|
|
||||||
|
// Equation type
|
||||||
|
enum equationType
|
||||||
|
{
|
||||||
|
UNDECIDED = -1,
|
||||||
|
COARSE = 0,
|
||||||
|
FINE = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Private Static Data
|
||||||
|
|
||||||
|
//- Weighting factor
|
||||||
|
static const debug::tolerancesSwitch epsilon_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("SAMG");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from matrix and group size
|
||||||
|
BlockMatrixSelection
|
||||||
|
(
|
||||||
|
const BlockLduMatrix<Type>& matrix,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label groupSize,
|
||||||
|
const label minCoarseEqns
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~BlockMatrixSelection();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return array with labels of equations (coarse = 0 / fine = 1)
|
||||||
|
//- (used only for postprocessing)
|
||||||
|
const labelList& coarseningLabels() const
|
||||||
|
{
|
||||||
|
return rowLabel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Can a coarse level be constructed?
|
||||||
|
virtual bool coarsen() const
|
||||||
|
{
|
||||||
|
return coarsen_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Restrict matrix
|
||||||
|
virtual autoPtr<BlockAMGLevel<Type> > restrictMatrix() const;
|
||||||
|
|
||||||
|
//- Restrict residual
|
||||||
|
virtual void restrictResidual
|
||||||
|
(
|
||||||
|
const Field<Type>& res,
|
||||||
|
Field<Type>& coarseRes
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Prolongate correction
|
||||||
|
virtual void prolongateCorrection
|
||||||
|
(
|
||||||
|
Field<Type>& x,
|
||||||
|
const Field<Type>& coarseX
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "BlockMatrixSelection.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "blockMatrixSelections.H"
|
||||||
|
#include "blockMatrixCoarsenings.H"
|
||||||
|
#include "coarseBlockAMGLevel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeBlockMatrixCoarsenings(BlockMatrixSelection);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockMatrixSelection
|
||||||
|
|
||||||
|
Description
|
||||||
|
Typedefs for block matrix AMG coarsening.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FAMENA
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
BlockMatrixSelection.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef BlockMatrixSelections_H
|
||||||
|
#define BlockMatrixSelections_H
|
||||||
|
|
||||||
|
// Disabled instantiation for primitive types by force
|
||||||
|
#include "scalarBlockMatrixSelection.H"
|
||||||
|
#include "tensorBlockMatrixSelection.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef BlockMatrixSelection<scalar> BlockMatrixSelectionScalar;
|
||||||
|
typedef BlockMatrixSelection<vector> BlockMatrixSelectionVector;
|
||||||
|
typedef BlockMatrixSelection<tensor> BlockMatrixSelectionTensor;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockMatrixSelection
|
||||||
|
|
||||||
|
Description
|
||||||
|
Specialisation of the BlockMatrixSelection for scalars.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FAMENA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef scalarBlockMatrixSelection_H
|
||||||
|
#define scalarBlockMatrixSelection_H
|
||||||
|
|
||||||
|
#include "BlockMatrixSelection.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class BlockMatrixSelection Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// Disable restrict matrix
|
||||||
|
// HJ: remove inline in refactoring
|
||||||
|
template<>
|
||||||
|
inline autoPtr<BlockAMGLevel<scalar> >
|
||||||
|
BlockMatrixSelection<scalar>::restrictMatrix() const
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"autoPtr<BlockAMGLevel<scalar> > "
|
||||||
|
"BlockMatrixSelection<Type>::restrictMatrix() const"
|
||||||
|
) << "Function not implemented for Type=scalar. " << endl
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
// Dummy return to keep compiler happy
|
||||||
|
return autoPtr<BlockAMGLevel<scalar> >(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockMatrixSelection
|
||||||
|
|
||||||
|
Description
|
||||||
|
Specialisation of the BlockMatrixSelection for tensors.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FAMENA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef tensorBlockMatrixSelection_H
|
||||||
|
#define tensorBlockMatrixSelection_H
|
||||||
|
|
||||||
|
#include "BlockMatrixSelection.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class BlockMatrixSelection Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// Disable restrict matrix: no square type
|
||||||
|
// HJ: remove inline in refactoring
|
||||||
|
template<>
|
||||||
|
inline autoPtr<BlockAMGLevel<tensor> >
|
||||||
|
BlockMatrixSelection<tensor>::restrictMatrix() const
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"autoPtr<BlockAMGLevel<tensor> > "
|
||||||
|
"BlockMatrixSelection<Type>::"
|
||||||
|
"restrictMatrix() const"
|
||||||
|
) << "Function not implemented for Type=tensor. " << endl
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
// Dummy return to keep compiler happy
|
||||||
|
return autoPtr<BlockAMGLevel<tensor> >(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,177 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockSelectiveAMG
|
||||||
|
|
||||||
|
Description
|
||||||
|
Selective AMG policy for block matrices
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FMENA
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
BlockSelectiveAMG.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef BlockSelectiveAMG_H
|
||||||
|
#define BlockSelectiveAMG_H
|
||||||
|
|
||||||
|
#include "BlockMatrixCoarsening.H"
|
||||||
|
#include "BlockLduMatrix.H"
|
||||||
|
#include "BlockCoeffNorm.H"
|
||||||
|
#include "BlockCoeff.H"
|
||||||
|
#include "crMatrix.H"
|
||||||
|
#include "tolerancesSwitch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class BlockSelectiveAMG Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class BlockSelectiveAMG
|
||||||
|
:
|
||||||
|
public BlockMatrixCoarsening<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Reference to matrix
|
||||||
|
const BlockLduMatrix<Type>& matrix_;
|
||||||
|
|
||||||
|
//- Reference to a templated norm calculator
|
||||||
|
//- INFO: Component norm is recommended, based on the pressure equation
|
||||||
|
autoPtr<BlockCoeffNorm<Type> > normPtr_;
|
||||||
|
|
||||||
|
//- Number of coarse equations
|
||||||
|
label nCoarseEqns_;
|
||||||
|
|
||||||
|
//- Can a coarse level be constructed?
|
||||||
|
bool coarsen_;
|
||||||
|
|
||||||
|
//- Prolongation matrix
|
||||||
|
crMatrix* Pptr_;
|
||||||
|
|
||||||
|
//- Restriction matrix
|
||||||
|
crMatrix* Rptr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
BlockSelectiveAMG(const BlockSelectiveAMG<Type>&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const BlockSelectiveAMG<Type>&);
|
||||||
|
|
||||||
|
//- Calculate restriction and prolongation
|
||||||
|
void calcCoarsening();
|
||||||
|
|
||||||
|
|
||||||
|
// Private enumerations
|
||||||
|
|
||||||
|
// Equation type
|
||||||
|
enum equationType
|
||||||
|
{
|
||||||
|
UNDECIDED = -1,
|
||||||
|
COARSE = 0,
|
||||||
|
FINE = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Private Static Data
|
||||||
|
|
||||||
|
//- Weighting factor
|
||||||
|
static const debug::tolerancesSwitch epsilon_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("selection");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from matrix and group size
|
||||||
|
BlockSelectiveAMG
|
||||||
|
(
|
||||||
|
const BlockLduMatrix<Type>& matrix,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label groupSize,
|
||||||
|
const label minCoarseEqns
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~BlockSelectiveAMG();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Can a coarse level be constructed?
|
||||||
|
virtual bool coarsen() const
|
||||||
|
{
|
||||||
|
return coarsen_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Restrict matrix
|
||||||
|
virtual autoPtr<BlockAMGLevel<Type> > restrictMatrix() const;
|
||||||
|
|
||||||
|
//- Restrict residual
|
||||||
|
virtual void restrictResidual
|
||||||
|
(
|
||||||
|
const Field<Type>& res,
|
||||||
|
Field<Type>& coarseRes
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Prolongate correction
|
||||||
|
virtual void prolongateCorrection
|
||||||
|
(
|
||||||
|
Field<Type>& x,
|
||||||
|
const Field<Type>& coarseX
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "BlockSelectiveAMG.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "blockSelectiveAMGs.H"
|
||||||
|
#include "blockMatrixCoarsenings.H"
|
||||||
|
#include "coarseBlockAMGLevel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeBlockMatrixCoarsenings(blockSelectiveAMG);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockSelectiveAMG
|
||||||
|
|
||||||
|
Description
|
||||||
|
Typedefs for block matrix AMG coarsening.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FAMENA
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
BlockSelectiveAMG.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef blockSelectiveAMGs_H
|
||||||
|
#define blockSelectiveAMGs_H
|
||||||
|
|
||||||
|
// Disabled instantiation for primitive types by force
|
||||||
|
#include "scalarBlockSelectiveAMG.H"
|
||||||
|
#include "tensorBlockSelectiveAMG.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef BlockSelectiveAMG<scalar> blockSelectiveAMGScalar;
|
||||||
|
typedef BlockSelectiveAMG<vector> blockSelectiveAMGVector;
|
||||||
|
typedef BlockSelectiveAMG<tensor> blockSelectiveAMGTensor;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockSelectiveAMG
|
||||||
|
|
||||||
|
Description
|
||||||
|
Specialisation of the BlockSelectiveAMG for scalars.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FAMENA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef scalarBlockSelectiveAMG_H
|
||||||
|
#define scalarBlockSelectiveAMG_H
|
||||||
|
|
||||||
|
#include "BlockSelectiveAMG.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Disable restrict matrix
|
||||||
|
template<>
|
||||||
|
inline autoPtr<BlockAMGLevel<scalar> >
|
||||||
|
BlockSelectiveAMG<scalar>::restrictMatrix() const
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"autoPtr<BlockAMGLevel<scalar> > "
|
||||||
|
"BlockSelectiveAMG<Type>::restrictMatrix() const"
|
||||||
|
) << "Function not implemented for Type=scalar. " << endl
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
// Dummy return to keep compiler happy
|
||||||
|
return autoPtr<BlockAMGLevel<scalar> >(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
BlockMatrixSelection
|
||||||
|
|
||||||
|
Description
|
||||||
|
Specialisation of the BlockMatrixSelection for tensors.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Tessa Uroic, FAMENA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef tensorBlockSelectiveAMG_H
|
||||||
|
#define tensorBlockSelectiveAMG_H
|
||||||
|
|
||||||
|
#include "BlockSelectiveAMG.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Disable restrict matrix: no square type
|
||||||
|
template<>
|
||||||
|
inline autoPtr<BlockAMGLevel<tensor> >
|
||||||
|
BlockSelectiveAMG<tensor>::restrictMatrix() const
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"autoPtr<BlockAMGLevel<Type> > "
|
||||||
|
"BlockSelectiveAMG<Type>::restrictMatrix() const"
|
||||||
|
) << "Function not implemented for Type=tensor. " << endl
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
// Dummy return to keep compiler happy
|
||||||
|
return autoPtr<BlockAMGLevel<tensor> >(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -51,6 +51,8 @@ License
|
||||||
#include "blockMatrixCoarsenings.H"
|
#include "blockMatrixCoarsenings.H"
|
||||||
#include "blockMatrixAgglomerations.H"
|
#include "blockMatrixAgglomerations.H"
|
||||||
#include "blockMatrixClusterings.H"
|
#include "blockMatrixClusterings.H"
|
||||||
|
#include "blockMatrixSelections.H"
|
||||||
|
#include "blockSelectiveAMGs.H"
|
||||||
#include "blockCoeffNorms.H"
|
#include "blockCoeffNorms.H"
|
||||||
#include "blockCoeffTwoNorms.H"
|
#include "blockCoeffTwoNorms.H"
|
||||||
#include "blockCoeffMaxNorms.H"
|
#include "blockCoeffMaxNorms.H"
|
||||||
|
@ -151,6 +153,12 @@ makeBlockMatrixCoarsening(block##Type##MatrixCoarsening, block##Type##MatrixAggl
|
||||||
typedef BlockMatrixClustering<type > block##Type##MatrixClustering; \
|
typedef BlockMatrixClustering<type > block##Type##MatrixClustering; \
|
||||||
makeBlockMatrixCoarsening(block##Type##MatrixCoarsening, block##Type##MatrixClustering); \
|
makeBlockMatrixCoarsening(block##Type##MatrixCoarsening, block##Type##MatrixClustering); \
|
||||||
\
|
\
|
||||||
|
typedef BlockMatrixSelection<type > block##Type##MatrixSelection; \
|
||||||
|
makeBlockMatrixCoarsening(block##Type##MatrixCoarsening, block##Type##MatrixSelection); \
|
||||||
|
\
|
||||||
|
typedef BlockSelectiveAMG<type > block##Type##SelectiveAMG; \
|
||||||
|
makeBlockMatrixCoarsening(block##Type##MatrixCoarsening, block##Type##SelectiveAMG); \
|
||||||
|
\
|
||||||
typedef BlockCoeffNorm<type > block##Type##CoeffNorm; \
|
typedef BlockCoeffNorm<type > block##Type##CoeffNorm; \
|
||||||
defineNamedTemplateTypeNameAndDebug(block##Type##CoeffNorm, 0); \
|
defineNamedTemplateTypeNameAndDebug(block##Type##CoeffNorm, 0); \
|
||||||
defineTemplateRunTimeSelectionTable(block##Type##CoeffNorm, dictionary); \
|
defineTemplateRunTimeSelectionTable(block##Type##CoeffNorm, dictionary); \
|
||||||
|
|
Reference in a new issue