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, measured against m_residualScale.
 
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 = 0.0
 Norm that both the printed residual and the convergence test are measured against.
 

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 = 0.0

Norm that both the printed residual and the convergence test are measured against.

The driver sets this to the zero-residual ||r_zero|| = ||rhs - L(0)||, which is the scale the hosting solver itself uses to decide whether a solution has converged. Measuring the exit test on that same scale is what makes m_eps mean the same thing here as it does to the caller, and is also what lets a warm start pay for itself: scaling the tolerance by this solve's own initial residual instead would demand the same reduction factor no matter how good the initial guess was. A non-positive value falls back to this solve's initial residual norm, which is the right scale when there is no host to agree with.


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