#include <NodeQuadCFInterp2.H>
Class to interpolate quadratically at interface between this level and next coarser level, when the refinement ratio is 2. This class should be considered internal to NodeQuadCFInterp.
Long Description:
The interface has codimension one.
If a fine node coincides with a coarse node, then we merely project from the coarse node to the fine node.
Otherwise, we take the mean of the neighboring coarse nodes and subtract 1/8 * dx^2 times the sum of the second derivatives in the appropriate directions.
The interpolation is performed in function coarseFineInterp(). The constructor computes m_loCFIVS and m_hiCFIVS to determine the fine nodes at the interface with the coarse level.
The constructor also takes m_loCFIVS and m_hiCFIVS to determine the fine nodes at the interface with the coarse level. Calling getFineIVS() on m_loCFIVS[idir][dit()] gives us the IntVectSet of nodes of m_grids[dit()] on the face in the low direction in dimension idir, that lie on the interface with the coarser level. Similarly with m_hiCFIVS[idir][dit()] for the opposite face, in the high direction in dimension idir.
2-D Description:
In the 2-D problem, the interface is 1-D. Between coarse nodes at 0 and 1, we approximate the value at the fine node by
f(1/2) ~ (f(0) + f(1))/2 - 1/8 * f''(1/2)
where we estimate the second derivative f''(1/2) from the coarse values f(0), f(1), and either f(-1) or f(2) or both.
If the points -1 and 2 are both on the grid:
o---o-x-o---o -1 0 1 2then we use
If the point -1 is on the grid but 2 is not:
o---o-x-o o -1 0 1 2then we approximate f''(1/2) by f''(0) and use
If the point 2 is on the grid but -1 is not:
o o-x-o---o -1 0 1 2then we approximate f''(1/2) by f''(1) and use
3-D Description:
In the 3-D problem, the interface is 2-D. For any given fine node along the interface, look at its three coordinates. At least one of the coordinates is divisible by 2, meaning that it lies on a plane of coarse nodes. If all of the coordinates are even, then the fine node coincides with a coarse node, and we project the value. If only one coordinate is odd, then this reduces to the problem of a 1-D interface described above in the 2-D case.
We are left with the problem of interpolating f(1/2, 1/2).
(0,1) (1,1) o-------o | | | x | | | o-------o (0,0) (1,0)We use
In particular, d^2 f/dx^2 (1/2,1/2) is approximated by the mean of d^2 f/dx^2 (1/2, 0) and d^2 f/dx^2 (1/2, 1).
These second derivatives are estimated in the same way as described above for the 1-D interface in the 2-D case.
Public Member Functions | |
Constructors, destructor and defines | |
NodeQuadCFInterp2 () | |
NodeQuadCFInterp2 (const DisjointBoxLayout &a_grids, const Box &a_domain, const LayoutData< NodeCFIVS > *const a_loCFIVS, const LayoutData< NodeCFIVS > *const a_hiCFIVS, bool a_interfaceOnly, int a_interpolationDegree, int a_ncomp=1, bool a_verbose=false) | |
NodeQuadCFInterp2 (const DisjointBoxLayout &a_grids, const ProblemDomain &a_domain, const LayoutData< NodeCFIVS > *const a_loCFIVS, const LayoutData< NodeCFIVS > *const a_hiCFIVS, bool a_interfaceOnly, int a_interpolationDegree, int a_ncomp=1, bool a_verbose=false) | |
~NodeQuadCFInterp2 () | |
void | define (const DisjointBoxLayout &a_grids, const ProblemDomain &a_domain, const LayoutData< NodeCFIVS > *const a_loCFIVS, const LayoutData< NodeCFIVS > *const a_hiCFIVS, bool a_interfaceOnly, int a_interpolationDegree, int a_ncomp=1, bool a_verbose=false) |
void | define (const DisjointBoxLayout &a_grids, const Box &a_domain, const LayoutData< NodeCFIVS > *const a_loCFIVS, const LayoutData< NodeCFIVS > *const a_hiCFIVS, bool a_interfaceOnly, int a_interpolationDegree, int a_ncomp=1, bool a_verbose=false) |
Access functions | |
bool | isDefined () const |
Parameter-setting functions | |
void | setVerbose (bool a_verbose) |
Data modification functions | |
void | coarseFineInterp (LevelData< NodeFArrayBox > &a_phi, const LevelData< NodeFArrayBox > &a_phiCoarse) |
Protected Attributes | |
DisjointBoxLayout | m_grids |
ProblemDomain | m_domain |
Box | m_domainCoarseNodes |
DisjointBoxLayout | m_coarsenedGrids |
LevelData< NodeFArrayBox > | m_coarseCopy |
bool | m_interfaceOnly |
int | m_interpolationDegree |
int | m_ncomp |
bool | m_isDefined |
const LayoutData< NodeCFIVS > * | m_loCFIVS |
const LayoutData< NodeCFIVS > * | m_hiCFIVS |
bool | m_verbose |
Private Member Functions | |
void | clearMemory () |
void | setDefaultValues () |
void | interpLine (FArrayBox &a_fineFab, const FArrayBox &a_psiFab, const IntVectSet &a_psiFabNodes, const IntVect &a_iv, int a_idirOther) |
NodeQuadCFInterp2::NodeQuadCFInterp2 | ( | ) |
Default constructor. User must subsequently call define().
NodeQuadCFInterp2::NodeQuadCFInterp2 | ( | const DisjointBoxLayout & | a_grids, | |
const Box & | a_domain, | |||
const LayoutData< NodeCFIVS > *const | a_loCFIVS, | |||
const LayoutData< NodeCFIVS > *const | a_hiCFIVS, | |||
bool | a_interfaceOnly, | |||
int | a_interpolationDegree, | |||
int | a_ncomp = 1 , |
|||
bool | a_verbose = false | |||
) |
Constructor calls setDefaultValues() and then calls define() with the same arguments.
NodeQuadCFInterp2::NodeQuadCFInterp2 | ( | const DisjointBoxLayout & | a_grids, | |
const ProblemDomain & | a_domain, | |||
const LayoutData< NodeCFIVS > *const | a_loCFIVS, | |||
const LayoutData< NodeCFIVS > *const | a_hiCFIVS, | |||
bool | a_interfaceOnly, | |||
int | a_interpolationDegree, | |||
int | a_ncomp = 1 , |
|||
bool | a_verbose = false | |||
) |
Constructor calls setDefaultValues() and then calls define() with the same arguments.
NodeQuadCFInterp2::~NodeQuadCFInterp2 | ( | ) |
Destructor.
void NodeQuadCFInterp2::define | ( | const DisjointBoxLayout & | a_grids, | |
const ProblemDomain & | a_domain, | |||
const LayoutData< NodeCFIVS > *const | a_loCFIVS, | |||
const LayoutData< NodeCFIVS > *const | a_hiCFIVS, | |||
bool | a_interfaceOnly, | |||
int | a_interpolationDegree, | |||
int | a_ncomp = 1 , |
|||
bool | a_verbose = false | |||
) |
Full define function. Makes all coarse-fine information and sets internal variables. The current level is taken to be the fine level.
a_grids | CELL-centered grids at this level |
a_domain | CELL-centered physical domain at this level |
a_loCFIVS | pointer to object storing coarse/fine interface nodes |
a_hiCFIVS | pointer to object storing coarse/fine interface nodes |
a_interfaceOnly | whether interpolation is from interface only, meaning that off-interface data should not be used |
a_interpolationDegree | degree of interpolation; 1 for (bi)linear, 2 for (bi)quadratic |
a_ncomp | number of components of data |
a_verbose | verbose output flag |
void NodeQuadCFInterp2::define | ( | const DisjointBoxLayout & | a_grids, | |
const Box & | a_domain, | |||
const LayoutData< NodeCFIVS > *const | a_loCFIVS, | |||
const LayoutData< NodeCFIVS > *const | a_hiCFIVS, | |||
bool | a_interfaceOnly, | |||
int | a_interpolationDegree, | |||
int | a_ncomp = 1 , |
|||
bool | a_verbose = false | |||
) |
Full define function. Makes all coarse-fine information and sets internal variables. The current level is taken to be the fine level.
a_grids | CELL-centered grids at this level |
a_domain | CELL-centered physical domain at this level |
a_loCFIVS | pointer to object storing coarse/fine interface nodes |
a_hiCFIVS | pointer to object storing coarse/fine interface nodes |
a_interfaceOnly | whether interpolation is from interface only, meaning that off-interface data should not be used |
a_interpolationDegree | degree of interpolation; 1 for (bi)linear, 2 for (bi)quadratic |
a_ncomp | number of components of data |
a_verbose | verbose output flag |
bool NodeQuadCFInterp2::isDefined | ( | ) | const |
Returns true
if this object was created with the defining constructor or if define() has been called.
void NodeQuadCFInterp2::setVerbose | ( | bool | a_verbose | ) |
Set whether to give output. Default is false
.
void NodeQuadCFInterp2::coarseFineInterp | ( | LevelData< NodeFArrayBox > & | a_phi, | |
const LevelData< NodeFArrayBox > & | a_phiCoarse | |||
) |
Coarse / Fine (inhomogeneous) interpolation operator. Fill the nodes of a_phi on the coarse/fine interface with interpolated data from a_phiCoarse.
a_phi | data at this level |
a_phiCoarse | data at the next coarser level |
void NodeQuadCFInterp2::clearMemory | ( | ) | [private] |
void NodeQuadCFInterp2::setDefaultValues | ( | ) | [private] |
void NodeQuadCFInterp2::interpLine | ( | FArrayBox & | a_fineFab, | |
const FArrayBox & | a_psiFab, | |||
const IntVectSet & | a_psiFabNodes, | |||
const IntVect & | a_iv, | |||
int | a_idirOther | |||
) | [private] |
Interpolate from a_psiFab to a_fineFab at a_iv along a line.
a_fineFab | fine data on NODE-centered FAB |
a_psiFab | coarse data on NODE-centered FAB |
a_psiFabNodes | nodes of a_psiFab from which data can be used |
a_iv | point at which to interpolate |
a_idirOther | direction (0 to SpaceDim-1) along which to interpolate |
DisjointBoxLayout NodeQuadCFInterp2::m_grids [protected] |
CELL-centered grids at the current level (the finer level)
ProblemDomain NodeQuadCFInterp2::m_domain [protected] |
CELL-centered physical domain of this level
Box NodeQuadCFInterp2::m_domainCoarseNodes [protected] |
NODE-centered box of nodes at physical domain at the coarser level
DisjointBoxLayout NodeQuadCFInterp2::m_coarsenedGrids [protected] |
CELL-centered m_grids coarsened by 2
LevelData<NodeFArrayBox> NodeQuadCFInterp2::m_coarseCopy [protected] |
copy of coarse phi, used in CFInterp().
bool NodeQuadCFInterp2::m_interfaceOnly [protected] |
interpolating from interface only?
int NodeQuadCFInterp2::m_interpolationDegree [protected] |
degree of interpolation: 1 for (bi)linear, 2 for (bi)quadratic
int NodeQuadCFInterp2::m_ncomp [protected] |
number of components of data, needed for setting size of work array
bool NodeQuadCFInterp2::m_isDefined [protected] |
has full define function been called?
const LayoutData<NodeCFIVS>* NodeQuadCFInterp2::m_loCFIVS [protected] |
pointer to object storing coarse/fine interface nodes between this level and next coarser level
const LayoutData<NodeCFIVS>* NodeQuadCFInterp2::m_hiCFIVS [protected] |
pointer to object storing coarse/fine interface nodes between this level and next coarser level
bool NodeQuadCFInterp2::m_verbose [protected] |
if true
, print out extra information