|
| LevelGridMetrics (const int a_nComp, const int a_spaceOrder) |
| Constructor. More...
|
|
virtual | ~LevelGridMetrics () |
| Destructor. More...
|
|
void | clear () |
| Free memory. More...
|
|
bool | hasFiner () const |
| Does a finer level exist? More...
|
|
bool | hasCoarser () const |
| Does a coarser level exist? More...
|
|
void | define (AMRLevel *const a_AMRLevel, MultiBlockCoordSysFactory *const a_coordSysFact, LevelGridMetrics *const a_coarserLevelGridMetrics, const RealVect &a_dxVect, const IntVect &a_ghostVect, const TransverseNOpType a_transverseNOpType=TransverseNOpNone, const bool a_haveMultiBlockVectorData=true, const int a_numBlocks=1) |
| Define the class. No metrics terms are yet available. More...
|
|
void | define (AMRLevel *const a_AMRLevel, MultiBlockCoordSys *const a_coordSys, LevelGridMetrics *const a_coarserLevelGridMetrics, const RealVect &a_dxVect, const IntVect &a_ghostVect, const TransverseNOpType a_transverseNOpType=TransverseNOpNone, const bool a_haveMultiBlockVectorData=true, const int a_numBlocks=1) |
| Define the class. No metrics terms are yet available. More...
|
|
bool | metricsDefined () const |
| Are the metrics defined on this level? More...
|
|
bool | didFinerChange () const |
| Did the metrics change on the finer mesh? More...
|
|
const MultiBlockCoordSys & | getCoordSys () const |
| Retrieve the multi-block coordinate system. More...
|
|
const NewCoordSys * | getCoordSys2 (const Box &box) const |
| Get the coordinate system. More...
|
|
const NewFourthOrderCoordSys * | getCoordSys (const Box &box) const |
|
int | getBlock (const Box &a_box) const |
| Get the block index. More...
|
|
const ProblemDomain & | blockDomain (const Box &a_box, const int a_numGhost=0) |
| Get a problem domain representing a block. More...
|
|
const RealVect & | dxVect () const |
| Get the computational mesh spacing. More...
|
|
void | postTimeStep () |
| After a time step, average down and . More...
|
|
virtual void | initialGrid (const DisjointBoxLayout *const a_newGrid) |
| Set up initial grid. More...
|
|
void | postInitialGrid (const DisjointBoxLayout *const a_newGrid) |
| Set up the initial metric terms. More...
|
|
void | preRegrid (const int a_baseLevel, const DisjointBoxLayout &a_newGrid, const LevelData< FArrayBox > *const a_coarseUOldPtr, LevelData< FArrayBox > &a_UOld, LevelData< FArrayBox > &a_JUOld) |
| Compute new metrics and correct the solution on the coarser meshes. More...
|
|
virtual void | regrid (LevelData< FArrayBox > &a_JU, const LevelData< FArrayBox > &a_CrU, const LevelData< FArrayBox > &a_CrJU, const Interval &a_vectorIntv) |
| Regrid operations – performs a coarse to fine interpolation. More...
|
|
virtual void | fillFineGhostCells (LevelData< FArrayBox > &a_U, LevelData< FArrayBox > &a_JU, Real a_time=-1) |
| Fill invalid fine ghost cells (with preset CrFnU) More...
|
|
void | computeValidU (LevelData< FArrayBox > &a_U, const LevelData< FArrayBox > &a_JU) |
| Computes <U> in valid cells. More...
|
|
void | multiblockExchangeU (LevelData< FArrayBox > &a_U, const Interval &a_vectorIntv) const |
| Exchange <U> across multiblock boundaries. More...
|
|
void | timeIntermediate (const TimeInterpolatorRK4 &a_timeInterpolator, const Real &a_timeInterpCoeff, const int &a_stage, const Interval &a_vectorIntv) |
| Supports a call to TimeInterpolatorRK4::intermediate for multi-block grids. More...
|
|
LevelData< FArrayBox > & | presetCr2ThisInterpolatorCrFnLevU () |
| Set the coarsened-fine <U> used by the interpolator (CrFn access) More...
|
|
LevelData< FArrayBox > & | presetCr2ThisInterpolatorCrFnLevJU () |
| Set the coarsened-fine <JU> used by the interpolator (CrFn access) More...
|
|
void | presetThis2FnInterpolatorCrFnLevU (const LevelData< FArrayBox > &a_CrLevU, const Interval &a_vectorIntv) |
| Set the coarsened-fine <U> used by the interpolator. More...
|
|
void | invalidateCr2ThisInterpolatorCrFnLevData () |
| Invalidate the CrFn data, both <U> and <JU>\, used by the interpolator. More...
|
|
void | invalidateThis2FnInterpolatorCrFnLevData () |
| Invalidate the CrFn data, both <U> and <JU>\, used by the interpolator. More...
|
|
const IntVect & | interpolatorCrFnNumGhost (const bool a_force=false) const |
| Number of ghosts used to build the coarsened-fine data in the interpolator. More...
|
|
bool | isMultiblock () const |
| Is this a multiblock grid. More...
|
|
|
There are several places to get the boxes and interators from but all should be the same. These functions provide consistent access with sizes relevant to the metrics.
|
const DisjointBoxLayout & | getBoxes () const |
| Get the boxes. More...
|
|
DataIterator | getDataIterator () const |
| Get a level iterator. More...
|
|
Box | resizeWithGhosts (const Box &box) const |
| Resize a box to include the ghost cells. More...
|
|
virtual IntVect | getJReqGhostVect () const |
| Determine the ghost vector required for . More...
|
|
virtual IntVect | getNReqGhostVect () const |
| Determine the ghost vector required for . More...
|
|
Box | resizeWithJReqGhosts (const Box &box) const |
| Resize a box to the size required for . More...
|
|
Box | resizeWithNReqGhosts (const Box &box) const |
| Resize a box to the size required for . More...
|
|
Grid metrics for a level.
This class adds infrastructure for mapped grids to the fourth-order Cartesian AMRLevel class. The interface closely follows that of AMRLevel. Typically this class is a member of the user's derived AMRLevel and the member functions of LevelGridData should be called from member functions of the derived AMRLevel that have the same name.
This class provides m_N, the metric terms on each face, and m_J, the determinant (physical cell volume divided by computational cell volume). These quantities are appropriately maintained during all aspects of an AMR solution.
GHOSTS — The determinants, (J), are defined on all ghost cells at the domain interior and 1 layer of ghost cells outside a non-periodic domain. Hence, gradients of J are available everywhere an application may store data. To achieve this, it is assumed that the metrics can be evaluated everywhere in . HOWEVER, metrics that are consistent between levels are only maintained in the valid region of the finer level. A valid cell on a coarse level will have metrics computed separately from any overlapping ghost cells from a finer level (i.e., the volumes of the fine ghost cells may not sum to the volume of the valid coarse cell). Consistency between levels everywhere could be achieved by treating all ghost cells as part of the valid region — this would simply (probably simply) require some modifications to the "averagers". However we do not do this because:
-
it breaks a consistent definition of valid/invalid
-
there is no requirement for conservation in ghost cells since they are only used for gradient reconstruction, limiting, etc.
Any ghost cell that is covered by a valid cell on that level is consistent with the metrics from any finer level by means of the copiers (used in the averagers) copying to both the invalid and valid regions of a destination.
Transverse terms in N are determined only on the faces of grow(N.box(), -1) if obtained by averaging, i.e., on one less layer than where the normal components are known. If obtained by analytic methods, they are available everywhere.
Normally, N is calculated using script N to ensure freestream preservation. But in some cases, e.g., a 2-D solution on the surface of a sphere, there is no definition of script N. In those cases, m_useScriptN should be set to false and N will be calculated and averaged directly. The averaging ensures conservation but freestream-preservation is sacrificed. The value of m_useScriptN is obtained from the MultiBlockCoordSys and should be set to 'false' in the constructor of coordinate systems derived from class MultiBlockCoordSys. Otherwise, by default, it is set to true.
The following routines should be called from the corresponding routines with the same name derived AMRLevel:
-
initialGrid
-
postInitialGrid
-
postTimeStep
-
preRegrid
-
regrid
Setup for the class is as follows:
-
Call define to setup the class members – metrics are still undefined.
-
Optionally call initialGrid to set the new box layout on a level. This can be deferred until postInitialGrid if desired.
-
Call postInitialGrid to set the new box layout (if not done in previous step) and define the metrics.
During a run, be sure to:
-
Call postTimeStep to average down the metric terms from finer levels. This only has an effect if they changed on the finer level
For a regrid do the following:
-
Call preRegrid to compute the new metrics and correct the solution on the old mesh to the metrics of the new mesh (snapback).
-
Optionally call regrid to interpolate from the coarse mesh to the new fine mesh. This can be done is user code but must use FourthOrderMappedFineInterp to ensure a conservative and free-stream preserving interpolation on the mapped grid.
- Note
-
To facilitate products that involve gradients, the metrics (N) are determined on the faces of boxes with size ghostBox+2. This is labeled an 'NReqGhostBox' herein. At domain boundaries, the boxes for 'N' extend by 2 cells outside the physical domain and it is assumed that the mappings exist there. The determinants (J) are determined on the cells of boxes with size ghostBox+1. This is labeled a 'JReqGhostBox' herein. At domain boundaries, the boxes for 'J' extends by 1 cell outside the physical domain
-
Averages of fluxes. Most of the fluxes, <F>\ are stored as average quantities to be applied to a face and do not include area information. I.e., the actual flux across a 2-D face is Hence when correcting from fine to coarse, you want to average the fine <F> and then muliply by the area of the coarse face (although in most equations, the area cancels out with another term). However, the , which are a type of flux, are stored differently in that they have already been multiplied by the length term (equivalent to in the example above). Hence, these fluxes needed to be summed when correcting from coarse to fine.
-
WARNING! If transverse components of <N> are computed analytically, they are only averaged down when finer levels have changed before entering a postTimeStep (along with normal components). Consequently, it is currently difficult to know if they have been computed or averaged from a finer level at any given point. But note that if transverse components of <N> are computed by averaging from normal components, then they should always be consistent. **FIXME – probably the best fix is to only average the normal components if transverse are computed analytically.