Chombo + EB  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
PiecewiseLinearFillPatch Class Reference

Fills ghost cells by linear interpolation in space and time. More...

#include <PiecewiseLinearFillPatch.H>

Public Member Functions

 PiecewiseLinearFillPatch ()
 
virtual ~PiecewiseLinearFillPatch ()
 
 PiecewiseLinearFillPatch (const DisjointBoxLayout &a_fine_domain, const DisjointBoxLayout &a_coarse_domain, int a_num_comps, const Box &a_crse_problem_domain, int a_ref_ratio, int a_interp_radius, bool a_pwconst_interp_only=false)
 
 PiecewiseLinearFillPatch (const DisjointBoxLayout &a_fine_domain, const DisjointBoxLayout &a_coarse_domain, int a_num_comps, const ProblemDomain &a_crse_problem_domain, int a_ref_ratio, int a_interp_radius, bool a_pwconst_interp_only=false)
 
void define (const DisjointBoxLayout &a_fine_domain, const DisjointBoxLayout &a_coarse_domain, int a_num_comps, const Box &a_crse_problem_domain, int a_ref_ratio, int a_interp_radius, bool a_pwconst_interp_only=false)
 
void define (const DisjointBoxLayout &a_fine_domain, const DisjointBoxLayout &a_coarse_domain, int a_num_comps, const ProblemDomain &a_crse_problem_domain, int a_ref_ratio, int a_interp_radius, bool a_pwconst_interp_only=false)
 
bool isDefined () const
 
void fillInterp (LevelData< FArrayBox > &a_fine_data, const LevelData< FArrayBox > &a_old_coarse_data, const LevelData< FArrayBox > &a_new_coarse_data, Real a_time_interp_coef, int a_src_comp, int a_dest_comp, int a_num_comp)
 
void fillInterpPWConstSpace (LevelData< FArrayBox > &a_fine_data, const LevelData< FArrayBox > &a_coarse_data, int a_src_comp, int a_dest_comp, int a_num_comp)
 
void printIntVectSets () const
 

Protected Member Functions

void timeInterp (const LevelData< FArrayBox > &a_old_coarse_data, const LevelData< FArrayBox > &a_new_coarse_data, Real a_time_interp_coef, int a_src_comp, int a_dest_comp, int a_num_comp)
 
virtual void fillConstantInterp (LevelData< FArrayBox > &a_fine_data, int a_src_comp, int a_dest_comp, int a_num_comp) const
 
virtual void computeSlopes (int a_src_comp, int a_num_comp)
 
void computeSimpleSlopesFab (FArrayBox &a_slopeFab, const int &a_src_comp, const int &a_num_comp, const int &a_dir, const FArrayBox &a_dataFab, const IntVectSet &a_local_centered_interp, const IntVectSet &a_local_lo_interp, const IntVectSet &a_local_hi_interp)
 
void computeMultiDimSlopes (FArrayBox &a_slopes0, FArrayBox &a_slopes1, FArrayBox &a_slopes2, const FArrayBox &a_dataFab, const int &a_src_comp, const int &a_num_comp, const Box &a_slopeBox)
 
virtual void incrementLinearInterp (LevelData< FArrayBox > &a_fine_data, int a_src_comp, int a_dest_comp, int a_num_comp) const
 

Protected Attributes

bool m_is_defined
 
int m_ref_ratio
 
int m_interp_radius
 
LevelData< FArrayBoxm_coarsened_fine_data
 
LevelData< FArrayBoxm_slopes [3]
 
ProblemDomain m_crse_problem_domain
 
LayoutData< IntVectSetm_fine_interp
 
LayoutData< IntVectSetm_coarse_centered_interp [SpaceDim]
 
LayoutData< IntVectSetm_coarse_lo_interp [SpaceDim]
 
LayoutData< IntVectSetm_coarse_hi_interp [SpaceDim]
 
Copier m_coarsenCopier
 

Static Protected Attributes

static const int s_stencil_radius
 

Detailed Description

Fills ghost cells by linear interpolation in space and time.

Fills some fine level ghost cells by piecewise linear interpolation from the coarse level.

This class also presents an interface for performing piecewise constant interpolation in space. If this is all that is required, define with 'a_pwconst_interp_only = true' to save memory and expense.

This class fills the first a_interp_radius layers of fine level ghost cells that are not part of other fine level grids. It uses piecewise linear interpolation from the coarse level. The slopes are computed using van leer limiting if there is enough room for the stencil. It drops order and uses first-order one-sided differences otherwise.

Below is a picture of a fine level, with a_interp_radius = 1. The ghost cells of grid 1 are shown. Cells marked X are interpolated to from the coarse level. Cells marked ^ are not interpolated to because they are in the valid domain of another fine grid. Cells marked . are not interpolated to because they are outside the problem domain. All of this changes in the presence of periodic boundary conditions – in periodic directions, all cells are considered to be within the domain.

 +=======================================+
 |                                       |
 |                                       |
 |                                       |
 |                                       |
 |         + - - - - - - - - - - - - - - | +
 |          X X X X X X X X X X X X X X X|.
 |         | +===========================+ |
 |          X|                           |.
 |         | |                           | |
 |          X|        grid 1             |.
 |         | |                           | |
 |          X|                           |.
 |         | |                           | |
 |          X|                           |.
 |   +=======+===+===============+=======+ |
 |   |      ^ ^ ^|X X X X X X X X|^ ^ ^ ^|.
 |   |     + - - | - - - - - - - | - - - | +
 |   |           |               |grid 2 |
 |   |  grid 0   |               +=======+
 |   |           |                       |
 |   |           |                       |
 |   |           |                       |
 |   +===========+                       |
 |                                       |
 |                                       |
 |              problem domain           |
 +=======================================+

the picture below shows the locations of the types of slopes. The coarse grid is shown, and the projection of the fine grid onto the coarse index space (on which slopes are computed). Coarse cells marked ^ and . do not need slopes. Van Leer slopes in both directions are used at coarse cells marked X. Coarse cells marked V and < have one-sided differencing: cells marked V have low-sided differencing in the y-direction (in this example, because the coarse grid doesn't exist on the high side of these cells), and cells marked < have low-sided differencing in the x-direction (because the problem domain doesn't exist on the high side of these cells). There can also be cells that have one-sided differences in both directions.

 +--------------------—+===============+
coarse grid 1
+=======================+ - - - - - - - - +
\ / \ / \ / \ /\ / \ / \ / \ /
| | V V V V | X X X < | . | | / \ / \ / \ / |/ \ / \ / \ / | | | +------------------------—+ | | \ /| | | | | X | | | . | | / | | | | | | | | | | \ /| | | | | X | | | . | | / | | | | +----—+—+------------—+----—+ | | | |\ / \ /|\ / \ /| | | | | ^ ^ | X X | X X | ^ ^ | . | | | |/ \ / |/ \ / | | | | + - - - | - - - - - - - +----—+ - +
| +--------—+ +===============+
coarse grid 0
+=======================+------------—+

Constructor & Destructor Documentation

◆ PiecewiseLinearFillPatch() [1/3]

PiecewiseLinearFillPatch::PiecewiseLinearFillPatch ( )

Default constructor. User must subsequently call define().

◆ ~PiecewiseLinearFillPatch()

virtual PiecewiseLinearFillPatch::~PiecewiseLinearFillPatch ( )
virtual

Destructor.

◆ PiecewiseLinearFillPatch() [2/3]

PiecewiseLinearFillPatch::PiecewiseLinearFillPatch ( const DisjointBoxLayout a_fine_domain,
const DisjointBoxLayout a_coarse_domain,
int  a_num_comps,
const Box a_crse_problem_domain,
int  a_ref_ratio,
int  a_interp_radius,
bool  a_pwconst_interp_only = false 
)

Defining constructor.

{ Arguments:}\ a_fine_domain (not modified): domain of fine level. \ a_coarse_domain (not modified): domain of coarse level. \ a_num_comps (not modified): number of components of state vector. \ a_problem_domain (not modified): problem domain on the coarse level. \ a_ref_ratio (not modified): refinement ratio. \ a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \ a_constInterpOnly (not modified): if true, only set up for piecewise-constant interpolation in space. \

◆ PiecewiseLinearFillPatch() [3/3]

PiecewiseLinearFillPatch::PiecewiseLinearFillPatch ( const DisjointBoxLayout a_fine_domain,
const DisjointBoxLayout a_coarse_domain,
int  a_num_comps,
const ProblemDomain a_crse_problem_domain,
int  a_ref_ratio,
int  a_interp_radius,
bool  a_pwconst_interp_only = false 
)

Defining constructor.

{ Arguments:}\ a_fine_domain (not modified): domain of fine level. \ a_coarse_domain (not modified): domain of coarse level. \ a_num_comps (not modified): number of components of state vector. \ a_problem_domain (not modified): problem domain on the coarse level. \ a_ref_ratio (not modified): refinement ratio. \ a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \ a_constInterpOnly (not modified): if true, only set up for piecewise-constant interpolation in space. \

Member Function Documentation

◆ define() [1/2]

void PiecewiseLinearFillPatch::define ( const DisjointBoxLayout a_fine_domain,
const DisjointBoxLayout a_coarse_domain,
int  a_num_comps,
const Box a_crse_problem_domain,
int  a_ref_ratio,
int  a_interp_radius,
bool  a_pwconst_interp_only = false 
)

Defines this object. The user may call define() once and call fillInterp() multiple times with different valid data sets.

{ Arguments:}\ a_fine_domain (not modified): domain of fine level. \ a_coarse_domain (not modified): domain of coarse level. \ a_num_comps (not modified): number of components of state vector. \ a_problem_domain (not modified): problem domain on the coarse level. \ a_ref_ratio (not modified): refinement ratio. \ a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \ a_constInterpOnly (not modified): if true, only set up for piecewise-constant interpolation in space. \

{ This:}\ —This object is modified.—

◆ define() [2/2]

void PiecewiseLinearFillPatch::define ( const DisjointBoxLayout a_fine_domain,
const DisjointBoxLayout a_coarse_domain,
int  a_num_comps,
const ProblemDomain a_crse_problem_domain,
int  a_ref_ratio,
int  a_interp_radius,
bool  a_pwconst_interp_only = false 
)

Defines this object. The user may call define() once and call fillInterp() multiple times with different valid data sets.

{ Arguments:}\ a_fine_domain (not modified): domain of fine level. \ a_coarse_domain (not modified): domain of coarse level. \ a_num_comps (not modified): number of components of state vector. \ a_problem_domain (not modified): problem domain on the coarse level. \ a_ref_ratio (not modified): refinement ratio. \ a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \ a_constInterpOnly (not modified): if true, only set up for piecewise-constant interpolation in space. \

{ This:}\ —This object is modified.—

◆ isDefined()

bool PiecewiseLinearFillPatch::isDefined ( ) const

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

{ This:}\ This object is not modified.

◆ fillInterp()

void PiecewiseLinearFillPatch::fillInterp ( LevelData< FArrayBox > &  a_fine_data,
const LevelData< FArrayBox > &  a_old_coarse_data,
const LevelData< FArrayBox > &  a_new_coarse_data,
Real  a_time_interp_coef,
int  a_src_comp,
int  a_dest_comp,
int  a_num_comp 
)

Fills the first m_interp_radius layers of fine ghost cells by interpolation from the coarse level. It is an error to call if not this->isDefined(). The range components to interpolate must be specified. The corresponding components on the coarse and fine levels may be different. It is required that a_fine_data's domain is the same as was specified in the most recent call to define(). It is expected that the coarse and fine level's domains are properly nested.

{ Arguments:}\ a_fine_data (modified): fine-level data being interpolated to.\ a_old_coarse_data (not modified): coarse level source data at the old time.\ a_new_coarse_data (not modified): coarse level source data at the new time.\ a_time_interp_coef (not modified): time interpolation coefficient, in the range [0:1]. 0=old time, 1=new time.\ a_src_comp (not modifed): starting coarse data component.\ a_dest_comp (not modifed): starting fine data component.\ a_num_comp (not modified): number of data components to be interpolated.

{ This:}\ Well, it's complicated. As far as the user is concerned, this object is not modified. See the design document if you care for details.

◆ fillInterpPWConstSpace()

void PiecewiseLinearFillPatch::fillInterpPWConstSpace ( LevelData< FArrayBox > &  a_fine_data,
const LevelData< FArrayBox > &  a_coarse_data,
int  a_src_comp,
int  a_dest_comp,
int  a_num_comp 
)

Fills the first m_interp_radius layers of fine ghost cells by piece-wise constant interpolation (only in space) from a coarse level { Arguments:}\ a_fine_data (modified): fine-level data being interpolated to.\ a_coarse_data (not modified): coarse level source data.\ a_src_comp (not modifed): starting coarse data component.\ a_dest_comp (not modifed): starting fine data component.\ a_num_comp (not modified): number of data components to be

◆ printIntVectSets()

void PiecewiseLinearFillPatch::printIntVectSets ( ) const

◆ timeInterp()

void PiecewiseLinearFillPatch::timeInterp ( const LevelData< FArrayBox > &  a_old_coarse_data,
const LevelData< FArrayBox > &  a_new_coarse_data,
Real  a_time_interp_coef,
int  a_src_comp,
int  a_dest_comp,
int  a_num_comp 
)
protected

◆ fillConstantInterp()

virtual void PiecewiseLinearFillPatch::fillConstantInterp ( LevelData< FArrayBox > &  a_fine_data,
int  a_src_comp,
int  a_dest_comp,
int  a_num_comp 
) const
protectedvirtual

◆ computeSlopes()

virtual void PiecewiseLinearFillPatch::computeSlopes ( int  a_src_comp,
int  a_num_comp 
)
protectedvirtual

◆ computeSimpleSlopesFab()

void PiecewiseLinearFillPatch::computeSimpleSlopesFab ( FArrayBox a_slopeFab,
const int &  a_src_comp,
const int &  a_num_comp,
const int &  a_dir,
const FArrayBox a_dataFab,
const IntVectSet a_local_centered_interp,
const IntVectSet a_local_lo_interp,
const IntVectSet a_local_hi_interp 
)
protected

◆ computeMultiDimSlopes()

void PiecewiseLinearFillPatch::computeMultiDimSlopes ( FArrayBox a_slopes0,
FArrayBox a_slopes1,
FArrayBox a_slopes2,
const FArrayBox a_dataFab,
const int &  a_src_comp,
const int &  a_num_comp,
const Box a_slopeBox 
)
protected

◆ incrementLinearInterp()

virtual void PiecewiseLinearFillPatch::incrementLinearInterp ( LevelData< FArrayBox > &  a_fine_data,
int  a_src_comp,
int  a_dest_comp,
int  a_num_comp 
) const
protectedvirtual

Member Data Documentation

◆ m_is_defined

bool PiecewiseLinearFillPatch::m_is_defined
protected

◆ s_stencil_radius

const int PiecewiseLinearFillPatch::s_stencil_radius
staticprotected

◆ m_ref_ratio

int PiecewiseLinearFillPatch::m_ref_ratio
protected

◆ m_interp_radius

int PiecewiseLinearFillPatch::m_interp_radius
protected

◆ m_coarsened_fine_data

LevelData<FArrayBox> PiecewiseLinearFillPatch::m_coarsened_fine_data
protected

◆ m_slopes

LevelData<FArrayBox> PiecewiseLinearFillPatch::m_slopes[3]
protected

◆ m_crse_problem_domain

ProblemDomain PiecewiseLinearFillPatch::m_crse_problem_domain
protected

◆ m_fine_interp

LayoutData<IntVectSet> PiecewiseLinearFillPatch::m_fine_interp
protected

◆ m_coarse_centered_interp

LayoutData<IntVectSet> PiecewiseLinearFillPatch::m_coarse_centered_interp[SpaceDim]
protected

◆ m_coarse_lo_interp

LayoutData<IntVectSet> PiecewiseLinearFillPatch::m_coarse_lo_interp[SpaceDim]
protected

◆ m_coarse_hi_interp

LayoutData<IntVectSet> PiecewiseLinearFillPatch::m_coarse_hi_interp[SpaceDim]
protected

◆ m_coarsenCopier

Copier PiecewiseLinearFillPatch::m_coarsenCopier
protected

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