cdiff question
Eric Altshuler
ela at COLA.IGES.ORG
Thu Feb 7 15:23:47 EST 2008
John,
I have a grads exec script that calculates divergence, vorticity and deformation from the u and v wind components. The expressions I use are pretty much equivalent to the ones you wrote here, except I think it is better to write the expression for du in a different form. The grads documentation says that:
du = cdiff(u*cos(lat*3.1416/180),y)
It is possible to evaluate the derivative of cos(lat*3.1416/180) with respect to y in analytical form, rather than approximating it as a differential, by using the product rule of differentiation. The resulting expression is:
du = cdiff(u,y)*cos(lat*3.1416/180) - u*sin(lat*3.1416/180)
In my script, which is given below, the expressions have been rearranged somewhat but the end results should be the same.
pi=3.14159
dtr=pi/180
a=6.37122e6
un=&0
vn=&1
dx=a*cos(dtr*lat)*dtr*cdiff(lon,x)
dy=a*dtr*cdiff(lat,y)
div=cdiff(un,x)/dx+cdiff(vn,y)/dy-vn*tan(dtr*lat)/a
vor=cdiff(vn,x)/dx-cdiff(un,y)/dy+un*tan(dtr*lat)/a
def1=cdiff(un,x)/dx-cdiff(vn,y)/dy-vn*tan(dtr*lat)/a
def2=cdiff(vn,x)/dx+cdiff(un,y)/dy+un*tan(dtr*lat)/a
Here, 'un' and 'vn' are the u and v wind components, 'div' is divergence, 'vor' is vorticity, and 'def1' and 'def2' are the deformation components. If the winds are grid relative, the divergence and vorticity should be unchanged since they are rotationally invariant, but I believe the deformation components are *not* rotationally invariant, although the total deformation, mag(def1,def2), should not change.
I have another script that may be useful, it calculates temperature advection and frontogenesis in addition to divergence, vorticity and deformation:
pi=3.14159
dtr=pi/180
a=6.37122e6
un=&0
vn=&1
tn=&2
dx=a*cos(dtr*lat)*dtr*cdiff(lon,x)
dy=a*dtr*cdiff(lat,y)
dtdx=cdiff(tn,x)/dx
dtdy=cdiff(tn,y)/dy
tadv=-un*dtdx-vn*dtdy
div=cdiff(un,x)/dx+cdiff(vn,y)/dy-vn*tan(dtr*lat)/a
vor=cdiff(vn,x)/dx-cdiff(un,y)/dy+un*tan(dtr*lat)/a
def1=cdiff(un,x)/dx-cdiff(vn,y)/dy-vn*tan(dtr*lat)/a
def2=cdiff(vn,x)/dx+cdiff(un,y)/dy+un*tan(dtr*lat)/a
fx=-(dtdx*(div+def1)+dtdy*(vor+def2))/2
fy=(dtdx*(vor-def2)-dtdy*(div-def1))/2
fn=(dtdx*fx+dtdy*fy)/mag(dtdx,dtdy)
fs=(dtdx*fy-dtdy*fx)/mag(dtdx,dtdy)
Here, 'tn' is temperature, 'fx' and 'fy' are the x and y components of frontogenesis, and 'fn' and 'fs' are the frontogenesis components normal and tangential to the isotherms, respectively.
Best regards,
Eric L. Altshuler
Assistant Research Scientist
Center for Ocean-Land-Atmosphere Studies
4041 Powder Mill Road, Suite 302
Calverton, MD 20705-3106
USA
E-mail: ela at cola.iges.org
Phone: (301) 902-1257
Fax: (301) 595-9793
----- Original Message -----
From: "John Guhin" <johnguhin at GMAIL.COM>
To: GRADSUSR at LIST.CINECA.IT
Sent: Wednesday, February 6, 2008 2:51:02 PM (GMT-0500) America/New_York
Subject: cdiff question
In the grads documentation index ( http://grads.iges.org/grads/gadoc/gadocindex.html ) for cdiff function, one can find the following:
1. define dv = cdiff(v,x) define dx = cdiff(lon,x)*3.1416/180 define du = cdiff(u*cos(lat*3.1416/180),y) define dy = cdiff(lat,y)*3.1416/180 display (dv/dx-du/dy)/(6.37e6*cos(lat*3.1416/180))
Are the expressions for dv and du are correct? What kind of difference will be there if u and v components are 'grid relative' or 'earth relative'.
thanks in advance.
--
John Guhin
More information about the gradsusr
mailing list