Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::MLMGT< MF > Class Template Reference

#include <AMReX_MLMG.H>

Classes

class  error
 

Public Types

enum class  CFStrategy : int { none , ghostnodes }
 
using MFType = MF
 
using FAB = typename MLLinOpT< MF >::FAB
 
using RT = typename MLLinOpT< MF >::RT
 
using BCMode = typename MLLinOpT< MF >::BCMode
 
using Location = typename MLLinOpT< MF >::Location
 
using BottomSolver = amrex::BottomSolver
 

Public Member Functions

 MLMGT (MLLinOpT< MF > &a_lp)
 
 ~MLMGT ()
 
 MLMGT (MLMGT< MF > const &)=delete
 
 MLMGT (MLMGT< MF > &&)=delete
 
MLMGT< MF > & operator= (MLMGT< MF > const &)=delete
 
MLMGT< MF > & operator= (MLMGT< MF > &&)=delete
 
template<typename AMF >
RT solve (const Vector< AMF * > &a_sol, const Vector< AMF const * > &a_rhs, RT a_tol_rel, RT a_tol_abs, const char *checkpoint_file=nullptr)
 Solve the multilevel system; optional checkpoint_file is for debugging only.
 
template<typename AMF >
RT solve (std::initializer_list< AMF * > a_sol, std::initializer_list< AMF const * > a_rhs, RT a_tol_rel, RT a_tol_abs, const char *checkpoint_file=nullptr)
 Convenience initializer-list overload that forwards to the Vector-based solve.
 
RT precond (Vector< MF * > const &a_sol, Vector< MF const * > const &a_rhs, RT a_tol_rel, RT a_tol_abs)
 Apply MLMG as a right-preconditioner with relaxed tolerances.
 
template<typename AMF >
void getGradSolution (const Vector< Array< AMF *, 3 > > &a_grad_sol, Location a_loc=Location::FaceCenter)
 Populate gradient components of the converged solution.
 
template<typename AMF >
void getGradSolution (std::initializer_list< Array< AMF *, 3 > > a_grad_sol, Location a_loc=Location::FaceCenter)
 Initializer-list convenience overload for getGradSolution.
 
template<typename AMF >
void getFluxes (const Vector< Array< AMF *, 3 > > &a_flux, Location a_loc=Location::FaceCenter)
 Face-centered flux helper (-b grad(phi) for alpha a - beta div(b grad)).
 
template<typename AMF >
void getFluxes (std::initializer_list< Array< AMF *, 3 > > a_flux, Location a_loc=Location::FaceCenter)
 Initializer-list convenience overload for getFluxes (face-centered).
 
template<typename AMF >
void getFluxes (const Vector< Array< AMF *, 3 > > &a_flux, const Vector< AMF * > &a_sol, Location a_loc=Location::FaceCenter)
 Face-centered flux helper that accepts an explicit solution vector.
 
template<typename AMF >
void getFluxes (std::initializer_list< Array< AMF *, 3 > > a_flux, std::initializer_list< AMF * > a_sol, Location a_loc=Location::FaceCenter)
 Initializer-list convenience overload for the face-centered flux helper above.
 
template<typename AMF >
void getFluxes (const Vector< AMF * > &a_flux, Location a_loc=Location::CellCenter)
 Cell-centered flux helper.
 
template<typename AMF >
void getFluxes (std::initializer_list< AMF * > a_flux, Location a_loc=Location::CellCenter)
 Initializer-list convenience overload for cell-centered fluxes.
 
template<typename AMF >
void getFluxes (const Vector< AMF * > &a_flux, const Vector< AMF * > &a_sol, Location a_loc=Location::CellCenter)
 Cell-centered flux helper that accepts an explicit solution vector.
 
template<typename AMF >
void getFluxes (std::initializer_list< AMF * > a_flux, std::initializer_list< AMF * > a_sol, Location a_loc=Location::CellCenter)
 Initializer-list convenience overload for the cell-centered flux helper above.
 
void compResidual (const Vector< MF * > &a_res, const Vector< MF * > &a_sol, const Vector< MF const * > &a_rhs)
 Compute multilevel residuals a_rhs - L(a_sol) on each AMR level.
 
void getEBFluxes (const Vector< MF * > &a_eb_flux)
 Flux into the EB wall using the internally stored solution.
 
void getEBFluxes (const Vector< MF * > &a_eb_flux, const Vector< MF * > &a_sol)
 Flux into the EB wall using an explicit solution vector.
 
void apply (const Vector< MF * > &out, const Vector< MF * > &in)
 out = L(in). Note that, if no actual solve is needed, one could turn off multigrid coarsening by constructing a MLLinOp object with an appropriate LPInfo object (e.g., with LPInfo().setMaxCoarseningLevel(0)).
 
void applyPrecond (const Vector< MF * > &out, const Vector< MF * > &in)
 Apply the linear operator as a preconditioner (out = L(in)).
 
int getVerbose () const
 
int getBottomVerbose () const
 
void incPrintIdentation ()
 Increase the indentation used when printing solver logs.
 
void decPrintIdentation ()
 Decrease the indentation used when printing solver logs.
 
void setThrowException (bool t) noexcept
 Control behavior when the solve fails to converge or blows up.
 
void setVerbose (int v) noexcept
 Set the main solver verbosity (0 silent).
 
void setMaxIter (int n) noexcept
 Cap the number of MLMG iterations executed.
 
void setMaxFmgIter (int n) noexcept
 Cap the number of FMG cycles executed.
 
void setFixedIter (int nit) noexcept
 Set the number of fixed MLMG iterations (convergence may still exit early if the residual is already small).
 
void setPrecondIter (int nit) noexcept
 Set how many MLMG iterations the preconditioner executes per Krylov call (still subject to early-convergence checks).
 
void setPreSmooth (int n) noexcept
 Number of pre-smoothing passes per V-cycle.
 
void setPostSmooth (int n) noexcept
 Number of post-smoothing passes per V-cycle.
 
void setFinalSmooth (int n) noexcept
 Number of smoothing passes when MLMG is used standalone (final smooth).
 
void setBottomSmooth (int n) noexcept
 Additional smoothing passes executed after the bottom solver.
 
void setBottomSolver (BottomSolver s) noexcept
 Select the bottom solver type (e.g., CG, BiCGStab, Hypre, PETSc).
 
BottomSolver getBottomSolver () const noexcept
 
void setCFStrategy (CFStrategy a_cf_strategy) noexcept
 Select the coarse-fine synchronization strategy.
 
void setBottomVerbose (int v) noexcept
 Verbosity for the bottom solver (0 silent).
 
void setBottomMaxIter (int n) noexcept
 Cap the number of iterations inside the bottom solver.
 
void setBottomTolerance (RT t) noexcept
 Relative tolerance for the bottom solver.
 
void setBottomToleranceAbs (RT t) noexcept
 Absolute tolerance for the bottom solver.
 
RT getBottomToleranceAbs () const noexcept
 
void setAlwaysUseBNorm (int flag) noexcept
 Deprecated flag for forcing B-norm convergence checks.
 
void setConvergenceNormType (MLMGNormType norm) noexcept
 Choose the norm used for convergence tests.
 
void setFinalFillBC (int flag) noexcept
 Force a FillBoundary at the end of the solve (nonzero enables).
 
int numAMRLevels () const noexcept
 
void setNSolve (int flag) noexcept
 Enable (flag!=0) or disable the N-solve path.
 
void setNSolveGridSize (int s) noexcept
 Set the tile size used for N-solve builds.
 
void setNoGpuSync (bool do_not_sync) noexcept
 Disable global GPU syncs before returning to the app.
 
void prepareForFluxes (Vector< MF const * > const &a_sol)
 Build boundary caches needed by getFluxes()/compFluxes.
 
template<typename AMF >
void prepareForSolve (Vector< AMF * > const &a_sol, Vector< AMF const * > const &a_rhs)
 Prepare linear operators, coefficients, and RHS data prior to solving.
 
void prepareForNSolve ()
 Prepare the NSolve path.
 
void prepareLinOp ()
 Finalize operator-dependent metadata before iterating.
 
void preparePrecond ()
 Prepare preconditioner-specific caches (e.g., boundary data).
 
void oneIter (int iter)
 Execute a single multigrid iteration (FMG or V-cycle).
 
void miniCycle (int amrlev)
 Execute a per-level mini cycle.
 
void mgVcycle (int amrlev, int mglev)
 Run a multigrid V-cycle on (amrlev,mglev).
 
void mgFcycle ()
 Run an FMG cycle starting from the coarsest grid.
 
void bottomSolve ()
 Execute the configured bottom solver (Hypre, PETSc, CG, etc.).
 
void NSolve (MLMGT< MF > &a_solver, MF &a_sol, MF &a_rhs)
 Perform an NSolve using an MLMGT wrapper.
 
void actualBottomSolve ()
 Execute the actual bottom solve after pre-smoothing and restriction.
 
void computeMLResidual (int amrlevmax)
 Compute the composite residual norm up to AMR level amrlevmax.
 
void computeResidual (int alev)
 Compute the residual on AMR level alev.
 
void computeResWithCrseSolFineCor (int calev, int falev)
 Residual update using coarse solution / fine correction.
 
void computeResWithCrseCorFineCor (int falev)
 Residual update using coarse correction / fine correction.
 
void interpCorrection (int alev)
 Interpolate corrections onto AMR level alev.
 
void interpCorrection (int alev, int mglev)
 Interpolate corrections on (alev,mglev).
 
void addInterpCorrection (int alev, int mglev)
 Add interpolated corrections to (alev,mglev) data.
 
void computeResOfCorrection (int amrlev, int mglev)
 Compute the residual of the correction equation on (amrlev,mglev).
 
RT ResNormInf (int alev, bool local=false)
 Infinity norm of the residual on level alev.
 
RT MLResNormInf (int alevmax, bool local=false)
 Composite infinity norm of the residual up to level alevmax.
 
RT MLRhsNormInf (bool local=false)
 Composite infinity norm of the RHS.
 
void makeSolvable ()
 Adjust RHS/solution to satisfy null-space constraints.
 
void makeSolvable (int amrlev, int mglev, MF &mf)
 Adjust a field on (amrlev,mglev) to satisfy null-space constraints.
 
int bottomSolveWithCG (MF &x, const MF &b, typename MLCGSolverT< MF >::Type type)
 Bottom solve using CG/BiCGStab implemented in MLCGSolverT.
 
RT getInitRHS () const noexcept
 
RT getInitResidual () const noexcept
 
RT getFinalResidual () const noexcept
 
Vector< RT > const & getResidualHistory () const noexcept
 
int getNumIters () const noexcept
 
Vector< int > const & getNumCGIters () const noexcept
 
MLLinOpT< MF > & getLinOp ()
 
template<typename AMF >
auto solve (std::initializer_list< AMF * > a_sol, std::initializer_list< AMF const * > a_rhs, RT a_tol_rel, RT a_tol_abs, const char *checkpoint_file) -> RT
 
template<typename AMF >
auto solve (const Vector< AMF * > &a_sol, const Vector< AMF const * > &a_rhs, RT a_tol_rel, RT a_tol_abs, const char *checkpoint_file) -> RT
 

Friends

template<typename T >
class MLCGSolverT
 
template<typename M >
class GMRESMLMGT
 

Member Typedef Documentation

◆ BCMode

template<typename MF >
using amrex::MLMGT< MF >::BCMode = typename MLLinOpT<MF>::BCMode

◆ BottomSolver

template<typename MF >
using amrex::MLMGT< MF >::BottomSolver = amrex::BottomSolver

◆ FAB

template<typename MF >
using amrex::MLMGT< MF >::FAB = typename MLLinOpT<MF>::FAB

◆ Location

template<typename MF >
using amrex::MLMGT< MF >::Location = typename MLLinOpT<MF>::Location

◆ MFType

template<typename MF >
using amrex::MLMGT< MF >::MFType = MF

◆ RT

template<typename MF >
using amrex::MLMGT< MF >::RT = typename MLLinOpT<MF>::RT

Member Enumeration Documentation

◆ CFStrategy

template<typename MF >
enum class amrex::MLMGT::CFStrategy : int
strong
Enumerator
none 
ghostnodes 

Constructor & Destructor Documentation

◆ MLMGT() [1/3]

template<typename MF >
amrex::MLMGT< MF >::MLMGT ( MLLinOpT< MF > &  a_lp)

◆ ~MLMGT()

template<typename MF >
amrex::MLMGT< MF >::~MLMGT ( )
default

◆ MLMGT() [2/3]

template<typename MF >
amrex::MLMGT< MF >::MLMGT ( MLMGT< MF > const &  )
delete

◆ MLMGT() [3/3]

template<typename MF >
amrex::MLMGT< MF >::MLMGT ( MLMGT< MF > &&  )
delete

Member Function Documentation

◆ actualBottomSolve()

template<typename MF >
void amrex::MLMGT< MF >::actualBottomSolve ( )

Execute the actual bottom solve after pre-smoothing and restriction.

◆ addInterpCorrection()

template<typename MF >
void amrex::MLMGT< MF >::addInterpCorrection ( int  alev,
int  mglev 
)

Add interpolated corrections to (alev,mglev) data.

Parameters
alevAMR level index.
mglevMultigrid level index.

◆ apply()

template<typename MF >
void amrex::MLMGT< MF >::apply ( const Vector< MF * > &  out,
const Vector< MF * > &  in 
)

out = L(in). Note that, if no actual solve is needed, one could turn off multigrid coarsening by constructing a MLLinOp object with an appropriate LPInfo object (e.g., with LPInfo().setMaxCoarseningLevel(0)).

◆ applyPrecond()

template<typename MF >
void amrex::MLMGT< MF >::applyPrecond ( const Vector< MF * > &  out,
const Vector< MF * > &  in 
)

Apply the linear operator as a preconditioner (out = L(in)).

Parameters
outDestination vectors (per level).
inSource vectors (per level).

◆ bottomSolve()

template<typename MF >
void amrex::MLMGT< MF >::bottomSolve ( )

Execute the configured bottom solver (Hypre, PETSc, CG, etc.).

◆ bottomSolveWithCG()

template<typename MF >
int amrex::MLMGT< MF >::bottomSolveWithCG ( MF &  x,
const MF &  b,
typename MLCGSolverT< MF >::Type  type 
)

Bottom solve using CG/BiCGStab implemented in MLCGSolverT.

Parameters
xSolution vector updated in place.
bRight-hand side.
typeKrylov flavor (CG or BiCGStab).
Returns
Status code from the Krylov solver.

◆ compResidual()

template<typename MF >
void amrex::MLMGT< MF >::compResidual ( const Vector< MF * > &  a_res,
const Vector< MF * > &  a_sol,
const Vector< MF const * > &  a_rhs 
)

Compute multilevel residuals a_rhs - L(a_sol) on each AMR level.

Parameters
a_resResidual MF s per level (output).
a_solSolution MF s per level.
a_rhsRight-hand sides per level.

◆ computeMLResidual()

template<typename MF >
void amrex::MLMGT< MF >::computeMLResidual ( int  amrlevmax)

Compute the composite residual norm up to AMR level amrlevmax.

Parameters
amrlevmaxFinest AMR level included in the composite norm.

◆ computeResidual()

template<typename MF >
void amrex::MLMGT< MF >::computeResidual ( int  alev)

Compute the residual on AMR level alev.

Parameters
alevAMR level whose residual is refreshed.

◆ computeResOfCorrection()

template<typename MF >
void amrex::MLMGT< MF >::computeResOfCorrection ( int  amrlev,
int  mglev 
)

Compute the residual of the correction equation on (amrlev,mglev).

Parameters
amrlevAMR level index.
mglevMultigrid level index.

◆ computeResWithCrseCorFineCor()

template<typename MF >
void amrex::MLMGT< MF >::computeResWithCrseCorFineCor ( int  falev)

Residual update using coarse correction / fine correction.

Parameters
falevFine AMR level index supplying the correction.

◆ computeResWithCrseSolFineCor()

template<typename MF >
void amrex::MLMGT< MF >::computeResWithCrseSolFineCor ( int  calev,
int  falev 
)

Residual update using coarse solution / fine correction.

Parameters
calevCoarse AMR level index.
falevFine AMR level index.

◆ decPrintIdentation()

template<typename MF >
void amrex::MLMGT< MF >::decPrintIdentation ( )

Decrease the indentation used when printing solver logs.

◆ getBottomSolver()

template<typename MF >
BottomSolver amrex::MLMGT< MF >::getBottomSolver ( ) const
inlinenoexcept

◆ getBottomToleranceAbs()

template<typename MF >
RT amrex::MLMGT< MF >::getBottomToleranceAbs ( ) const
inlinenoexcept

◆ getBottomVerbose()

template<typename MF >
int amrex::MLMGT< MF >::getBottomVerbose ( ) const
inline

◆ getEBFluxes() [1/2]

template<typename MF >
void amrex::MLMGT< MF >::getEBFluxes ( const Vector< MF * > &  a_eb_flux)

Flux into the EB wall using the internally stored solution.

Parameters
a_eb_fluxPer-level MF s that receive wall fluxes.

◆ getEBFluxes() [2/2]

template<typename MF >
void amrex::MLMGT< MF >::getEBFluxes ( const Vector< MF * > &  a_eb_flux,
const Vector< MF * > &  a_sol 
)

Flux into the EB wall using an explicit solution vector.

Parameters
a_eb_fluxPer-level MF s that receive wall fluxes.
a_solExplicit solution MF s per level.

◆ getFinalResidual()

template<typename MF >
RT amrex::MLMGT< MF >::getFinalResidual ( ) const
inlinenoexcept

◆ getFluxes() [1/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( const Vector< AMF * > &  a_flux,
const Vector< AMF * > &  a_sol,
Location  a_loc = Location::CellCenter 
)

Cell-centered flux helper that accepts an explicit solution vector.

Parameters
a_fluxDestination MF s (one per level).
a_solExplicit solution MF s.
a_locLocation at which fluxes are evaluated.

◆ getFluxes() [2/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( const Vector< AMF * > &  a_flux,
Location  a_loc = Location::CellCenter 
)

Cell-centered flux helper.

Parameters
a_fluxDestination MF s (one per level).
a_locLocation at which fluxes are evaluated (cell centers by default).

◆ getFluxes() [3/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( const Vector< Array< AMF *, 3 > > &  a_flux,
const Vector< AMF * > &  a_sol,
Location  a_loc = Location::FaceCenter 
)

Face-centered flux helper that accepts an explicit solution vector.

Parameters
a_fluxDestination arrays for per-face fluxes (per level).
a_solExplicit solution vectors per level.
a_locLocation at which fluxes are evaluated.

◆ getFluxes() [4/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( const Vector< Array< AMF *, 3 > > &  a_flux,
Location  a_loc = Location::FaceCenter 
)

Face-centered flux helper (-b grad(phi) for alpha a - beta div(b grad)).

Parameters
a_fluxDestination arrays for per-face fluxes (per level).
a_locLocation at which fluxes are evaluated.

◆ getFluxes() [5/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( std::initializer_list< AMF * >  a_flux,
Location  a_loc = Location::CellCenter 
)

Initializer-list convenience overload for cell-centered fluxes.

Parameters
a_fluxInitializer list of destination MF s.
a_locLocation at which fluxes are evaluated.

◆ getFluxes() [6/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( std::initializer_list< AMF * >  a_flux,
std::initializer_list< AMF * >  a_sol,
Location  a_loc = Location::CellCenter 
)

Initializer-list convenience overload for the cell-centered flux helper above.

Parameters
a_fluxInitializer list of destination MF s.
a_solInitializer list of solution MF s.
a_locLocation at which fluxes are evaluated.

◆ getFluxes() [7/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( std::initializer_list< Array< AMF *, 3 > >  a_flux,
Location  a_loc = Location::FaceCenter 
)

Initializer-list convenience overload for getFluxes (face-centered).

Parameters
a_fluxInitializer list converted to a temporary Vector.
a_locLocation at which fluxes are evaluated.

◆ getFluxes() [8/8]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getFluxes ( std::initializer_list< Array< AMF *, 3 > >  a_flux,
std::initializer_list< AMF * >  a_sol,
Location  a_loc = Location::FaceCenter 
)

Initializer-list convenience overload for the face-centered flux helper above.

Parameters
a_fluxInitializer list converted to a temporary Vector.
a_solInitializer list of solution pointers converted to a Vector.
a_locLocation at which fluxes are evaluated.

◆ getGradSolution() [1/2]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getGradSolution ( const Vector< Array< AMF *, 3 > > &  a_grad_sol,
Location  a_loc = Location::FaceCenter 
)

Populate gradient components of the converged solution.

Parameters
a_grad_solOutput gradient arrays (per level and direction) updated in place.
a_locLocation to sample the gradient (face center by default).

◆ getGradSolution() [2/2]

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::getGradSolution ( std::initializer_list< Array< AMF *, 3 > >  a_grad_sol,
Location  a_loc = Location::FaceCenter 
)

Initializer-list convenience overload for getGradSolution.

Parameters
a_grad_solInitializer list converted to a temporary Vector.
a_locLocation to sample the gradient (face center by default).

◆ getInitResidual()

template<typename MF >
RT amrex::MLMGT< MF >::getInitResidual ( ) const
inlinenoexcept

◆ getInitRHS()

template<typename MF >
RT amrex::MLMGT< MF >::getInitRHS ( ) const
inlinenoexcept

◆ getLinOp()

template<typename MF >
MLLinOpT< MF > & amrex::MLMGT< MF >::getLinOp ( )
inline

◆ getNumCGIters()

template<typename MF >
Vector< int > const & amrex::MLMGT< MF >::getNumCGIters ( ) const
inlinenoexcept

◆ getNumIters()

template<typename MF >
int amrex::MLMGT< MF >::getNumIters ( ) const
inlinenoexcept

◆ getResidualHistory()

template<typename MF >
Vector< RT > const & amrex::MLMGT< MF >::getResidualHistory ( ) const
inlinenoexcept

◆ getVerbose()

template<typename MF >
int amrex::MLMGT< MF >::getVerbose ( ) const
inline

◆ incPrintIdentation()

template<typename MF >
void amrex::MLMGT< MF >::incPrintIdentation ( )

Increase the indentation used when printing solver logs.

◆ interpCorrection() [1/2]

template<typename MF >
void amrex::MLMGT< MF >::interpCorrection ( int  alev)

Interpolate corrections onto AMR level alev.

Parameters
alevAMR level receiving the correction.

◆ interpCorrection() [2/2]

template<typename MF >
void amrex::MLMGT< MF >::interpCorrection ( int  alev,
int  mglev 
)

Interpolate corrections on (alev,mglev).

Parameters
alevAMR level index.
mglevMultigrid level index.

◆ makeSolvable() [1/2]

template<typename MF >
void amrex::MLMGT< MF >::makeSolvable ( )

Adjust RHS/solution to satisfy null-space constraints.

◆ makeSolvable() [2/2]

template<typename MF >
void amrex::MLMGT< MF >::makeSolvable ( int  amrlev,
int  mglev,
MF &  mf 
)

Adjust a field on (amrlev,mglev) to satisfy null-space constraints.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
mfMF updated in place.

◆ mgFcycle()

template<typename MF >
void amrex::MLMGT< MF >::mgFcycle ( )

Run an FMG cycle starting from the coarsest grid.

◆ mgVcycle()

template<typename MF >
void amrex::MLMGT< MF >::mgVcycle ( int  amrlev,
int  mglev 
)

Run a multigrid V-cycle on (amrlev,mglev).

Parameters
amrlevAMR level index whose V-cycle is executed.
mglevMultigrid level index that seeds the descent.

◆ miniCycle()

template<typename MF >
void amrex::MLMGT< MF >::miniCycle ( int  amrlev)

Execute a per-level mini cycle.

Parameters
amrlevAMR level that triggers the synchronization.

◆ MLResNormInf()

template<typename MF >
auto amrex::MLMGT< MF >::MLResNormInf ( int  alevmax,
bool  local = false 
)

Composite infinity norm of the residual up to level alevmax.

Parameters
alevmaxFinest AMR level included.
localTrue to skip MPI reductions.

◆ MLRhsNormInf()

template<typename MF >
auto amrex::MLMGT< MF >::MLRhsNormInf ( bool  local = false)

Composite infinity norm of the RHS.

Parameters
localTrue to skip MPI reductions.

◆ NSolve()

template<typename MF >
void amrex::MLMGT< MF >::NSolve ( MLMGT< MF > &  a_solver,
MF &  a_sol,
MF &  a_rhs 
)

Perform an NSolve using an MLMGT wrapper.

Parameters
a_solverHelper solver object.
a_solNodal solution updated in place.
a_rhsNodal RHS.

◆ numAMRLevels()

template<typename MF >
int amrex::MLMGT< MF >::numAMRLevels ( ) const
inlinenoexcept

◆ oneIter()

template<typename MF >
void amrex::MLMGT< MF >::oneIter ( int  iter)

Execute a single multigrid iteration (FMG or V-cycle).

Parameters
iterIteration index (starting at zero).

◆ operator=() [1/2]

template<typename MF >
MLMGT< MF > & amrex::MLMGT< MF >::operator= ( MLMGT< MF > &&  )
delete

◆ operator=() [2/2]

template<typename MF >
MLMGT< MF > & amrex::MLMGT< MF >::operator= ( MLMGT< MF > const &  )
delete

◆ precond()

template<typename MF >
auto amrex::MLMGT< MF >::precond ( Vector< MF * > const &  a_sol,
Vector< MF const * > const &  a_rhs,
RT  a_tol_rel,
RT  a_tol_abs 
)

Apply MLMG as a right-preconditioner with relaxed tolerances.

Parameters
a_solDestination (acts like the correction).
a_rhsSource residual that should be smoothed.
a_tol_relRelative tolerance passed to the inner solve.
a_tol_absAbsolute tolerance passed to the inner solve.
Returns
Residual norm reported by the inner V-cycle.

◆ prepareForFluxes()

template<typename MF >
void amrex::MLMGT< MF >::prepareForFluxes ( Vector< MF const * > const &  a_sol)

Build boundary caches needed by getFluxes()/compFluxes.

Parameters
a_solSolution MF s per level (const pointers).

◆ prepareForNSolve()

template<typename MF >
void amrex::MLMGT< MF >::prepareForNSolve ( )

Prepare the NSolve path.

◆ prepareForSolve()

template<typename MF >
template<typename AMF >
void amrex::MLMGT< MF >::prepareForSolve ( Vector< AMF * > const &  a_sol,
Vector< AMF const * > const &  a_rhs 
)

Prepare linear operators, coefficients, and RHS data prior to solving.

Parameters
a_solInitial guesses per level (updated in place as needed).
a_rhsRight-hand sides per level.

◆ prepareLinOp()

template<typename MF >
void amrex::MLMGT< MF >::prepareLinOp ( )

Finalize operator-dependent metadata before iterating.

◆ preparePrecond()

template<typename MF >
void amrex::MLMGT< MF >::preparePrecond ( )

Prepare preconditioner-specific caches (e.g., boundary data).

◆ ResNormInf()

template<typename MF >
auto amrex::MLMGT< MF >::ResNormInf ( int  alev,
bool  local = false 
)

Infinity norm of the residual on level alev.

Parameters
alevAMR level index.
localTrue to skip MPI reductions.

◆ setAlwaysUseBNorm()

template<typename MF >
void amrex::MLMGT< MF >::setAlwaysUseBNorm ( int  flag)
noexcept

Deprecated flag for forcing B-norm convergence checks.

Parameters
flagNonzero to always use the B-norm.

◆ setBottomMaxIter()

template<typename MF >
void amrex::MLMGT< MF >::setBottomMaxIter ( int  n)
inlinenoexcept

Cap the number of iterations inside the bottom solver.

Parameters
nMaximum iterations for the bottom solve.

◆ setBottomSmooth()

template<typename MF >
void amrex::MLMGT< MF >::setBottomSmooth ( int  n)
inlinenoexcept

Additional smoothing passes executed after the bottom solver.

Parameters
nBottom smoother iterations.

◆ setBottomSolver()

template<typename MF >
void amrex::MLMGT< MF >::setBottomSolver ( BottomSolver  s)
inlinenoexcept

Select the bottom solver type (e.g., CG, BiCGStab, Hypre, PETSc).

Parameters
sBottom solver enum.

◆ setBottomTolerance()

template<typename MF >
void amrex::MLMGT< MF >::setBottomTolerance ( RT  t)
inlinenoexcept

Relative tolerance for the bottom solver.

Parameters
tRelative tolerance.

◆ setBottomToleranceAbs()

template<typename MF >
void amrex::MLMGT< MF >::setBottomToleranceAbs ( RT  t)
inlinenoexcept

Absolute tolerance for the bottom solver.

Parameters
tAbsolute tolerance.

◆ setBottomVerbose()

template<typename MF >
void amrex::MLMGT< MF >::setBottomVerbose ( int  v)
inlinenoexcept

Verbosity for the bottom solver (0 silent).

Parameters
vBottom-solver verbosity level.

◆ setCFStrategy()

template<typename MF >
void amrex::MLMGT< MF >::setCFStrategy ( CFStrategy  a_cf_strategy)
inlinenoexcept

Select the coarse-fine synchronization strategy.

Parameters
a_cf_strategyStrategy enum governing CF handling.

◆ setConvergenceNormType()

template<typename MF >
void amrex::MLMGT< MF >::setConvergenceNormType ( MLMGNormType  norm)
inlinenoexcept

Choose the norm used for convergence tests.

Parameters
normNorm type (residual, RHS, etc.).

◆ setFinalFillBC()

template<typename MF >
void amrex::MLMGT< MF >::setFinalFillBC ( int  flag)
inlinenoexcept

Force a FillBoundary at the end of the solve (nonzero enables).

Parameters
flagNonzero to fill BCs after convergence.

◆ setFinalSmooth()

template<typename MF >
void amrex::MLMGT< MF >::setFinalSmooth ( int  n)
inlinenoexcept

Number of smoothing passes when MLMG is used standalone (final smooth).

Parameters
nFinal smoothing iterations.

◆ setFixedIter()

template<typename MF >
void amrex::MLMGT< MF >::setFixedIter ( int  nit)
inlinenoexcept

Set the number of fixed MLMG iterations (convergence may still exit early if the residual is already small).

Parameters
nitTarget number of iterations.

◆ setMaxFmgIter()

template<typename MF >
void amrex::MLMGT< MF >::setMaxFmgIter ( int  n)
inlinenoexcept

Cap the number of FMG cycles executed.

Parameters
nMaximum FMG cycles per solve.

◆ setMaxIter()

template<typename MF >
void amrex::MLMGT< MF >::setMaxIter ( int  n)
inlinenoexcept

Cap the number of MLMG iterations executed.

Parameters
nMaximum iterations per solve (may include FMG cycles).

◆ setNoGpuSync()

template<typename MF >
void amrex::MLMGT< MF >::setNoGpuSync ( bool  do_not_sync)
inlinenoexcept

Disable global GPU syncs before returning to the app.

Parameters
do_not_syncTrue skips the sync.

◆ setNSolve()

template<typename MF >
void amrex::MLMGT< MF >::setNSolve ( int  flag)
inlinenoexcept

Enable (flag!=0) or disable the N-solve path.

Parameters
flagNonzero enables N-solve support.

◆ setNSolveGridSize()

template<typename MF >
void amrex::MLMGT< MF >::setNSolveGridSize ( int  s)
inlinenoexcept

Set the tile size used for N-solve builds.

Parameters
sGrid size hint for N-solve.

◆ setPostSmooth()

template<typename MF >
void amrex::MLMGT< MF >::setPostSmooth ( int  n)
inlinenoexcept

Number of post-smoothing passes per V-cycle.

Parameters
nPost-smoothing iterations.

◆ setPrecondIter()

template<typename MF >
void amrex::MLMGT< MF >::setPrecondIter ( int  nit)
inlinenoexcept

Set how many MLMG iterations the preconditioner executes per Krylov call (still subject to early-convergence checks).

Parameters
nitTarget number of inner iterations.

◆ setPreSmooth()

template<typename MF >
void amrex::MLMGT< MF >::setPreSmooth ( int  n)
inlinenoexcept

Number of pre-smoothing passes per V-cycle.

Parameters
nPre-smoothing iterations.

◆ setThrowException()

template<typename MF >
void amrex::MLMGT< MF >::setThrowException ( bool  t)
inlinenoexcept

Control behavior when the solve fails to converge or blows up.

Parameters
tTrue to throw MLMGT::error on failure; false to call Abort. solve() always returns the composite residual norm regardless of this setting.

◆ setVerbose()

template<typename MF >
void amrex::MLMGT< MF >::setVerbose ( int  v)
inlinenoexcept

Set the main solver verbosity (0 silent).

Parameters
vVerbosity level forwarded to MLMG.

◆ solve() [1/4]

template<typename MF >
template<typename AMF >
auto amrex::MLMGT< MF >::solve ( const Vector< AMF * > &  a_sol,
const Vector< AMF const * > &  a_rhs,
RT  a_tol_rel,
RT  a_tol_abs,
const char *  checkpoint_file 
) -> RT

◆ solve() [2/4]

template<typename MF >
template<typename AMF >
RT amrex::MLMGT< MF >::solve ( const Vector< AMF * > &  a_sol,
const Vector< AMF const * > &  a_rhs,
RT  a_tol_rel,
RT  a_tol_abs,
const char *  checkpoint_file = nullptr 
)

Solve the multilevel system; optional checkpoint_file is for debugging only.

Parameters
a_solPer-level solution MF s (overwritten with the answer).
a_rhsPer-level right-hand sides.
a_tol_relRelative residual tolerance.
a_tol_absAbsolute residual tolerance.
checkpoint_fileOptional checkpoint basename for dumping MLMG state (debug).
Returns
Composite infinity norm of the residual at the end of solve.

◆ solve() [3/4]

template<typename MF >
template<typename AMF >
auto amrex::MLMGT< MF >::solve ( std::initializer_list< AMF * >  a_sol,
std::initializer_list< AMF const * >  a_rhs,
RT  a_tol_rel,
RT  a_tol_abs,
const char *  checkpoint_file 
) -> RT

◆ solve() [4/4]

template<typename MF >
template<typename AMF >
RT amrex::MLMGT< MF >::solve ( std::initializer_list< AMF * >  a_sol,
std::initializer_list< AMF const * >  a_rhs,
RT  a_tol_rel,
RT  a_tol_abs,
const char *  checkpoint_file = nullptr 
)

Convenience initializer-list overload that forwards to the Vector-based solve.

Parameters
a_solInitializer list converted to a temporary Vector.
a_rhsInitializer list converted to a temporary Vector.
a_tol_relRelative residual tolerance.
a_tol_absAbsolute residual tolerance.
checkpoint_fileOptional checkpoint basename for dumping MLMG state (debug).
Returns
Composite infinity norm of the residual at the end of solve.

Friends And Related Symbol Documentation

◆ GMRESMLMGT

template<typename MF >
template<typename M >
friend class GMRESMLMGT
friend

◆ MLCGSolverT

template<typename MF >
template<typename T >
friend class MLCGSolverT
friend

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