Difference between revisions of "Dynlib derivatives functions"

(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…')
 
Line 11: Line 11:
 
! width="300" | Description
 
! width="300" | Description
 
|-
 
|-
! width="80" | u
+
! width="80" | dat
| real || (nz,ny,nx) || Zonal velocity
+
| real || (nz,ny,nx) || The input data
|-
 
! width="80" | v
 
| real || (nz,ny,nx) || Meridional velocity
 
|-
 
! width="80" | pv
 
| real || (nz,ny,nx) || Potential vorticity
 
 
|}
 
|}
  

Revision as of 20:15, 29 January 2013

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
dat real (nz,ny,nx) The input data
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.