NOAA-PMEL / Ferret

The Ferret program from NOAA/PMEL
https://ferret.pmel.noaa.gov/Ferret/
The Unlicense
55 stars 20 forks source link

Curvilinear: sigma coordinates by thickness #1390

Open karlmsmith opened 6 years ago

karlmsmith commented 6 years ago

Reported by steven.c.hankin on 17 Dec 2013 17:12 UTC This trac ticket is to document a detail task that I am postponing in order to work on the more general framework of automated curvilinear grid support:

Consider temp[gz(depth)=zax]

The current vertical (sigma) regridding code assumes that the auxiliary variable, depth, contains the Z coordinate locations for temp. In the case of layered depth coordinates, in which the '''thickness''' of each layer is stored in a variable, our "depth" variable will be most faithful if it contains the cell edges, instead of the cell points. It would be a step function. It would be N+1 in length and contain values at each XY point

0, thick(1), thick(1)+thick(2), ...

Supporting a depth variable of this type will require several enhancements to the code o @lin regridding is not a natural operation from a step function. It would (probably?) best done by computing the midpoints of the layers and using those as the "depths" in the current @lin code. I believe this can easily be done by setting up the array posline to contain the midpoint locations in doo/do_aux_var_regrid_1d.F o @ave regridding will be more natural and will be numerically consistent with @ave as it has always been performed on rectilinear grids. Easiest way to implement it is probably to produce a new routine doo/do_aux_var_line_sfave.F ("sf"=step function) that is a delta on the current doo/do_aux_var_line_ave.F. (Might also rename the current routine do_aux_var_line_ave.F to do_aux_var_line_plave.F as house-keeping). Then tweak the internals of do_aux_var_line_sfave.F so it adds rectangles instead of trapezoids. (There's quite a lot of subtle logic in this routine, so writing it from scratch would be a lot more work.)
o stk/aux_regrid_lims -- likely small logic tweaks to make sure that the lo and hi subscripts of "temp" that are needed for the result grid are requested

Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/2118

karlmsmith commented 6 years ago

Attachment from steven.c.hankin on 17 Dec 2013 18:16 UTC Journal file used for initial testing of depth based on layer thickness test_edges.jnl.txt