cart_grid.h File Reference

Go to the source code of this file.

Functions

struct UnstructuredGridcreate_grid_cart2d (int nx, int ny, double dx, double dy)
 
struct UnstructuredGridcreate_grid_cart3d (int nx, int ny, int nz)
 
struct UnstructuredGridcreate_grid_hexa3d (int nx, int ny, int nz, double dx, double dy, double dz)
 
struct UnstructuredGridcreate_grid_tensor2d (int nx, int ny, const double *x, const double *y)
 
struct UnstructuredGridcreate_grid_tensor3d (int nx, int ny, int nz, const double *x, const double *y, const double *z, const double *depthz)
 

Detailed Description

Routines to construct fully formed grid structures from a simple Cartesian (i.e., tensor product) description.

The cells are lexicographically ordered with the i index cycling the most rapidly, followed by the j index and then, in three space dimensions, the k (`layer') index as the least rapidly cycling index.

Function Documentation

struct UnstructuredGrid* create_grid_cart2d ( int  nx,
int  ny,
double  dx,
double  dy 
)

Form geometrically Cartesian grid in two space dimensions with equally sized cells.

Parameters
[in]nxNumber of cells in x direction.
[in]nyNumber of cells in y direction.
[in]dxLength, in meters, of each cell's x extent.
[in]dyLength, in meters, of each cell's y extent.
Returns
Fully formed grid structure containing valid geometric primitives. Must be destroyed using function destroy_grid().
struct UnstructuredGrid* create_grid_cart3d ( int  nx,
int  ny,
int  nz 
)

Form geometrically Cartesian grid in three space dimensions with unit-sized cells.

Parameters
[in]nxNumber of cells in x direction.
[in]nyNumber of cells in y direction.
[in]nzNumber of cells in z direction.
Returns
Fully formed grid structure containing valid geometric primitives. Must be destroyed using function destroy_grid().
struct UnstructuredGrid* create_grid_hexa3d ( int  nx,
int  ny,
int  nz,
double  dx,
double  dy,
double  dz 
)

Form geometrically Cartesian grid in three space dimensions with equally sized cells.

Each cell has physical size (volume) $\mathit{dx}\times \mathit{dy}\times \mathit{dz}$.

Parameters
[in]nxNumber of cells in x direction.
[in]nyNumber of cells in y direction.
[in]nzNumber of cells in z direction.
[in]dxLength, in meters, of each cell's x extent.
[in]dyLength, in meters, of each cell's y extent.
[in]dzLength, in meters, of each cell's z extent.
Returns
Fully formed grid structure containing valid geometric primitives. Must be destroyed using function destroy_grid().
struct UnstructuredGrid* create_grid_tensor2d ( int  nx,
int  ny,
const double *  x,
const double *  y 
)

Form tensor product (Cartesian) grid in two space dimensions.

The size (volume) of cell $(i,j)$ is

\[ v_{ij} = (x_{i+1} - x_i)\cdot (y_{j+1} - y_j) \]

Similar relations hold for the cell and interface centroids as well as the interface areas and normal vectors. In other words, cell $(i,j)$ is the convex hull bounded by the tensor product of nodes $x_i$, $x_{i+1}$, $y_j$, and $y_{j+1}$.

Parameters
[in]nxNumber of cells in x direction.
[in]nyNumber of cells in y direction.
[in]xPosition along x axis of each grid line with constant x coordinate. Array of size nx + 1.
[in]yPosition along y axis of each grid line with constant y coordinate. Array of size ny + 1.
Returns
Fully formed grid structure containing valid geometric primitives. Must be destroyed using function destroy_grid().
struct UnstructuredGrid* create_grid_tensor3d ( int  nx,
int  ny,
int  nz,
const double *  x,
const double *  y,
const double *  z,
const double *  depthz 
)

Form tensor product (i.e., topologically Cartesian) grid in three space dimensions–possibly with a variable top-layer topography.

If depthz is NULL, then geometric information such as volumes and centroids is calculated from analytic expressions. Otherwise, these values are computed using function compute_geometry().

Parameters
[in]nxNumber of cells in x direction.
[in]nyNumber of cells in y direction.
[in]nzNumber of cells in z direction.
[in]xPosition along x axis of each grid line with constant x coordinate. Array of size nx + 1.
[in]yPosition along y axis of each grid line with constant y coordinate. Array of size ny + 1.
[in]zDistance (depth) from top-layer measured along the z axis of each grid line with constant z coordinate. Array of size nz + 1.
[in]depthzTop-layer topography specification. If NULL, interpreted as horizontal top-layer at z=0. Otherwise, must be an array of size (nx + 1) * (ny + 1), ordered lexicographically, that defines the depth of each top-layer pillar vertex.
Returns
Fully formed grid structure containing valid geometric primitives. Must be destroyed using function destroy_grid().