NAME
GridLatticeC - staggered C-grid for finite difference computa
tions
INCLUDE
include "GridLatticeC.h"
SYNTAX
class GridLatticeC : public GridLattice
{
private:
protected:
public:
GridLatticeC (int nsd =1, bool scalar_in_half_index=true);
GridLatticeC (int nsd, bool scalar_in_half_index,
Ptv(int) half_shift_in_min, Ptv(int) half_shift_in_max);
~GridLatticeC ();
void changeGridSize();
void setIndexBase();
void indexCheckOk(real i) const;
void indexCheckOk(real i, real j) const;
void indexCheckOk(real i, real j, real k) const;
void computeCgrid(const GridLattice& grid,
const GridLattice:: Component);
CLASS_INFO
VIRTUAL_CAST(GridLatticeC)
};
KEYWORDS
finite difference, staggered grid
DESCRIPTION
GridLatticeC enables the programmer to construct a staggered C-
grid which is automatically copied and redimensioned into the
right size when the grid is bound to a FieldLattice object which
represents the different components in the calculations.
CONSTRUCTORS AND INITIALIZATION
There are two constructors with two and three arguments respec
tively. The scalar_in_half_index argument is true if the scalar
is located at the centroid of the cell (placing the velocity
points at the vertices of the cells), and false in the opposite
case. This variable will not be set by any other functions, hence
if it is to be different than the default value true, it must be
set at construction time. The half_shift_in_max argument is used
to cut off half a grid cell at the upper part of the grid. This
is typically used if one has a velocity component given at one
boundary and the scalar value given at the other boundary. The
variable is a Ptv(int) and has, in each direction, the value 1 if
a half shift is to occur, and 0 if the grid is to be left as it
is.
MEMBER FUNCTIONS
changeGridSize and setIndexBase is called by FieldLattices real
locate function as soon as the FieldLattice object is constructed
and the field has got information on which component it repre
sents in the staggered grid.
changeGridSize alters a copy of the grid to make it the right
size for the field it represents.
setIndexBase sets the variable index_base to the appropriate val
ues determined by which component it represents in the staggered
grid.
computeCgrid - alters a copy of the supplied grid to hold the
appropriate size for the given component in a C-grid. This change
is normally done by the FieldLattice constructor at the same time
as the required array for holding the values is created, hence in
ordinary sequencial programming this function should not be
called explicitely by the user. In parallel programming however,
one wishes to create the grid in the right size first, then dis
tribute it on the available processors before the appropriate
array is allocated.
SEE ALSO
class FieldLattice, class GridLattice
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Elizabeth Acklam, UiO