Tuesday, May 14, 2013

Script: Dynamic: Calculates temperature and vorticity advection, Q-vectors, deformation, geostrophic and ageostrophic winds, and Fronogenesis in GrADS

Usually, more advanced dynamic variables like frontogenesis and deformation are not included in the list of variables in your model output files.  Instead, it is up to the user to calculate them from the available wind and temperature fields.  Calculating these variables is complex and often requires a lot of steps using the various centered difference functions in GrADS.

Dynamic.gs calculates the following variables from the geopotential height, temperature, and horizontal wind.

Variable                           Name             Units                
-Geostrophic Wind     :    ug,vg             [m/s]   
-Ageostrophic Wind   :    ua,va             [m/s] 
-Q-Vectors                :    Q1,Q1           [pa/m2/s]   
-Temp Advection       :    tadv               [K/s]        
-Vort Advection         :    vadv              [-]         
-Frontogenesis         :    F                   [K/m/s]x10^9
-Fn Vector                :    fnx,fny         [K/m/s]x10^9
-Deformation             :    def1,def2     [m]         

The variables are then saved into the name, and you can plot them as normal variables.  However, since there are a lot of calculations to make in this script, the variables are only calculated for the current dimensions.  To calculate these values at all x,y,z,t points, simply set your dimensions to span the entire 4D domain.

Options:   -help: pulls up help page
                  -var : allows the user to point to specified height, temperature, wind variables
                            Default variables are: hgtprs, tmpprs, ugrdprs, vgrdprs


Example Usage: dynamic -var hgtprs tmpprs ugrdprs vgrdprs

This example will use the hgtprs, tmpprs, ugrdprs, vgrdprs variables to calculate the dynamic variables.

Example Image: NARR Shaded: Fronogenesis, Contoured in Green: Fn vector divergence, Vectors: Fn Vectors for 06UTC Feb 15, 2003

850-700mb average: Frontogensis, Fn Vectors, Fn Divergence, plotted for 06UTC Feb 15 2003



I chose this example to compare to the example used in this presentation.  Things seem to match up reasonably well.  Though I do urge some caution here, I am not (nor have I ever been) a dynamics expert, and some of the calculations were taken from either old GrADS scripts, or approximations of textbook equations.  Also, it is possible that the listed units are not 100% correct.  These caveats aside, I have been using this script to successfully diagnose areas of frontogenesis, and ageostrophic circulations from model output for quite some time, so I think overall it serves it's purpose well.  I post it now, with a newly added help page, and slightly cleaner code.

Download Dynamic.gs Here

Download Frontogenesis Example Here


5 comments:

  1. Good job, but did not get it right how to calculate and display geostrophic winds. Iy you may have a specific scrip for that particular task, please drop in my peterenos@ymail.com

    ReplyDelete
  2. Nice job..keep doing good work...

    ReplyDelete
  3. Hi, this script is so nice. thanks for your work. BTW, at lines 120, 121, and 125 in the script, '10e9' are perhaps typos. This returns:
    -Frontogenesis: F [K/m/s]x10^10
    -Fn Vector : fnx,fny [K/m/s]x10^10,
    not:
    -Frontogenesis: F [K/m/s]x10^9
    -Fn Vector : fnx,fny [K/m/s]x10^9.

    Please fix it if you can.

    ReplyDelete
  4. Hello there,
    I have modified these parameters to use with WRF model

    Height, Temperature, Uwind, Vwind'
    say ''
    'hgt=hgt'
    'tmp=t2'
    'vwnd=v'
    'uwnd=u'

    and it ends like this, if i execute 'd deformation'. With the rest it happens the same to me.

    --------------------------------------------------------------------
    Defined Variables: Variable Name Units
    -Geostrophic Wind : ug,vg [m/s]
    -Ageostrophic Wind: ua,va [m/s]
    -Q-Vectors : Q1,Q1 [pa/m2/s]
    -Temp Advection : tadv [K/s]
    -Vort Advection : vadv [-]
    -Frontogenesis : F [K/m/s]x10^9
    -Fn Vector : fnx,fny [K/m/s]x10^9
    -Deformation : def1,def2 [m]
    --------------------------------------------------------------------
    To plot a variable simply type "d " then pick a Name from the list
    ga-> d Deformation
    Syntax Error: Invalid Operand
    'deformation' not a variable or function name
    Error ocurred at column 1
    DISPLAY error: Invalid expression
    Expression = deformation

    ReplyDelete
  5. Hi, thanks for the scripts, could I know your source for the frontogenesis function?
    Thanks in advance

    ReplyDelete