Adapter presenting an already-defined AMRMultiGrid as a LinearOp over the AMR hierarchy.
More...
|
|
| AMRMultigridKrylovOp ()=default |
| | Default constructor. Call define() before use.
|
| |
|
virtual | ~AMRMultigridKrylovOp () |
| | Destructor. Frees the preconditioner scratch storage.
|
| |
| void | define (AMRMultiGrid< LevelData< T > > *a_mg, const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_validCells, const Vector< Real > &a_dx, const int a_lbase, const int a_lmax, const int a_numVCycles) |
| | Define the adapter. Call once per regrid (after the AMRMultiGrid has been defined and init'd).
|
| |
| void | applyOp (Vector< LevelData< T > * > &a_lhs, const Vector< LevelData< T > * > &a_phi, bool a_homogeneous=false) override |
| | Matrix-vector product L(phi) over the AMR hierarchy (always homogeneous for the Krylov path).
|
| |
| void | residual (Vector< LevelData< T > * > &a_lhs, const Vector< LevelData< T > * > &a_phi, const Vector< LevelData< T > * > &a_rhs, bool a_homogeneous=false) override |
| | AMR residual a_lhs = L(a_phi) - a_rhs.
|
| |
| void | preCond (Vector< LevelData< T > * > &a_cor, const Vector< LevelData< T > * > &a_residual) override |
| | Apply the preconditioner: a_cor approx L^{-1} a_residual via m_numVCycles multigrid cycles (cycle type from the AMRMultiGrid configuration; normally V-cycles).
|
| |
| void | create (Vector< LevelData< T > * > &a_lhs, const Vector< LevelData< T > * > &a_rhs) override |
| | Allocate a_lhs to mirror a_rhs.
|
| |
| void | clear (Vector< LevelData< T > * > &a_lhs) override |
| | Free a holder created by create().
|
| |
| void | assign (Vector< LevelData< T > * > &a_lhs, const Vector< LevelData< T > * > &a_rhs) override |
| | Copy a_rhs into a_lhs.
|
| |
| Real | dotProduct (const Vector< LevelData< T > * > &a_1, const Vector< LevelData< T > * > &a_2) override |
| | AMR-composite inner product (allocation-free, fine-covered cells masked out).
|
| |
| void | mDotProduct (const Vector< LevelData< T > * > &a_1, const int a_sz, const Vector< LevelData< T > * > a_2[], Real a_mdots[]) override |
| | Batched inner products a_mdots[k] = dotProduct(a_1, a_2[k]) for k=0..a_sz-1.
|
| |
| void | incr (Vector< LevelData< T > * > &a_lhs, const Vector< LevelData< T > * > &a_x, Real a_scale) override |
| | Increment a_lhs += a_scale*a_x.
|
| |
| void | axby (Vector< LevelData< T > * > &a_lhs, const Vector< LevelData< T > * > &a_x, const Vector< LevelData< T > * > &a_y, Real a_a, Real a_b) override |
| | Set a_lhs = a_a*a_x + a_b*a_y.
|
| |
| void | scale (Vector< LevelData< T > * > &a_lhs, const Real &a_scale) override |
| | Scale a_lhs *= a_scale.
|
| |
| Real | norm (const Vector< LevelData< T > * > &a_rhs, int a_ord) override |
| | Norm of a_rhs. For a_ord==2 this is the inner-product-induced norm sqrt(dotProduct(x,x)) so that it is consistent with dotProduct (a requirement of GMRES); other orders use the per-level max norm.
|
| |
| void | setToZero (Vector< LevelData< T > * > &a_lhs) override |
| | Set a_lhs = 0.
|
| |
|
|
AMRMultiGrid< LevelData< T > > * | m_mg = nullptr |
| | Reused multigrid solver (not owned).
|
| |
|
Vector< AMRLevelOp< LevelData< T > > * > | m_amrOps |
| | Per-level AMR operators borrowed from m_mg (not owned).
|
| |
|
Vector< Real > | m_dxScale |
| | Per-level dx^SpaceDim, the AMR inner-product weight.
|
| |
|
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > | m_validMask |
| | Per-level valid-cell mask: false where the level is covered by a finer level (excluded from the inner product). Shared (refcounted) with AmrMesh's valid-cell mask rather than built here.
|
| |
|
Vector< Real > | m_volume |
| | Per-level reduced total volume (geometry-only, vector-independent); cached on first dotProduct.
|
| |
|
bool | m_volumeCached = false |
| | Whether m_volume has been computed and reduced. Reset to false in define() (regrid invalidates it).
|
| |
|
int | m_lbase = 0 |
| | Coarsest level in the solve.
|
| |
|
int | m_lmax = 0 |
| | Finest level in the solve.
|
| |
|
int | m_numVCycles = 1 |
| | Number of multigrid cycles per preconditioner application (cycle type from the AMRMultiGrid configuration; normally V-cycles).
|
| |
|
bool | m_precondInit = false |
| | Whether the preconditioner scratch has been allocated.
|
| |
|
Vector< LevelData< T > * > | m_precondTmp |
| | Preconditioner scratch (residual), lazily allocated on first preCond.
|
| |
|
Vector< LevelData< T > * > | m_precondDcor |
| | Preconditioner scratch (cycle correction), lazily allocated on first preCond.
|
| |
template<class T>
class AMRMultigridKrylovOp< T >
Adapter presenting an already-defined AMRMultiGrid as a LinearOp over the AMR hierarchy.
This lets an outer Krylov solver (GMRES/BiCGStab, operating on Vector<LevelData<T>*>) use the multigrid cycle as a preconditioner. The matrix-vector product and the preconditioner delegate to the supplied, fully set-up AMRMultiGrid (its AMR operators and multigrid cycle; the cycle type follows the AMRMultiGrid configuration / cycle, normally a V-cycle for efficiency). The vector operations delegate to the per-level AMR operators, and the AMR inner product is computed allocation-free using a per-level fine-covered mask precomputed in define().
- Note
- T is the FAB type (EBCellFAB or MFCellFAB); the LinearOp acts on Vector<LevelData<T>*>.