/[MITgcm]/MITgcm/model/src/dynamics.F
ViewVC logotype

Diff of /MITgcm/model/src/dynamics.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.51 by heimbach, Wed Jun 21 20:46:31 2000 UTC revision 1.54.2.4 by adcroft, Tue Jan 9 15:44:59 2001 UTC
# Line 20  C     | ===== Line 20  C     | =====
20  C     | C*P* comments indicating place holders for which code is |  C     | C*P* comments indicating place holders for which code is |
21  C     |      presently being developed.                          |  C     |      presently being developed.                          |
22  C     \==========================================================/  C     \==========================================================/
 c  
 c     changed: Patrick Heimbach heimbach@mit.edu 6-Jun-2000  
 c              - computation of ikey wrong for nTx,nTy > 1  
 c                and/or nsx,nsy > 1: act1 and act2 were  
 c                mixed up.  
   
23        IMPLICIT NONE        IMPLICIT NONE
24    
25  C     == Global variables ===  C     == Global variables ===
# Line 37  C     == Global variables === Line 31  C     == Global variables ===
31  #include "GRID.h"  #include "GRID.h"
32    
33  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
34  #include "tamc.h"  # include "tamc.h"
35  #include "tamc_keys.h"  # include "tamc_keys.h"
36    #endif /* ALLOW_AUTODIFF_TAMC */
37    
38    #ifdef ALLOW_KPP
39    # include "KPP.h"
40  #endif  #endif
41    
42  C     == Routine arguments ==  C     == Routine arguments ==
# Line 90  C     KappaRS          (background + spa Line 88  C     KappaRS          (background + spa
88  C     iMin, iMax     - Ranges and sub-block indices on which calculations  C     iMin, iMax     - Ranges and sub-block indices on which calculations
89  C     jMin, jMax       are applied.  C     jMin, jMax       are applied.
90  C     bi, bj  C     bi, bj
91  C     k, kUp,        - Index for layer above and below. kUp and kDown  C     k, kup,        - Index for layer above and below. kup and kDown
92  C     kDown, kM1       are switched with layer to be the appropriate  C     kDown, km1       are switched with layer to be the appropriate
93  C                      index into fVerTerm.  C                      index into fVerTerm.
94        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
95        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 119  C                      index into fVerTe Line 117  C                      index into fVerTe
117        _RL buoyKM1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL buoyKM1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
118        _RL buoyK   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL buoyK   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
119        _RL rhotmp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhotmp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
       _RL etaSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL etaSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
120        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
121        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
122        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
# Line 129  C                      index into fVerTe Line 125  C                      index into fVerTe
125        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
126        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
127    
128  #ifdef INCLUDE_CONVECT_CALL  C This is currently also used by IVDC and Diagnostics
129    C #ifdef INCLUDE_CONVECT_CALL
130        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
131  #endif  C #endif
132    
133        INTEGER iMin, iMax        INTEGER iMin, iMax
134        INTEGER jMin, jMax        INTEGER jMin, jMax
135        INTEGER bi, bj        INTEGER bi, bj
136        INTEGER i, j        INTEGER i, j
137        INTEGER k, kM1, kUp, kDown        INTEGER k, km1, kup, kDown
       LOGICAL BOTTOM_LAYER  
138    
139  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
140        INTEGER    isbyte        INTEGER    isbyte
# Line 148  C                      index into fVerTe Line 144  C                      index into fVerTe
144        INTEGER max1, max2, max3        INTEGER max1, max2, max3
145        INTEGER iikey, kkey        INTEGER iikey, kkey
146        INTEGER maximpl        INTEGER maximpl
147  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
148    
149  C---    The algorithm...  C---    The algorithm...
150  C  C
# Line 163  C Line 159  C
159  C       "Calculation of Gs"  C       "Calculation of Gs"
160  C       ===================  C       ===================
161  C       This is where all the accelerations and tendencies (ie.  C       This is where all the accelerations and tendencies (ie.
162  C       phiHydysics, parameterizations etc...) are calculated  C       physics, parameterizations etc...) are calculated
163  C         rVel = sum_r ( div. u[n] )  C         rVel = sum_r ( div. u[n] )
164  C         rho = rho ( theta[n], salt[n] )  C         rho = rho ( theta[n], salt[n] )
165  C         b   = b(rho, theta)  C         b   = b(rho, theta)
# Line 198  C--- Line 194  C---
194  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
195  C--   dummy statement to end declaration part  C--   dummy statement to end declaration part
196        ikey = 1        ikey = 1
197  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
198    
199  C--   Set up work arrays with valid (i.e. not NaN) values  C--   Set up work arrays with valid (i.e. not NaN) values
200  C     These inital values do not alter the numerical results. They  C     These inital values do not alter the numerical results. They
# Line 218  C     uninitialised but inert locations. Line 214  C     uninitialised but inert locations.
214          pTerm(i,j)   = 0. _d 0          pTerm(i,j)   = 0. _d 0
215          fZon(i,j)    = 0. _d 0          fZon(i,j)    = 0. _d 0
216          fMer(i,j)    = 0. _d 0          fMer(i,j)    = 0. _d 0
217          DO K=1,Nr          DO k=1,Nr
218           phiHyd (i,j,k)  = 0. _d 0           phiHyd (i,j,k)  = 0. _d 0
219           KappaRU(i,j,k) = 0. _d 0           KappaRU(i,j,k) = 0. _d 0
220           KappaRV(i,j,k) = 0. _d 0           KappaRV(i,j,k) = 0. _d 0
# Line 239  C     uninitialised but inert locations. Line 235  C     uninitialised but inert locations.
235    
236  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
237  C--   HPF directive to help TAMC  C--   HPF directive to help TAMC
238  !HPF$ INDEPENDENT  CHPF$ INDEPENDENT
239  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
240    
241        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
242    
243  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
244  C--    HPF directive to help TAMC  C--    HPF directive to help TAMC
245  !HPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV  CHPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV
246  !HPF$&                  ,phiHyd,  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA
247  !HPF$&                  ,utrans,vtrans,maskc,xA,yA  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV
248  !HPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV  CHPF$&                  )
249  !HPF$&                  )  #endif /* ALLOW_AUTODIFF_TAMC */
 #endif  
250    
251         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
252    
# Line 270  C--    HPF directive to help TAMC Line 265  C--    HPF directive to help TAMC
265            ikey = (act1 + 1) + act2*max1            ikey = (act1 + 1) + act2*max1
266       &                      + act3*max1*max2       &                      + act3*max1*max2
267       &                      + act4*max1*max2*max3       &                      + act4*max1*max2*max3
268  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
269    
270  C--     Set up work arrays that need valid initial values  C--     Set up work arrays that need valid initial values
271          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
# Line 308  C--     Set up work arrays that need val Line 303  C--     Set up work arrays that need val
303          jMax = sNy+OLy          jMax = sNy+OLy
304    
305    
306          K = 1  C--     Start of diagnostic loop
307          BOTTOM_LAYER = K .EQ. Nr          DO k=Nr,1,-1
   
 #ifdef DO_PIPELINED_CORRECTION_STEP  
 C--     Calculate gradient of surface pressure  
         CALL CALC_GRAD_ETA_SURF(  
      I       bi,bj,iMin,iMax,jMin,jMax,  
      O       etaSurfX,etaSurfY,  
      I       myThid)  
 C--     Update fields in top level according to tendency terms  
         CALL CORRECTION_STEP(  
      I       bi,bj,iMin,iMax,jMin,jMax,K,  
      I       etaSurfX,etaSurfY,myTime,myThid)  
   
 #ifdef ALLOW_OBCS  
         IF (openBoundaries) THEN  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte  
 #endif  
            CALL APPLY_OBCS1( bi, bj, K, myThid )  
         END IF  
 #endif  
   
         IF ( .NOT. BOTTOM_LAYER ) THEN  
 C--      Update fields in layer below according to tendency terms  
          CALL CORRECTION_STEP(  
      I        bi,bj,iMin,iMax,jMin,jMax,K+1,  
      I        etaSurfX,etaSurfY,myTime,myThid)  
 #ifdef ALLOW_OBCS  
          IF (openBoundaries) THEN  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte  
 #endif  
             CALL APPLY_OBCS1( bi, bj, K+1, myThid )  
          END IF  
 #endif  
         ENDIF  
 #endif  
 C--     Density of 1st level (below W(1)) reference to level 1  
 #ifdef  INCLUDE_FIND_RHO_CALL  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE salt (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 #endif  
         CALL FIND_RHO(  
      I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,  
      O     rhoKm1,  
      I     myThid )  
 #endif  
   
         IF (       (.NOT. BOTTOM_LAYER)  
      &     ) THEN  
 C--      Check static stability with layer below  
 C--      and mix as needed.  
 #ifdef  INCLUDE_FIND_RHO_CALL  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE salt (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  
 #endif  
          CALL FIND_RHO(  
      I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,  
      O      rhoKp1,  
      I      myThid )  
 #endif  
   
 #ifdef  INCLUDE_CONVECT_CALL  
   
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE rhoKm1(:,:)  = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE rhoKp1(:,:)  = comlev1_2d, key = ikey, byte = isbyte  
 #endif  
          CALL CONVECT(  
      I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,  
      U       ConvectCount,  
      I       myTime,myIter,myThid)  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE theta(:,:,k+1,bi,bj),theta(:,:,k,bi,bj)  
 CADJ &     = comlev1_2d, key = ikey, byte = isbyte  
 CADJ STORE salt (:,:,k+1,bi,bj),salt (:,:,k,bi,bj)  
 CADJ &     = comlev1_2d, key = ikey, byte = isbyte  
 #endif  
   
 #endif  
   
 C--      Implicit Vertical Diffusion for Convection  
          IF (ivdc_kappa.NE.0.) CALL CALC_IVDC(  
      I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,  
      U       ConvectCount, KappaRT, KappaRS,  
      I       myTime,myIter,myThid)  
 CRG: do we need do store STORE KappaRT, KappaRS ?  
   
 C--      Recompute density after mixing  
 #ifdef  INCLUDE_FIND_RHO_CALL  
          CALL FIND_RHO(  
      I      bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,  
      O      rhoKm1,  
      I      myThid )  
 #endif  
         ENDIF  
 C--     Calculate buoyancy  
         CALL CALC_BUOYANCY(  
      I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,  
      O      buoyKm1,  
      I      myThid )  
 C--     Integrate hydrostatic balance for phiHyd with BC of  
 C--     phiHyd(z=0)=0  
         CALL CALC_PHI_HYD(  
      I      bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1,  
      U      phiHyd,  
      I      myThid )  
         CALL GRAD_SIGMA(  
      I            bi, bj, iMin, iMax, jMin, jMax, K,  
      I            rhoKm1, rhoKm1, rhoKm1,  
      O            sigmaX, sigmaY, sigmaR,  
      I            myThid )  
   
 C--     Start of downward loop  
         DO K=2,Nr  
308    
309  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
310    C? Patrick, is this formula correct now that we change the loop range?
311    C? Do we still need this?
312           kkey = (ikey-1)*(Nr-2+1) + (k-2) + 1           kkey = (ikey-1)*(Nr-2+1) + (k-2) + 1
313  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
   
          BOTTOM_LAYER = K .EQ. Nr  
314    
 #ifdef DO_PIPELINED_CORRECTION_STEP  
          IF ( .NOT. BOTTOM_LAYER ) THEN  
 C--       Update fields in layer below according to tendency terms  
           CALL CORRECTION_STEP(  
      I         bi,bj,iMin,iMax,jMin,jMax,K+1,  
      I         etaSurfX,etaSurfY,myTime,myThid)  
315  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
316    C--       Calculate future values on open boundaries
317            IF (openBoundaries) THEN            IF (openBoundaries) THEN
318  #ifdef ALLOW_AUTODIFF_TAMC  Caja        CALL CYCLE_OBCS( k, bi, bj, myThid )
319  CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  c new args! CALL SET_OBCS( k, bi, bj, myTime, myThid )
320  CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  c +deltaT?
321  CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte            ENDIF
 CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte  
 #endif  
              CALL APPLY_OBCS1( bi, bj, K+1, myThid )  
           END IF  
 #endif  
          ENDIF  
 #endif  
   
 C--      Density of K level (below W(K)) reference to K level  
 #ifdef  INCLUDE_FIND_RHO_CALL  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  
 CADJ STORE salt (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  
 #endif  
          CALL FIND_RHO(  
      I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,  
      O      rhoK,  
      I      myThid )  
 #endif  
          IF (       (.NOT. BOTTOM_LAYER)  
      &      ) THEN  
 C--       Check static stability with layer below and mix as needed.  
 C--       Density of K+1 level (below W(K+1)) reference to K level.  
 #ifdef  INCLUDE_FIND_RHO_CALL  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  
 CADJ STORE salt (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  
 #endif  
           CALL FIND_RHO(  
      I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,  
      O       rhoKp1,  
      I       myThid )  
 #endif  
   
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE rhok  (:,:)   = comlev1_3d, key = kkey, byte = isbyte  
 CADJ STORE rhoKm1(:,:)   = comlev1_3d, key = kkey, byte = isbyte  
 CADJ STORE rhoKp1(:,:)   = comlev1_3d, key = kkey, byte = isbyte  
322  #endif  #endif
323    
324  #ifdef  INCLUDE_CONVECT_CALL  C--       Integrate continuity vertically for vertical velocity
325            CALL CONVECT(            CALL INTEGRATE_FOR_W(
326       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,       I                         bi, bj, k, uVel, vVel,
327       U        ConvectCount,       O                         wVel,
328       I        myTime,myIter,myThid)       I                         myThid )
329  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_OBCS
330  CADJ STORE theta(:,:,k+1,bi,bj),theta(:,:,k,bi,bj)            IF (openBoundaries) THEN
331  CADJ &     = comlev1_3d, key = kkey, byte = isbyte  c new subr  CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )
332  CADJ STORE salt (:,:,k+1,bi,bj),salt (:,:,k,bi,bj)            ENDIF
 CADJ &     = comlev1_3d, key = kkey, byte = isbyte  
 #endif  
333  #endif  #endif
334    
335  C--      Implicit Vertical Diffusion for Convection  C--       Calculate gradients of potential density for isoneutral
336           IF (ivdc_kappa.NE.0.) THEN  C         slope terms (e.g. GM/Redi tensor or IVDC diffusivity)
337              CALL CALC_IVDC(            IF ( k.GT.1 .AND. (useGMRedi.OR.ivdc_kappa.NE.0.) ) THEN
338       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,              CALL FIND_RHO(
339       U       ConvectCount, KappaRT, KappaRS,       I        bi, bj, iMin, iMax, jMin, jMax, k, k, eosType,
340       I       myTime,myIter,myThid)       O        rhoK,
 CRG: do we need do store STORE KappaRT, KappaRS ?  
          END IF  
   
 C--       Recompute density after mixing  
 #ifdef  INCLUDE_FIND_RHO_CALL  
           CALL FIND_RHO(  
      I       bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,  
      O       rhoK,  
      I       myThid )  
 #endif  
          ENDIF  
 C--      Calculate buoyancy  
          CALL CALC_BUOYANCY(  
      I       bi,bj,iMin,iMax,jMin,jMax,K,rhoK,  
      O       buoyK,  
      I       myThid )  
 C--      Integrate hydrostatic balance for phiHyd with BC of  
 C--      phiHyd(z=0)=0  
          CALL CALC_PHI_HYD(  
      I        bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK,  
      U        phiHyd,  
341       I        myThid )       I        myThid )
342  C--      Calculate iso-neutral slopes for the GM/Redi parameterisation              CALL FIND_RHO(
343  #ifdef  INCLUDE_FIND_RHO_CALL       I        bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType,
344           CALL FIND_RHO(       O        rhoKm1,
      I        bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,  
      O        rhoTmp,  
345       I        myThid )       I        myThid )
346  #endif              CALL GRAD_SIGMA(
347           CALL GRAD_SIGMA(       I             bi, bj, iMin, iMax, jMin, jMax, k,
348       I             bi, bj, iMin, iMax, jMin, jMax, K,       I             rhoK, rhoKm1, rhoK,
      I             rhoK, rhotmp, rhoK,  
349       O             sigmaX, sigmaY, sigmaR,       O             sigmaX, sigmaY, sigmaR,
350       I             myThid )       I             myThid )
351              ENDIF
352    
353    C--       Implicit Vertical Diffusion for Convection
354              IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN
355                CALL CALC_IVDC(
356         I        bi, bj, iMin, iMax, jMin, jMax, k,
357         I        rhoKm1, rhoK,
358    c should use sigmaR !!!
359         U        ConvectCount, KappaRT, KappaRS,
360         I        myTime, myIter, myThid)
361              END IF
362    
363           DO J=jMin,jMax  C--     end of diagnostic k loop (Nr:1)
           DO I=iMin,iMax  
 #ifdef  INCLUDE_FIND_RHO_CALL  
            rhoKm1 (I,J) = rhoK(I,J)  
 #endif  
            buoyKm1(I,J) = buoyK(I,J)  
           ENDDO  
          ENDDO  
364          ENDDO          ENDDO
 C--     end of k loop  
365    
366  #ifdef ALLOW_GMREDI  #ifdef  ALLOW_GMREDI
367  #ifdef ALLOW_AUTODIFF_TAMC  C--     Calculate iso-neutral slopes for the GM/Redi parameterisation
368  CADJ STORE rhoTmp(:,:)  = comlev1_3d, key = kkey, byte = isbyte          IF (useGMRedi) THEN
369  CADJ STORE rhok  (:,:)  = comlev1_3d, key = kkey, byte = isbyte            DO k=1,Nr
370  CADJ STORE rhoKm1(:,:)  = comlev1_3d, key = kkey, byte = isbyte              CALL GMREDI_CALC_TENSOR(
371  #endif       I             bi, bj, iMin, iMax, jMin, jMax, k,
         DO K=1, Nr  
          IF (use_GMRedi) CALL GMREDI_CALC_TENSOR(  
      I             bi, bj, iMin, iMax, jMin, jMax, K,  
372       I             sigmaX, sigmaY, sigmaR,       I             sigmaX, sigmaY, sigmaR,
373       I             myThid )       I             myThid )
374          ENDDO            ENDDO
375  #endif          ENDIF
376    #endif  /* ALLOW_GMREDI */
377    
378    #ifdef  ALLOW_KPP
379    C--     Compute KPP mixing coefficients
380            IF (useKPP) THEN
381              CALL KPP_CALC(
382         I                  bi, bj, myTime, myThid )
383            ENDIF
384    #endif  /* ALLOW_KPP */
385    
386    C--     Determines forcing terms based on external fields
387    C       relaxation terms, etc.
388            CALL EXTERNAL_FORCING_SURF(
389         I             bi, bj, iMin, iMax, jMin, jMax,
390         I             myThid )
391    
392  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
393  CADJ STORE theta(:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  CADJ STORE KappaRT(:,:,:)     = comlev1_bibj, key = ikey, byte = isbyte
394  CADJ STORE salt (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  CADJ STORE KappaRS(:,:,:)     = comlev1_bibj, key = ikey, byte = isbyte
395  CADJ STORE uvel (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  CADJ STORE theta(:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte
396  CADJ STORE vvel (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte  CADJ STORE salt (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte
397  #endif  CADJ STORE uvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte
398    CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte
399    #endif /* ALLOW_AUTODIFF_TAMC */
400    
 #ifdef ALLOW_KPP  
 C--     Compute KPP mixing coefficients  
         CALL TIMER_START('KPP_CALC               [DYNAMICS]', myThid)  
         CALL KPP_CALC(  
      I               bi, bj, myTime, myThid )  
         CALL TIMER_STOP ('KPP_CALC               [DYNAMICS]', myThid)  
 #endif  
401    
 C--     Start of upward loop  
         DO K = Nr, 1, -1  
402    
403           kM1  =max(1,k-1)   ! Points to level above k (=k-1)  C--     Start of thermodynamics loop
404           kUp  =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above          DO k=Nr,1,-1
405           kDown=1+MOD(k,2)   ! Cycles through 2,1 to point to current layer  
406    C--       km1    Points to level above k (=k-1)
407           iMin = 1-OLx+2  C--       kup    Cycles through 1,2 to point to layer above
408           iMax = sNx+OLx-1  C--       kDown  Cycles through 2,1 to point to current layer
409           jMin = 1-OLy+2  
410           jMax = sNy+OLy-1            km1  = MAX(1,k-1)
411              kup  = 1+MOD(k+1,2)
412              kDown= 1+MOD(k,2)
413    
414              iMin = 1-OLx+2
415              iMax = sNx+OLx-1
416              jMin = 1-OLy+2
417              jMax = sNy+OLy-1
418    
419  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
420    CPatrick Is this formula correct?
421           kkey = (ikey-1)*(Nr-1+1) + (k-1) + 1           kkey = (ikey-1)*(Nr-1+1) + (k-1) + 1
422  #endif  CADJ STORE rvel  (:,:,kDown) = comlev1_bibj_k, key = kkey, byte = isbyte
423    CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte
424  #ifdef ALLOW_AUTODIFF_TAMC  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
425  CADJ STORE rvel  (:,:,kDown)  = comlev1_3d, key = kkey, byte = isbyte  CADJ STORE KappaRS(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
426  CADJ STORE rTrans(:,:)        = comlev1_3d, key = kkey, byte = isbyte  #endif /* ALLOW_AUTODIFF_TAMC */
 CADJ STORE KappaRT(:,:,:)     = comlev1_3d, key = kkey, byte = isbyte  
 CADJ STORE KappaRS(:,:,:)     = comlev1_3d, key = kkey, byte = isbyte  
 #endif  
427    
428  C--      Get temporary terms used by tendency routines  C--      Get temporary terms used by tendency routines
429           CALL CALC_COMMON_FACTORS (           CALL CALC_COMMON_FACTORS (
430       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,
431       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,
432       I        myThid)       I        myThid)
433    
 #ifdef ALLOW_OBCS  
         IF (openBoundaries) THEN  
          CALL APPLY_OBCS3( bi, bj, K, Kup, rTrans, rVel, myThid )  
         ENDIF  
 #endif  
   
434  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
435  C--      Calculate the total vertical diffusivity  C--      Calculate the total vertical diffusivity
436           CALL CALC_DIFFUSIVITY(           CALL CALC_DIFFUSIVITY(
437       I        bi,bj,iMin,iMax,jMin,jMax,K,       I        bi,bj,iMin,iMax,jMin,jMax,k,
438       I        maskC,maskUp,       I        maskC,maskup,
439       O        KappaRT,KappaRS,KappaRU,KappaRV,       O        KappaRT,KappaRS,KappaRU,KappaRV,
440       I        myThid)       I        myThid)
441  #endif  #endif
442  C--      Calculate accelerations in the momentum equations  
443           IF ( momStepping ) THEN  C--      Calculate active tracer tendencies (gT,gS,...)
444            CALL CALC_MOM_RHS(  C        and step forward storing result in gTnm1, gSnm1, etc.
      I         bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,  
      I         xA,yA,uTrans,vTrans,rTrans,rVel,maskC,  
      I         phiHyd,KappaRU,KappaRV,  
      U         aTerm,xTerm,cTerm,mTerm,pTerm,  
      U         fZon, fMer, fVerU, fVerV,  
      I         myTime, myThid)  
 #ifdef ALLOW_AUTODIFF_TAMC  
 #ifdef INCLUDE_CD_CODE  
          ELSE  
             DO j=1-OLy,sNy+OLy  
                DO i=1-OLx,sNx+OLx  
                   guCD(i,j,k,bi,bj) = 0.0  
                   gvCD(i,j,k,bi,bj) = 0.0  
                END DO  
             END DO  
 #endif  
 #endif  
          ENDIF  
 C--      Calculate active tracer tendencies  
445           IF ( tempStepping ) THEN           IF ( tempStepping ) THEN
446            CALL CALC_GT(             CALL CALC_GT(
447       I         bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,
448       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
449       I         KappaRT,       I         KappaRT,
450       U         aTerm,xTerm,fZon,fMer,fVerT,       U         aTerm,xTerm,fZon,fMer,fVerT,
451       I         myTime, myThid)       I         myTime, myThid)
452               CALL TIMESTEP_TRACER(
453         I         bi,bj,iMin,iMax,jMin,jMax,k,
454         I         theta, gT,
455         U         gTnm1,
456         I         myIter, myThid)
457           ENDIF           ENDIF
458           IF ( saltStepping ) THEN           IF ( saltStepping ) THEN
459            CALL CALC_GS(             CALL CALC_GS(
460       I         bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,
461       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
462       I         KappaRS,       I         KappaRS,
463       U         aTerm,xTerm,fZon,fMer,fVerS,       U         aTerm,xTerm,fZon,fMer,fVerS,
464       I         myTime, myThid)       I         myTime, myThid)
465               CALL TIMESTEP_TRACER(
466         I         bi,bj,iMin,iMax,jMin,jMax,k,
467         I         salt, gS,
468         U         gSnm1,
469         I         myIter, myThid)
470           ENDIF           ENDIF
471  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
 C--      Calculate future values on open boundaries  
          IF (openBoundaries) THEN  
 Caja      CALL CYCLE_OBCS( K, bi, bj, myThid )  
           CALL SET_OBCS( K, bi, bj, myTime+deltaTclock, myThid )  
          ENDIF  
 #endif  
 C--      Prediction step (step forward all model variables)  
          CALL TIMESTEP(  
      I       bi,bj,iMin,iMax,jMin,jMax,K,  
      I       myIter, myThid)  
 #ifdef ALLOW_OBCS  
472  C--      Apply open boundary conditions  C--      Apply open boundary conditions
473           IF (openBoundaries) THEN           IF (openBoundaries) THEN
474  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
475  CADJ STORE gunm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  CADJ STORE gwnm1(:,:,k,bi,bj) = comlev1_bibj_k
476  CADJ STORE gvnm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  CADJ &   , key = kkey, byte = isbyte
477  CADJ STORE gwnm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  #endif /* ALLOW_AUTODIFF_TAMC */
478  #endif  c new subr  CALL OBCS_APPLY_TS( bi, bj, k, myThid )
             CALL APPLY_OBCS2( bi, bj, K, myThid )  
479           END IF           END IF
480  #endif  #endif
481  C--      Freeze water  C--      Freeze water
482           IF (allowFreezing) THEN           IF (allowFreezing) THEN
483  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
484  CADJ STORE gTNm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte  CADJ STORE gTNm1(:,:,k,bi,bj) = comlev1_bibj_k
485  #endif  CADJ &   , key = kkey, byte = isbyte
486              CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid )  #endif /* ALLOW_AUTODIFF_TAMC */
487                CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, k, myThid )
488           END IF           END IF
489    
490  #ifdef DIVG_IN_DYNAMICS  C--     end of thermodynamic k loop (Nr:1)
491  C--      Diagnose barotropic divergence of predicted fields          ENDDO
          CALL CALC_DIV_GHAT(  
      I       bi,bj,iMin,iMax,jMin,jMax,K,  
      I       xA,yA,  
      I       myThid)  
 #endif /* DIVG_IN_DYNAMICS */  
   
 C--      Cumulative diagnostic calculations (ie. time-averaging)  
 #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE  
          IF (taveFreq.GT.0.) THEN  
           CALL DO_TIME_AVERAGES(  
      I                           myTime, myIter, bi, bj, K, kUp, kDown,  
      I                           rVel, ConvectCount,  
      I                           myThid )  
          ENDIF  
 #endif  
   
492    
         ENDDO ! K  
493    
494  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
495    CPatrick? What about this one?
496             maximpl = 6             maximpl = 6
497             iikey = (ikey-1)*maximpl             iikey = (ikey-1)*maximpl
498  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
499    
500  C--     Implicit diffusion  C--     Implicit diffusion
501          IF (implicitDiffusion) THEN          IF (implicitDiffusion) THEN
502    
503           IF (tempStepping) THEN            IF (tempStepping) THEN
504  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
505              idkey = iikey + 1              idkey = iikey + 1
506  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
507              CALL IMPLDIFF(              CALL IMPLDIFF(
508       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
509       I         deltaTtracer, KappaRT,recip_HFacC,       I         deltaTtracer, KappaRT, recip_HFacC,
510       U         gTNm1,       U         gTNm1,
511       I         myThid )       I         myThid )
512           END IF           ENDIF
513    
514           IF (saltStepping) THEN           IF (saltStepping) THEN
515  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
516           idkey = iikey + 2           idkey = iikey + 2
517  #endif  #endif /* ALLOW_AUTODIFF_TAMC */
518              CALL IMPLDIFF(              CALL IMPLDIFF(
519       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
520       I         deltaTtracer, KappaRS,recip_HFacC,       I         deltaTtracer, KappaRS, recip_HFacC,
521       U         gSNm1,       U         gSNm1,
522       I         myThid )       I         myThid )
523           END IF           ENDIF
524    
525    C--     End If implicitDiffusion
526            ENDIF
527    
         ENDIF ! implicitDiffusion  
528    
 C--     Implicit viscosity  
         IF (implicitViscosity) THEN  
529    
530           IF (momStepping) THEN  C--     Start of dynamics loop
531  #ifdef ALLOW_AUTODIFF_TAMC          DO k=1,Nr
532           idkey = iikey + 3  
533  #endif  C--       km1    Points to level above k (=k-1)
534    C--       kup    Cycles through 1,2 to point to layer above
535    C--       kDown  Cycles through 2,1 to point to current layer
536    
537              km1  = MAX(1,k-1)
538              kup  = 1+MOD(k+1,2)
539              kDown= 1+MOD(k,2)
540    
541              iMin = 1-OLx+2
542              iMax = sNx+OLx-1
543              jMin = 1-OLy+2
544              jMax = sNy+OLy-1
545    
546    C--      Calculate buoyancy
547             CALL FIND_RHO(
548         I        bi, bj, iMin, iMax, jMin, jMax, km1, km1, eosType,
549         O        rhoKm1,
550         I        myThid )
551             CALL CALC_BUOYANCY(
552         I        bi,bj,iMin,iMax,jMin,jMax,k,rhoKm1,
553         O        buoyKm1,
554         I        myThid )
555             CALL FIND_RHO(
556         I        bi, bj, iMin, iMax, jMin, jMax, k, k, eosType,
557         O        rhoK,
558         I        myThid )
559             CALL CALC_BUOYANCY(
560         I        bi,bj,iMin,iMax,jMin,jMax,k,rhoK,
561         O        buoyK,
562         I        myThid )
563    
564    C--      Integrate hydrostatic balance for phiHyd with BC of
565    C--      phiHyd(z=0)=0
566             CALL CALC_PHI_HYD(
567         I        bi,bj,iMin,iMax,jMin,jMax,k,buoyKm1,buoyK,
568         U        phiHyd,
569         I        myThid )
570    
571    C--      Calculate accelerations in the momentum equations (gU, gV, ...)
572    C        and step forward storing the result in gUnm1, gVnm1, etc...
573             IF ( momStepping ) THEN
574               CALL CALC_MOM_RHS(
575         I         bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown,
576         I         phiHyd,KappaRU,KappaRV,
577         U         fVerU, fVerV,
578         I         myTime, myThid)
579               CALL TIMESTEP(
580         I         bi,bj,iMin,iMax,jMin,jMax,k,
581         I         myIter, myThid)
582    #ifdef   ALLOW_AUTODIFF_TAMC
583    #ifdef   INCLUDE_CD_CODE
584             ELSE
585               DO j=1-OLy,sNy+OLy
586                 DO i=1-OLx,sNx+OLx
587                   guCD(i,j,k,bi,bj) = 0.0
588                   gvCD(i,j,k,bi,bj) = 0.0
589                 END DO
590               END DO
591    #endif   /* INCLUDE_CD_CODE */
592    #endif   /* ALLOW_AUTODIFF_TAMC */
593             ENDIF
594    
595    
596    C--     end of dynamics k loop (1:Nr)
597            ENDDO
598    
599    
600    
601    C--     Implicit viscosity
602            IF (implicitViscosity.AND.momStepping) THEN
603    #ifdef    ALLOW_AUTODIFF_TAMC
604              idkey = iikey + 3
605    #endif    /* ALLOW_AUTODIFF_TAMC */
606            CALL IMPLDIFF(            CALL IMPLDIFF(
607       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
608       I         deltaTmom, KappaRU,recip_HFacW,       I         deltaTmom, KappaRU,recip_HFacW,
609       U         gUNm1,       U         gUNm1,
610       I         myThid )       I         myThid )
611  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
612           idkey = iikey + 4            idkey = iikey + 4
613  #endif  #endif    /* ALLOW_AUTODIFF_TAMC */
614            CALL IMPLDIFF(            CALL IMPLDIFF(
615       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
616       I         deltaTmom, KappaRV,recip_HFacS,       I         deltaTmom, KappaRV,recip_HFacS,
617       U         gVNm1,       U         gVNm1,
618       I         myThid )       I         myThid )
619    
620  #ifdef INCLUDE_CD_CODE  #ifdef    INCLUDE_CD_CODE
621    #ifdef    ALLOW_AUTODIFF_TAMC
622  #ifdef ALLOW_AUTODIFF_TAMC            idkey = iikey + 5
623           idkey = iikey + 5  #endif    /* ALLOW_AUTODIFF_TAMC */
 #endif  
624            CALL IMPLDIFF(            CALL IMPLDIFF(
625       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
626       I         deltaTmom, KappaRU,recip_HFacW,       I         deltaTmom, KappaRU,recip_HFacW,
627       U         vVelD,       U         vVelD,
628       I         myThid )       I         myThid )
629  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
630          idkey = iikey + 6            idkey = iikey + 6
631  #endif  #endif    /* ALLOW_AUTODIFF_TAMC */
632            CALL IMPLDIFF(            CALL IMPLDIFF(
633       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
634       I         deltaTmom, KappaRV,recip_HFacS,       I         deltaTmom, KappaRV,recip_HFacS,
635       U         uVelD,       U         uVelD,
636       I         myThid )       I         myThid )
637    #endif    /* INCLUDE_CD_CODE */
638  #endif  C--     End If implicitViscosity.AND.momStepping
639            ENDIF
          ENDIF ! momStepping  
         ENDIF ! implicitViscosity  
640    
641         ENDDO         ENDDO
642        ENDDO        ENDDO
643    
 C     write(0,*) 'dynamics: pS ',minval(cg2d_x(1:sNx,1:sNy,:,:)),  
 C    &                           maxval(cg2d_x(1:sNx,1:sNy,:,:))  
 C     write(0,*) 'dynamics: U  ',minval(uVel(1:sNx,1:sNy,1,:,:),mask=uVel(1:sNx,1:sNy,1,:,:).NE.0.),  
 C    &                           maxval(uVel(1:sNx,1:sNy,1,:,:),mask=uVel(1:sNx,1:sNy,1,:,:).NE.0.)  
 C     write(0,*) 'dynamics: V  ',minval(vVel(1:sNx,1:sNy,1,:,:),mask=vVel(1:sNx,1:sNy,1,:,:).NE.0.),  
 C    &                           maxval(vVel(1:sNx,1:sNy,1,:,:),mask=vVel(1:sNx,1:sNy,1,:,:).NE.0.)  
 C     write(0,*) 'dynamics: rVel(1) ',  
 C    &            minval(rVel(1:sNx,1:sNy,1),mask=rVel(1:sNx,1:sNy,1).NE.0.),  
 C    &            maxval(rVel(1:sNx,1:sNy,1),mask=rVel(1:sNx,1:sNy,1).NE.0.)  
 C     write(0,*) 'dynamics: rVel(2) ',  
 C    &            minval(rVel(1:sNx,1:sNy,2),mask=rVel(1:sNx,1:sNy,2).NE.0.),  
 C    &            maxval(rVel(1:sNx,1:sNy,2),mask=rVel(1:sNx,1:sNy,2).NE.0.)  
 C     write(0,*) 'dynamics: gT ',minval(gT(1:sNx,1:sNy,:,:,:)),  
 C    &                           maxval(gT(1:sNx,1:sNy,:,:,:))  
 C     write(0,*) 'dynamics: T  ',minval(Theta(1:sNx,1:sNy,:,:,:)),  
 C    &                           maxval(Theta(1:sNx,1:sNy,:,:,:))  
 C     write(0,*) 'dynamics: gS ',minval(gS(1:sNx,1:sNy,:,:,:)),  
 C    &                           maxval(gS(1:sNx,1:sNy,:,:,:))  
 C     write(0,*) 'dynamics: S  ',minval(salt(1:sNx,1:sNy,:,:,:)),  
 C    &                           maxval(salt(1:sNx,1:sNy,:,:,:))  
 C     write(0,*) 'dynamics: phiHyd ',minval(phiHyd/(Gravity*Rhonil),mask=phiHyd.NE.0.),  
 C    &                           maxval(phiHyd/(Gravity*Rhonil))  
 C     CALL PLOT_FIELD_XYZRL( gU, ' GU exiting dyanmics ' ,  
 C    &Nr, 1, myThid )  
 C     CALL PLOT_FIELD_XYZRL( gV, ' GV exiting dyanmics ' ,  
 C    &Nr, 1, myThid )  
 C     CALL PLOT_FIELD_XYZRL( gS, ' GS exiting dyanmics ' ,  
 C    &Nr, 1, myThid )  
 C     CALL PLOT_FIELD_XYZRL( gT, ' GT exiting dyanmics ' ,  
 C    &Nr, 1, myThid )  
 C     CALL PLOT_FIELD_XYZRL( phiHyd, ' phiHyd exiting dyanmics ' ,  
 C    &Nr, 1, myThid )  
   
   
644        RETURN        RETURN
645        END        END
646    
647    
648    C--      Cumulative diagnostic calculations (ie. time-averaging)
649    #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE
650    c        IF (taveFreq.GT.0.) THEN
651    c         CALL DO_TIME_AVERAGES(
652    c    I                           myTime, myIter, bi, bj, k, kup, kDown,
653    c    I                           ConvectCount,
654    c    I                           myThid )
655    c        ENDIF
656    #endif
657    

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.54.2.4

  ViewVC Help
Powered by ViewVC 1.1.22