[gradsusr] CDIFF Versus HDIVG?

Eric Altshuler ela at cola.iges.org
Tue Oct 19 19:58:16 EDT 2010


Hello Robert,

Your expressions for du and dv are incorrect for calculating divergence. I assume you copied the expressions from the grads documentation page for cdiff, where an example is presented for calculating vorticity. However, the expressions are different when calculating divergence. Use the following:

du = cdiff(ugrdprs,x)
dv = cdiff(vgrdprs*cos(lat*3.1416/180),y)

I based these expressions on the formula for divergence in spherical coordinates given in Holton's book, in the appendix on vector analysis (I have the 4th edition, but older editions should have the same appendix).

As an aside, I think it's possible to obtain more accurate approximations for divergence and vorticity than those given in the grads documentation, because the factor cos(lat) can be taken outside the derivative operator and differentiated analytically rather than using finite differencing. Using the product rule of differentiation and a bit of algebra, I have derived the following sequence of calculations for these quantities (my definitions of intermediate quantities are different, but the end result is the same):

pi=3.14159265359
dtr=pi/180
a=6.371e6
dx=a*cos(dtr*lat)*dtr*cdiff(lon,x)
dy=a*dtr*cdiff(lat,y)
div=cdiff(u,x)/dx+cdiff(v,y)/dy-v*tan(dtr*lat)/a
vor=cdiff(v,x)/dx-cdiff(u,y)/dy+u*tan(dtr*lat)/a
def1=cdiff(u,x)/dx-cdiff(v,y)/dy-v*tan(dtr*lat)/a
def2=cdiff(v,x)/dx+cdiff(u,y)/dy+u*tan(dtr*lat)/a

In these formulas, substitute your wind variable names for u and v. In addition to divergence and vorticity, there are also calculations of the components of deformation, def1 and def2, and total deformation is equal to mag(def1,def2). These formulas (in terms of continuous fields) can also be found in Bluestein (1992), "Synoptic-Dynamic Meteorology in Midlatitudes", Vol. I, p. 111.

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: "Robert N LeeJoice" <rnleejoi at nps.edu>
To: gradsusr at gradsusr.org
Sent: Tuesday, October 19, 2010 3:27:26 PM
Subject: [gradsusr] CDIFF Versus HDIVG?


I was wondering if there is a difference in the differencing scheme between CDIFF and HDIVG. I ask because I did a modified example from the documentation, i.e., divergence vice vorticity. The documentation states that CDIFF uses centered differencing. HDIVG says the same. The images suggest something else unless I’m missing something. 

CDIFF file 
if(var='DIV') 
'run bluewhitered.gs -2.0 .5 10' 
'define dv = cdiff(vgrdprs,x)' 
'define dx = cdiff(lon,x)*3.1416/180' 
'define du = cdiff(ugrdprs*cos(lat*3.1416/180),y)' 
'define dy = cdiff(lat,y)*3.1416/180' 
'display (du/dx+dv/dy)*1e5/(6.37e6*cos(lat*3.1416/180))' 
'run cbarn.gs 0.8 1 10.4 4.7' 
endif 

HDIVG file 
if(var='DIV') 
'run bluewhitered.gs -2.0 .5 10' 
'd 1e5*hdivg(ugrdprs,vgrdprs)' 
'run cbarn.gs 0.8 1 10.4 4.7' 
Endif 

Here are the images in order... 

Thank you for any comments, 

Robert LeeJoice 
PhD Candidate, Naval Postgraduate School 

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr




More information about the gradsusr mailing list