/[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.19 by cnh, Mon Jun 15 05:13:56 1998 UTC revision 1.51 by heimbach, Wed Jun 21 20:46:31 2000 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2    
3  #include "CPP_EEOPTIONS.h"  #include "CPP_OPTIONS.h"
4    
5        SUBROUTINE DYNAMICS(myTime, myIter, myThid)        SUBROUTINE DYNAMICS(myTime, myIter, myThid)
6  C     /==========================================================\  C     /==========================================================\
# 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     \==========================================================/
23    c
24    c     changed: Patrick Heimbach heimbach@mit.edu 6-Jun-2000
25    c              - computation of ikey wrong for nTx,nTy > 1
26    c                and/or nsx,nsy > 1: act1 and act2 were
27    c                mixed up.
28    
29          IMPLICIT NONE
30    
31  C     == Global variables ===  C     == Global variables ===
32  #include "SIZE.h"  #include "SIZE.h"
# Line 27  C     == Global variables === Line 34  C     == Global variables ===
34  #include "CG2D.h"  #include "CG2D.h"
35  #include "PARAMS.h"  #include "PARAMS.h"
36  #include "DYNVARS.h"  #include "DYNVARS.h"
37    #include "GRID.h"
38    
39    #ifdef ALLOW_AUTODIFF_TAMC
40    #include "tamc.h"
41    #include "tamc_keys.h"
42    #endif
43    
44  C     == Routine arguments ==  C     == Routine arguments ==
45  C     myTime - Current time in simulation  C     myTime - Current time in simulation
46  C     myIter - Current iteration number in simulation  C     myIter - Current iteration number in simulation
47  C     myThid - Thread number for this instance of the routine.  C     myThid - Thread number for this instance of the routine.
       INTEGER myThid  
48        _RL myTime        _RL myTime
49        INTEGER myIter        INTEGER myIter
50          INTEGER myThid
51    
52  C     == Local variables  C     == Local variables
53  C     xA, yA                 - Per block temporaries holding face areas  C     xA, yA                 - Per block temporaries holding face areas
54  C     uTrans, vTrans, wTrans - Per block temporaries holding flow transport  C     uTrans, vTrans, rTrans - Per block temporaries holding flow
55  C     wVel                     o uTrans: Zonal transport  C                              transport
56    C     rVel                     o uTrans: Zonal transport
57  C                              o vTrans: Meridional transport  C                              o vTrans: Meridional transport
58  C                              o wTrans: Vertical transport  C                              o rTrans: Vertical transport
59  C                              o wVel:   Vertical velocity at upper and lower  C                              o rVel:   Vertical velocity at upper and
60  C                                        cell faces.  C                                        lower cell faces.
61  C     maskC,maskUp             o maskC: land/water mask for tracer cells  C     maskC,maskUp             o maskC: land/water mask for tracer cells
62  C                              o maskUp: land/water mask for W points  C                              o maskUp: land/water mask for W points
63  C     aTerm, xTerm, cTerm    - Work arrays for holding separate terms in  C     aTerm, xTerm, cTerm    - Work arrays for holding separate terms in
# Line 59  C                              o fVer: V Line 73  C                              o fVer: V
73  C                                      is "pipelined" in the vertical  C                                      is "pipelined" in the vertical
74  C                                      so we need an fVer for each  C                                      so we need an fVer for each
75  C                                      variable.  C                                      variable.
76  C     iMin, iMax - Ranges and sub-block indices on which calculations  C     rhoK, rhoKM1   - Density at current level, level above and level
77  C     jMin, jMax   are applied.  C                      below.
78    C     rhoKP1                                                                  
79    C     buoyK, buoyKM1 - Buoyancy at current level and level above.
80    C     phiHyd         - Hydrostatic part of the potential phiHydi.
81    C                      In z coords phiHydiHyd is the hydrostatic
82    C                      pressure anomaly
83    C                      In p coords phiHydiHyd is the geopotential
84    C                      surface height
85    C                      anomaly.
86    C     etaSurfX,      - Holds surface elevation gradient in X and Y.
87    C     etaSurfY
88    C     KappaRT,       - Total diffusion in vertical for T and S.
89    C     KappaRS          (background + spatially varying, isopycnal term).
90    C     iMin, iMax     - Ranges and sub-block indices on which calculations
91    C     jMin, jMax       are applied.
92  C     bi, bj  C     bi, bj
93  C     k, kUp, kDown, kM1 - Index for layer above and below. kUp and kDown  C     k, kUp,        - Index for layer above and below. kUp and kDown
94  C                          are switched with layer to be the appropriate index  C     kDown, kM1       are switched with layer to be the appropriate
95  C                          into fVerTerm  C                      index into fVerTerm.
96        _RS xA    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
97        _RS yA    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
98        _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99        _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
100        _RL wTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
101        _RL wVel  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL rVel    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
102        _RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
103        _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
104        _RL aTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL aTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
105        _RL xTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL xTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
106        _RL cTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL cTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
107        _RL mTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL mTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
108        _RL pTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL pTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
109        _RL fZon  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL fZon    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
110        _RL fMer  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL fMer    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
111        _RL fVerT (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
112        _RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerS   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
113        _RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerU   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
114        _RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerV   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
115        _RL pH    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
116        _RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
117        _RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokp1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
118        _RL rhok  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
119        _RL rhotmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL buoyKM1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
120        _RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL buoyK   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
121        _RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhotmp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
122        _RL K13   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL etaSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
123        _RL K23   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL etaSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
124        _RL K33   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
125        _RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
126        _RL KappaZT(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nz)        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
127        _RL KappaZS(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nz)        _RL KappaRV (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
128          _RL sigmaX  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
129          _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
130          _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
131    
132    #ifdef INCLUDE_CONVECT_CALL
133          _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
134    #endif
135    
136        INTEGER iMin, iMax        INTEGER iMin, iMax
137        INTEGER jMin, jMax        INTEGER jMin, jMax
# Line 105  C                          into fVerTerm Line 140  C                          into fVerTerm
140        INTEGER k, kM1, kUp, kDown        INTEGER k, kM1, kUp, kDown
141        LOGICAL BOTTOM_LAYER        LOGICAL BOTTOM_LAYER
142    
143    #ifdef ALLOW_AUTODIFF_TAMC
144          INTEGER    isbyte
145          PARAMETER( isbyte = 4 )
146    
147          INTEGER act1, act2, act3, act4
148          INTEGER max1, max2, max3
149          INTEGER iikey, kkey
150          INTEGER maximpl
151    #endif
152    
153  C---    The algorithm...  C---    The algorithm...
154  C  C
155  C       "Correction Step"  C       "Correction Step"
# Line 118  C Line 163  C
163  C       "Calculation of Gs"  C       "Calculation of Gs"
164  C       ===================  C       ===================
165  C       This is where all the accelerations and tendencies (ie.  C       This is where all the accelerations and tendencies (ie.
166  C       physics, parameterizations etc...) are calculated  C       phiHydysics, parameterizations etc...) are calculated
167  C         w = sum_z ( div. u[n] )  C         rVel = sum_r ( div. u[n] )
168  C         rho = rho ( theta[n], salt[n] )  C         rho = rho ( theta[n], salt[n] )
169    C         b   = b(rho, theta)
170  C         K31 = K31 ( rho )  C         K31 = K31 ( rho )
171  C         Gu[n] = Gu( u[n], v[n], w, rho, Ph, ... )  C         Gu[n] = Gu( u[n], v[n], rVel, b, ... )
172  C         Gv[n] = Gv( u[n], v[n], w, rho, Ph, ... )  C         Gv[n] = Gv( u[n], v[n], rVel, b, ... )
173  C         Gt[n] = Gt( theta[n], u[n], v[n], w, K31, ... )  C         Gt[n] = Gt( theta[n], u[n], v[n], rVel, K31, ... )
174  C         Gs[n] = Gs( salt[n], u[n], v[n], w, K31, ... )  C         Gs[n] = Gs( salt[n], u[n], v[n], rVel, K31, ... )
175  C  C
176  C       "Time-stepping" or "Prediction"  C       "Time-stepping" or "Prediction"
177  C       ================================  C       ================================
# Line 149  C         (1 + dt * K * d_zz) theta[n] = Line 195  C         (1 + dt * K * d_zz) theta[n] =
195  C         (1 + dt * K * d_zz) salt[n] = salt*  C         (1 + dt * K * d_zz) salt[n] = salt*
196  C---  C---
197    
198    #ifdef ALLOW_AUTODIFF_TAMC
199    C--   dummy statement to end declaration part
200          ikey = 1
201    #endif
202    
203  C--   Set up work arrays with valid (i.e. not NaN) values  C--   Set up work arrays with valid (i.e. not NaN) values
204  C     These inital values do not alter the numerical results. They  C     These inital values do not alter the numerical results. They
205  C     just ensure that all memory references are to valid floating  C     just ensure that all memory references are to valid floating
# Line 167  C     uninitialised but inert locations. Line 218  C     uninitialised but inert locations.
218          pTerm(i,j)   = 0. _d 0          pTerm(i,j)   = 0. _d 0
219          fZon(i,j)    = 0. _d 0          fZon(i,j)    = 0. _d 0
220          fMer(i,j)    = 0. _d 0          fMer(i,j)    = 0. _d 0
221          DO K=1,nZ          DO K=1,Nr
222           pH (i,j,k)  = 0. _d 0           phiHyd (i,j,k)  = 0. _d 0
223           K13(i,j,k) = 0. _d 0           KappaRU(i,j,k) = 0. _d 0
224           K23(i,j,k) = 0. _d 0           KappaRV(i,j,k) = 0. _d 0
225           K33(i,j,k) = 0. _d 0           sigmaX(i,j,k) = 0. _d 0
226           KappaZT(i,j,k) = 0. _d 0           sigmaY(i,j,k) = 0. _d 0
227             sigmaR(i,j,k) = 0. _d 0
228          ENDDO          ENDDO
229          rhokm1(i,j)  = 0. _d 0          rhoKM1 (i,j) = 0. _d 0
230          rhok  (i,j)  = 0. _d 0          rhok   (i,j) = 0. _d 0
231          rhokp1(i,j)  = 0. _d 0          rhoKP1 (i,j) = 0. _d 0
232          rhotmp(i,j)  = 0. _d 0          rhoTMP (i,j) = 0. _d 0
233          maskC (i,j)  = 0. _d 0          buoyKM1(i,j) = 0. _d 0
234            buoyK  (i,j) = 0. _d 0
235            maskC  (i,j) = 0. _d 0
236         ENDDO         ENDDO
237        ENDDO        ENDDO
238    
239    
240    #ifdef ALLOW_AUTODIFF_TAMC
241    C--   HPF directive to help TAMC
242    !HPF$ INDEPENDENT
243    #endif
244    
245        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
246    
247    #ifdef ALLOW_AUTODIFF_TAMC
248    C--    HPF directive to help TAMC
249    !HPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV
250    !HPF$&                  ,phiHyd,
251    !HPF$&                  ,utrans,vtrans,maskc,xA,yA
252    !HPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV
253    !HPF$&                  )
254    #endif
255    
256         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
257    
258    #ifdef ALLOW_AUTODIFF_TAMC
259              act1 = bi - myBxLo(myThid)
260              max1 = myBxHi(myThid) - myBxLo(myThid) + 1
261    
262              act2 = bj - myByLo(myThid)
263              max2 = myByHi(myThid) - myByLo(myThid) + 1
264    
265              act3 = myThid - 1
266              max3 = nTx*nTy
267    
268              act4 = ikey_dynamics - 1
269    
270              ikey = (act1 + 1) + act2*max1
271         &                      + act3*max1*max2
272         &                      + act4*max1*max2*max3
273    #endif
274    
275  C--     Set up work arrays that need valid initial values  C--     Set up work arrays that need valid initial values
276          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
277           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
278            wTrans(i,j)  = 0. _d 0            rTrans(i,j)   = 0. _d 0
279            wVel  (i,j,1) = 0. _d 0            rVel  (i,j,1) = 0. _d 0
280            wVel  (i,j,2) = 0. _d 0            rVel  (i,j,2) = 0. _d 0
281            fVerT(i,j,1) = 0. _d 0            fVerT (i,j,1) = 0. _d 0
282            fVerT(i,j,2) = 0. _d 0            fVerT (i,j,2) = 0. _d 0
283            fVerS(i,j,1) = 0. _d 0            fVerS (i,j,1) = 0. _d 0
284            fVerS(i,j,2) = 0. _d 0            fVerS (i,j,2) = 0. _d 0
285            fVerU(i,j,1) = 0. _d 0            fVerU (i,j,1) = 0. _d 0
286            fVerU(i,j,2) = 0. _d 0            fVerU (i,j,2) = 0. _d 0
287            fVerV(i,j,1) = 0. _d 0            fVerV (i,j,1) = 0. _d 0
288            fVerV(i,j,2) = 0. _d 0            fVerV (i,j,2) = 0. _d 0
289            pH(i,j,1) = 0. _d 0            phiHyd(i,j,1) = 0. _d 0
290            K13(i,j,1) = 0. _d 0           ENDDO
291            K23(i,j,1) = 0. _d 0          ENDDO
292            K33(i,j,1) = 0. _d 0  
293            KapGM(i,j) = 0. _d 0          DO k=1,Nr
294             DO j=1-OLy,sNy+OLy
295              DO i=1-OLx,sNx+OLx
296    #ifdef INCLUDE_CONVECT_CALL
297               ConvectCount(i,j,k) = 0.
298    #endif
299               KappaRT(i,j,k) = 0. _d 0
300               KappaRS(i,j,k) = 0. _d 0
301              ENDDO
302           ENDDO           ENDDO
303          ENDDO          ENDDO
304    
# Line 212  C--     Set up work arrays that need val Line 307  C--     Set up work arrays that need val
307          jMin = 1-OLy+1          jMin = 1-OLy+1
308          jMax = sNy+OLy          jMax = sNy+OLy
309    
310    
311          K = 1          K = 1
312          BOTTOM_LAYER = K .EQ. Nz          BOTTOM_LAYER = K .EQ. Nr
313    
314    #ifdef DO_PIPELINED_CORRECTION_STEP
315  C--     Calculate gradient of surface pressure  C--     Calculate gradient of surface pressure
316          CALL GRAD_PSURF(          CALL CALC_GRAD_ETA_SURF(
317       I       bi,bj,iMin,iMax,jMin,jMax,       I       bi,bj,iMin,iMax,jMin,jMax,
318       O       pSurfX,pSurfY,       O       etaSurfX,etaSurfY,
319       I       myThid)       I       myThid)
   
320  C--     Update fields in top level according to tendency terms  C--     Update fields in top level according to tendency terms
321          CALL CORRECTION_STEP(          CALL CORRECTION_STEP(
322       I       bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid)       I       bi,bj,iMin,iMax,jMin,jMax,K,
323         I       etaSurfX,etaSurfY,myTime,myThid)
324    
325    #ifdef ALLOW_OBCS
326            IF (openBoundaries) THEN
327    #ifdef ALLOW_AUTODIFF_TAMC
328    CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
329    CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
330    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
331    CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte
332    #endif
333               CALL APPLY_OBCS1( bi, bj, K, myThid )
334            END IF
335    #endif
336    
337            IF ( .NOT. BOTTOM_LAYER ) THEN
338    C--      Update fields in layer below according to tendency terms
339             CALL CORRECTION_STEP(
340         I        bi,bj,iMin,iMax,jMin,jMax,K+1,
341         I        etaSurfX,etaSurfY,myTime,myThid)
342    #ifdef ALLOW_OBCS
343             IF (openBoundaries) THEN
344    #ifdef ALLOW_AUTODIFF_TAMC
345    CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
346    CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
347    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
348    CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte
349    #endif
350                CALL APPLY_OBCS1( bi, bj, K+1, myThid )
351             END IF
352    #endif
353            ENDIF
354    #endif
355  C--     Density of 1st level (below W(1)) reference to level 1  C--     Density of 1st level (below W(1)) reference to level 1
356    #ifdef  INCLUDE_FIND_RHO_CALL
357    #ifdef ALLOW_AUTODIFF_TAMC
358    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
359    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
360    #endif
361          CALL FIND_RHO(          CALL FIND_RHO(
362       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
363       O     rhoKm1,       O     rhoKm1,
364       I     myThid )       I     myThid )
365    #endif
366    
367          IF ( .NOT. BOTTOM_LAYER ) THEN          IF (       (.NOT. BOTTOM_LAYER)
368         &     ) THEN
369  C--      Check static stability with layer below  C--      Check static stability with layer below
370  C        and mix as needed.  C--      and mix as needed.
371    #ifdef  INCLUDE_FIND_RHO_CALL
372    #ifdef ALLOW_AUTODIFF_TAMC
373    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
374    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
375    #endif
376           CALL FIND_RHO(           CALL FIND_RHO(
377       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,
378       O      rhoKp1,       O      rhoKp1,
379       I      myThid )       I      myThid )
380    #endif
381    
382    #ifdef  INCLUDE_CONVECT_CALL
383    
384    #ifdef ALLOW_AUTODIFF_TAMC
385    CADJ STORE rhoKm1(:,:)  = comlev1_2d, key = ikey, byte = isbyte
386    CADJ STORE rhoKp1(:,:)  = comlev1_2d, key = ikey, byte = isbyte
387    #endif
388           CALL CONVECT(           CALL CONVECT(
389       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
390         U       ConvectCount,
391       I       myTime,myIter,myThid)       I       myTime,myIter,myThid)
392    #ifdef ALLOW_AUTODIFF_TAMC
393    CADJ STORE theta(:,:,k+1,bi,bj),theta(:,:,k,bi,bj)
394    CADJ &     = comlev1_2d, key = ikey, byte = isbyte
395    CADJ STORE salt (:,:,k+1,bi,bj),salt (:,:,k,bi,bj)
396    CADJ &     = comlev1_2d, key = ikey, byte = isbyte
397    #endif
398    
399    #endif
400    
401    C--      Implicit Vertical Diffusion for Convection
402             IF (ivdc_kappa.NE.0.) CALL CALC_IVDC(
403         I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
404         U       ConvectCount, KappaRT, KappaRS,
405         I       myTime,myIter,myThid)
406    CRG: do we need do store STORE KappaRT, KappaRS ?
407    
408  C--      Recompute density after mixing  C--      Recompute density after mixing
409    #ifdef  INCLUDE_FIND_RHO_CALL
410           CALL FIND_RHO(           CALL FIND_RHO(
411       I      bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
412       O      rhoKm1,       O      rhoKm1,
413       I      myThid )       I      myThid )
414    #endif
415          ENDIF          ENDIF
416    C--     Calculate buoyancy
417  C--     Integrate hydrostatic balance for pH with BC of pH(z=0)=0          CALL CALC_BUOYANCY(
418          CALL CALC_PH(       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,
419       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKm1,       O      buoyKm1,
      U      pH,  
420       I      myThid )       I      myThid )
421    C--     Integrate hydrostatic balance for phiHyd with BC of
422    C--     phiHyd(z=0)=0
423            CALL CALC_PHI_HYD(
424         I      bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1,
425         U      phiHyd,
426         I      myThid )
427            CALL GRAD_SIGMA(
428         I            bi, bj, iMin, iMax, jMin, jMax, K,
429         I            rhoKm1, rhoKm1, rhoKm1,
430         O            sigmaX, sigmaY, sigmaR,
431         I            myThid )
432    
433    C--     Start of downward loop
434            DO K=2,Nr
435    
436    #ifdef ALLOW_AUTODIFF_TAMC
437             kkey = (ikey-1)*(Nr-2+1) + (k-2) + 1
438    #endif
439    
440          DO K=2,Nz           BOTTOM_LAYER = K .EQ. Nr
441    
442           BOTTOM_LAYER = K .EQ. Nz  #ifdef DO_PIPELINED_CORRECTION_STEP
443             IF ( .NOT. BOTTOM_LAYER ) THEN
444    C--       Update fields in layer below according to tendency terms
445              CALL CORRECTION_STEP(
446         I         bi,bj,iMin,iMax,jMin,jMax,K+1,
447         I         etaSurfX,etaSurfY,myTime,myThid)
448    #ifdef ALLOW_OBCS
449              IF (openBoundaries) THEN
450    #ifdef ALLOW_AUTODIFF_TAMC
451    CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
452    CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
453    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
454    CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte
455    #endif
456                 CALL APPLY_OBCS1( bi, bj, K+1, myThid )
457              END IF
458    #endif
459             ENDIF
460    #endif
461    
 C--      Update fields in Kth level according to tendency terms  
          CALL CORRECTION_STEP(  
      I        bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid)  
462  C--      Density of K level (below W(K)) reference to K level  C--      Density of K level (below W(K)) reference to K level
463    #ifdef  INCLUDE_FIND_RHO_CALL
464    #ifdef ALLOW_AUTODIFF_TAMC
465    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
466    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
467    #endif
468           CALL FIND_RHO(           CALL FIND_RHO(
469       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,
470       O      rhoK,       O      rhoK,
471       I      myThid )       I      myThid )
472           IF ( .NOT. BOTTOM_LAYER ) THEN  #endif
473  C--       Check static stability with layer below           IF (       (.NOT. BOTTOM_LAYER)
474  C         and mix as needed.       &      ) THEN
475  C--       Density of K+1 level (below W(K+1)) reference to K level  C--       Check static stability with layer below and mix as needed.
476    C--       Density of K+1 level (below W(K+1)) reference to K level.
477    #ifdef  INCLUDE_FIND_RHO_CALL
478    #ifdef ALLOW_AUTODIFF_TAMC
479    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
480    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
481    #endif
482            CALL FIND_RHO(            CALL FIND_RHO(
483       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,
484       O       rhoKp1,       O       rhoKp1,
485       I       myThid )       I       myThid )
486    #endif
487    
488    #ifdef ALLOW_AUTODIFF_TAMC
489    CADJ STORE rhok  (:,:)   = comlev1_3d, key = kkey, byte = isbyte
490    CADJ STORE rhoKm1(:,:)   = comlev1_3d, key = kkey, byte = isbyte
491    CADJ STORE rhoKp1(:,:)   = comlev1_3d, key = kkey, byte = isbyte
492    #endif
493    
494    #ifdef  INCLUDE_CONVECT_CALL
495            CALL CONVECT(            CALL CONVECT(
496       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,
497         U        ConvectCount,
498       I        myTime,myIter,myThid)       I        myTime,myIter,myThid)
499    #ifdef ALLOW_AUTODIFF_TAMC
500    CADJ STORE theta(:,:,k+1,bi,bj),theta(:,:,k,bi,bj)
501    CADJ &     = comlev1_3d, key = kkey, byte = isbyte
502    CADJ STORE salt (:,:,k+1,bi,bj),salt (:,:,k,bi,bj)
503    CADJ &     = comlev1_3d, key = kkey, byte = isbyte
504    #endif
505    #endif
506    
507    C--      Implicit Vertical Diffusion for Convection
508             IF (ivdc_kappa.NE.0.) THEN
509                CALL CALC_IVDC(
510         I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
511         U       ConvectCount, KappaRT, KappaRS,
512         I       myTime,myIter,myThid)
513    CRG: do we need do store STORE KappaRT, KappaRS ?
514             END IF
515    
516  C--       Recompute density after mixing  C--       Recompute density after mixing
517    #ifdef  INCLUDE_FIND_RHO_CALL
518            CALL FIND_RHO(            CALL FIND_RHO(
519       I       bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I       bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
520       O       rhoK,       O       rhoK,
521       I       myThid )       I       myThid )
522    #endif
523           ENDIF           ENDIF
524  C--      Integrate hydrostatic balance for pH with BC of pH(z=0)=0  C--      Calculate buoyancy
525           CALL CALC_PH(           CALL CALC_BUOYANCY(
526       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoK,       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoK,
527       U       pH,       O       buoyK,
528       I       myThid )       I       myThid )
529    C--      Integrate hydrostatic balance for phiHyd with BC of
530    C--      phiHyd(z=0)=0
531             CALL CALC_PHI_HYD(
532         I        bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK,
533         U        phiHyd,
534         I        myThid )
535  C--      Calculate iso-neutral slopes for the GM/Redi parameterisation  C--      Calculate iso-neutral slopes for the GM/Redi parameterisation
536    #ifdef  INCLUDE_FIND_RHO_CALL
537           CALL FIND_RHO(           CALL FIND_RHO(
538       I      bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,       I        bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,
539       O      rhoTmp,       O        rhoTmp,
540       I      myThid )       I        myThid )
541           CALL CALC_ISOSLOPES(  #endif
542             CALL GRAD_SIGMA(
543       I             bi, bj, iMin, iMax, jMin, jMax, K,       I             bi, bj, iMin, iMax, jMin, jMax, K,
544       I             rhoKm1, rhoK, rhotmp,       I             rhoK, rhotmp, rhoK,
545       O             K13, K23, K33, KapGM,       O             sigmaX, sigmaY, sigmaR,
546       I             myThid )       I             myThid )
547    
548    
549           DO J=jMin,jMax           DO J=jMin,jMax
550            DO I=iMin,iMax            DO I=iMin,iMax
551             rhoKm1(I,J)=rhoK(I,J)  #ifdef  INCLUDE_FIND_RHO_CALL
552               rhoKm1 (I,J) = rhoK(I,J)
553    #endif
554               buoyKm1(I,J) = buoyK(I,J)
555            ENDDO            ENDDO
556           ENDDO           ENDDO
557            ENDDO
558    C--     end of k loop
559    
560          ENDDO ! K  #ifdef ALLOW_GMREDI
561    #ifdef ALLOW_AUTODIFF_TAMC
562    CADJ STORE rhoTmp(:,:)  = comlev1_3d, key = kkey, byte = isbyte
563    CADJ STORE rhok  (:,:)  = comlev1_3d, key = kkey, byte = isbyte
564    CADJ STORE rhoKm1(:,:)  = comlev1_3d, key = kkey, byte = isbyte
565    #endif
566            DO K=1, Nr
567             IF (use_GMRedi) CALL GMREDI_CALC_TENSOR(
568         I             bi, bj, iMin, iMax, jMin, jMax, K,
569         I             sigmaX, sigmaY, sigmaR,
570         I             myThid )
571            ENDDO
572    #endif
573    
574    #ifdef ALLOW_AUTODIFF_TAMC
575    CADJ STORE theta(:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
576    CADJ STORE salt (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
577    CADJ STORE uvel (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
578    CADJ STORE vvel (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
579    #endif
580    
581    #ifdef ALLOW_KPP
582    C--     Compute KPP mixing coefficients
583            CALL TIMER_START('KPP_CALC               [DYNAMICS]', myThid)
584            CALL KPP_CALC(
585         I               bi, bj, myTime, myThid )
586            CALL TIMER_STOP ('KPP_CALC               [DYNAMICS]', myThid)
587    #endif
588    
589    C--     Start of upward loop
590            DO K = Nr, 1, -1
591    
         DO K = Nz, 1, -1  
592           kM1  =max(1,k-1)   ! Points to level above k (=k-1)           kM1  =max(1,k-1)   ! Points to level above k (=k-1)
593           kUp  =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above           kUp  =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above
594           kDown=1+MOD(k,2)   ! Cycles through 2,1 to point to current layer           kDown=1+MOD(k,2)   ! Cycles through 2,1 to point to current layer
595    
596           iMin = 1-OLx+2           iMin = 1-OLx+2
597           iMax = sNx+OLx-1           iMax = sNx+OLx-1
598           jMin = 1-OLy+2           jMin = 1-OLy+2
599           jMax = sNy+OLy-1           jMax = sNy+OLy-1
600    
601    #ifdef ALLOW_AUTODIFF_TAMC
602             kkey = (ikey-1)*(Nr-1+1) + (k-1) + 1
603    #endif
604    
605    #ifdef ALLOW_AUTODIFF_TAMC
606    CADJ STORE rvel  (:,:,kDown)  = comlev1_3d, key = kkey, byte = isbyte
607    CADJ STORE rTrans(:,:)        = comlev1_3d, key = kkey, byte = isbyte
608    CADJ STORE KappaRT(:,:,:)     = comlev1_3d, key = kkey, byte = isbyte
609    CADJ STORE KappaRS(:,:,:)     = comlev1_3d, key = kkey, byte = isbyte
610    #endif
611    
612  C--      Get temporary terms used by tendency routines  C--      Get temporary terms used by tendency routines
613           CALL CALC_COMMON_FACTORS (           CALL CALC_COMMON_FACTORS (
614       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
615       O        xA,yA,uTrans,vTrans,wTrans,wVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,
616       I        myThid)       I        myThid)
617    
618    #ifdef ALLOW_OBCS
619            IF (openBoundaries) THEN
620             CALL APPLY_OBCS3( bi, bj, K, Kup, rTrans, rVel, myThid )
621            ENDIF
622    #endif
623    
624    #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
625  C--      Calculate the total vertical diffusivity  C--      Calculate the total vertical diffusivity
626           CALL CALC_DIFFUSIVITY(           CALL CALC_DIFFUSIVITY(
627       I        bi,bj,iMin,iMax,jMin,jMax,K,       I        bi,bj,iMin,iMax,jMin,jMax,K,
628       I        maskC,maskUp,KapGM,K33,       I        maskC,maskUp,
629       O        KappaZT,KappaZS,       O        KappaRT,KappaRS,KappaRU,KappaRV,
630       I        myThid)       I        myThid)
631    #endif
632  C--      Calculate accelerations in the momentum equations  C--      Calculate accelerations in the momentum equations
633           IF ( momStepping ) THEN           IF ( momStepping ) THEN
634            CALL CALC_MOM_RHS(            CALL CALC_MOM_RHS(
635       I         bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I         bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
636       I         xA,yA,uTrans,vTrans,wTrans,wVel,maskC,       I         xA,yA,uTrans,vTrans,rTrans,rVel,maskC,
637       I         pH,       I         phiHyd,KappaRU,KappaRV,
638       U         aTerm,xTerm,cTerm,mTerm,pTerm,       U         aTerm,xTerm,cTerm,mTerm,pTerm,
639       U         fZon, fMer, fVerU, fVerV,       U         fZon, fMer, fVerU, fVerV,
640       I         myThid)       I         myTime, myThid)
641    #ifdef ALLOW_AUTODIFF_TAMC
642    #ifdef INCLUDE_CD_CODE
643             ELSE
644                DO j=1-OLy,sNy+OLy
645                   DO i=1-OLx,sNx+OLx
646                      guCD(i,j,k,bi,bj) = 0.0
647                      gvCD(i,j,k,bi,bj) = 0.0
648                   END DO
649                END DO
650    #endif
651    #endif
652           ENDIF           ENDIF
   
653  C--      Calculate active tracer tendencies  C--      Calculate active tracer tendencies
654           IF ( tempStepping ) THEN           IF ( tempStepping ) THEN
655            CALL CALC_GT(            CALL CALC_GT(
656       I         bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
657       I         xA,yA,uTrans,vTrans,wTrans,maskUp,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
658       I         K13,K23,KappaZT,KapGM,       I         KappaRT,
659       U         aTerm,xTerm,fZon,fMer,fVerT,       U         aTerm,xTerm,fZon,fMer,fVerT,
660       I         myThid)       I         myTime, myThid)
661           ENDIF           ENDIF
662           IF ( saltStepping ) THEN           IF ( saltStepping ) THEN
663            CALL CALC_GS(            CALL CALC_GS(
664       I         bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
665       I         xA,yA,uTrans,vTrans,wTrans,maskUp,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
666       I         K13,K23,KappaZS,KapGM,       I         KappaRS,
667       U         aTerm,xTerm,fZon,fMer,fVerS,       U         aTerm,xTerm,fZon,fMer,fVerS,
668       I         myThid)       I         myTime, myThid)
669           ENDIF           ENDIF
670    #ifdef ALLOW_OBCS
671    C--      Calculate future values on open boundaries
672             IF (openBoundaries) THEN
673    Caja      CALL CYCLE_OBCS( K, bi, bj, myThid )
674              CALL SET_OBCS( K, bi, bj, myTime+deltaTclock, myThid )
675             ENDIF
676    #endif
677  C--      Prediction step (step forward all model variables)  C--      Prediction step (step forward all model variables)
678           CALL TIMESTEP(           CALL TIMESTEP(
679       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
680       I       myThid)       I       myIter, myThid)
681    #ifdef ALLOW_OBCS
682    C--      Apply open boundary conditions
683             IF (openBoundaries) THEN
684    #ifdef ALLOW_AUTODIFF_TAMC
685    CADJ STORE gunm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
686    CADJ STORE gvnm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
687    CADJ STORE gwnm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
688    #endif
689                CALL APPLY_OBCS2( bi, bj, K, myThid )
690             END IF
691    #endif
692    C--      Freeze water
693             IF (allowFreezing) THEN
694    #ifdef ALLOW_AUTODIFF_TAMC
695    CADJ STORE gTNm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
696    #endif
697                CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid )
698             END IF
699    
700    #ifdef DIVG_IN_DYNAMICS
701  C--      Diagnose barotropic divergence of predicted fields  C--      Diagnose barotropic divergence of predicted fields
702           CALL DIV_G(           CALL CALC_DIV_GHAT(
703       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
704       I       xA,yA,       I       xA,yA,
705       I       myThid)       I       myThid)
706    #endif /* DIVG_IN_DYNAMICS */
707    
708    C--      Cumulative diagnostic calculations (ie. time-averaging)
709    #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE
710             IF (taveFreq.GT.0.) THEN
711              CALL DO_TIME_AVERAGES(
712         I                           myTime, myIter, bi, bj, K, kUp, kDown,
713         I                           rVel, ConvectCount,
714         I                           myThid )
715             ENDIF
716    #endif
717    
718    
719          ENDDO ! K          ENDDO ! K
720    
721    #ifdef ALLOW_AUTODIFF_TAMC
722               maximpl = 6
723               iikey = (ikey-1)*maximpl
724    #endif
725    
726  C--     Implicit diffusion  C--     Implicit diffusion
727          IF (implicitDiffusion) THEN          IF (implicitDiffusion) THEN
728           CALL IMPLDIFF( bi, bj, iMin, iMax, jMin, jMax,  
729       I                  KappaZT,KappaZS,           IF (tempStepping) THEN
730       I                  myThid )  #ifdef ALLOW_AUTODIFF_TAMC
731          ENDIF              idkey = iikey + 1
732    #endif
733                CALL IMPLDIFF(
734         I         bi, bj, iMin, iMax, jMin, jMax,
735         I         deltaTtracer, KappaRT,recip_HFacC,
736         U         gTNm1,
737         I         myThid )
738             END IF
739    
740             IF (saltStepping) THEN
741    #ifdef ALLOW_AUTODIFF_TAMC
742             idkey = iikey + 2
743    #endif
744                CALL IMPLDIFF(
745         I         bi, bj, iMin, iMax, jMin, jMax,
746         I         deltaTtracer, KappaRS,recip_HFacC,
747         U         gSNm1,
748         I         myThid )
749             END IF
750    
751            ENDIF ! implicitDiffusion
752    
753    C--     Implicit viscosity
754            IF (implicitViscosity) THEN
755    
756             IF (momStepping) THEN
757    #ifdef ALLOW_AUTODIFF_TAMC
758             idkey = iikey + 3
759    #endif
760              CALL IMPLDIFF(
761         I         bi, bj, iMin, iMax, jMin, jMax,
762         I         deltaTmom, KappaRU,recip_HFacW,
763         U         gUNm1,
764         I         myThid )
765    #ifdef ALLOW_AUTODIFF_TAMC
766             idkey = iikey + 4
767    #endif
768              CALL IMPLDIFF(
769         I         bi, bj, iMin, iMax, jMin, jMax,
770         I         deltaTmom, KappaRV,recip_HFacS,
771         U         gVNm1,
772         I         myThid )
773    
774    #ifdef INCLUDE_CD_CODE
775    
776    #ifdef ALLOW_AUTODIFF_TAMC
777             idkey = iikey + 5
778    #endif
779              CALL IMPLDIFF(
780         I         bi, bj, iMin, iMax, jMin, jMax,
781         I         deltaTmom, KappaRU,recip_HFacW,
782         U         vVelD,
783         I         myThid )
784    #ifdef ALLOW_AUTODIFF_TAMC
785            idkey = iikey + 6
786    #endif
787              CALL IMPLDIFF(
788         I         bi, bj, iMin, iMax, jMin, jMax,
789         I         deltaTmom, KappaRV,recip_HFacS,
790         U         uVelD,
791         I         myThid )
792    
793    #endif
794    
795             ENDIF ! momStepping
796            ENDIF ! implicitViscosity
797    
798         ENDDO         ENDDO
799        ENDDO        ENDDO
800    
801  C     write(0,*) 'dynamics: pS ',minval(cg2d_x(1:sNx,1:sNy,:,:)),  C     write(0,*) 'dynamics: pS ',minval(cg2d_x(1:sNx,1:sNy,:,:)),
802  C    &                           maxval(cg2d_x(1:sNx,1:sNy,:,:))  C    &                           maxval(cg2d_x(1:sNx,1:sNy,:,:))
803        write(0,*) 'dynamics: U  ',minval(uVel(1:sNx,1:sNy,1,:,:),mask=uVel(1:sNx,1:sNy,1,:,:).NE.0.),  C     write(0,*) 'dynamics: U  ',minval(uVel(1:sNx,1:sNy,1,:,:),mask=uVel(1:sNx,1:sNy,1,:,:).NE.0.),
804       &                           maxval(uVel(1:sNx,1:sNy,1,:,:))  C    &                           maxval(uVel(1:sNx,1:sNy,1,:,:),mask=uVel(1:sNx,1:sNy,1,:,:).NE.0.)
805        write(0,*) 'dynamics: V  ',minval(vVel(1:sNx,1:sNy,1,:,:),mask=vVel(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.),
806       &                           maxval(vVel(1:sNx,1:sNy,1,:,:))  C    &                           maxval(vVel(1:sNx,1:sNy,1,:,:),mask=vVel(1:sNx,1:sNy,1,:,:).NE.0.)
807        write(0,*) 'dynamics: wVel(1) ',  C     write(0,*) 'dynamics: rVel(1) ',
808       &            minval(wVel(1:sNx,1:sNy,1),mask=wVel(1:sNx,1:sNy,1).NE.0.),  C    &            minval(rVel(1:sNx,1:sNy,1),mask=rVel(1:sNx,1:sNy,1).NE.0.),
809       &            maxval(wVel(1:sNx,1:sNy,1))  C    &            maxval(rVel(1:sNx,1:sNy,1),mask=rVel(1:sNx,1:sNy,1).NE.0.)
810        write(0,*) 'dynamics: wVel(2) ',  C     write(0,*) 'dynamics: rVel(2) ',
811       &            minval(wVel(1:sNx,1:sNy,2),mask=wVel(1:sNx,1:sNy,2).NE.0.),  C    &            minval(rVel(1:sNx,1:sNy,2),mask=rVel(1:sNx,1:sNy,2).NE.0.),
812       &            maxval(wVel(1:sNx,1:sNy,2))  C    &            maxval(rVel(1:sNx,1:sNy,2),mask=rVel(1:sNx,1:sNy,2).NE.0.)
 cblk  write(0,*) 'dynamics: K13',minval(K13(1:sNx,1:sNy,:)),  
 cblk &                           maxval(K13(1:sNx,1:sNy,:))  
 cblk  write(0,*) 'dynamics: K23',minval(K23(1:sNx,1:sNy,:)),  
 cblk &                           maxval(K23(1:sNx,1:sNy,:))  
 cblk  write(0,*) 'dynamics: K33',minval(K33(1:sNx,1:sNy,:)),  
 cblk &                           maxval(K33(1:sNx,1:sNy,:))  
813  C     write(0,*) 'dynamics: gT ',minval(gT(1:sNx,1:sNy,:,:,:)),  C     write(0,*) 'dynamics: gT ',minval(gT(1:sNx,1:sNy,:,:,:)),
814  C    &                           maxval(gT(1:sNx,1:sNy,:,:,:))  C    &                           maxval(gT(1:sNx,1:sNy,:,:,:))
815  C     write(0,*) 'dynamics: T  ',minval(Theta(1:sNx,1:sNy,:,:,:)),  C     write(0,*) 'dynamics: T  ',minval(Theta(1:sNx,1:sNy,:,:,:)),
# Line 406  C     write(0,*) 'dynamics: gS ',minval( Line 818  C     write(0,*) 'dynamics: gS ',minval(
818  C    &                           maxval(gS(1:sNx,1:sNy,:,:,:))  C    &                           maxval(gS(1:sNx,1:sNy,:,:,:))
819  C     write(0,*) 'dynamics: S  ',minval(salt(1:sNx,1:sNy,:,:,:)),  C     write(0,*) 'dynamics: S  ',minval(salt(1:sNx,1:sNy,:,:,:)),
820  C    &                           maxval(salt(1:sNx,1:sNy,:,:,:))  C    &                           maxval(salt(1:sNx,1:sNy,:,:,:))
821        write(0,*) 'dynamics: pH ',minval(pH/(Gravity*Rhonil),mask=ph.NE.0.),  C     write(0,*) 'dynamics: phiHyd ',minval(phiHyd/(Gravity*Rhonil),mask=phiHyd.NE.0.),
822       &                           maxval(pH/(Gravity*Rhonil))  C    &                           maxval(phiHyd/(Gravity*Rhonil))
823    C     CALL PLOT_FIELD_XYZRL( gU, ' GU exiting dyanmics ' ,
824    C    &Nr, 1, myThid )
825    C     CALL PLOT_FIELD_XYZRL( gV, ' GV exiting dyanmics ' ,
826    C    &Nr, 1, myThid )
827    C     CALL PLOT_FIELD_XYZRL( gS, ' GS exiting dyanmics ' ,
828    C    &Nr, 1, myThid )
829    C     CALL PLOT_FIELD_XYZRL( gT, ' GT exiting dyanmics ' ,
830    C    &Nr, 1, myThid )
831    C     CALL PLOT_FIELD_XYZRL( phiHyd, ' phiHyd exiting dyanmics ' ,
832    C    &Nr, 1, myThid )
833    
834    
835        RETURN        RETURN
836        END        END

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

  ViewVC Help
Powered by ViewVC 1.1.22