Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::BiCGStab< V, M > Class Template Reference

BiCGStab solver with right preconditioning. More...

#include <AMReX_BiCGStab.H>

Public Types

using RT = typename M::RT
 

Public Member Functions

 BiCGStab ()=default
 
void define (M &linop)
 
void solve (V &a_sol, V const &a_rhs, RT a_tol_rel, RT a_tol_abs, int a_its=-1)
 Solve the linear system.
 
void setInitialGuessNonzero (bool flag)
 
void setVerbose (int v)
 Sets verbosity.
 
void setMaxIters (int niters)
 Sets the max number of iterations.
 
int getNumIters () const
 Gets the number of iterations.
 
int getStatus () const
 Gets the solver status.
 
RT getResidualNorm () const
 Gets the 2-norm of the residual.
 
RT getInitialResidualNorm () const
 Gets the 2-norm of the initial residual of the last solve().
 

Detailed Description

template<typename V, typename M>
class amrex::BiCGStab< V, M >

BiCGStab solver with right preconditioning.

The operator type M must provide the same interface as for amrex::GMRES: makeVecRHS, makeVecLHS, norm2, dotProduct, assign, increment, linComb, scale, setToZero, apply and precond.

Member Typedef Documentation

◆ RT

template<typename V , typename M >
using amrex::BiCGStab< V, M >::RT = typename M::RT

Constructor & Destructor Documentation

◆ BiCGStab()

template<typename V , typename M >
amrex::BiCGStab< V, M >::BiCGStab ( )
default

Member Function Documentation

◆ define()

template<typename V , typename M >
void amrex::BiCGStab< V, M >::define ( M &  linop)
inline

Defines with a reference to M. It's the user's responsibility to keep the M object alive for BiCGStab to be functional. This function must be called before solve() can be called.

◆ getInitialResidualNorm()

template<typename V , typename M >
RT amrex::BiCGStab< V, M >::getInitialResidualNorm ( ) const
inline

Gets the 2-norm of the initial residual of the last solve().

◆ getNumIters()

template<typename V , typename M >
int amrex::BiCGStab< V, M >::getNumIters ( ) const
inline

Gets the number of iterations.

◆ getResidualNorm()

template<typename V , typename M >
RT amrex::BiCGStab< V, M >::getResidualNorm ( ) const
inline

Gets the 2-norm of the residual.

◆ getStatus()

template<typename V , typename M >
int amrex::BiCGStab< V, M >::getStatus ( ) const
inline

Gets the solver status.

0 converged, 1 max iterations reached, 2 rho = 0, 3 rh.v = 0, 4 t.t = 0, 5 omega = 0. A NaN or infinity counts as the matching breakdown.

◆ setInitialGuessNonzero()

template<typename V , typename M >
void amrex::BiCGStab< V, M >::setInitialGuessNonzero ( bool  flag)
inline

Use a_sol passed to solve() as the initial guess (default: false, i.e., start from zero).

◆ setMaxIters()

template<typename V , typename M >
void amrex::BiCGStab< V, M >::setMaxIters ( int  niters)
inline

Sets the max number of iterations.

◆ setVerbose()

template<typename V , typename M >
void amrex::BiCGStab< V, M >::setVerbose ( int  v)
inline

Sets verbosity.

◆ solve()

template<typename V , typename M >
void amrex::BiCGStab< V, M >::solve ( V &  a_sol,
V const &  a_rhs,
RT  a_tol_rel,
RT  a_tol_abs,
int  a_its = -1 
)

Solve the linear system.

The initial guess is zero unless setInitialGuessNonzero(true) was called, in which case it is the value of a_sol on entry.

Parameters
a_solunknowns, i.e., x in A x = b.
a_rhsRHS, i.e., b in A x = b.
a_tol_relrelative tolerance, relative to the initial residual norm, which is ||b|| for a zero initial guess.
a_tol_absabsolute tolerance.
a_itsoptional argument specifying the maximum number of iterations.

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