Solve using GMRES with multigrid as preconditioner. More...
#include <AMReX_GMRES_MLMG.H>
Public Types | |
using | VEC = Vector< MF > |
using | MG = MLMGT< MF > |
using | RT = typename MG::RT |
using | GM = GMRES< Vector< MF >, GMRESMLMGT< MF > > |
Public Member Functions | |
GMRESMLMGT (MG &mlmg) | |
void | solve (MF &a_sol, MF const &a_rhs, RT a_tol_rel, RT a_tol_abs) |
Solve the linear system. | |
void | solve (Vector< MF * > const &a_sol, Vector< MF const * > const &a_rhs, RT a_tol_rel, RT a_tol_abs) |
void | setVerbose (int v) |
Sets verbosity. | |
void | setMaxIters (int niters) |
Sets the max number of iterations. | |
int | getNumIters () const |
Gets the number of iterations. | |
RT | getResidualNorm () const |
Gets the 2-norm of the residual. | |
GM & | getGMRES () |
Get the GMRES object. | |
VEC | makeVecRHS () const |
Make MultiFab without ghost cells. | |
VEC | makeVecLHS () const |
Make MultiFab with ghost cells and set ghost cells to zero. | |
RT | norm2 (VEC const &mf) const |
RT | dotProduct (VEC const &mf1, VEC const &mf2) const |
void | apply (VEC &lhs, VEC const &rhs) const |
lhs = L(rhs) | |
void | precond (VEC &lhs, VEC const &rhs) const |
bool | usePrecond (bool new_flag) |
Control whether or not to use MLMG as preconditioner. | |
void | setPrecondNumIters (int precond_niters) |
Set the number of MLMG preconditioner iterations per GMRES iteration. | |
Static Public Member Functions | |
static void | scale (VEC &mf, RT scale_factor) |
static void | setToZero (VEC &lhs) |
lhs = 0 | |
static void | assign (VEC &lhs, VEC const &rhs) |
lhs = rhs | |
static void | increment (VEC &lhs, VEC const &rhs, RT a) |
lhs += a*rhs | |
static void | linComb (VEC &lhs, RT a, VEC const &rhs_a, RT b, VEC const &rhs_b) |
lhs = a*rhs_a + b*rhs_b | |
Private Attributes | |
GM | m_gmres |
MG * | m_mlmg |
MLLinOpT< MF > * | m_linop |
int | m_verbose = 0 |
int | m_nlevels = 0 |
bool | m_use_precond = true |
int | m_precond_niters = 1 |
Solve using GMRES with multigrid as preconditioner.
The linear system to solve is provided by MLMG, which is also being used as the preconditioner.
using amrex::GMRESMLMGT< MF >::GM = GMRES<Vector<MF>,GMRESMLMGT<MF> > |
using amrex::GMRESMLMGT< MF >::MG = MLMGT<MF> |
using amrex::GMRESMLMGT< MF >::RT = typename MG::RT |
using amrex::GMRESMLMGT< MF >::VEC = Vector<MF> |
|
explicit |
void amrex::GMRESMLMGT< MF >::apply | ( | VEC & | lhs, |
VEC const & | rhs | ||
) | const |
lhs = L(rhs)
|
static |
lhs = rhs
auto amrex::GMRESMLMGT< MF >::dotProduct | ( | VEC const & | mf1, |
VEC const & | mf2 | ||
) | const |
|
inline |
Get the GMRES object.
|
inline |
Gets the number of iterations.
|
inline |
Gets the 2-norm of the residual.
|
static |
lhs += a*rhs
|
static |
lhs = a*rhs_a + b*rhs_b
auto amrex::GMRESMLMGT< MF >::makeVecLHS | ( | ) | const |
Make MultiFab with ghost cells and set ghost cells to zero.
auto amrex::GMRESMLMGT< MF >::makeVecRHS | ( | ) | const |
Make MultiFab without ghost cells.
auto amrex::GMRESMLMGT< MF >::norm2 | ( | VEC const & | mf | ) | const |
void amrex::GMRESMLMGT< MF >::precond | ( | VEC & | lhs, |
VEC const & | rhs | ||
) | const |
|
static |
|
inline |
Sets the max number of iterations.
|
inline |
Set the number of MLMG preconditioner iterations per GMRES iteration.
|
static |
lhs = 0
|
inline |
Sets verbosity.
void amrex::GMRESMLMGT< MF >::solve | ( | MF & | a_sol, |
MF const & | a_rhs, | ||
RT | a_tol_rel, | ||
RT | a_tol_abs | ||
) |
Solve the linear system.
a_sol | unknowns, i.e., x in A x = b. |
a_rhs | RHS, i.e., b in A x = b. |
a_tol_rel | relative tolerance. |
a_tol_abs | absolute tolerance. |
void amrex::GMRESMLMGT< MF >::solve | ( | Vector< MF * > const & | a_sol, |
Vector< MF const * > const & | a_rhs, | ||
RT | a_tol_rel, | ||
RT | a_tol_abs | ||
) |
|
inline |
Control whether or not to use MLMG as preconditioner.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |