Doing zonal average in the source code (in step3d_t.F)

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
schen
Posts: 29
Joined: Wed Feb 09, 2005 6:34 pm
Location: WHOI

Doing zonal average in the source code (in step3d_t.F)

#1 Unread post by schen »

Hi all,

I’m simulating a barocliniczlly unstable flow in an E-W periodic channel. I’d like to restore the zonal mean (in I-direction) density to a prescribed climatology. I have modified “step3d_t.F” to do zonal average in the following way, but I worry if the implementation is correct. I’d really appreciate if people in the community could take a look and let me know if I have done something wrong. Thanks

Implementation:

1. Because I’d like to run the application in parallel mode and I don’t have good enough understanding of ROMS indices (like Istr, Iend, etc), I use NtileI = 1, NtileJ > 1 so that my Itile = 0 and cover the whole domain in I-direction.

2. In step3d_t.F, the following modifications are made

(A) adding working arrays

Code: Select all

      real(r8), dimension(JminS:JmaxS,0:N(ng)) :: AvgNudg    ! storing zonal mean salinity (s)
      real(r8) :: sumSaltDx, sumDx                           ! sum(s*dx) sum(dx)
(B) doing zonal mean and then doing nudging

Code: Select all

!
!  Nudge towards tracer climatology.
!
        IF (LtracerCLM(itrc,ng).and.LnudgeTCLM(itrc,ng)) THEN

! Doing zonal average of tracer (salinity here)
         DO k=1,N(ng)
           DO j=JstrR,JendR
                sumSaltDx=0.0_r8
                sumDx=0.0_r8
                DO i=IstrR,IendR
                  sumSaltDx = sumSaltDx +1.0_r8/pm(i,j)*t(i,j,k,nnew,itrc)     ! sum of s*dx
                  sumDx     = sumDx     +1.0_r8/pm(i,j)                                   ! sum of dx
                END DO
                AvgNudg(j,k) = sumSaltDx/sumDx          ! zonal mean salinity
            END DO
          END DO


! tclm(i,j,k,ic) - AvgNudg(j,k) is the difference between zonal mean salinity & climatology
          DO k=1,N(ng)
            DO j=JstrR,JendR
              DO i=IstrR,IendR
                t(i,j,k,nnew,itrc)=t(i,j,k,nnew,itrc)+                  &
     &                             dt(ng)*                              &
     &                             CLIMA(ng)%Tnudgcof(i,j,k,ic)*        &
     &                             (CLIMA(ng)%tclm(i,j,k,ic)-           &
     &                              AvgNudg(j,k))
              END DO
            END DO
          END DO
        END IF

Questions:

1. Is the above implementation correct ?

The test simulations look reasonable to me, but it’s hard to tell if the details are correct.


2. The implementation requires NtileI = 1. There should be better ways to do zonal average in the source code. Any suggestions?

Thanks in advance.

------ Shih-Nan

Post Reply