Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace > Class Template Reference

PFMG solver. More...

#include <Cabana_Grid_HypreStructuredSolver.hpp>

Inheritance diagram for Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >:
Collaboration diagram for Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >:

Public Types

using base_type = HypreStructuredSolver<Scalar, EntityType, MemorySpace>
 Base HYPRE structured solver type.
 
- Public Types inherited from Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >
using entity_type = EntityType
 Entity type.
 
using memory_space = MemorySpace
 Kokkos memory space..
 
using value_type = Scalar
 Scalar value type.
 

Public Member Functions

template<class ArrayLayout_t>
 HypreStructPFMG (const ArrayLayout_t &layout, const bool is_preconditioner=false)
 Constructor.
 
void setMaxLevels (const int max_levels)
 Set the maximum number of multigrid levels.
 
void setRelChange (const int rel_change)
 
void setRelaxType (const int relax_type)
 Set relaxation type.
 
void setJacobiWeight (const double weight)
 Set the Jacobi weight.
 
void setRAPType (const int rap_type)
 Set type of coarse-grid operator to use.
 
void setNumPreRelax (const int num_pre_relax)
 Set number of relaxation sweeps before coarse-grid correction.
 
void setNumPostRelax (const int num_post_relax)
 Set number of relaxation sweeps before coarse-grid correction.
 
void setSkipRelax (const int skip_relax)
 
void setLogging (const int logging)
 Set the amount of logging to do.
 
HYPRE_StructSolver getHypreSolver () const override
 Get the preconditioner.
 
HYPRE_PtrToStructSolverFcn getHypreSetupFunction () const override
 Get the preconditioner setup function.
 
HYPRE_PtrToStructSolverFcn getHypreSolveFunction () const override
 Get the preconditioner solve function.
 
- Public Member Functions inherited from Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >
template<class ArrayLayout_t>
 HypreStructuredSolver (const ArrayLayout_t &layout, const bool is_preconditioner=false)
 Hypre memory space compatibility check.
 
bool isPreconditioner () const
 Return if this solver is a preconditioner.
 
template<std::size_t NumSpaceDim>
void setMatrixStencil (const std::vector< std::array< int, NumSpaceDim > > &stencil, const bool is_symmetric=false)
 Set the operator stencil.
 
template<class Array_t>
void setMatrixValues (const Array_t &values)
 Set the matrix values.
 
void printMatrix (const char *prefix)
 Print the hypre matrix to output file.
 
void printLHS (const char *prefix)
 Print the hypre LHS to output file.
 
void printRHS (const char *prefix)
 Print the hypre RHS to output file.
 
void setTolerance (const double tol)
 Set convergence tolerance implementation.
 
void setMaxIter (const int max_iter)
 Set maximum iteration implementation.
 
void setPrintLevel (const int print_level)
 Set the output level.
 
void setPreconditioner (const std::shared_ptr< HypreStructuredSolver< Scalar, EntityType, MemorySpace > > &preconditioner)
 Set a preconditioner.
 
void setup ()
 Setup the problem.
 
template<class Array_t>
void solve (const Array_t &b, Array_t &x)
 Solve the problem Ax = b for x.
 
int getNumIter ()
 Get the number of iterations taken on the last solve.
 
double getFinalRelativeResidualNorm ()
 Get the relative residual norm achieved on the last solve.
 

Protected Member Functions

void setToleranceImpl (const double tol) override
 Set convergence tolerance implementation.
 
void setMaxIterImpl (const int max_iter) override
 Set maximum iteration implementation.
 
void setPrintLevelImpl (const int print_level) override
 Set the output level.
 
void setupImpl () override
 Setup implementation.
 
void solveImpl () override
 Solver implementation.
 
int getNumIterImpl () override
 Get the number of iterations taken on the last solve.
 
double getFinalRelativeResidualNormImpl () override
 Get the relative residual norm achieved on the last solve.
 
void setPreconditionerImpl (const HypreStructuredSolver< Scalar, EntityType, MemorySpace > &) override
 Set a preconditioner.
 
- Protected Member Functions inherited from Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >
void checkHypreError (const int error) const
 Check a hypre error.
 

Additional Inherited Members

- Protected Attributes inherited from Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >
HYPRE_StructMatrix _A
 Matrix for the problem Ax = b.
 
HYPRE_StructVector _b
 Forcing term for the problem Ax = b.
 
HYPRE_StructVector _x
 Solution to the problem Ax = b.
 

Detailed Description

template<class Scalar, class EntityType, class MemorySpace>
class Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >

PFMG solver.

Member Function Documentation

◆ getFinalRelativeResidualNormImpl()

template<class Scalar, class EntityType, class MemorySpace>
double Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::getFinalRelativeResidualNormImpl ( )
inlineoverrideprotectedvirtual

Get the relative residual norm achieved on the last solve.

Implements Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >.

◆ getHypreSetupFunction()

template<class Scalar, class EntityType, class MemorySpace>
HYPRE_PtrToStructSolverFcn Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::getHypreSetupFunction ( ) const
inlineoverridevirtual

Get the preconditioner setup function.

Implements Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >.

◆ getHypreSolveFunction()

template<class Scalar, class EntityType, class MemorySpace>
HYPRE_PtrToStructSolverFcn Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::getHypreSolveFunction ( ) const
inlineoverridevirtual

Get the preconditioner solve function.

Implements Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >.

◆ getHypreSolver()

template<class Scalar, class EntityType, class MemorySpace>
HYPRE_StructSolver Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::getHypreSolver ( ) const
inlineoverridevirtual

◆ getNumIterImpl()

template<class Scalar, class EntityType, class MemorySpace>
int Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::getNumIterImpl ( )
inlineoverrideprotectedvirtual

Get the number of iterations taken on the last solve.

Implements Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >.

◆ setMaxIterImpl()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setMaxIterImpl ( const int max_iter)
inlineoverrideprotectedvirtual

Set maximum iteration implementation.

Implements Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >.

◆ setPreconditionerImpl()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setPreconditionerImpl ( const HypreStructuredSolver< Scalar, EntityType, MemorySpace > & preconditioner)
inlineoverrideprotectedvirtual

◆ setPrintLevelImpl()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setPrintLevelImpl ( const int print_level)
inlineoverrideprotectedvirtual

◆ setRAPType()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setRAPType ( const int rap_type)
inline

Set type of coarse-grid operator to use.

0 - Galerkin (default) 1 - non-Galerkin 5-pt or 7-pt stencils

Both operators are constructed algebraically. The non-Galerkin option maintains a 5-pt stencil in 2D and a 7-pt stencil in 3D on all grid levels. The stencil coefficients are computed by averaging techniques.

◆ setRelaxType()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setRelaxType ( const int relax_type)
inline

Set relaxation type.

0 - Jacobi 1 - Weighted Jacobi (default) 2 - Red/Black Gauss-Seidel (symmetric: RB pre-relaxation, BR post-relaxation) 3 - Red/Black Gauss-Seidel (nonsymmetric: RB pre- and post-relaxation)

◆ setRelChange()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setRelChange ( const int rel_change)
inline

Additionally require that the relative difference in successive iterates be small.

◆ setSkipRelax()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setSkipRelax ( const int skip_relax)
inline

Skip relaxation on certain grids for isotropic problems. This can greatly improve efficiency by eliminating unnecessary relaxations when the underlying problem is isotropic.

◆ setToleranceImpl()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setToleranceImpl ( const double tol)
inlineoverrideprotectedvirtual

Set convergence tolerance implementation.

Implements Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >.

◆ setupImpl()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::setupImpl ( )
inlineoverrideprotectedvirtual

◆ solveImpl()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >::solveImpl ( )
inlineoverrideprotectedvirtual

The documentation for this class was generated from the following file: