#include <AMRMultiGrid.H>
Public Member Functions | |
AMRMultiGrid () | |
virtual | ~AMRMultiGrid () |
virtual void | define (const ProblemDomain &a_coarseDomain, AMRLevelOpFactory< T > &a_factory, LinearSolver< T > *a_bottomSolver, int a_numLevels) |
virtual void | solve (Vector< T * > &a_phi, const Vector< T * > &a_rhs, int l_max, int l_base, bool a_zeroPhi=true) |
virtual void | solveNoInit (Vector< T * > &a_phi, const Vector< T * > &a_rhs, int l_max, int l_base, bool a_zeroPhi=true) |
void | relaxOnlyHomogeneous (Vector< T * > &a_phi, const Vector< T * > &a_rhs, int l_max, int l_base) |
virtual void | AMRVCycle (Vector< T * > &a_correction, Vector< T * > &a_residual, int l, int l_max, int l_base) |
void | setMGCycle (int a_numMG) |
void | init (const Vector< T * > &a_phi, const Vector< T * > &a_rhs, int l_max, int l_base) |
void | revert (const Vector< T * > &a_phi, const Vector< T * > &a_rhs, int l_max, int l_base) |
AMRLevelOp< T > & | levelOp (int level) |
Real | computeAMRResidual (Vector< T * > &a_resid, Vector< T * > &a_phi, const Vector< T * > &a_rhs, int l_max, int l_base, bool a_homogeneousBC=false, bool a_computeNorm=true) |
void | computeAMROperator (Vector< T * > &a_lph, Vector< T * > &a_phi, int l_max, int l_base, bool a_homogeneousBC=false) |
Vector< MGLevelOp< T > * > | getAllOperators () |
Vector< MGLevelOp< T > * > | getOperatorsOp () |
Vector< Vector< MGLevelOp< T > * > > | getOperatorsMG () |
void | setSolverParameters (const int &a_pre, const int &a_post, const int &a_bottom, const int &a_numMG, const int &a_iterMax, const Real &a_eps, const Real &a_hang, const Real &a_normThresh) |
void | setBottomSolver (int l_max, int l_base) |
set up bottom solver for internal MG solver | |
Public Attributes | |
Real | m_eps |
Real | m_hang |
Real | m_normThresh |
bool | m_solverParamsSet |
int | m_imin |
int | m_iterMax |
int | m_verbosity |
int | m_exitStatus |
int | m_pre |
int | m_post |
int | m_bottom |
int | m_numMG |
int | m_maxDepth |
max no. of coarsenings -- -1 (default) means coarsen as far as possible | |
Real | m_convergenceMetric |
Protected Member Functions | |
void | relax (T &phi, T &R, int depth, int nRelax=2) |
void | computeAMRResidualLevel (Vector< T * > &a_resid, Vector< T * > &a_phi, const Vector< T * > &a_rhs, int l_max, int l_base, int ilev, bool a_homogeneousBC) |
void | clear () |
Protected Attributes | |
Vector< AMRLevelOp< T > * > | m_op |
Vector< MultiGrid< T > * > | m_mg |
Vector< T * > | m_correction |
Vector< T * > | m_residual |
Vector< T * > | m_resC |
Vector< Copier > | m_resCopier |
Vector< Copier > | m_reverseCopier |
NoOpSolver< T > | m_nosolve |
LinearSolver< T > * | m_bottomSolver |
Private Member Functions | |
AMRMultiGrid (const AMRMultiGrid< T > &a_opin) | |
void | operator= (const AMRMultiGrid< T > &a_opin) |
AMRMultiGrid< T >::AMRMultiGrid | ( | ) | [inline] |
References AMRMultiGrid< T >::m_solverParamsSet.
AMRMultiGrid< T >::~AMRMultiGrid | ( | ) | [inline, virtual] |
References CH_TIME, and AMRMultiGrid< T >::clear().
AMRMultiGrid< T >::AMRMultiGrid | ( | const AMRMultiGrid< T > & | a_opin | ) | [inline, private] |
void AMRMultiGrid< T >::define | ( | const ProblemDomain & | a_coarseDomain, | |
AMRLevelOpFactory< T > & | a_factory, | |||
LinearSolver< T > * | a_bottomSolver, | |||
int | a_numLevels | |||
) | [inline, virtual] |
Define the solver. a_coarseDomain is the index space on the coarsest AMR level. a_factory is the operator factory through which all special information is conveyed. a_bottomSolver is the solver to be used at the termination of multigrid coarsening. a_numLevels is the number of AMR levels.
References AMRLevelOpFactory< T >::AMRnewOp(), CH_TIME, AMRMultiGrid< T >::clear(), i, AMRMultiGrid< T >::m_bottomSolver, AMRMultiGrid< T >::m_correction, AMRMultiGrid< T >::m_maxDepth, AMRMultiGrid< T >::m_mg, AMRMultiGrid< T >::m_nosolve, AMRMultiGrid< T >::m_op, AMRMultiGrid< T >::m_resC, AMRMultiGrid< T >::m_resCopier, AMRMultiGrid< T >::m_residual, AMRMultiGrid< T >::m_reverseCopier, ProblemDomain::refine(), AMRLevelOpFactory< T >::refToFiner(), and Vector< T >::resize().
Referenced by MultilevelLinearOp< T >::define().
void AMRMultiGrid< T >::solve | ( | Vector< T * > & | a_phi, | |
const Vector< T * > & | a_rhs, | |||
int | l_max, | |||
int | l_base, | |||
bool | a_zeroPhi = true | |||
) | [inline, virtual] |
Solve L(phi) = rho from l_base to l_max. To solve over all levels, l_base = 0 and l_max = max_level = numLevels-1.
References CH_TIME, AMRMultiGrid< T >::init(), AMRMultiGrid< T >::revert(), and AMRMultiGrid< T >::solveNoInit().
void AMRMultiGrid< T >::solveNoInit | ( | Vector< T * > & | a_phi, | |
const Vector< T * > & | a_rhs, | |||
int | l_max, | |||
int | l_base, | |||
bool | a_zeroPhi = true | |||
) | [inline, virtual] |
same as "solve" except user has taken the reponsibility of having previously called "init" so solver can allocate temporary holders.
set bottom solver convergence norm and solver tolerance
References AMRMultiGrid< T >::AMRVCycle(), CH_START, CH_STOP, CH_TIME, CH_TIMER, CH_TIMERS, Vector< T >::clear(), AMRMultiGrid< T >::computeAMRResidual(), i, AMRMultiGrid< T >::m_bottomSolver, AMRMultiGrid< T >::m_convergenceMetric, AMRMultiGrid< T >::m_eps, AMRMultiGrid< T >::m_exitStatus, AMRMultiGrid< T >::m_hang, AMRMultiGrid< T >::m_imin, AMRMultiGrid< T >::m_iterMax, AMRMultiGrid< T >::m_normThresh, AMRMultiGrid< T >::m_op, AMRMultiGrid< T >::m_verbosity, pout(), AMRMultiGrid< T >::setBottomSolver(), and Vector< T >::size().
Referenced by AMRMultiGrid< T >::solve().
void AMRMultiGrid< T >::relaxOnlyHomogeneous | ( | Vector< T * > & | a_phi, | |
const Vector< T * > & | a_rhs, | |||
int | l_max, | |||
int | l_base | |||
) | [inline] |
References CH_TIME, Vector< T >::clear(), i, AMRMultiGrid< T >::init(), AMRMultiGrid< T >::m_eps, AMRMultiGrid< T >::m_exitStatus, AMRMultiGrid< T >::m_hang, AMRMultiGrid< T >::m_imin, AMRMultiGrid< T >::m_iterMax, AMRMultiGrid< T >::m_normThresh, AMRMultiGrid< T >::m_op, AMRMultiGrid< T >::m_verbosity, pout(), and Vector< T >::size().
void AMRMultiGrid< T >::AMRVCycle | ( | Vector< T * > & | a_correction, | |
Vector< T * > & | a_residual, | |||
int | l, | |||
int | l_max, | |||
int | l_base | |||
) | [inline, virtual] |
References AMRMultiGrid< T >::computeAMRResidualLevel(), AMRMultiGrid< T >::m_correction, AMRMultiGrid< T >::m_mg, AMRMultiGrid< T >::m_numMG, AMRMultiGrid< T >::m_op, AMRMultiGrid< T >::m_post, AMRMultiGrid< T >::m_pre, AMRMultiGrid< T >::m_resC, AMRMultiGrid< T >::m_resCopier, AMRMultiGrid< T >::m_residual, AMRMultiGrid< T >::m_reverseCopier, and AMRMultiGrid< T >::relax().
Referenced by MultilevelLinearOp< T >::preCond(), and AMRMultiGrid< T >::solveNoInit().
void AMRMultiGrid< T >::setMGCycle | ( | int | a_numMG | ) | [inline] |
References AMRMultiGrid< T >::m_mg, AMRMultiGrid< T >::m_numMG, AMRMultiGrid< T >::m_op, and Vector< T >::size().
Referenced by AMRMultiGrid< T >::setSolverParameters().
void AMRMultiGrid< T >::init | ( | const Vector< T * > & | a_phi, | |
const Vector< T * > & | a_rhs, | |||
int | l_max, | |||
int | l_base | |||
) | [inline] |
References AMRLevelOp< T >::buildCopier(), CH_TIME, LinearOp< T >::create(), AMRLevelOp< T >::createCoarsened(), i, AMRMultiGrid< T >::m_correction, AMRMultiGrid< T >::m_mg, AMRMultiGrid< T >::m_op, AMRMultiGrid< T >::m_resC, AMRMultiGrid< T >::m_resCopier, AMRMultiGrid< T >::m_residual, AMRMultiGrid< T >::m_reverseCopier, and AMRLevelOp< T >::refToCoarser().
Referenced by MultilevelLinearOp< T >::preCond(), AMRMultiGrid< T >::relaxOnlyHomogeneous(), and AMRMultiGrid< T >::solve().
void AMRMultiGrid< T >::revert | ( | const Vector< T * > & | a_phi, | |
const Vector< T * > & | a_rhs, | |||
int | l_max, | |||
int | l_base | |||
) | [inline] |
AMRLevelOp< T > & AMRMultiGrid< T >::levelOp | ( | int | level | ) | [inline] |
References AMRMultiGrid< T >::m_op.
Real AMRMultiGrid< T >::computeAMRResidual | ( | Vector< T * > & | a_resid, | |
Vector< T * > & | a_phi, | |||
const Vector< T * > & | a_rhs, | |||
int | l_max, | |||
int | l_base, | |||
bool | a_homogeneousBC = false , |
|||
bool | a_computeNorm = true | |||
) | [inline] |
resid = L(phi) - rhs
References CH_TIME, AMRMultiGrid< T >::computeAMRResidualLevel(), MayDay::Error(), AMRMultiGrid< T >::m_op, AMRMultiGrid< T >::m_resC, AMRMultiGrid< T >::m_resCopier, Max(), and MPI_CH_REAL.
Referenced by AMRMultiGrid< T >::computeAMROperator(), and AMRMultiGrid< T >::solveNoInit().
void AMRMultiGrid< T >::computeAMROperator | ( | Vector< T * > & | a_lph, | |
Vector< T * > & | a_phi, | |||
int | l_max, | |||
int | l_base, | |||
bool | a_homogeneousBC = false | |||
) | [inline] |
lph = L(phi)
References AMRMultiGrid< T >::computeAMRResidual(), AMRMultiGrid< T >::m_op, and AMRMultiGrid< T >::m_residual.
Vector< MGLevelOp< T > * > AMRMultiGrid< T >::getAllOperators | ( | ) | [inline] |
For changing coefficients. Use at thy own peril.
References Vector< T >::append(), AMRMultiGrid< T >::m_mg, AMRMultiGrid< T >::m_op, Vector< T >::push_back(), and Vector< T >::size().
Vector< MGLevelOp< T > * > AMRMultiGrid< T >::getOperatorsOp | ( | ) | [inline] |
References AMRMultiGrid< T >::m_op, Vector< T >::push_back(), and Vector< T >::size().
Vector< Vector< MGLevelOp< T > * > > AMRMultiGrid< T >::getOperatorsMG | ( | ) | [inline] |
References AMRMultiGrid< T >::m_mg, and Vector< T >::size().
void AMRMultiGrid< T >::setSolverParameters | ( | const int & | a_pre, | |
const int & | a_post, | |||
const int & | a_bottom, | |||
const int & | a_numMG, | |||
const int & | a_iterMax, | |||
const Real & | a_eps, | |||
const Real & | a_hang, | |||
const Real & | a_normThresh | |||
) | [inline] |
Set parameters of the solve. a_pre is the number of smoothings before averaging. a_post is the number of smoothings after averaging. a_bottom is the number of smoothings at the bottom level. a_numMG = 1 for vcycle, =2 for wcycle (use 1). a_itermax is the max number of v cycles. a_hang is the minimum amount of change per vcycle. a_eps is the solution tolerance. a_normThresh is how close to zero eps*resid is allowed to get.
References AMRMultiGrid< T >::m_bottom, AMRMultiGrid< T >::m_eps, AMRMultiGrid< T >::m_hang, AMRMultiGrid< T >::m_iterMax, AMRMultiGrid< T >::m_mg, AMRMultiGrid< T >::m_normThresh, AMRMultiGrid< T >::m_post, AMRMultiGrid< T >::m_pre, AMRMultiGrid< T >::m_solverParamsSet, AMRMultiGrid< T >::setMGCycle(), and Vector< T >::size().
Referenced by MultilevelLinearOp< T >::define().
void AMRMultiGrid< T >::setBottomSolver | ( | int | l_max, | |
int | l_base | |||
) | [inline] |
set up bottom solver for internal MG solver
This function is normally called by the solve(...) function. However, it must be called if solve will not be called (in particular, if only the V-cycle is being used)
References AMRMultiGrid< T >::m_bottom, AMRMultiGrid< T >::m_bottomSolver, AMRMultiGrid< T >::m_mg, AMRMultiGrid< T >::m_nosolve, AMRMultiGrid< T >::m_post, AMRMultiGrid< T >::m_pre, and AMRMultiGrid< T >::m_solverParamsSet.
Referenced by MultilevelLinearOp< T >::preCond(), and AMRMultiGrid< T >::solveNoInit().
void AMRMultiGrid< T >::relax | ( | T & | phi, | |
T & | R, | |||
int | depth, | |||
int | nRelax = 2 | |||
) | [inline, protected] |
References CH_TIME, AMRMultiGrid< T >::m_mg, and AMRMultiGrid< T >::m_op.
Referenced by AMRMultiGrid< T >::AMRVCycle().
void AMRMultiGrid< T >::computeAMRResidualLevel | ( | Vector< T * > & | a_resid, | |
Vector< T * > & | a_phi, | |||
const Vector< T * > & | a_rhs, | |||
int | l_max, | |||
int | l_base, | |||
int | ilev, | |||
bool | a_homogeneousBC | |||
) | [inline, protected] |
References CH_TIME, and AMRMultiGrid< T >::m_op.
Referenced by AMRMultiGrid< T >::AMRVCycle(), and AMRMultiGrid< T >::computeAMRResidual().
void AMRMultiGrid< T >::clear | ( | ) | [inline, protected] |
void AMRMultiGrid< T >::operator= | ( | const AMRMultiGrid< T > & | a_opin | ) | [inline, private] |
Real AMRMultiGrid< T >::m_eps |
Real AMRMultiGrid< T >::m_hang |
Real AMRMultiGrid< T >::m_normThresh |
bool AMRMultiGrid< T >::m_solverParamsSet |
int AMRMultiGrid< T >::m_imin |
Referenced by AMRMultiGrid< T >::relaxOnlyHomogeneous(), and AMRMultiGrid< T >::solveNoInit().
int AMRMultiGrid< T >::m_iterMax |
int AMRMultiGrid< T >::m_verbosity |
int AMRMultiGrid< T >::m_exitStatus |
Referenced by AMRMultiGrid< T >::relaxOnlyHomogeneous(), and AMRMultiGrid< T >::solveNoInit().
int AMRMultiGrid< T >::m_pre |
int AMRMultiGrid< T >::m_post |
int AMRMultiGrid< T >::m_bottom |
Referenced by AMRMultiGrid< T >::setBottomSolver(), and AMRMultiGrid< T >::setSolverParameters().
int AMRMultiGrid< T >::m_numMG |
Referenced by AMRMultiGrid< T >::AMRVCycle(), and AMRMultiGrid< T >::setMGCycle().
int AMRMultiGrid< T >::m_maxDepth |
max no. of coarsenings -- -1 (default) means coarsen as far as possible
If using a value besides the default, need to set it _before_ define function is called
Referenced by MultilevelLinearOp< T >::define(), and AMRMultiGrid< T >::define().
Real AMRMultiGrid< T >::m_convergenceMetric |
Referenced by AMRMultiGrid< T >::solveNoInit().
Vector<AMRLevelOp<T>*> AMRMultiGrid< T >::m_op [protected] |
Referenced by AMRMultiGrid< T >::AMRVCycle(), AMRMultiGrid< T >::clear(), AMRMultiGrid< T >::computeAMROperator(), AMRMultiGrid< T >::computeAMRResidual(), AMRMultiGrid< T >::computeAMRResidualLevel(), AMRMultiGrid< T >::define(), AMRMultiGrid< T >::getAllOperators(), AMRMultiGrid< T >::getOperatorsOp(), AMRMultiGrid< T >::init(), AMRMultiGrid< T >::levelOp(), AMRMultiGrid< T >::relax(), AMRMultiGrid< T >::relaxOnlyHomogeneous(), AMRMultiGrid< T >::setMGCycle(), and AMRMultiGrid< T >::solveNoInit().
Vector<MultiGrid<T> *> AMRMultiGrid< T >::m_mg [protected] |
Referenced by AMRMultiGrid< T >::AMRVCycle(), AMRMultiGrid< T >::clear(), AMRMultiGrid< T >::define(), AMRMultiGrid< T >::getAllOperators(), AMRMultiGrid< T >::getOperatorsMG(), AMRMultiGrid< T >::init(), AMRMultiGrid< T >::relax(), AMRMultiGrid< T >::revert(), AMRMultiGrid< T >::setBottomSolver(), AMRMultiGrid< T >::setMGCycle(), and AMRMultiGrid< T >::setSolverParameters().
Vector<T*> AMRMultiGrid< T >::m_correction [protected] |
Vector<T*> AMRMultiGrid< T >::m_residual [protected] |
Vector<T*> AMRMultiGrid< T >::m_resC [protected] |
Vector<Copier> AMRMultiGrid< T >::m_resCopier [protected] |
Vector<Copier> AMRMultiGrid< T >::m_reverseCopier [protected] |
Referenced by AMRMultiGrid< T >::AMRVCycle(), AMRMultiGrid< T >::define(), and AMRMultiGrid< T >::init().
NoOpSolver<T> AMRMultiGrid< T >::m_nosolve [protected] |
Referenced by AMRMultiGrid< T >::define(), and AMRMultiGrid< T >::setBottomSolver().
LinearSolver<T>* AMRMultiGrid< T >::m_bottomSolver [protected] |