Chombo + EB + MF
3.2
|
Class to interpolate quadratically at coarse/fine interface when refinement ratio is 2. More...
#include <NodeQuadCFInterp2.H>
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) |
Class to interpolate quadratically at coarse/fine interface when refinement ratio is 2.
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 2
then we use
f''(1/2) ~ (f(-1) - f(0) - f(1) + f(2))/2.
If the point -1 is on the grid but 2 is not:
o---o-x-o o -1 0 1 2
then we approximate f''(1/2) by f''(0) and use
f''(0) ~ (f(-1) - 2 * f(0) + f(1)).
If the point 2 is on the grid but -1 is not:
o o-x-o---o -1 0 1 2
then we approximate f''(1/2) by f''(1) and use
f''(1) ~ (f(0) - 2 * f(1) + f(2)).
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
f(1/2,1/2) ~ (f(0,0) + f(0,1) + f(1,0) + f(1,1))/4 - 1/8 * ( d^2 f/dx^2 (1/2,1/2) + d^2 f/dy^2 (1/2,1/2))
where the second derivatives are estimated from the four neighboring coarse nodes and their neighbors.
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.
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 |
|
private |
|
private |
|
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 |
|
protected |
CELL-centered grids at the current level (the finer level)
|
protected |
CELL-centered physical domain of this level
|
protected |
NODE-centered box of nodes at physical domain at the coarser level
|
protected |
CELL-centered m_grids coarsened by 2
|
protected |
copy of coarse phi, used in CFInterp().
|
protected |
interpolating from interface only?
|
protected |
degree of interpolation: 1 for (bi)linear, 2 for (bi)quadratic
|
protected |
number of components of data, needed for setting size of work array
|
protected |
has full define function been called?
|
protected |
pointer to object storing coarse/fine interface nodes between this level and next coarser level
|
protected |
pointer to object storing coarse/fine interface nodes between this level and next coarser level
|
protected |
if true
, print out extra information