Chombo + EB + MF  3.2
Protected Attributes | Private Member Functions | List of all members
NodeQuadCFInterp2 Class Reference

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< NodeFArrayBoxm_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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ NodeQuadCFInterp2() [1/3]

NodeQuadCFInterp2::NodeQuadCFInterp2 ( )

Default constructor. User must subsequently call define().

◆ NodeQuadCFInterp2() [2/3]

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() [3/3]

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::~NodeQuadCFInterp2 ( )

Destructor.

Member Function Documentation

◆ define() [1/2]

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.

Parameters
a_gridsCELL-centered grids at this level
a_domainCELL-centered physical domain at this level
a_loCFIVSpointer to object storing coarse/fine interface nodes
a_hiCFIVSpointer to object storing coarse/fine interface nodes
a_interfaceOnlywhether interpolation is from interface only, meaning that off-interface data should not be used
a_interpolationDegreedegree of interpolation; 1 for (bi)linear, 2 for (bi)quadratic
a_ncompnumber of components of data
a_verboseverbose output flag

◆ define() [2/2]

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.

Parameters
a_gridsCELL-centered grids at this level
a_domainCELL-centered physical domain at this level
a_loCFIVSpointer to object storing coarse/fine interface nodes
a_hiCFIVSpointer to object storing coarse/fine interface nodes
a_interfaceOnlywhether interpolation is from interface only, meaning that off-interface data should not be used
a_interpolationDegreedegree of interpolation; 1 for (bi)linear, 2 for (bi)quadratic
a_ncompnumber of components of data
a_verboseverbose output flag

◆ isDefined()

bool NodeQuadCFInterp2::isDefined ( ) const

Returns true if this object was created with the defining constructor or if define() has been called.

◆ setVerbose()

void NodeQuadCFInterp2::setVerbose ( bool  a_verbose)

Set whether to give output. Default is false.

◆ coarseFineInterp()

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.

Parameters
a_phidata at this level
a_phiCoarsedata at the next coarser level

◆ clearMemory()

void NodeQuadCFInterp2::clearMemory ( )
private

◆ setDefaultValues()

void NodeQuadCFInterp2::setDefaultValues ( )
private

◆ interpLine()

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.

Parameters
a_fineFabfine data on NODE-centered FAB
a_psiFabcoarse data on NODE-centered FAB
a_psiFabNodesnodes of a_psiFab from which data can be used
a_ivpoint at which to interpolate
a_idirOtherdirection (0 to SpaceDim-1) along which to interpolate

Member Data Documentation

◆ m_grids

DisjointBoxLayout NodeQuadCFInterp2::m_grids
protected

CELL-centered grids at the current level (the finer level)

◆ m_domain

ProblemDomain NodeQuadCFInterp2::m_domain
protected

CELL-centered physical domain of this level

◆ m_domainCoarseNodes

Box NodeQuadCFInterp2::m_domainCoarseNodes
protected

NODE-centered box of nodes at physical domain at the coarser level

◆ m_coarsenedGrids

DisjointBoxLayout NodeQuadCFInterp2::m_coarsenedGrids
protected

CELL-centered m_grids coarsened by 2

◆ m_coarseCopy

LevelData<NodeFArrayBox> NodeQuadCFInterp2::m_coarseCopy
protected

copy of coarse phi, used in CFInterp().

◆ m_interfaceOnly

bool NodeQuadCFInterp2::m_interfaceOnly
protected

interpolating from interface only?

◆ m_interpolationDegree

int NodeQuadCFInterp2::m_interpolationDegree
protected

degree of interpolation: 1 for (bi)linear, 2 for (bi)quadratic

◆ m_ncomp

int NodeQuadCFInterp2::m_ncomp
protected

number of components of data, needed for setting size of work array

◆ m_isDefined

bool NodeQuadCFInterp2::m_isDefined
protected

has full define function been called?

◆ m_loCFIVS

const LayoutData<NodeCFIVS>* NodeQuadCFInterp2::m_loCFIVS
protected

pointer to object storing coarse/fine interface nodes between this level and next coarser level

◆ m_hiCFIVS

const LayoutData<NodeCFIVS>* NodeQuadCFInterp2::m_hiCFIVS
protected

pointer to object storing coarse/fine interface nodes between this level and next coarser level

◆ m_verbose

bool NodeQuadCFInterp2::m_verbose
protected

if true, print out extra information


The documentation for this class was generated from the following file: