question about the caculating of om_p, om_u, on_p, on_u

Discussion about tangent linear and adjoint models, variational data assimilation, and other related issues.

Moderators: arango, robertson

Post Reply
Message
Author
xiaozhu557
Posts: 62
Joined: Fri Sep 11, 2009 1:48 pm
Location: nmefc

question about the caculating of om_p, om_u, on_p, on_u

#1 Post by xiaozhu557 » Mon Mar 26, 2018 7:56 am

Hello everyone,
I am not understand the caculating of om_p, om_u, on_p, on_u, om_v, on_v. In the file mod_grid.F, they are discribed as

Code: Select all

!  om_p       PSI-grid spacing (meters) in the XI-direction.           !
!  om_r       RHO-grid spacing (meters) in the XI-direction.           !
!  om_u       U-grid spacing (meters) in the XI-direction.             !
!  om_v       V-grid spacing (meters) in the XI-direction.             !
!  on_p       PSI-grid spacing (meters) in the ETA-direction.          !
!  on_r       RHO-grid spacing (meters) in the ETA-direction.          !
!  on_u       U-grid spacing (meters) in the ETA-direction.            !
!  on_v       V-grid spacing (meters) in the ETA-direction.            !
and in the file metric.F, the om_r and on_r have been defined as

Code: Select all

om_r(i,j)=1.0_r8/pm(i,j)
on_r(i,j)=1.0_r8/pn(i,j)
It means that om_r=Δx, on_r=Δy. I can understand it. However, the om_u and on_u have been defined as

Code: Select all

om_u(i,j)=2.0_r8/(pm(i-1,j)+pm(i,j))
on_u(i,j)=2.0_r8/(pn(i-1,j)+pn(i,j))
They look like disagree with the defination of U-grid spacing (meters) in the XI/ETA-direction. In this case,

Code: Select all

on_u(i,j)=2*on_r(i,j)*on_r(i-1,j)/(on_r(i,j)+on_r(i-1,j))
.
In my opinion, it should be

Code: Select all

on_u(i,j)=(1/pn(i,j)+1/pn(i-1,j))/2=(on_r(i,j)+on_r(i-1,j))/2
This is the exactly U-grid spacing (meters) in the ETA-direction. Am I right? Or where am I wrong?

jcwarner
Posts: 885
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: question about the caculating of om_p, om_u, on_p, on_u

#2 Post by jcwarner » Mon Mar 26, 2018 11:49 am

the metrics are computed in a way that is consistent in the code, and needs to be this way for mass conservation properties. Here is a post from 2003 on the similar issue:
viewtopic.php?f=19&t=150&view=next

User avatar
wilkin
Posts: 560
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: question about the caculating of om_p, om_u, on_p, on_u

#3 Post by wilkin » Tue Mar 27, 2018 5:13 am

Those comments

Code: Select all

!  om_r   RHO-grid spacing (meters) in the XI-direction.                 !
should read

Code: Select all

!  om_r   reciprocal of RHO-grid spacing (meters^-1) in the XI-direction.!
The "o" is for "over" as in "one over m" (1/m). You will see this usage throughout the code.

The way these terms are computed at points other than the RHO cells where pm,pn are defined are as they are, as John Warner notes, for reasons of conservation in the discrete code.

The usage "pm" in place of "m" for 1/dx stems from historical predecessor codes to ROMS, where the FORTRAN implicit definition for all variables starting with characters I through N was type INTEGER, and all other variables was type REAL.

Safe FORTRAN practice is always to define IMPLICIT NONE, and declare all variables (as we do in ROMS).
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

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

Re: question about the caculating of om_p, om_u, on_p, on_u

#4 Post by kate » Tue Mar 27, 2018 6:01 am

wilkin wrote:Those comments

Code: Select all

!  om_r   RHO-grid spacing (meters) in the XI-direction.                 !
should read

Code: Select all

!  om_r   reciprocal of RHO-grid spacing (meters^-1) in the XI-direction.!
The "o" is for "over" as in "one over m" (1/m). You will see this usage throughout the code.
Actually, "om" is one over m, where m is one over dx, so the original comment is correct.

It's true that these codes have a lot of baggage from the past.

User avatar
wilkin
Posts: 560
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: question about the caculating of om_p, om_u, on_p, on_u

#5 Post by wilkin » Tue Mar 27, 2018 10:44 am

You are quite right Kate - my mistake. Two wrongs don't make a right, but three rights make a left. So one over one over DX is DX.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

xiaozhu557
Posts: 62
Joined: Fri Sep 11, 2009 1:48 pm
Location: nmefc

Re: question about the caculating of om_p, om_u, on_p, on_u

#6 Post by xiaozhu557 » Tue Mar 27, 2018 1:39 pm

I have got it. Thanks all your replying. :)

Post Reply