Grid cell volume

Facts, news, and guidance about ROMS software

Moderators: arango, robertson

Post Reply
Message
Author
zanzigr
Posts: 2
Joined: Mon Jun 23, 2003 9:35 pm
Location: University of Washington

Grid cell volume

#1 Unread post by zanzigr »

Is there an easy way to find the grid cell volumes of an entire grid? I'm looking to find the volume of a water mass and this would make things very simple.

I'm not sure I completely understand the geometry involved, so I'm having a hard time figuring out how to calculate it. Surely the code has to do this somewhere...

Thanks,
Rebecca

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

#2 Unread post by kate »

The volume of a grid cell is (h+zeta)/(pm*pn). Look at how the diagnostic my_volume is computed for the entire domain in diag.F. In 3-D, the vertical sum of Hz should be equal to (h+zeta), as should z_w(N)-z_w(0).

zanzigr
Posts: 2
Joined: Mon Jun 23, 2003 9:35 pm
Location: University of Washington

#3 Unread post by zanzigr »

It seems to me that this computes the volume for the entire water column. How, then, does this get split between the different vertical levels?

In other words, if I want the volume at i=1, j=1 and N=12 (of 20), how do I find this?

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

#4 Unread post by kate »

The vertical delta z is Hz(i,j,k).

stef
Posts: 175
Joined: Tue Mar 13, 2007 6:38 pm
Location: Independent researcher
Contact:

#5 Unread post by stef »

Hi!
I still use version 2.2, and don't know if anything has changed in the new version.

In mod_grid.F there are some variables defined, three of them are:

Hz: Thickness of vertical rho-Points
Huon: Total u-Momentum Flux term: interpolated(Hz)*u*dy (dy is the same as 1/pn, at least for a rectilinear grid, I don't know anything about curvilinear setups)
Hvom: interpolated(Hz)*v*dx

The 'allocate' functions in that file allocate N vertical levels for each i,j for each one of those variables.

Roms uses a staggered grid (see http://marine.rutgers.edu/po/documentat ... =technique ).
Hz is, as documented in mod_grid, the thickness at rho points (thickness means cell hight). But due to the staggered grid, there is a different thickness at the neighbouring u and v points.
For example, take the Finite-Volume formulation for a tracer. Tracers are defined on rho-points, so the cell must be constructed in a way that it's center is a rho-point. Now the in- and outflow of the cell has to be calculated, to update the tracer. The in- and outflow has to be calculated on the cell boundaries, and in the case of a staggered grid, that's where the u- and v- points are located. To calculate the inflow per second, one has to multiply area*velocitynormal*tracer. Area is dx*Height or dy*Height, but one needs the hight at VELOCITY-points, not at rho points, so one has to linearly interpolate Hz between neighbouring rho-point-Heights (e.g, in set_massflux).

One problem in the above explanation is that cell heights are changing during a 3d-timestep, and if I understood correctly, the massflux for calculating tracer-flux is averaged in fast barotropic time to the middle of the flux-period. That means, in the equation for tracer-update you will find the following cell-heights:
one in the middle of the cell at time n to calculate the old volume of the grid cell.
one in the middle of the cell at time n+1, to calculate new volume.
one at each boundary at time n+1/2, for the inflow-area.

The second of the above is also calculated with the barotropic time steps, but with different weights as the third.

See the Shchepetkin-McWilliams 2005 paper for more info.

For the momentum equations, things are similar, I think, exept that now the cell boundaries coincide with rho points, so no need to interpolate the cellheights.

The above is all simplified, but what I want to say is that one has to take care at what time and at what location to define the height.

I hope I could help you, I spent some weeks to find out what I just wrote (and even now i don't know if it's right or not... :wink: )
--Stefan

stef
Posts: 175
Joined: Tue Mar 13, 2007 6:38 pm
Location: Independent researcher
Contact:

#6 Unread post by stef »

I think that what I wrote above only makes sense for 2nd order centered advection, both for velocity and tracers.

AlexisEspinosa
Posts: 23
Joined: Fri May 24, 2013 3:05 am
Location: UWA

Re: Grid cell volume

#7 Unread post by AlexisEspinosa »

Can Hz be saved in the history files?
Or is set_depth function the only way to obtain it for postprocessing?

Many thanks.
Alexis

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Grid cell volume

#8 Unread post by kate »

One could add the writing of Hz to def_his.F and wrt_his.F. You'd also have to invent an id tag for it, put it in varinfo.dat and read it where they get read. Also check the Hout(idHz) in read_phypar.F. You can grep for one like idDano to see how it's done. Note that Hernan believes the id tags should all be six characters long, so perhaps idHzee or idHzed? :roll:

Most of us have postprocessing tools that know how to compute Hz, be it Matlab or whatever. Or one colleague asks me to write a static file of the z_rho, z_w appropriate for zeta=0 which I do with a Python script.

Post Reply