KASKADE 7 development version
|
A general multiplicative multigrid preconditioner. More...
#include <multiplicativeMultigrid.hh>
A general multiplicative multigrid preconditioner.
This realizes a classical V-cycle with a specified number of pre- and post-smoothings. Two (possibly different) preconditioners are used for (i) smoothing on the levels and (ii) approximately solving the coarse grid system.
Note that this is only a preconditioner, no solver. In fact, the computed step is not guaranteed to decrease the energy of the error (depending on the smoother - Gauss-Seidel does, but Jacobi need not).
Entry | the type of projected Galerkin matrix entries |
Index | the index type of Galerkin matrices (usually size_t) |
Smoother | a smoother type |
Prolongation | the type of prolongations (conceptually a sparse matrix type) |
The smoother may rely on the matrix provided on construction remaining available during any method calls besides the smoother destruction. Hence it is perfectly suitable for the smoother just to reference parts of the matrix.
A convenient construction of multiplicative multigrid preconditioners is provided by the functions makeMultiplicativeMultiGrid and makeJacobiMultiGrid for h-multigrid in grid hierarchies, and makeMultiplicativePMultiGrid makeJacobiPMultiGrid for p-h-multigrid exploiting both polynomial order and grid hierarchies.
Multigrid preconditioners can be put together easily from the three main ingredients multigrid stack, coarse solver, and smoother as follows:
Definition at line 73 of file multiplicativeMultigrid.hh.
Public Types | |
using | field_type = typename Smoother::field_type |
using | domain_type = typename Smoother::domain_type |
using | range_type = typename Smoother::range_type |
using | CoarsePreconditioner = Dune::Preconditioner< domain_type, range_type > |
Public Member Functions | |
MultiplicativeMultiGrid ()=default | |
Default constructor. More... | |
template<class MakeSmoother > | |
MultiplicativeMultiGrid (MultiGridStack< Prolongation, Entry, Index > &&mgStack_, MakeSmoother const &makeSmoother, std::unique_ptr< CoarsePreconditioner > &&coarsePreconditioner_, int nPre_=3, int nPost_=3) | |
Constructor. More... | |
MultiplicativeMultiGrid (MultiplicativeMultiGrid &&other)=default | |
MultiplicativeMultiGrid & | operator= (MultiplicativeMultiGrid &&other)=default |
virtual void | apply (domain_type &x, range_type const &r) |
Application of preconditioner. More... | |
virtual field_type | applyDp (domain_type &x, range_type const &r) |
Computes \( x \leftarrow By \) and returns \( \langle By, y \rangle \). More... | |
virtual bool | requiresInitializedInput () const |
Returns true if the target vector x has to be initialized to zero before calling apply or applyDp. More... | |
void | setSmoothings (int nPre_, int nPost_) |
Sets the number of pre- and post-smoothing iterations to perform. More... | |
void | setSmootherStepSize (double w) |
Define the smoother step size. More... | |
double | getSmootherStepSize () const |
void | setLinesearch (bool ls) |
Enable or disable the line search option. More... | |
CoarsePreconditioner & | getCoarsePreconditioner () |
Provides access to the coarse grid preconditioner. More... | |
std::pair< int, int > | getSmoothings () |
Returns a pair of number of pre- and post-smoothing iterations to perform. More... | |
virtual void | pre (Smoother::domain_type &, Smoother::range_type &) |
Preconditioner preparation. More... | |
virtual void | post (Smoother::domain_type &x) |
Preconditioner cleanup. More... | |
virtual Dune::SolverCategory::Category | category () const override |
returns the category of the operator More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<class Entry , class Index , class Prolongation , class MakeSmoother , class CoarsePreconditioner > | |
auto | makeMultiplicativeMultiGrid (MultiGridStack< Prolongation, Entry, Index > &&mgStack, MakeSmoother const &makeSmoother, std::unique_ptr< CoarsePreconditioner > &&coarsePreconditioner, int nPre=3, int nPost=3) |
Convenience function creating multiplicative multigrid preconditioner of V-cycle type for P1 elements. More... | |
template<class Entry , class Index , class GridMan > | |
auto | makeJacobiMultiGrid (NumaBCRSMatrix< Entry, Index > const &A, GridMan const &gridman, int nPre=3, int nPost=3, bool onlyLowerTriangle=false, DirectType directType=DirectType::MUMPS) |
Convenience function creating multiplicative Jacobi multigrid for P1 elements. More... | |
template<class Entry , class Index , class Space , class MakeSmoother > | |
auto | makeMultiplicativePMultiGrid (NumaBCRSMatrix< Entry, Index > &&A, Space const &space, MakeSmoother const &makeSmoother, int nPre=3, int nPost=3, bool onlyLowerTriangle=false, DirectType directType=DirectType::MUMPS) |
Convenience function creating multiplicative multigrid preconditioner of V-cycle type for higher order elements. More... | |
template<class Entry , class Index , class Space , class CoarseSpace > | |
auto | makeBlockJacobiPMultiGrid (NumaBCRSMatrix< Entry, Index > A, Space const &space, NumaBCRSMatrix< Entry, Index > coarseA, CoarseSpace const &coarseSpace, int nPre=3, int nPost=3, DirectType directType=DirectType::MUMPS) |
Convenience function creating multiplicative multigrid preconditioner of V-cycle type for higher order elements. More... | |
template<class Entry , class Index , class Space > | |
auto | makeBlockJacobiPMultiGrid (NumaBCRSMatrix< Entry, Index > A, Space const &space, int nPre=3, int nPost=3, bool onlyLowerTriangle=false, DirectType directType=DirectType::MUMPS) |
Convenience function creating multiplicative multigrid preconditioner of V-cycle type for higher order elements. More... | |
template<class Entry , class Index , class FineSpace > | |
auto | makeJacobiPMultiGrid (NumaBCRSMatrix< Entry, Index > A, FineSpace const &space, int nPre=3, int nPost=3, bool onlyLowerTriangle=false, DirectType directType=DirectType::MUMPS) |
Convenience function creating multiplicative multigrid preconditioner of V-cycle type with Jacobi smoother for higher order elements. More... | |
using Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::CoarsePreconditioner = Dune::Preconditioner<domain_type,range_type> |
Definition at line 79 of file multiplicativeMultigrid.hh.
using Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::domain_type = typename Smoother::domain_type |
Definition at line 77 of file multiplicativeMultigrid.hh.
using Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::field_type = typename Smoother::field_type |
Definition at line 76 of file multiplicativeMultigrid.hh.
using Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::range_type = typename Smoother::range_type |
Definition at line 78 of file multiplicativeMultigrid.hh.
|
default |
Default constructor.
|
inline |
Constructor.
A | the Galerkin matrix to be preconditioned |
Ps | the stack of multigrid prolongations |
makeSmoother | a callable object with arguments (Matrix const&, int level) that creates a smoother of type Smoother |
Definition at line 96 of file multiplicativeMultigrid.hh.
|
default |
|
inlinevirtual |
Application of preconditioner.
Precondition: x = 0
Definition at line 119 of file multiplicativeMultigrid.hh.
Referenced by Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::applyDp().
|
inlinevirtual |
Computes \( x \leftarrow By \) and returns \( \langle By, y \rangle \).
Implements Kaskade::SymmetricPreconditioner< Smoother::domain_type, Smoother::range_type >.
Definition at line 126 of file multiplicativeMultigrid.hh.
|
inlineoverridevirtualinherited |
returns the category of the operator
From the Dune doxygen documentation it is unclear what this is supposed to mean. We return a dummy here.
Definition at line 242 of file symmetricOperators.hh.
|
inline |
Provides access to the coarse grid preconditioner.
Definition at line 185 of file multiplicativeMultigrid.hh.
|
inline |
Definition at line 163 of file multiplicativeMultigrid.hh.
|
inline |
Returns a pair of number of pre- and post-smoothing iterations to perform.
Definition at line 193 of file multiplicativeMultigrid.hh.
|
default |
|
inlinevirtualinherited |
Preconditioner cleanup.
The provided default implementation does nothing.
Definition at line 225 of file symmetricOperators.hh.
|
inlinevirtualinherited |
Preconditioner preparation.
The provided default implementation does nothing.
Definition at line 218 of file symmetricOperators.hh.
|
inlinevirtual |
Returns true if the target vector x has to be initialized to zero before calling apply or applyDp.
Implements Kaskade::SymmetricPreconditioner< Smoother::domain_type, Smoother::range_type >.
Definition at line 132 of file multiplicativeMultigrid.hh.
|
inline |
Enable or disable the line search option.
With line search option, at the end of each level in the V-cycle a line search is performed for an optimal scaling of the correction. This may improve the contraction (but need not, for simple Laplace type problems it does not) and guarantee convergence of the multigrid as a fixed point iteration (removing the need for an outer stepsize loop), but incurs one more matrix-vector product (an overhead of up to 30%) and renders the V-cycle a nonlinear scheme, not suited as preconditioner in CG.
The default value on construction is off.
Definition at line 177 of file multiplicativeMultigrid.hh.
|
inline |
Define the smoother step size.
The default step length is 1.
Definition at line 157 of file multiplicativeMultigrid.hh.
|
inline |
Sets the number of pre- and post-smoothing iterations to perform.
Note that the sum of pre- and postsmoothings must be positive.
nPre | number of pre-smoothings (nonnegative) |
nPost | number of post-smoothings (nonnegative) |
Definition at line 145 of file multiplicativeMultigrid.hh.