chombo-discharge
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
KrylovBiCGStab< T > Class Template Reference

Preconditioned BiCGStab solver acting on an AMR hierarchy through AMRMultigridKrylovOp. More...

#include <CD_KrylovBiCGStab.H>

Inheritance diagram for KrylovBiCGStab< T >:
Inheritance graph
[legend]

Public Member Functions

 KrylovBiCGStab () noexcept=default
 Default constructor. Call define() before use.
 
 ~KrylovBiCGStab () noexcept
 Destructor. Frees the persistent work vectors.
 
void define (AMRMultigridKrylovOp< T > *a_op, const Vector< LevelData< T > * > &a_template) noexcept
 Allocate the persistent work vectors. Call once per regrid.
 
void undefine () noexcept
 Free the persistent work vectors.
 
bool isDefined () const noexcept
 Whether define() has been called and the work vectors are allocated.
 
bool solve (Vector< LevelData< T > * > &a_phi, const Vector< LevelData< T > * > &a_rhs) noexcept
 Solve a_op(a_phi) = a_rhs (homogeneous operator) with preconditioned BiCGStab.
 

Public Attributes

Real m_eps = 1.E-10
 Relative residual tolerance (against the initial residual norm).
 
int m_maxIter = 50
 Maximum number of iterations.
 
int m_numRestarts = 5
 Maximum number of restarts on breakdown.
 
int m_verbosity = -1
 Verbosity; at >= 4 a terse one-line-per-iteration residual/rate history is printed.
 
int m_exitStatus = -1
 Exit status after solve(): 1 = converged, 2 = breakdown, 3 = max iterations, -1 = not run.
 
Real m_residualNorm = -1.0
 Final residual norm after solve() (in the adapter inner-product norm).
 
int m_iterations = 0
 Number of iterations performed by the last solve().
 
Real m_residualScale = 1.0
 Display normalization for printed residuals (set to the zero-residual by the driver; 1 = print absolute).
 

Protected Attributes

AMRMultigridKrylovOp< T > * m_op = nullptr
 Operator/adapter (not owned).
 
bool m_isDefined = false
 Whether the work vectors are allocated.
 
Vector< LevelData< T > * > m_r
 Residual / s.
 
Vector< LevelData< T > * > m_rTilde
 Shadow residual.
 
Vector< LevelData< T > * > m_e
 Accumulated correction (added to a_phi at the end).
 
Vector< LevelData< T > * > m_p
 Search direction.
 
Vector< LevelData< T > * > m_pTilde
 Preconditioned search direction.
 
Vector< LevelData< T > * > m_sTilde
 Preconditioned s.
 
Vector< LevelData< T > * > m_t
 A*s_tilde.
 
Vector< LevelData< T > * > m_v
 A*p_tilde.
 

Detailed Description

template<class T>
class KrylovBiCGStab< T >

Preconditioned BiCGStab solver acting on an AMR hierarchy through AMRMultigridKrylovOp.

A chombo-discharge replacement for Chombo's BiCGStabSolver on the outer Krylov path, written for scale-out: the eight work vectors are allocated once in define() and reused across solves (no per-solve allocation), and the omega numerator/denominator inner products are fused into a single mDotProduct so the adapter issues one MPI reduction instead of two. The matrix-vector product and preconditioner are the homogeneous AMR operator and multigrid cycle supplied by the adapter; solve() updates the solution in place and honours a non-zero initial guess (warm start).

Note
T is the FAB type (EBCellFAB or MFCellFAB).

Member Function Documentation

◆ define()

template<class T >
void KrylovBiCGStab< T >::define ( AMRMultigridKrylovOp< T > *  a_op,
const Vector< LevelData< T > * > &  a_template 
)
noexcept

Allocate the persistent work vectors. Call once per regrid.

Parameters
[in]a_opThe (already define()d) operator/adapter to solve against
[in]a_templateA hierarchy whose layout the work vectors mirror (e.g. the rhs)

◆ isDefined()

template<class T >
bool KrylovBiCGStab< T >::isDefined ( ) const
noexcept

Whether define() has been called and the work vectors are allocated.

Returns
True if defined.

◆ solve()

template<class T >
bool KrylovBiCGStab< T >::solve ( Vector< LevelData< T > * > &  a_phi,
const Vector< LevelData< T > * > &  a_rhs 
)
noexcept

Solve a_op(a_phi) = a_rhs (homogeneous operator) with preconditioned BiCGStab.

Parameters
[in,out]a_phiSolution (in: initial guess; out: solution). Warm starts are honoured.
[in]a_rhsRight-hand side.
Returns
True if converged (m_exitStatus == 1).

Member Data Documentation

◆ m_residualScale

template<class T >
Real KrylovBiCGStab< T >::m_residualScale = 1.0

Display normalization for printed residuals (set to the zero-residual by the driver; 1 = print absolute).

Affects only verbose output, not the convergence test. The printed value is the relative residual ||r|| / ||r_zero||, so progress is comparable across solvers regardless of their internal norm.


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