[Thread Prev][Thread Next][Index]

[ferret_users] mixed layer average velocity (depth-integrating to an isosurface)



Posting this in case someone finds it useful...

Looking to compute an average velocity over the oceanic mixed layer, I ran
across Steve Hankin's message from 1999 (attached below), which shows how
to mask a variable and compute a vertical average over an irregular depth.
That was before the ZBOXLO and ZBOXHI variables were introduced in 2001
(Ferret v5.3), so it summed only over full cells.  We can now improve the
accuracy of the computation by including fractional cells.

Suppose we have a variable V(x,y,z) and mixed layer depth H(x,y), where z
is a depth-axis, and both z and H have units of meters.  To compute the
vertical average of V between the surface and H:

let ztop = zboxlo[gz=v]           !depth of cell top
let zthick = zbox[gz=v]           !full cell thickness
let zfrac = min(zthick,h-ztop)    !like ZTHICK except where H intersects cell
let mask = IF ztop LT h THEN 1    !excludes cells completely below H
let v_weighted = v * zfrac * mask !masked product of variable and weights
let v_zint = v_weighted[z=@sum]   !the vertical integral
let v_zave = v_zint/h             !the vertical average

Or more concisely:

let v_weighted = IF zboxlo[gz=v] LT h THEN v*min(zbox[gz=v],h-zboxlo[gz=v])
let v_zave = v_weighted[z=@sum]/h

Cheers,

Andrew

+-----------------------+
| Dr. Andrew Wittenberg |
|       GFDL/NOAA       |
|     Princeton, NJ     |
+-----------------------+


from: http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_99/msg00016.html

    * To: Bruno Levier <blevier@xxxxxxxxxxxxxx>
    * Subject: Re: Averaging/integrating
    * From: Steve Hankin <hankin@xxxxxxxxxxxxx>
    * Date: Wed, 13 Jan 1999 11:35:45 -0800
    * Cc: ferret_users@xxxxxxxxxxxxxxxxxxx
    * References: <Pine.SUN.3.95.990113183638.5915A-100000@bali.cetiis.fr>
    * Sender: owner-ferret_users

Hi Bruno,

A general solution to this is to "mask" the variable before integration.

e.g. to integrate only above the 20 degree isotherm

  LET iso20 = my_temperature[Z=@LOC:20]
  LET mask = IF Z[g=my_temperature] .LT. iso20 THEN 1     ! else missing
is implied
  LET masked_temp = mask*my_temperature

Now integrate masked_temp instead of my_temp.

Note that this approach applies an all-or-nothing criterion to each grid
cell, rather than including fractional grid cells in the integration. If
necessary the accuracy of the integration can be improved by first
regridding my_temperature to a finer grid. 

	- steve

=========================================================================

Bruno Levier wrote:
> 
> Hi!
> 
> How to integrate a variable within a surface/volume delimitated by an
> isoligne/isosurface?
> 
> Thanks
> 
>         Bruno




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement