#include <AMRNodeSolverAlt.H>
AMRNodeSolverAlt manages the AMR/multigrid solution to the elliptic equation on a set of grids on multiple levels satisfying certain proper-nesting conditions.
It can be used either as a solver, or to apply the AMR / multigrid V-cycle as a preconditioner for some other iterative method, such as a Krylov method.
Public Member Functions | |
Constructors, destructor and defines | |
AMRNodeSolverAlt () | |
AMRNodeSolverAlt (const Vector< DisjointBoxLayout > &a_gridsLevel, const Vector< ProblemDomain > &a_domainLevel, const Vector< Real > &a_dxLevel, const Vector< int > &a_refRatio, int a_numLevels, int a_lBase, const NodeLevelOp *const a_opin, int a_minLength=1) | |
AMRNodeSolverAlt (const Vector< DisjointBoxLayout > &a_gridsLevel, const Vector< Box > &a_domainLevel, const Vector< Real > &a_dxLevel, const Vector< int > &a_refRatio, int a_numLevels, int a_lBase, const NodeLevelOp *const a_opin, int a_minLength=1) | |
~AMRNodeSolverAlt () | |
void | define (const Vector< DisjointBoxLayout > &a_gridsLevel, const Vector< ProblemDomain > &a_domainLevel, const Vector< Real > &a_dxLevel, const Vector< int > &a_refRatio, int a_numLevels, int a_lBase, const NodeLevelOp *const a_opin, int a_minLength=1) |
void | define (const Vector< DisjointBoxLayout > &a_gridsLevel, const Vector< Box > &a_domainLevel, const Vector< Real > &a_dxLevel, const Vector< int > &a_refRatio, int a_numLevels, int a_lBase, 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 | setTolerance (Real a_tolerance) |
void | setBottomSmoothing (bool a_doBottomSmooth) |
void | setMaxIter (int a_maxIter) |
void | setVerbose (bool a_verbose) |
Data modification functions | |
void | solveAMR (Vector< LevelData< NodeFArrayBox > * > &a_phiLevel, const Vector< LevelData< NodeFArrayBox > * > &a_rhsLevel) |
Protected Member Functions | |
void | setDefaultValues () |
void | clear () |
Protected Attributes | |
Real | m_tolerance |
int | m_lBase |
int | m_numLevels |
int | m_finestLevel |
Vector< int > | m_refRatio |
Vector< Real > | m_dxLevel |
Vector< DisjointBoxLayout > | m_gridsLevel |
Vector< ProblemDomain > | m_domainLevel |
int | m_numSmoothUp |
int | m_numSmoothDown |
bool | m_isDefined |
Vector< LevelNodeSolver * > | m_levelSolver |
bool | m_verbose |
Private Member Functions | |
AMRNodeSolverAlt (const AMRNodeSolverAlt &) | |
AMRNodeSolverAlt & | operator= (const AMRNodeSolverAlt &) |
AMRNodeSolverAlt::AMRNodeSolverAlt | ( | ) |
Creates a AMRNodeSolverAlt whose internal state is undefined. Need to call define() function to use any of the functionality of the class.
AMRNodeSolverAlt::AMRNodeSolverAlt | ( | const Vector< DisjointBoxLayout > & | a_gridsLevel, | |
const Vector< ProblemDomain > & | a_domainLevel, | |||
const Vector< Real > & | a_dxLevel, | |||
const Vector< int > & | a_refRatio, | |||
int | a_numLevels, | |||
int | a_lBase, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) |
Creates a fully-defined AMRNodeSolverAlt. Calls define() function with identical arguments.
AMRNodeSolverAlt::AMRNodeSolverAlt | ( | const Vector< DisjointBoxLayout > & | a_gridsLevel, | |
const Vector< Box > & | a_domainLevel, | |||
const Vector< Real > & | a_dxLevel, | |||
const Vector< int > & | a_refRatio, | |||
int | a_numLevels, | |||
int | a_lBase, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) |
Creates a fully-defined AMRNodeSolverAlt. Calls define() function with identical arguments.
AMRNodeSolverAlt::~AMRNodeSolverAlt | ( | ) |
Destructor.
AMRNodeSolverAlt::AMRNodeSolverAlt | ( | const AMRNodeSolverAlt & | ) | [private] |
void AMRNodeSolverAlt::define | ( | const Vector< DisjointBoxLayout > & | a_gridsLevel, | |
const Vector< ProblemDomain > & | a_domainLevel, | |||
const Vector< Real > & | a_dxLevel, | |||
const Vector< int > & | a_refRatio, | |||
int | a_numLevels, | |||
int | a_lBase, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) |
Defines AMRNodeSolverAlt's internal state.
Except for a_refRatio, each Vector argument contains a component for each level, and Vector index corresponds to level number.
a_gridsLevel | the grids (CELL-centered) at all levels; Vector length at least a_numLevels |
a_domainLevel | the CELL-centered physical domains at all levels; Vector length at least a_numLevels |
a_dxLevel | the grid spacing at all levels; Vector length at least a_numLevels |
a_refRatio | refinement ratios between adjacent levels, starting with a_refRatio[0], the refinement ratio between levels 0 and 1; Vector length at least a_numLevels-1 |
a_numLevels | the number of AMR levels in the calculation |
a_lBase | index of coarsest level on which solution is to be computed; must be set at time of definition in order to build the bottom LevelNodeSolver |
a_opin | pointer to the NodeLevelOp to use in the solution |
a_minLength | minimum length of maximally coarsened box in LevelNodeSolver, or 0 for no coarsening |
void AMRNodeSolverAlt::define | ( | const Vector< DisjointBoxLayout > & | a_gridsLevel, | |
const Vector< Box > & | a_domainLevel, | |||
const Vector< Real > & | a_dxLevel, | |||
const Vector< int > & | a_refRatio, | |||
int | a_numLevels, | |||
int | a_lBase, | |||
const NodeLevelOp *const | a_opin, | |||
int | a_minLength = 1 | |||
) |
Defines AMRNodeSolverAlt's internal state.
Except for a_refRatio, each Vector argument contains a component for each level, and Vector index corresponds to level number.
a_gridsLevel | the grids (CELL-centered) at all levels; Vector length at least a_numLevels |
a_domainLevel | the CELL-centered physical domains at all levels; Vector length at least a_numLevels |
a_dxLevel | the grid spacing at all levels; Vector length at least a_numLevels |
a_refRatio | refinement ratios between adjacent levels, starting with a_refRatio[0], the refinement ratio between levels 0 and 1; Vector length at least a_numLevels-1 |
a_numLevels | the number of AMR levels in the calculation |
a_lBase | index of coarsest level on which solution is to be computed; must be set at time of definition in order to build the bottom LevelNodeSolver |
a_opin | pointer to the NodeLevelOp to use in the solution |
a_minLength | minimum length of maximally coarsened box in LevelNodeSolver, or 0 for no coarsening |
bool AMRNodeSolverAlt::isDefined | ( | ) | const |
Returns true
if full define() function has been called.
void AMRNodeSolverAlt::setNumSmoothUp | ( | int | a_numSmoothUp | ) |
Set number of multigrid smoothings on way up V-cycle; Default is 4.
void AMRNodeSolverAlt::setNumSmoothDown | ( | int | a_numSmoothDown | ) |
Set number of multigrid smoothings on way down V-cycle; Default is 4.
void AMRNodeSolverAlt::setTolerance | ( | Real | a_tolerance | ) |
Set tolerance of solvers. Default is set in LevelNodeSolver.
void AMRNodeSolverAlt::setBottomSmoothing | ( | bool | a_doBottomSmooth | ) |
Set whether solver does smoothing at bottom level. Default is set in LevelNodeSolver.
void AMRNodeSolverAlt::setMaxIter | ( | int | a_maxIter | ) |
Set max number of iterations for solvers at every level. Default is set in LevelNodeSolver.
void AMRNodeSolverAlt::setVerbose | ( | bool | a_verbose | ) |
Set whether the solver gives output while solving. Default is true.
void AMRNodeSolverAlt::solveAMR | ( | Vector< LevelData< NodeFArrayBox > * > & | a_phiLevel, | |
const Vector< LevelData< NodeFArrayBox > * > & | a_rhsLevel | |||
) |
Solves the elliptic equation over the hierarchy of levels m_lBase ... m_finestLevel where m_finestLevel = m_numLevels-1.
If m_lBase > 0, then the data at level m_lBase - 1 is used to interpolate boundary conditions at boundary nodes that are not adjacent to the domain boundary.
Solves to tolerance m_tolerance.
a_phiLevel | pointers to current guess at the solution values for levels (lMin = max(m_lBase-1,0)) ... m_finestLevel. Vector index corresponds to level number. These values are updated in place. |
a_rhsLevel | pointers to right-hand side for levels lMin ... m_finestLevel. Not modified. |
void AMRNodeSolverAlt::setDefaultValues | ( | ) | [protected] |
Set data to default values. Not for external use.
void AMRNodeSolverAlt::clear | ( | ) | [protected] |
Delete m_levelSolver Vector.
AMRNodeSolverAlt& AMRNodeSolverAlt::operator= | ( | const AMRNodeSolverAlt & | ) | [private] |
Real AMRNodeSolverAlt::m_tolerance [protected] |
solver tolerance
int AMRNodeSolverAlt::m_lBase [protected] |
index of coarsest level on which solution is to be computed.
int AMRNodeSolverAlt::m_numLevels [protected] |
number of levels allowed
int AMRNodeSolverAlt::m_finestLevel [protected] |
index of finest level used, equal to m_numLevels-1
Vector<int> AMRNodeSolverAlt::m_refRatio [protected] |
refinement ratio between levels; m_refRatio[ilev] is refinement ratio between levels ilev and ilev+1
Vector<Real> AMRNodeSolverAlt::m_dxLevel [protected] |
grid spacing at each level
Vector<DisjointBoxLayout> AMRNodeSolverAlt::m_gridsLevel [protected] |
grids, CELL-centered (disjoint) at each level
Vector<ProblemDomain> AMRNodeSolverAlt::m_domainLevel [protected] |
CELL-centered physical domain at each level
int AMRNodeSolverAlt::m_numSmoothUp [protected] |
number of smoother iterations on sweep up
int AMRNodeSolverAlt::m_numSmoothDown [protected] |
number of smoother iterations on sweep down
bool AMRNodeSolverAlt::m_isDefined [protected] |
whether the full define() function has been called
Vector<LevelNodeSolver*> AMRNodeSolverAlt::m_levelSolver [protected] |
multigrid solver for each level
bool AMRNodeSolverAlt::m_verbose [protected] |
whether to write verbose output; default is true