Commit 97575a22 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[amg] clean up the AMG backend

- The properties "AMGPDELabBackend" and "AMGLocalFemMap" are unified to
  "AmgTraits". Since they appear to have been used only internally and
  deprecation is technically difficult, no deprecation is made.

- Remove setting of the property "SolutionVector", since it only resets
  the defaults.

- Deprecate the classes "SeqAMGBackend" and "ScaledSeqAMGBackend". The
  "AMGBackend" already distinguishes between serial and parallel
  settings. The scaling should be done for the residual already.

- Deprecate the class "P0LocalFiniteElementMap" which was only used for
  the PDELab-based backend.

- Remove occurrences of "PDELab" in the comments.

Reviewed by gruenich.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14162 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 3e17d34f
......@@ -57,6 +57,9 @@ Differences Between DuMuX 2.6 and DuMuX 2.7
it has to be renamed to "newtonUpdateShift". See
dumux/nonlinear/newtoncontroller.hh for an example.
- The properties "AMGPDELabBackend" and "AMGLocalFemMap" have been unified to
"AmgTraits".
* Deprecated PROPERTY and PARAMETER NAMES, to be removed after 2.7: BEWARE: The
compiler will not print any warning if a deprecated property or parameter name
is used. However, a run-time warning should appear in the summary lines after
......@@ -71,7 +74,11 @@ Differences Between DuMuX 2.6 and DuMuX 2.7
SatisfyAbsAndRel -> SatisfyResidualAndShiftCriterion
* Deprecated CLASSES/FILES, to be removed after 2.7:
- CellData2P2Cmultiphysics, replaced by CellData2P2CMultiPhysics
- SeqAMGBackend and ScaledSeqAMGBackend, replaced by AMGBackend.
- P0LocalFiniteElementMap.
- CellData2P2Cmultiphysics, replaced by CellData2P2CMultiPhysics.
* Deprecated MEMBER FUNCTIONS, to be removed after 2.7:
- The functions "heatCapacity", "densitySolid" (mpnc only) and
......
......@@ -20,7 +20,7 @@
* \file
* \ingroup Linear
*
* \brief Provides linear solvers using the PDELab AMG backends.
* \brief Provides a linear solver based on the ISTL AMG.
*/
#ifndef DUMUX_AMGBACKEND_HH
#define DUMUX_AMGBACKEND_HH
......@@ -34,7 +34,6 @@
#include <dumux/linear/linearsolverproperties.hh>
#include <dumux/linear/amgproperties.hh>
#include <dumux/linear/amgparallelhelpers.hh>
#include <dumux/linear/p0fem.hh>
namespace Dumux {
......@@ -69,7 +68,7 @@ void scaleLinearSystem(Matrix& matrix, Vector& rhs)
}
/*!
* \brief Provides a linear solver using the parallel PDELab AMG backend.
* \brief Provides a linear solver using the ISTL AMG.
*/
template <class TypeTag>
class AMGBackend
......@@ -77,17 +76,15 @@ class AMGBackend
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
enum { numEq = JacobianMatrix::block_type::rows};
typedef typename GET_PROP(TypeTag, AMGPDELabBackend) PDELabBackend;
typedef typename PDELabBackend::LinearOperator LinearOperator;
typedef typename PDELabBackend::VType VType;
typedef typename PDELabBackend::Comm Comm;
typedef typename PDELabBackend::Smoother Smoother;
typedef Dune::Amg::AMG<typename PDELabBackend::LinearOperator, VType,
typedef typename GET_PROP(TypeTag, AmgTraits) AmgTraits;
enum { numEq = AmgTraits::numEq };
typedef typename AmgTraits::LinearOperator LinearOperator;
typedef typename AmgTraits::VType VType;
typedef typename AmgTraits::Comm Comm;
typedef typename AmgTraits::Smoother Smoother;
typedef Dune::Amg::AMG<typename AmgTraits::LinearOperator, VType,
Smoother,Comm> AMGType;
typedef typename PDELabBackend::LinearOperator::matrix_type BCRSMat;
typedef typename AmgTraits::LinearOperator::matrix_type BCRSMat;
public:
/*!
......@@ -115,17 +112,17 @@ public:
static const double residReduction = GET_PARAM_FROM_GROUP(TypeTag, double, LinearSolver, ResidualReduction);
#if HAVE_MPI
Dune::SolverCategory::Category category = PDELabBackend::isNonOverlapping?
Dune::SolverCategory::Category category = AmgTraits::isNonOverlapping?
Dune::SolverCategory::nonoverlapping : Dune::SolverCategory::overlapping;
if(PDELabBackend::isNonOverlapping && firstCall_)
if(AmgTraits::isNonOverlapping && firstCall_)
{
phelper_.initGhostsAndOwners();
}
typename PDELabBackend::Comm comm(problem_.gridView().comm(), category);
typename AmgTraits::Comm comm(problem_.gridView().comm(), category);
if(PDELabBackend::isNonOverlapping)
if(AmgTraits::isNonOverlapping)
{
// extend the matrix pattern such that it is usable for AMG
EntityExchanger<TypeTag> exchanger(problem_);
......@@ -134,19 +131,19 @@ public:
}
phelper_.createIndexSetAndProjectForAMG(A, comm);
typename PDELabBackend::LinearOperator fop(A, comm);
typename PDELabBackend::ScalarProduct sp(comm);
typename AmgTraits::LinearOperator fop(A, comm);
typename AmgTraits::ScalarProduct sp(comm);
int rank = comm.communicator().rank();
// Make rhs consistent
if(PDELabBackend::isNonOverlapping)
if(AmgTraits::isNonOverlapping)
{
phelper_.makeNonOverlappingConsistent(b);
}
#else
typename PDELabBackend::Comm comm;
typename PDELabBackend::LinearOperator fop(A);
typename PDELabBackend::ScalarProduct sp;
typename AmgTraits::Comm comm;
typename AmgTraits::LinearOperator fop(A);
typename AmgTraits::ScalarProduct sp;
int rank=0;
#endif
typedef typename Dune::Amg::SmootherTraits<Smoother>::Arguments
......@@ -164,7 +161,7 @@ public:
smootherArgs.relaxationFactor = 1;
AMGType amg(fop, criterion, smootherArgs, comm);
Dune::BiCGSTABSolver<typename PDELabBackend::VType> solver(fop, sp, amg, residReduction, maxIt,
Dune::BiCGSTABSolver<typename AmgTraits::VType> solver(fop, sp, amg, residReduction, maxIt,
rank==0?verbosity: 0);
......@@ -189,7 +186,7 @@ private:
};
/*!
* \brief Provides a linear solver using the sequential PDELab AMG backend.
* \brief Provides a linear solver using the sequential ISTL AMG.
*/
template <class TypeTag>
class SeqAMGBackend
......@@ -212,6 +209,7 @@ public:
* \param problem the problem at hand
*/
SeqAMGBackend(const Problem& problem)
DUNE_DEPRECATED_MSG("use the AMGBackend (without 'Seq') instead")
: problem_(problem)
{}
......@@ -260,7 +258,7 @@ private:
};
/*!
* \brief Provides a linear solver using the sequential PDELab AMG backend.
* \brief Provides a linear solver using the sequential ISTL AMG.
*
* The linear system is scaled beforehand, possibly improving the
* convergence behavior of the iterative solver.
......@@ -286,6 +284,7 @@ public:
* \param problem the problem at hand
*/
ScaledSeqAMGBackend(const Problem& problem)
DUNE_DEPRECATED_MSG("use the AMGBackend (without 'ScaledSeq') instead")
: problem_(problem)
{}
......
......@@ -20,7 +20,7 @@
* \file
*
* \brief Provides a helper class for nonoverlapping
* decomposition using the PDELab AMG.
* decomposition using the ISTL AMG.
*/
#ifndef DUMUX_AMGPARALLELHELPERS_HH
#define DUMUX_AMGPARALLELHELPERS_HH
......@@ -44,10 +44,10 @@ template<class TypeTag>
class ParallelISTLHelper
{
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP(TypeTag, AMGLocalFemMap) LocalFemMap;
typedef typename GET_PROP(TypeTag, AmgTraits) AmgTraits;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
enum { dofCodim = LocalFemMap::dofCodim };
enum { dofCodim = AmgTraits::dofCodim };
class BaseGatherScatter
{
......@@ -490,24 +490,22 @@ private:
template<class TypeTag>
class EntityExchanger
{
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP(TypeTag, AMGLocalFemMap) LocalFemMap;
enum { numEq = JacobianMatrix::block_type::rows};
typedef typename GET_PROP(TypeTag, AmgTraits) AmgTraits;
enum { numEq = AmgTraits::numEq };
typedef Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,numEq,numEq> > Matrix;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
enum {dim = GridView::dimension};
enum { dim = GridView::dimension };
enum { dofCodim = AmgTraits::dofCodim };
typedef typename GridView::Traits::Grid Grid;
typedef typename Matrix::block_type BlockType;
typedef typename GridView::template Codim<LocalFemMap::dofCodim>::Iterator EntityIterator;
typedef typename GridView::template Codim<dofCodim>::Iterator EntityIterator;
typedef typename Grid::Traits::GlobalIdSet IDS;
typedef typename IDS::IdType IdType;
typedef typename Matrix::RowIterator RowIterator;
typedef typename Matrix::ColIterator ColIterator;
enum { dofCodim = LocalFemMap::dofCodim };
public:
/*! \brief Constructor. Sets up the local to global relations.
\param[in] problem The problem to be solved.
......@@ -520,8 +518,8 @@ public:
const GridView& gridView = problem.gridView();
EntityIterator entityEndIt = gridView.template end<LocalFemMap::dofCodim>();
for (EntityIterator entityIt = gridView.template begin<LocalFemMap::dofCodim>();
EntityIterator entityEndIt = gridView.template end<dofCodim>();
for (EntityIterator entityIt = gridView.template begin<dofCodim>();
entityIt != entityEndIt; ++entityIt)
{
if (entityIt->partitionType() == Dune::BorderEntity)
......
......@@ -21,7 +21,7 @@
* \ingroup Properties
* \ingroup Linear
*
* \brief Defines some fundamental properties for the PDELab AMG solver.
* \brief Defines some fundamental properties for the AMG backend.
*/
#ifndef DUMUXAMGPROPERTIES_HH
#define DUMUXAMGPROPERTIES_HH
......@@ -47,63 +47,18 @@ template <class TypeTag> class AMGBackend;
namespace Properties
{
//! the PDELab finite element map used for the gridfunctionspace
NEW_PROP_TAG(AMGLocalFemMap);
//! the type traits required for using the AMG backend
NEW_PROP_TAG(AmgTraits);
//! box: use the (multi-)linear local FEM space associated with cubes by default
SET_PROP(BoxModel, AMGLocalFemMap)
{
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
enum{dim = GridView::dimension};
public:
enum{
//! \brief The codimension that the degrees of freedom are attached to.
dofCodim = GridView::dimension
};
};
//! cell-centered: use the element-wise constant local FEM space by default
SET_PROP(CCModel, AMGLocalFemMap)
{
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
enum{dim = GridView::dimension};
public:
enum{
//! \brief The codimension that the degrees of freedom are attached to.
dofCodim = 0
};
};
//! decoupled models: use the element-wise constant local FEM space by default
SET_PROP(DecoupledModel, AMGLocalFemMap)
{
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
enum{dim = GridView::dimension};
public:
enum{
//! \brief The codimension that the degrees of freedom are attached to.
dofCodim = 0
};
};
//! set a property JacobianMatrix also for the decoupled models
SET_PROP(DecoupledModel, JacobianMatrix)
//! box: use the non-overlapping AMG
SET_PROP(BoxModel, AmgTraits)
{
public:
typedef typename GET_PROP_TYPE(TypeTag, PressureCoefficientMatrix) type;
};
//! the type of the employed PDELab backend
NEW_PROP_TAG(AMGPDELabBackend);
//! box: use the non-overlapping AMG backend
SET_PROP(BoxModel, AMGPDELabBackend)
{
public:
//typedef Dune::PDELab::ISTLBackend_NOVLP_BCGS_AMG_SSOR<GridOperator> type;
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
enum {
numEq = JacobianMatrix::block_type::rows,
dofCodim = GridView::dimension,
isNonOverlapping = true
};
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
......@@ -122,13 +77,14 @@ SET_PROP(BoxModel, AMGPDELabBackend)
#endif
};
//! cell-centered: use the overlapping PDELab AMG backend
SET_PROP(CCModel, AMGPDELabBackend)
//! cell-centered: use the overlapping AMG
SET_PROP(CCModel, AmgTraits)
{
public:
public:
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
enum {
numEq = JacobianMatrix::block_type::rows,
dofCodim = 0,
isNonOverlapping = false
};
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
......@@ -147,14 +103,14 @@ SET_PROP(CCModel, AMGPDELabBackend)
#endif
};
//! decoupled model: use the overlapping PDELab AMG backend
SET_PROP(DecoupledModel, AMGPDELabBackend)
//! decoupled model: use the overlapping AMG
SET_PROP(DecoupledModel, AmgTraits)
{
//typedef typename Dumux::AMGBackend<TypeTag>::GridOperator GridOperator;
public:
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
public:
typedef typename GET_PROP_TYPE(TypeTag, PressureCoefficientMatrix) JacobianMatrix;
enum {
numEq = JacobianMatrix::block_type::rows,
dofCodim = 0,
isNonOverlapping = false
};
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
......@@ -173,47 +129,6 @@ SET_PROP(DecoupledModel, AMGPDELabBackend)
#endif
};
//! box: reset the type of solution vector to be PDELab conforming
SET_PROP(BoxModel, SolutionVector)
{
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
enum { numEq = JacobianMatrix::block_type::rows};
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar,numEq> > type;
};
//! cell-centered: reset the type of solution vector to be PDELab conforming
SET_PROP(CCModel, SolutionVector)
{
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
enum { numEq = JacobianMatrix::block_type::rows};
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar,numEq> > type;
};
//! decoupled model: reset the type of solution vector to be PDELab conforming
SET_PROP(DecoupledModel, PressureSolutionVector)
{
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
enum { numEq = JacobianMatrix::block_type::rows};
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar,numEq> > type;
};
//! decoupled model: reset the type of solution vector to be PDELab conforming
SET_PROP(DecoupledModel, PressureRHSVector)
{
typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
enum { numEq = JacobianMatrix::block_type::rows};
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar,numEq> > type;
};
} // namespace Properties
} // namespace Dumux
#endif
......@@ -44,8 +44,9 @@ class P0LocalFiniteElementMap
typedef Dune::PDELab::SimpleLocalFiniteElementMap< Dune::P0LocalFiniteElement<D,R,d> > ParentType;
public:
P0LocalFiniteElementMap ()
: ParentType (Dune::P0LocalFiniteElement<D,R,d>(isCube ? Dune::GeometryType(Dune::GeometryType::cube, d)
: Dune::GeometryType(Dune::GeometryType::simplex, d)))
: ParentType (Dune::P0LocalFiniteElement<D,R,d>(isCube ? Dune::GeometryType(Dune::GeometryType::cube, d)
: Dune::GeometryType(Dune::GeometryType::simplex, d)))
DUNE_DEPRECATED_MSG("should not be needed anymore")
{}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment