Zafer
With (i, j) notation:
Indexing in ROMS (if working on ROMS code or defining inputs in analytical modules or NetCDF files):
Code: Select all
--------v(i,j+1,k)---------
| |
u(i,j,k) r(i,j,k) u(i+1,j,k)
| |
---------v(i,j,k)----------
Indexing in MATLAB (for post processing, analsis and plotting purposes):
Code: Select all
--------v(j+1,i+1,k)---------
| |
u(j+1,i,k) r(j+1,i+1,k) u(j+1,i+1,k)
| |
---------v(j,i+1,k)----------
Example with (xi, eta) notation:
in ROMS:
Code: Select all
......................v(80,55)...............
u(80,54).....rho(xi= 80,eta= 54).....u(81,54)
......................v(80,54)...............
in MATLAB:
Code: Select all
...................v(55,81)..................
u(55,80).....rho(eta= 55,xi= 81).....u(55,81)
...................v(54,81)..................
Explanation:
1. Array indices start from 1 in MATLAB.
2. Array indices start from 0 in Fortran (ROMS).
3. Array dimensions are flipped between MATLAB (eta, xi) and ROMS (xi, eta) notations.
4. rho point indices in MATLAB are one more of what they are in ROMS. i.e.
Code: Select all
ROMS(xi, eta) -> MATLAB(eta+1, xi+1)
5. For u and v points this is slightly difference since these arrays have one member short in one of their dimensions. ROMS solves hydrodynamic equations over the interior points (i=1:Lm and j=1:Nm) for a full grid size of (i=0:L, j=0:M). i.e. Lm=L-1, Mm=M-1 and full range rho(0:L, 0:M), whereas, u(1:Lm, 0:M), v(0:L,1:M). See [url=https://www.myroms.org/wiki/index.php/Numerical_Solution_Technique]here[/url] for more details.
e.g.
Lm=158 means 1:158 interior points in ROMS which corresponds to 0:159 full range points in ROMS and 1:160 full range points in MATLAB.
[b]Additional Notes:
[/b]1. Assume that the cell with rho(xi= 80,eta= 54) in the above example is a wet cell neighboring a land masked cell with rho(xi= 79,eta= 54) on the east of it. If defining a river / point source coming in from the east the location will be as river_Xposition=80, river_Eposition=54 in ROMS river input file.
2. You can test your river / point source indices by running map_rivers.m code, which can be found on [url=https://www.myroms.org/forum/viewtopic.php?f=14&t=2200]this post.[/url]