#include <LevelNodeSolver.H>
LevelNodeSolver solves elliptic equations on a level using multigrid.
Public Member Functions | |
Constructors, destructor and defines | |
LevelNodeSolver () | |
LevelNodeSolver (const DisjointBoxLayout &a_grids, const DisjointBoxLayout *a_gridsCoarsePtr, const ProblemDomain &a_domain, Real a_dx, int a_refToCoarse, const NodeLevelOp *const a_opin, int a_minLength=1) | |
LevelNodeSolver (const DisjointBoxLayout &a_grids, const DisjointBoxLayout *a_gridsCoarsePtr, const Box &a_domain, Real a_dx, int a_refToCoarse, const NodeLevelOp *const a_opin, int a_minLength=1) | |
virtual | ~LevelNodeSolver () |
virtual void | define (const DisjointBoxLayout &a_grids, const DisjointBoxLayout *a_gridsCoarsePtr, const ProblemDomain &a_domain, Real a_dx, int a_refToCoarse, const NodeLevelOp *const a_opin, int a_minLength=1) |
virtual void | define (const DisjointBoxLayout &a_grids, const DisjointBoxLayout *a_gridsCoarsePtr, const Box &a_domain, Real a_dx, int a_refToCoarse, const NodeLevelOp *const a_opin, int a_minLength=1) |
Access functions | |
bool | isDefined () const |
Parameter-setting functions | |
void | setnumSmoothUp (int a_numSmoothUp) |
void | setnumSmoothDown (int a_numSmoothDown) |
void | setBottomSmoothing (bool a_bottomSolveFlag) |
void | setTolerance (Real a_tolerance) |
void | setOperatorTolerance (Real a_operatorTolerance) |
void | setVerbose (bool a_verbose) |
void | setMaxIter (int a_maxIter) |
void | setMinIter (int a_minIter) |
Data modification functions | |
void | clearMemory () |
void | setDefaultValues () |
void | levelSolveH (LevelData< NodeFArrayBox > &a_phi, const LevelData< NodeFArrayBox > &a_rhs, bool a_initializePhiToZero=true) |
void | levelSolve (LevelData< NodeFArrayBox > &a_phi, const LevelData< NodeFArrayBox > *a_phiCoarse, const LevelData< NodeFArrayBox > &a_rhs, bool a_initializePhiToZero=true) |
Protected Attributes | |
NodeLevelMG | m_levelMG |
NodeLevelOp * | m_levelOpPtr |
bool | m_isDefined |
DisjointBoxLayout | m_grids |
ProblemDomain | m_domain |
LevelData< NodeFArrayBox > | m_resid |
LevelData< NodeFArrayBox > | m_scratch |
LevelData< NodeFArrayBox > | m_corr |
int | m_refToCoarse |
Real | m_dx |
int | m_maxIter |
int | m_minIter |
Real | m_tolerance |
Real | m_operatorTolerance |
bool | m_bottomSolveFlag |
bool | m_verbose |
LayoutData< Vector< IntVectSet > > | m_IVSV |
LayoutData< Vector< IntVectSet > > | m_IVSVext |
Private Member Functions | |
int | countCoarserLevels (int a_minLength) |
void | operator= (const LevelNodeSolver &) |
LevelNodeSolver (const LevelNodeSolver &) |
LevelNodeSolver::LevelNodeSolver | ( | ) |
Default constructor leaves LevelNodeSolver undefined.
LevelNodeSolver::LevelNodeSolver | ( | const DisjointBoxLayout & | a_grids, | |
const DisjointBoxLayout * | a_gridsCoarsePtr, | |||
const ProblemDomain & | a_domain, | |||
Real | a_dx, | |||
int | a_refToCoarse, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) |
Full constructor. Calls full define() function with identical arguments.
LevelNodeSolver::LevelNodeSolver | ( | const DisjointBoxLayout & | a_grids, | |
const DisjointBoxLayout * | a_gridsCoarsePtr, | |||
const Box & | a_domain, | |||
Real | a_dx, | |||
int | a_refToCoarse, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) |
Full constructor. Calls full define() function with identical arguments.
virtual LevelNodeSolver::~LevelNodeSolver | ( | ) | [virtual] |
Destructor.
LevelNodeSolver::LevelNodeSolver | ( | const LevelNodeSolver & | ) | [inline, private] |
virtual void LevelNodeSolver::define | ( | const DisjointBoxLayout & | a_grids, | |
const DisjointBoxLayout * | a_gridsCoarsePtr, | |||
const ProblemDomain & | a_domain, | |||
Real | a_dx, | |||
int | a_refToCoarse, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) | [virtual] |
Full define function.
a_grids | grids on which solution will be computed |
a_gridsCoarsePtr | pointer to next coarser AMR level's grids, or NULL if there is no coarser level |
a_domain | domain of solution level |
a_dx | grid spacing at solution level |
a_refToCoarse | refinement ratio to next coarser level (if any) |
a_opin | operator L used in solution of L(phi)=rho |
a_minLength | minimum side length of maximally coarsened box, or 0 if no coarsening; set to 1 for max coarsening |
virtual void LevelNodeSolver::define | ( | const DisjointBoxLayout & | a_grids, | |
const DisjointBoxLayout * | a_gridsCoarsePtr, | |||
const Box & | a_domain, | |||
Real | a_dx, | |||
int | a_refToCoarse, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) | [virtual] |
Full define function.
a_grids | grids on which solution will be computed |
a_gridsCoarsePtr | pointer to next coarser AMR level's grids, or NULL if there is no coarser level |
a_domain | domain of solution level |
a_dx | grid spacing at solution level |
a_refToCoarse | refinement ratio to next coarser level (if any) |
a_opin | operator L used in solution of L(phi)=rho |
a_minLength | minimum side length of maximally coarsened box, or 0 if no coarsening; set to 1 for max coarsening |
bool LevelNodeSolver::isDefined | ( | ) | const |
Returns true
if this object was created with the defining constructor or if define() has been called.
void LevelNodeSolver::setnumSmoothUp | ( | int | a_numSmoothUp | ) |
Set number of smoothings on way up V-cycle; Default is 4. Passed to NodeLevelMG.
void LevelNodeSolver::setnumSmoothDown | ( | int | a_numSmoothDown | ) |
Set number of smoothings on way down V-cycle; Default is 4. Passed to NodeLevelMG.
void LevelNodeSolver::setBottomSmoothing | ( | bool | a_bottomSolveFlag | ) |
Sets whether smoothing is done at bottom level. Default is true
.
void LevelNodeSolver::setTolerance | ( | Real | a_tolerance | ) |
Sets solution tolerance. Default is 1.0e-10.
void LevelNodeSolver::setOperatorTolerance | ( | Real | a_operatorTolerance | ) |
Set "operator tolerance" of iterative solution. Iteration will stop if (new_residual/old_residual) > 1-a_operatorTolerance (and at least m_minIter iterations have been performed). Default is 1.0e-4.
void LevelNodeSolver::setVerbose | ( | bool | a_verbose | ) |
Sets whether the solver gives output while solving. Default is false
.
void LevelNodeSolver::setMaxIter | ( | int | a_maxIter | ) |
Sets max number of multigrid V-cycles to use in solution; Default is 33.
void LevelNodeSolver::setMinIter | ( | int | a_minIter | ) |
Set min number of iterations. Only relevant when residual is not decreasing fast enough to satisfy the "operator tolerance". Default is 4.
void LevelNodeSolver::clearMemory | ( | ) |
Delete internal memory and set pointers to NULL.
void LevelNodeSolver::setDefaultValues | ( | ) |
Set default values. Does not deal with memory.
void LevelNodeSolver::levelSolveH | ( | LevelData< NodeFArrayBox > & | a_phi, | |
const LevelData< NodeFArrayBox > & | a_rhs, | |||
bool | a_initializePhiToZero = true | |||
) |
Does a level solve on this level using multigrid and homogeneous bcs at coarse/fine interfaces.
a_phi | input initial guess at solution, output solution |
a_rhs | right-hand side |
a_initializePhiToZero | whether to initialize guess of phi to zero |
void LevelNodeSolver::levelSolve | ( | LevelData< NodeFArrayBox > & | a_phi, | |
const LevelData< NodeFArrayBox > * | a_phiCoarse, | |||
const LevelData< NodeFArrayBox > & | a_rhs, | |||
bool | a_initializePhiToZero = true | |||
) |
Does a level solve on this level using multigrid and inhomogeneous bcs at coarse/fine interfaces.
a_phi | input initial guess at solution, output solution |
a_phiCoarse | pointer to solution at next coarser level, or NULL if there is no coarser level |
a_rhs | right-hand side |
a_initializePhiToZero | whether to initialize guess of phi to zero |
int LevelNodeSolver::countCoarserLevels | ( | int | a_minLength | ) | [private] |
void LevelNodeSolver::operator= | ( | const LevelNodeSolver & | ) | [inline, private] |
NodeLevelMG LevelNodeSolver::m_levelMG [protected] |
level solver object to relax on this level
NodeLevelOp* LevelNodeSolver::m_levelOpPtr [protected] |
pointer to operator
bool LevelNodeSolver::m_isDefined [protected] |
has this LevelNodeSolver been defined yet?
DisjointBoxLayout LevelNodeSolver::m_grids [protected] |
CELL-centered grids at this level
ProblemDomain LevelNodeSolver::m_domain [protected] |
CELL-centered physical domain at this level
LevelData<NodeFArrayBox> LevelNodeSolver::m_resid [protected] |
residual
LevelData<NodeFArrayBox> LevelNodeSolver::m_scratch [protected] |
useful scratch space
LevelData<NodeFArrayBox> LevelNodeSolver::m_corr [protected] |
correction
int LevelNodeSolver::m_refToCoarse [protected] |
refinement ratio to next coarser level
Real LevelNodeSolver::m_dx [protected] |
mesh spacing at this level
int LevelNodeSolver::m_maxIter [protected] |
maximum number of iterations
int LevelNodeSolver::m_minIter [protected] |
minimum number of iterations
Real LevelNodeSolver::m_tolerance [protected] |
solver tolerance
Real LevelNodeSolver::m_operatorTolerance [protected] |
operator tolerance: iteration will stop if (new_residual/old_residual) > 1-m_operatorTolerance
bool LevelNodeSolver::m_bottomSolveFlag [protected] |
whether to do smoothing at bottom level
bool LevelNodeSolver::m_verbose [protected] |
whether to write verbose output; default is true
LayoutData< Vector<IntVectSet> > LevelNodeSolver::m_IVSV [protected] |
interior boundary nodes of grids at this level
LayoutData< Vector<IntVectSet> > LevelNodeSolver::m_IVSVext [protected] |
exterior boundary nodes of grids at this level