In this section, let us explain how to apply the library without
parallelization.
A program that uses the library "staggex.h"
consists of four parts (example see here ):
The first part is the heading. One has to include:
#include "source/staggex.h"
In the second part, one has to define a non-staggered grid on a hexahedron.
For example, this can be done in the following way:
int Nx, Ny, Nz;
...
D3vector vWSD(0.0,0.0,0.0);
D3vector vENT(1.0,1.0,1.0));
Grid grid(Nx,Ny,Nz,vSWD,vNET);
Here, vSWD and vENT are the corner points of the hexahedron and Nx+1, Ny+1, Nz+1 are the numbers of grid points in x-, y-, and z-direction.
A variable is vector of a certain type on a grid. This variable can be staggered in x-,y- and z-direction. For example, a variable on a completely non-staggered grid is defined as follows:
Variable<double,not_staggered,not_staggered,not_staggered> u(grid);
and a variable in a staggered grid in x-, y-, z-direction is defined as follows:
Variable<double,staggered,staggered,staggered> v(grid);
A variable on a staggered grid in x-, y-, z-direction is a cell variable.
After defining variables, one can implement numerical codes. For example, after
Coordinate<WE_dir,Grid_uniform_one_d> X(grid);
u = X;
w = 2.2; u = u + w;
the vector represented by u contains the value x+2.2 at every grid point, where x is the x-coordinate of each grid point.
Last modified: Wed Jun 6 10:15:36 PDT 2001