Indexing in ROMS

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
richard.schmalz
Posts: 24
Joined: Thu Oct 04, 2007 4:14 am
Location: NOAA

Indexing in ROMS

#1 Unread post by richard.schmalz »

How are the u and v masks created from the rho mask. It appears that u and v masks are to the right and top of the computational stencil.



-----------UMASK(i-1,j).......RHOMASK(i,j).........UMASK(i,j)------------ Mask

Analogous for the VMASK with the role of i and j interchanged.

In the computational stencil:

--------------------U(i,j)..............RHO(i,j).............U(i+1,j)------------Stencil

Analogous for V with the role of i and j interchanged.

Is this interpretation correct? This comes into play when specifying the (I,J) locations for river inputs, which do not appear to correspond with the UMASK or VMASK?

Is there some further documentation or information on how to specify the locations for river inflows and on the relationship between the computational stencil I,J indexing in the numerical scheme and the I,J indexing for the masks?

Any information would be much appreciated. Thanks....Dick Schmalz

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

#2 Unread post by kate »

Actually, we think of it as:

-----------UMASK(i,j).......RHOMASK(i,j).........UMASK(i+1,j)------------ Mask

-------------------U(i,j)..............RHO(i,j).............U(i+1,j)------------Stencil

With U/Umask starting at 1 and rho starting at 0. However, the netcdf files will internally start all fields at 0, which may be confusing if you are working from them. The rivers are at the U and V points, specified by an i,j pair. This is not unique though, so you need another flag to say whether it is a U point source or a V point source. Have I answered all your questions or are you looking for tools too?

richard.schmalz
Posts: 24
Joined: Thu Oct 04, 2007 4:14 am
Location: NOAA

#3 Unread post by richard.schmalz »

So are these diagrams correct?

------U(i,j)..................Rho(i,j).................U(i+1,j)
UFLOW..............Rmask(i,j)..............Umask(i+1,j)


------U(i,j)...................Rho(i,j).................U(i+1,j)
Umask(i,j)............Rmask(i,j)................-UFLOW

Where UFLOW is the discharge in m3/s for river input.

For the top case Rmask(i-1,j)=0 and for the bottom case Rmask(i+1,j)=0.

I am still confused with the netCDF file and ROMS indexing

Rho points in Eta direction go from 0 to NY-1 in ROMS but are dimensioned NY in the netCDF file
Rho points in Xi direction go from 0 to NX-1 in ROMS but are dimensioned NX in netCDF file

U points in the Xi direction go from 1 to NX-1 in ROMS and are dimensioned NX-1 in the netCDF file and go from 0 to NX-2
U points in the Eta direction go from 0 to NY-1 in both ROMS and netCDF?

Is there any documentation on this? This would be extremely useful for
boundary condition application. How can I learn more on this topic in ROMS.

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

#4 Unread post by kate »

That all looks right. Does this figure help?
Image

The plan is to have a ROMS manual by a year from now, with things getting into and out of it to/from the wiki. These indexing issues haven't changed in a decade, though, so any old documentation you might find is still valid.

richard.schmalz
Posts: 24
Joined: Thu Oct 04, 2007 4:14 am
Location: NOAA

#5 Unread post by richard.schmalz »

Hi All,
Kate....Thanks for the picture. I am assuming that the netCDF files in ROMS read and write information only in the white area of the figure.
This also appears to be further documented in the C-grid figure within mod_param.F.

For RHO point information, one goes from 1, Lm and 1, Mm
Lm is denoted as NX and Mm is denoted as NY. Within the netCDF file itself the indicies go from 0 to NX-1 and 0 to NY-1.

For U point information, one goes from 2, Lm and 1, Mm. Within the netCDF file itself the indicies go from 0 to NX-2 and 0 to NY-1.

For V point information, the indicies are analogous to the U point information.

The reason for concern here is in the preparation and interpretation of the ROMS netCDF files. I am developing several Fortran wrapper routines to generate the necessary ROMS input netCDF files and for interpreting the ROMS netCDF files. I believe that for a RHO variable, in the Fortran program, I dimension S(NX,NY,NZ), that if I create dimensions of NX, NY, and NZ in the netCDF file, that I may just use nf_put_vara_double(S) to place the S field within the netCDF file and that ROMS will interpret the field correctly. Similarly for a U variable, in the Fortran program, I dimension UV(NXM,NY,NZ), that if I create dimensions NXM=NX-1, NY, and NX in the netCDF file, that I may just use nf_put_vara_double(UV) to place the UV field within the netCDF file and that ROMS will interpret the field correctly.

Please let me know, if my understanding of this indexing is correct.
Thanks for your help.....Dick Schmalz

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

#6 Unread post by kate »

The white areas of the figure are computed, but most fields that ROMS reads in are dimensioned according to that whole grid (Lm+2, Mm+2). Even the winds, which eventually need to end up at u, v points, start on rho points with the dimension (Lm+2, Mm+2) even though the outer ones may not actually be needed for anything. They are then rotated (if necessary) before averaging them onto the respective u and v grids.

Check the directory Data/ROMS/CDL for examples of how the netcdf files should look on an "ncdump -h". Here, xi_rho = Lm+2, eta_rho = Mm+2, and s_rho = N.

Post Reply