Solve using GMRES with multigrid as preconditioner. More...
#include <AMReX_GMRES_MLMG.H>
Public Types | |
using | MG = MLMGT< MF > |
using | RT = typename MG::RT |
using | GM = GMRES< 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. More... | |
void | setVerbose (int v) |
Sets verbosity. More... | |
void | setMaxIters (int niters) |
Sets the max number of iterations. More... | |
int | getNumIters () const |
Gets the number of iterations. More... | |
RT | getResidualNorm () const |
Gets the 2-norm of the residual. More... | |
GM & | getGMRES () |
Get the GMRES object. More... | |
void | setPropertyOfZero (bool b) |
Set MLMG's multiplicative property of zero. More... | |
MF | makeVecRHS () const |
Make MultiFab without ghost cells. More... | |
MF | makeVecLHS () const |
Make MultiFab with ghost cells and set ghost cells to zero. More... | |
RT | norm2 (MF const &mf) const |
RT | dotProduct (MF const &mf1, MF const &mf2) const |
void | apply (MF &lhs, MF const &rhs) const |
lhs = L(rhs) More... | |
void | precond (MF &lhs, MF const &rhs) const |
bool | usePrecond (bool new_flag) |
Control whether or not to use MLMG as preconditioner. More... | |
void | setPrecondNumIters (int precond_niters) |
Set the number of MLMG preconditioner iterations per GMRES iteration. More... | |
Static Public Member Functions | |
static void | scale (MF &mf, RT scale_factor) |
static void | setToZero (MF &lhs) |
lhs = 0 More... | |
static void | assign (MF &lhs, MF const &rhs) |
lhs = rhs More... | |
static void | increment (MF &lhs, MF const &rhs, RT a) |
lhs += a*rhs More... | |
static void | linComb (MF &lhs, RT a, MF const &rhs_a, RT b, MF const &rhs_b) |
lhs = a*rhs_a + b*rhs_b More... | |
Private Attributes | |
GM | m_gmres |
MG * | m_mlmg |
MLLinOpT< MF > * | m_linop |
bool | m_use_precond = true |
bool | m_prop_zero = false |
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<MF,GMRESMLMGT<MF> > |
using amrex::GMRESMLMGT< MF >::MG = MLMGT<MF> |
using amrex::GMRESMLMGT< MF >::RT = typename MG::RT |
|
explicit |
void amrex::GMRESMLMGT< MF >::apply | ( | MF & | lhs, |
MF const & | rhs | ||
) | const |
lhs = L(rhs)
|
static |
lhs = rhs
auto amrex::GMRESMLMGT< MF >::dotProduct | ( | MF const & | mf1, |
MF 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 |
Make MultiFab with ghost cells and set ghost cells to zero.
auto amrex::GMRESMLMGT< MF >::makeVecRHS |
Make MultiFab without ghost cells.
auto amrex::GMRESMLMGT< MF >::norm2 | ( | MF const & | mf | ) | const |
void amrex::GMRESMLMGT< MF >::precond | ( | MF & | lhs, |
MF const & | rhs | ||
) | const |
|
static |
|
inline |
Sets the max number of iterations.
|
inline |
Set the number of MLMG preconditioner iterations per GMRES iteration.
|
inline |
Set MLMG's multiplicative property of zero.
This should NOT be called unless MLMG has the multiplicative property of zero. MLMG is not a matrix, and usually does not have the properties of a matrix such as the multiplicative property of zero (i.e., M*0=0) because how domain boundary conditions are handled. However, if MLMG has the property of zero, calling this function with true can have a small performance benefit.
|
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. |
|
inline |
Control whether or not to use MLMG as preconditioner.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |