include/pops/numerics/elliptic/linear/generic_krylov.hpp Source File¶
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
generic_krylov.hpp
Go to the documentation of this file.
158 // Scratch allocated ONCE, co-distributed with phi; reused every iteration. p carries phi's ghost
357 // Scratch allocated ONCE, co-distributed with phi; reused across every restart cycle. The Arnoldi
358 // basis V holds m+1 vectors; w is the matvec / MGS workspace (carries phi's ghost width since A reads
359 // its ghosts); r is the (preconditioned) residual; Mb is M^{-1} b for the relative-residual base.
370 // Preconditioned right-hand-side norm: the left-preconditioned residual is M^{-1}(b - A x), so its
371 // base is ||M^{-1} b||. With the identity Mb aliases rhs and this is the true ||b||, matching CG.
378 // Fixed-size stack Hessenberg least-squares: H column-major (m columns of m+1 rows), the Givens
379 // rotation cosines/sines, the rotated rhs g (beta e1 after rotations), and the back-substituted y.
427 // else: lucky breakdown (the exact solution lies in the current subspace); v_{k+1} stays unused.
Owning MPI rank of each box, indexed by GLOBAL box index (parallel to a BoxArray).
Definition distribution_mapping.hpp:19
Field distributed over a level: decomposition (BoxArray) + distribution (DistributionMapping) + ncomp...
Definition multifab.hpp:33
const DistributionMapping & dmap() const
GLOBAL distribution (owner rank per box).
Definition multifab.hpp:58
const BoxArray & box_array() const
GLOBAL decomposition of the level (all boxes, all ranks).
Definition multifab.hpp:56
void set_val(Real v)
Fills all cells (valid + ghosts) of every local fab with v.
Definition multifab.hpp:85
KrylovResult – the shared result type of every Krylov solve in include/pops/numerics/elliptic/linear.
MultiFab arithmetic (saxpy, lincomb, norm_inf, dot) over VALID cells.
MultiFab: a field DISTRIBUTED over a level (equivalent of AMReX's MultiFab).
constexpr Real kKrylovTiny
Tiny breakdown guard for the BiCGStab scalar recurrences (division by ~0).
Definition generic_krylov.hpp:93
Real krylov_l2_norm(const MultiFab &x)
GLOBAL L2 norm sqrt(sum x.x), collective (all_reduce_sum).
Definition generic_krylov.hpp:82
Real krylov_dot(const MultiFab &x, const MultiFab &y)
Krylov inner product x.y, COLLECTIVE (all_reduce_sum).
Definition generic_krylov.hpp:76
void require_max_iter(int max_iters)
Guards a dynamic solver loop: a non-positive iteration budget is a configuration error.
Definition generic_krylov.hpp:87
Definition amr_hierarchy.hpp:29
KrylovResult gmres_solve(const ApplyFn &A, const ApplyFn &precond, MultiFab &phi, const MultiFab &rhs, Real rel_tol, int max_iters, int restart=30)
Left-preconditioned restarted GMRES(m), solving A x = b for a GENERAL (possibly NON-symmetric) operat...
Definition generic_krylov.hpp:344
Real dot_all(const MultiFab &x, const MultiFab &y)
FULL-component dot Sum_{cells, c} x(.,.,c) * y(.,.,c) over ALL components, reduced over ALL ranks (al...
Definition mf_arith.hpp:182
KrylovResult cg_solve(const ApplyFn &A, MultiFab &phi, const MultiFab &rhs, Real rel_tol, int max_iters)
Conjugate Gradient, solving A x = b for an SPD operator A.
Definition generic_krylov.hpp:155
Real dot(const MultiFab &x, const MultiFab &y, int comp=0)
Dot product Sum_cells x.y over component comp, reduced over ALL ranks (all_reduce).
Definition mf_arith.hpp:163
KrylovResult richardson_solve(const ApplyFn &A, MultiFab &phi, const MultiFab &rhs, Real omega, Real rel_tol, int max_iters)
Richardson iteration x <- x + omega (b - A x), solving A x = b.
Definition generic_krylov.hpp:108
void saxpy(MultiFab &y, Real a, const MultiFab &x)
y <- y + a x over ALL components of the valid cells. Identical layouts required.
Definition mf_arith.hpp:102
Real sum(const MultiFab &mf, int comp=0)
Sum of the VALID cells of component comp, reduced over ALL ranks (all_reduce).
Definition multifab.hpp:121
void lincomb(MultiFab &z, Real a, const MultiFab &x, Real b, const MultiFab &y)
z <- a x + b y over ALL components of the valid cells. Identical layouts; aliasing safe.
Definition mf_arith.hpp:133
std::function< void(MultiFab &out, const MultiFab &in)> ApplyFn
Matrix-free operator callback: out <- A(in).
Definition generic_krylov.hpp:67
KrylovResult bicgstab_solve(const ApplyFn &A, const ApplyFn &precond, MultiFab &phi, const MultiFab &rhs, Real rel_tol, int max_iters)
Preconditioned BiCGStab, solving A x = b for a general (possibly non-symmetric) operator A.
Definition generic_krylov.hpp:223
Outcome of a Krylov solve: iterations performed, final relative residual, convergence flag.
Definition krylov_result.hpp:16
Real rel_residual
||r_final|| / ||b|| (global L2 norm; base 1 when ||b|| == 0)
Definition krylov_result.hpp:18
bool converged
true if ||r|| <= rel_tol * ||b|| was reached
Definition krylov_result.hpp:19
Base scalar types and the POPS_HD macro (host+device portability).
Generated by