![]() |
Block-Structured AMR Software Framework
|
#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 |
| using | MultigridType = amrex::MultigridType |
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 | setMultigridType (MultigridType t) noexcept |
| Select how AMR level 0 is solved. See MultigridType. | |
| MultigridType | getMultigridType () const noexcept |
| bool | usedAlgMG () const noexcept |
| void | setAlgMGOptions (std::function< void(AlgMG< RT > &)> f) |
| Adjust the AlgMG solvers MLMG builds (level 0 and bottom). | |
| void | setHybridStallCriterion (int window, RT rate) noexcept |
Hybrid mode: switch to AlgMG when the residual has not dropped by rate per iteration on average over the last window iterations (defaults 0.8 and 4). | |
| void | setHybridDivergenceFactor (RT f) 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 |
| Control implicit GPU synchronization inside solve(). | |
| 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 | postCG (int ret, int niters=-1) |
| Post CG smoothing. | |
| 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. | |
| template<class TMF = MF> requires (std::same_as<TMF,MultiFab>) | |
| void | bottomSolveWithAlgMG (MF &x, const MF &b) |
| AlgMG on the bottom MG level (MultiFab, single component only). | |
| template<class TMF = MF> requires (std::same_as<TMF,MultiFab>) | |
| void | algmgLevel0Solve () |
| template<class TMF = MF> requires (std::same_as<TMF,MultiFab>) | |
| void | configureAlgMG (MLAlgMG &s, bool singular, bool with_options) |
| template<class TMF = MF> requires (std::same_as<TMF,MultiFab>) | |
| void | algmgSolve (MLAlgMG &s, MF &x, MF const &b) |
| bool | hybridShouldSwitch (Vector< RT > const &norms, RT max_norm, RT best_norm, std::string &reason) const |
| 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 |
| using amrex::MLMGT< MF >::BCMode = typename MLLinOpT<MF>::BCMode |
| using amrex::MLMGT< MF >::BottomSolver = amrex::BottomSolver |
| using amrex::MLMGT< MF >::FAB = typename MLLinOpT<MF>::FAB |
| using amrex::MLMGT< MF >::Location = typename MLLinOpT<MF>::Location |
| using amrex::MLMGT< MF >::MFType = MF |
| using amrex::MLMGT< MF >::MultigridType = amrex::MultigridType |
| using amrex::MLMGT< MF >::RT = typename MLLinOpT<MF>::RT |
|
strong |
| amrex::MLMGT< MF >::MLMGT | ( | MLLinOpT< MF > & | a_lp | ) |
|
default |
|
delete |
|
delete |
| void amrex::MLMGT< MF >::actualBottomSolve | ( | ) |
Execute the actual bottom solve after pre-smoothing and restriction.
| void amrex::MLMGT< MF >::addInterpCorrection | ( | int | alev, |
| int | mglev | ||
| ) |
Add interpolated corrections to (alev,mglev) data.
| alev | AMR level index. |
| mglev | Multigrid level index. |
| void amrex::MLMGT< MF >::algmgLevel0Solve | ( | ) |
AlgMG on the finest MG level of AMR level 0: res[0][0] -> cor[0][0] (one V-cycle in preconditioner mode).
| void amrex::MLMGT< MF >::algmgSolve | ( | MLAlgMG & | s, |
| MF & | x, | ||
| MF const & | b | ||
| ) |
| 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)).
| void amrex::MLMGT< MF >::applyPrecond | ( | const Vector< MF * > & | out, |
| const Vector< MF * > & | in | ||
| ) |
Apply the linear operator as a preconditioner (out = L(in)).
| out | Destination vectors (per level). |
| in | Source vectors (per level). |
| void amrex::MLMGT< MF >::bottomSolve | ( | ) |
Execute the configured bottom solver (Hypre, PETSc, CG, etc.).
| void amrex::MLMGT< MF >::bottomSolveWithAlgMG | ( | MF & | x, |
| const MF & | b | ||
| ) |
| int amrex::MLMGT< MF >::bottomSolveWithCG | ( | MF & | x, |
| const MF & | b, | ||
| typename MLCGSolverT< MF >::Type | type | ||
| ) |
Bottom solve using CG/BiCGStab implemented in MLCGSolverT.
| x | Solution vector updated in place. |
| b | Right-hand side. |
| type | Krylov flavor (CG or BiCGStab). |
| 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.
| a_res | Residual MF s per level (output). |
| a_sol | Solution MF s per level. |
| a_rhs | Right-hand sides per level. |
| void amrex::MLMGT< MF >::computeMLResidual | ( | int | amrlevmax | ) |
Compute the composite residual norm up to AMR level amrlevmax.
| amrlevmax | Finest AMR level included in the composite norm. |
| void amrex::MLMGT< MF >::computeResidual | ( | int | alev | ) |
Compute the residual on AMR level alev.
| alev | AMR level whose residual is refreshed. |
| void amrex::MLMGT< MF >::computeResOfCorrection | ( | int | amrlev, |
| int | mglev | ||
| ) |
Compute the residual of the correction equation on (amrlev,mglev).
| amrlev | AMR level index. |
| mglev | Multigrid level index. |
| void amrex::MLMGT< MF >::computeResWithCrseCorFineCor | ( | int | falev | ) |
Residual update using coarse correction / fine correction.
| falev | Fine AMR level index supplying the correction. |
| void amrex::MLMGT< MF >::computeResWithCrseSolFineCor | ( | int | calev, |
| int | falev | ||
| ) |
Residual update using coarse solution / fine correction.
| calev | Coarse AMR level index. |
| falev | Fine AMR level index. |
| void amrex::MLMGT< MF >::configureAlgMG | ( | MLAlgMG & | s, |
| bool | singular, | ||
| bool | with_options | ||
| ) |
| void amrex::MLMGT< MF >::decPrintIdentation | ( | ) |
Decrease the indentation used when printing solver logs.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
| void amrex::MLMGT< MF >::getEBFluxes | ( | const Vector< MF * > & | a_eb_flux | ) |
Flux into the EB wall using the internally stored solution.
| a_eb_flux | Per-level MF s that receive wall fluxes. |
| 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.
| a_eb_flux | Per-level MF s that receive wall fluxes. |
| a_sol | Explicit solution MF s per level. |
|
inlinenoexcept |
| 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.
| a_flux | Destination MF s (one per level). |
| a_sol | Explicit solution MF s. |
| a_loc | Location at which fluxes are evaluated. |
| void amrex::MLMGT< MF >::getFluxes | ( | const Vector< AMF * > & | a_flux, |
| Location | a_loc = Location::CellCenter |
||
| ) |
Cell-centered flux helper.
| a_flux | Destination MF s (one per level). |
| a_loc | Location at which fluxes are evaluated (cell centers by default). |
| 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.
| a_flux | Destination arrays for per-face fluxes (per level). |
| a_sol | Explicit solution vectors per level. |
| a_loc | Location at which fluxes are evaluated. |
| 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)).
| a_flux | Destination arrays for per-face fluxes (per level). |
| a_loc | Location at which fluxes are evaluated. |
| void amrex::MLMGT< MF >::getFluxes | ( | std::initializer_list< AMF * > | a_flux, |
| Location | a_loc = Location::CellCenter |
||
| ) |
Initializer-list convenience overload for cell-centered fluxes.
| a_flux | Initializer list of destination MF s. |
| a_loc | Location at which fluxes are evaluated. |
| 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.
| a_flux | Initializer list of destination MF s. |
| a_sol | Initializer list of solution MF s. |
| a_loc | Location at which fluxes are evaluated. |
| 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).
| a_flux | Initializer list converted to a temporary Vector. |
| a_loc | Location at which fluxes are evaluated. |
| void amrex::MLMGT< MF >::getFluxes | ( | std::initializer_list< Array< AMF *, 3 > > | a_flux, |
| std::initializer_list< AMF * > | a_sol, | ||
| Location | a_loc = Location::FaceCenter |
||
| ) |
| 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.
| a_grad_sol | Output gradient arrays (per level and direction) updated in place. |
| a_loc | Location to sample the gradient (face center by default). |
| 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.
| a_grad_sol | Initializer list converted to a temporary Vector. |
| a_loc | Location to sample the gradient (face center by default). |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
| bool amrex::MLMGT< MF >::hybridShouldSwitch | ( | Vector< RT > const & | norms, |
| RT | max_norm, | ||
| RT | best_norm, | ||
| std::string & | reason | ||
| ) | const |
Hybrid mode: is it time to give up on the geometric phase? norms holds the residual norms of the geometric iterations so far.
| void amrex::MLMGT< MF >::incPrintIdentation | ( | ) |
Increase the indentation used when printing solver logs.
| void amrex::MLMGT< MF >::interpCorrection | ( | int | alev | ) |
Interpolate corrections onto AMR level alev.
| alev | AMR level receiving the correction. |
| void amrex::MLMGT< MF >::interpCorrection | ( | int | alev, |
| int | mglev | ||
| ) |
Interpolate corrections on (alev,mglev).
| alev | AMR level index. |
| mglev | Multigrid level index. |
| void amrex::MLMGT< MF >::makeSolvable | ( | ) |
Adjust RHS/solution to satisfy null-space constraints.
| void amrex::MLMGT< MF >::makeSolvable | ( | int | amrlev, |
| int | mglev, | ||
| MF & | mf | ||
| ) |
Adjust a field on (amrlev,mglev) to satisfy null-space constraints.
| amrlev | AMR level index. |
| mglev | Multigrid level index. |
| mf | MF updated in place. |
| void amrex::MLMGT< MF >::mgFcycle | ( | ) |
Run an FMG cycle starting from the coarsest grid.
| void amrex::MLMGT< MF >::mgVcycle | ( | int | amrlev, |
| int | mglev | ||
| ) |
Run a multigrid V-cycle on (amrlev,mglev).
| amrlev | AMR level index whose V-cycle is executed. |
| mglev | Multigrid level index that seeds the descent. |
| void amrex::MLMGT< MF >::miniCycle | ( | int | amrlev | ) |
Execute a per-level mini cycle.
| amrlev | AMR level that triggers the synchronization. |
| auto amrex::MLMGT< MF >::MLResNormInf | ( | int | alevmax, |
| bool | local = false |
||
| ) |
Composite infinity norm of the residual up to level alevmax.
| alevmax | Finest AMR level included. |
| local | True to skip MPI reductions. |
| auto amrex::MLMGT< MF >::MLRhsNormInf | ( | bool | local = false | ) |
Composite infinity norm of the RHS.
| local | True to skip MPI reductions. |
| void amrex::MLMGT< MF >::NSolve | ( | MLMGT< MF > & | a_solver, |
| MF & | a_sol, | ||
| MF & | a_rhs | ||
| ) |
Perform an NSolve using an MLMGT wrapper.
| a_solver | Helper solver object. |
| a_sol | Nodal solution updated in place. |
| a_rhs | Nodal RHS. |
|
inlinenoexcept |
| void amrex::MLMGT< MF >::oneIter | ( | int | iter | ) |
Execute a single multigrid iteration (FMG or V-cycle).
| iter | Iteration index (starting at zero). |
|
delete |
|
delete |
| void amrex::MLMGT< MF >::postCG | ( | int | ret, |
| int | niters = -1 |
||
| ) |
Post CG smoothing.
| ret | Return code of the previous CG solver. |
| niters | Number of iterations of the previous CG solver to record for getNumCGIters(). Pass a negative number if it has already been recorded (e.g., by bottomSolveWithCG). |
| 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.
| a_sol | Destination (acts like the correction). |
| a_rhs | Source residual that should be smoothed. |
| a_tol_rel | Relative tolerance passed to the inner solve. |
| a_tol_abs | Absolute tolerance passed to the inner solve. |
| void amrex::MLMGT< MF >::prepareForFluxes | ( | Vector< MF const * > const & | a_sol | ) |
Build boundary caches needed by getFluxes()/compFluxes.
| a_sol | Solution MF s per level (const pointers). |
| void amrex::MLMGT< MF >::prepareForNSolve | ( | ) |
Prepare the NSolve path.
| 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.
| a_sol | Initial guesses per level (updated in place as needed). |
| a_rhs | Right-hand sides per level. |
| void amrex::MLMGT< MF >::prepareLinOp | ( | ) |
Finalize operator-dependent metadata before iterating.
| void amrex::MLMGT< MF >::preparePrecond | ( | ) |
Prepare preconditioner-specific caches (e.g., boundary data).
| auto amrex::MLMGT< MF >::ResNormInf | ( | int | alev, |
| bool | local = false |
||
| ) |
Infinity norm of the residual on level alev.
| alev | AMR level index. |
| local | True to skip MPI reductions. |
|
inline |
Adjust the AlgMG solvers MLMG builds (level 0 and bottom).
The callback runs once, when a solver is built for an assembled matrix, so it can set the multigrid parameters (Krylov acceleration, smoother, interpolation, strength, coarsening) without repeating the setup. MLMG applies its own bottom tolerances, iteration limit, verbosity, exception and singularity settings on every solve; those cannot be changed here.
|
noexcept |
Deprecated flag for forcing B-norm convergence checks.
| flag | Nonzero to always use the B-norm. |
|
inlinenoexcept |
Cap the number of iterations inside the bottom solver.
| n | Maximum iterations for the bottom solve. |
|
inlinenoexcept |
Additional smoothing passes executed after the bottom solver.
| n | Bottom smoother iterations. |
|
inlinenoexcept |
|
inlinenoexcept |
Relative tolerance for the bottom solver.
| t | Relative tolerance. |
|
inlinenoexcept |
Absolute tolerance for the bottom solver.
| t | Absolute tolerance. |
|
inlinenoexcept |
Verbosity for the bottom solver (0 silent).
| v | Bottom-solver verbosity level. |
|
inlinenoexcept |
Select the coarse-fine synchronization strategy.
| a_cf_strategy | Strategy enum governing CF handling. |
|
inlinenoexcept |
Choose the norm used for convergence tests.
| norm | Norm type (residual, RHS, etc.). |
|
inlinenoexcept |
Force a FillBoundary at the end of the solve (nonzero enables).
| flag | Nonzero to fill BCs after convergence. |
|
inlinenoexcept |
Number of smoothing passes when MLMG is used standalone (final smooth).
| n | Final smoothing iterations. |
|
inlinenoexcept |
Set the number of fixed MLMG iterations (convergence may still exit early if the residual is already small).
| nit | Target number of iterations. |
|
inlinenoexcept |
Hybrid mode: switch to AlgMG when the residual exceeds f times the best residual so far (default 10).
|
inlinenoexcept |
Hybrid mode: switch to AlgMG when the residual has not dropped by rate per iteration on average over the last window iterations (defaults 0.8 and 4).
|
inlinenoexcept |
Cap the number of FMG cycles executed.
| n | Maximum FMG cycles per solve. |
|
inlinenoexcept |
Cap the number of MLMG iterations executed.
| n | Maximum iterations per solve (may include FMG cycles). |
|
inlinenoexcept |
Select how AMR level 0 is solved. See MultigridType.
|
inlinenoexcept |
Control implicit GPU synchronization inside solve().
When enabled, solve() runs in a single-stream region without the implicit stream synchronizations normally performed by MFIter and many amrex functions. The GPU streams are synchronized once when solve() returns, unless the caller is already in a Gpu::NoSyncRegion. This is off by default. Skipping the synchronizations helps small problems with few boxes, but running on a single stream can slow down solvers that launch many small per-box kernels (e.g., the nodal and EB solvers with many boxes per process). Try both settings for your problem.
| do_not_sync | True skips the implicit syncs. Default is false. |
|
inlinenoexcept |
Enable (flag!=0) or disable the N-solve path.
| flag | Nonzero enables N-solve support. |
|
inlinenoexcept |
Set the tile size used for N-solve builds.
| s | Grid size hint for N-solve. |
|
inlinenoexcept |
Number of post-smoothing passes per V-cycle.
| n | Post-smoothing iterations. |
|
inlinenoexcept |
Set how many MLMG iterations the preconditioner executes per Krylov call (still subject to early-convergence checks).
| nit | Target number of inner iterations. |
|
inlinenoexcept |
Number of pre-smoothing passes per V-cycle.
| n | Pre-smoothing iterations. |
|
inlinenoexcept |
Control behavior when the solve fails to converge or blows up.
| t | True to throw MLMGT::error on failure; false to call Abort. solve() always returns the composite residual norm regardless of this setting. |
|
inlinenoexcept |
Set the main solver verbosity (0 silent).
| v | Verbosity level forwarded to MLMG. |
| 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 |
| 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.
| a_sol | Per-level solution MF s (overwritten with the answer). |
| a_rhs | Per-level right-hand sides. |
| a_tol_rel | Relative residual tolerance. |
| a_tol_abs | Absolute residual tolerance. |
| checkpoint_file | Optional checkpoint basename for dumping MLMG state (debug). |
| 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 |
| 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.
| a_sol | Initializer list converted to a temporary Vector. |
| a_rhs | Initializer list converted to a temporary Vector. |
| a_tol_rel | Relative residual tolerance. |
| a_tol_abs | Absolute residual tolerance. |
| checkpoint_file | Optional checkpoint basename for dumping MLMG state (debug). |
|
inlinenoexcept |
Whether the last solve used AlgMG on AMR level 0 (always in the algebraic type, after the switch in the hybrid type).