Dynlib derivatives functions: Difference between revisions

From gfi
No edit summary
(Outdated and obsolete, to be deleted.)
 
Line 1: Line 1:
== Dynlib partial derivatives libary ==
{{db-author}}
 
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:
 
{| border="1" class="wikitable" style="text-align:center;"
|+ style="text-align:left"| Arguments:
|-
|
! width="60" | Type
! width="80" | Dim
! width="300" | Description
|-
! width="80" | dat
| real || (nz,ny,nx) || The input data
|}
 
{| border="1" class="wikitable" style="text-align:center;"
|+ style="text-align:left"| Returns:
|-
|
! width="60" | Type
! width="120" | Dim
! width="300" | Description
|-
! width="80" | res
| real || (nz,ny,nx) || output data
|}
 
The ubiquitous inputs ''dx'' and ''dy'' are all of the form
{| border="1" class="wikitable" style="text-align:center;"
|-
|
! width="60" | Type
! width="80" | Dim
! width="300" | Description
|-
! width="80" | dx
| real || (ny,nx) || dx(j,i) = x(j, i+1) - x(j, i-1) (in metres)
|-
! width="80" | 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 ===
 
<code>res=ddx(dat,dx,dy)</code>
 
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 ===
 
<code>res=ddy(dat,dx,dy)</code>
 
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 ===
 
<code>(resx,resy)=grad(dat,dx,dy)</code>
 
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 ===
 
<code>res=lap2(dat,dx,dy)</code>
 
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.
 
[[Category:Dynlib]]

Latest revision as of 14:13, 18 September 2017