How does it realize the continuity equation in ROMS?

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

How does it realize the continuity equation in ROMS?

#1 Unread post by taowang »

Dear everyone:
I am calculating the integrated continuity equation and total transport flux with the ROMS output. When I calculate the integrated continuity equation, it is hardly closed. But when I calculate the net transport flux and the time variation of the volume in one grid, they are balanced well. Of course, I did them with the transformed equation in s-coordinate. Is this because that the grid is not exactly square to make the directly calculated continuity equation not closed?
Thank you for your time.
Yours sincerely,
Tao

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

Re: How does it realize the continuity equation in ROMS?

#2 Unread post by taowang »

And where can I acquire the magnitude of "m and n" in the transformation of equations in s-coordinate?

zhzhlin
Posts: 6
Joined: Thu Mar 01, 2012 2:28 pm
Location: California Department of Water Resources

Re: How does it realize the continuity equation in ROMS?

#3 Unread post by zhzhlin »

I am also doing the same calculation. I believe you can output 'pm' and 'pn' from average or history nc files. Did you check mass conservation for one grid cell?

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

Re: How does it realize the continuity equation in ROMS?

#4 Unread post by taowang »

I calculated it both in one grid and in one section. As we know, pm and pn are related to the density locations. But in C grid, u and v points locations are different from the locations of density. How can we know the pm and pn related to the u and v locations? That is to say, in the continuity equation in s-coordinate, "u*Hz/n", what should be the n is? pn(i,j) or pn(i+1,j) or (pn(i,j)+pn(i+1,j))/2, or other values? Thank you.

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

Re: How does it realize the continuity equation in ROMS?

#5 Unread post by kate »

Our grid numbering is such that u(i,j) is between rho(i,j) and rho(i-1,j). If you look through the code, you will see that pm at u points is always computed as an average of pm(i,j) and pm(i-1,j).

ETA: that said, that assumes you read the roms variables as ROMS does. If you read them as Python or Matlab does, you need to average with pm(i,j) and pm(i+1,j).

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

Re: How does it realize the continuity equation in ROMS?

#6 Unread post by taowang »

Thank you very much. Which file is the code in? I am a beginner. I looked for them for a long time, but I did not find them.

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

Re: How does it realize the continuity equation in ROMS?

#7 Unread post by taowang »

And I have seen that the calculation of total depth and vertically integrated mass flux in step2d_LF_AM3.h. The code is like this:
DO j=-1+J_RANGE+1
DO i=-2+I_RANGE+1
cff=0.5_r8*om_v(i,j)
cff1=cff*(Drhs(i,j)+Drhs(i,j-1))
DVom(i,j)=vbar(i,j,krhs)*cff1
# ifdef NEARSHORE_MELLOR
DVSom(i,j)=vbar_stokes(i,j)*cff1
DVom(i,j)=DVom(i,j)+DVSom(i,j)
# endif
END DO
END DO
But how does it calculate om_v, I did not find it. Thank you for your time.

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

Re: How does it realize the continuity equation in ROMS?

#8 Unread post by kate »

I find things like this by using grep from the top of the ROMS source tree:

Code: Select all

grep om_v */*/*
ROMS/Utility/metrics.F:      real(r8), intent(out) :: om_v(LBi:,LBj:)
and many other lines...

Maybe it would be better to refine it:

Code: Select all

kate@ThinkPad-W520:~/roms/feedme$ grep om_v */*/* | grep intent\(out\)
ROMS/Utility/metrics.F:      real(r8), intent(out) :: om_v(LBi:,LBj:)
ROMS/Utility/metrics.F:      real(r8), intent(out) :: pnom_v(LBi:,LBj:)
ROMS/Utility/metrics.F:      real(r8), intent(out) :: om_v(LBi:UBi,LBj:UBj)
ROMS/Utility/metrics.F:      real(r8), intent(out) :: pnom_v(LBi:UBi,LBj:UBj)

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

Re: How does it realize the continuity equation in ROMS?

#9 Unread post by taowang »

Thank you.

Post Reply