Dynlib derivatives functions

Revision as of 20:14, 29 January 2013 by Csp001 (talk | contribs) (Created page with '== Dynlib derivatives == The functions generally operate on real arrays with dimension (nz,ny,nx) where nz is number of times or levels, and ny and nx are the number of latitude…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Dynlib derivatives

The functions generally operate on real arrays with dimension (nz,ny,nx) where nz is number of times or levels, and ny and nx are the number of latitudes and longitudes, respectively. The function descriptions below contain detailed descriptions of arguments and returns where there is any deviation from this pattern; otherwise they may be assumed to be of the form:

Arguments:
Type Dim Description
u real (nz,ny,nx) Zonal velocity
v real (nz,ny,nx) Meridional velocity
pv real (nz,ny,nx) Potential vorticity
Returns:
Type Dim Description
res real (nz,ny,nx) output data

The ubiquitous inputs dx and dy are all of the form

Type Dim Description
dx real (ny,nx) dx(j,i) = x(j, i+1) - x(j, i-1) (in metres)
dy real (ny,nx) dy(j,i) = y(j+1, i) - y(j-1, i) (in metres)

Typically, the results for each level or time are computed individually in 2-D fashion, though they are returned as a 3-D array of the same size as the input.

dynlib.diag.ddx : partial x derivative

res=ddx(dat,dx,dy)

Calculates the partial x derivative of dat, using centred differences. For a non-EW-cyclic grid, 0 is returned on the edges of the x domain.

dynlib.diag.ddy : partial y derivative

res=ddy(dat,dx,dy)

Calculates the partial y derivative of dat, using centred differences. For a non-EW-cyclic grid, 0 is returned on all edges of the x,y domain. For an EW-cyclic grid, 0 is returned on the first and last latitudes.

dynlib.diag.grad : 2-D gradient

(resx,resy)=grad(dat,dx,dy)

Calculates the 2-D gradient of dat, using centred differences in x and y. For a non-EW-cyclic grid, 0 is returned on all edges of the x,y domain. For an EW-cyclic grid, 0 is returned on the first and last latitudes.

dynlib.diag.lap2 : 2-D laplacian

res=lap2(dat,dx,dy)

Calculates the 2-D laplacian of dat, using centred differences. For a non-EW-cyclic grid, 0 is returned on all edges of the x,y domain. For an EW-cyclic grid, 0 is returned on the first and last latitudes.