Calculation of river discharge with ROMS outputs

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
taowang
Posts: 15
Joined: Mon Dec 10, 2012 3:28 pm
Location: Woods Hole Oceanographic Institution

Calculation of river discharge with ROMS outputs

#1 Unread post by taowang »

River discharge.tiff
Dear all:
I am calculating the river discharge with ROMS output. But the river discharge I acquired was not smooth along the channel. I have tried to look for many reasons, but they did not work. Does anyone come across the same problem as mine?
Thank you for your time.
Below is my main code. I calculate the river discharge by using matlab:
%%%the size of v is [38(cross-channel) 643(along-channel) 16(vertical) 60(time(hours))] and zeta is [38 644 60]
%%%I make 25 hours averaged to be the tidally averaged
pm=get_var(cdf_info,'pm');
vbar=get_var(cdf_info,'vbar');
zeta=denanize(zeta,0); %%%to make the nan to 0
vbar=denanize(vbar,0);
hv=(h(:,1:643)+h(:,2:644))/2;
dxv=2./(pm(:,1:643)+pm(:,2:644));
zetav=(zeta(:,1:643,:)+zeta(:,2:644,:))/2;
Q=squeeze(sum(vbar.*(repmat(hv,[1,1,60])+zetav).*repmat(dxv,[1,1,60])));
Qr=meang(Q(:,1:25),2);

taowang
Posts: 15
Joined: Mon Dec 10, 2012 3:28 pm
Location: Woods Hole Oceanographic Institution

Re: Calculation of river discharge with ROMS outputs

#2 Unread post by taowang »

onegrid(1,400)dxdy.tiff
onegrid(2,400)dxdy.tiff
Dear all:
I have found why there are so many peaks. Because u(1,:,:,:) are zeros even not in land. And I checked the depth-averaged continuity equation for the grid (1,400). It is not closed just because of ubar(1,400,:) are zeros. For other grids, such as grid (2,400),the depth-averaged continuity equation is closed. Just like the attachment.
So why the u(1,:,:,:) in output are zeros, even not in land.
Thank you very much.
Yours sincerely,
Tao

taowang
Posts: 15
Joined: Mon Dec 10, 2012 3:28 pm
Location: Woods Hole Oceanographic Institution

Re: Calculation of river discharge with ROMS outputs

#3 Unread post by taowang »

The size of ubar is (37,644,60) and zeta is (38,644,60). zeta(1,:,:) are not zeros when there are no lands. So I don't think ubar(1,:,:) is the boundary.

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

Re: Calculation of river discharge with ROMS outputs

#4 Unread post by kate »

In ROMS, variables are dimensioned for a staggered grid, the numbering starting at i=0 for some, at i=1 for others. This is possible to do in Fortran. When reading ROMS input into other tools like Python and Matlab, all variables start with the same index. I don't remember what it is in Matlab, but in C and Python, all variables start at i=0. That means that preprocessing code must take that into account: the range of u indices becomes 0 to 36 instead of 1 to 37 while the zeta indices remain 0 to 37 for 38 values.

taowang
Posts: 15
Joined: Mon Dec 10, 2012 3:28 pm
Location: Woods Hole Oceanographic Institution

Re: Calculation of river discharge with ROMS outputs

#5 Unread post by taowang »

grids.JPG
Thank you for your reply, Kate.
So does it mean ubar(1,:,:) in Matlab is the same as ubar(0,:,:) in Fortran? In the output, the length of the first dimension of u is 37, and zeta is 38.I think the positions of u and zeta in output are like the figure I upload. Am I right? If I am right, the problem is that, u(1,:) are all zeros, but zeta(1,:) and v(1,:) are not zeros. And when I calculate the continuity equation for the grids in the first row,such as grid (1,2), the continuity equation is not closed.

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

Re: Calculation of river discharge with ROMS outputs

#6 Unread post by kate »

The ROMS view is shown here:
Image

taowang
Posts: 15
Joined: Mon Dec 10, 2012 3:28 pm
Location: Woods Hole Oceanographic Institution

Re: Calculation of river discharge with ROMS outputs

#7 Unread post by taowang »

The grids I sent is in matlab.Maybe there is something wrong in the output data. Thank you very much for your help, Kate.

Post Reply