/[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.30 by cnh, Thu Aug 20 20:05:01 1998 UTC revision 1.42 by adcroft, Tue May 18 18:01:12 1999 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     \==========================================================/
23          IMPLICIT NONE
24    
25  C     == Global variables ===  C     == Global variables ===
26  #include "SIZE.h"  #include "SIZE.h"
# Line 27  C     == Global variables === Line 28  C     == Global variables ===
28  #include "CG2D.h"  #include "CG2D.h"
29  #include "PARAMS.h"  #include "PARAMS.h"
30  #include "DYNVARS.h"  #include "DYNVARS.h"
31    #include "GRID.h"
32    #ifdef ALLOW_KPP
33    #include "KPPMIX.h"
34    #endif
35    
36  C     == Routine arguments ==  C     == Routine arguments ==
37  C     myTime - Current time in simulation  C     myTime - Current time in simulation
# Line 38  C     myThid - Thread number for this in Line 43  C     myThid - Thread number for this in
43    
44  C     == Local variables  C     == Local variables
45  C     xA, yA                 - Per block temporaries holding face areas  C     xA, yA                 - Per block temporaries holding face areas
46  C     uTrans, vTrans, rTrans - Per block temporaries holding flow transport  C     uTrans, vTrans, rTrans - Per block temporaries holding flow
47    C                              transport
48  C     rVel                     o uTrans: Zonal transport  C     rVel                     o uTrans: Zonal transport
49  C                              o vTrans: Meridional transport  C                              o vTrans: Meridional transport
50  C                              o rTrans: Vertical transport  C                              o rTrans: Vertical transport
51  C                              o rVel:   Vertical velocity at upper and lower  C                              o rVel:   Vertical velocity at upper and
52  C                                        cell faces.  C                                        lower cell faces.
53  C     maskC,maskUp             o maskC: land/water mask for tracer cells  C     maskC,maskUp             o maskC: land/water mask for tracer cells
54  C                              o maskUp: land/water mask for W points  C                              o maskUp: land/water mask for W points
55  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 65  C                              o fVer: V
65  C                                      is "pipelined" in the vertical  C                                      is "pipelined" in the vertical
66  C                                      so we need an fVer for each  C                                      so we need an fVer for each
67  C                                      variable.  C                                      variable.
68  C     rhoK, rhoKM1   - Density at current level, level above and level below.  C     rhoK, rhoKM1   - Density at current level, level above and level
69    C                      below.
70  C     rhoKP1                                                                    C     rhoKP1                                                                  
71  C     buoyK, buoyKM1 - Buoyancy at current level and level above.  C     buoyK, buoyKM1 - Buoyancy at current level and level above.
72  C     phiHyd         - Hydrostatic part of the potential phi.  C     phiHyd         - Hydrostatic part of the potential phiHydi.
73  C                      In z coords phiHyd is the hydrostatic pressure anomaly  C                      In z coords phiHydiHyd is the hydrostatic
74  C                      In p coords phiHyd is the geopotential surface height  C                      pressure anomaly
75    C                      In p coords phiHydiHyd is the geopotential
76    C                      surface height
77  C                      anomaly.  C                      anomaly.
78  C     etaSurfX,      - Holds surface elevation gradient in X and Y.  C     etaSurfX,      - Holds surface elevation gradient in X and Y.
79  C     etaSurfY  C     etaSurfY
# Line 72  C     K13, K23, K33  - Non-zero elements Line 81  C     K13, K23, K33  - Non-zero elements
81  C                      diffusion tensor.  C                      diffusion tensor.
82  C     KapGM          - Spatially varying Visbeck et. al mixing coeff.  C     KapGM          - Spatially varying Visbeck et. al mixing coeff.
83  C     KappaRT,       - Total diffusion in vertical for T and S.  C     KappaRT,       - Total diffusion in vertical for T and S.
84  C     KappaRS          ( background + spatially varying, isopycnal term).  C     KappaRS          (background + spatially varying, isopycnal term).
85  C     iMin, iMax     - Ranges and sub-block indices on which calculations  C     iMin, iMax     - Ranges and sub-block indices on which calculations
86  C     jMin, jMax       are applied.  C     jMin, jMax       are applied.
87  C     bi, bj  C     bi, bj
88  C     k, kUp,        - Index for layer above and below. kUp and kDown  C     k, kUp,        - Index for layer above and below. kUp and kDown
89  C     kDown, kM1       are switched with layer to be the appropriate index  C     kDown, kM1       are switched with layer to be the appropriate
90  C                      into fVerTerm  C                      index into fVerTerm.
91        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
92        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
93        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 98  C                      into fVerTerm Line 107  C                      into fVerTerm
107        _RL fVerS   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerS   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
108        _RL fVerU   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerU   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
109        _RL fVerV   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerV   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
110        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
111        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
112        _RL rhokp1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokp1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
113        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 107  C                      into fVerTerm Line 116  C                      into fVerTerm
116        _RL rhotmp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhotmp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
117        _RL etaSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL etaSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
118        _RL etaSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL etaSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
119        _RL K13     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL K13     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
120        _RL K23     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL K23     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
121        _RL K33     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL K33     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
122        _RL KapGM   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL KapGM   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
123        _RL KappaZT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nz)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
124        _RL KappaZS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nz)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
125          _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
126          _RL KappaRV (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
127    
128        INTEGER iMin, iMax        INTEGER iMin, iMax
129        INTEGER jMin, jMax        INTEGER jMin, jMax
# Line 134  C Line 145  C
145  C       "Calculation of Gs"  C       "Calculation of Gs"
146  C       ===================  C       ===================
147  C       This is where all the accelerations and tendencies (ie.  C       This is where all the accelerations and tendencies (ie.
148  C       physics, parameterizations etc...) are calculated  C       phiHydysics, parameterizations etc...) are calculated
149  C         rVel = sum_r ( div. u[n] )  C         rVel = sum_r ( div. u[n] )
150  C         rho = rho ( theta[n], salt[n] )  C         rho = rho ( theta[n], salt[n] )
151  C         b   = b(rho, theta)  C         b   = b(rho, theta)
# Line 184  C     uninitialised but inert locations. Line 195  C     uninitialised but inert locations.
195          pTerm(i,j)   = 0. _d 0          pTerm(i,j)   = 0. _d 0
196          fZon(i,j)    = 0. _d 0          fZon(i,j)    = 0. _d 0
197          fMer(i,j)    = 0. _d 0          fMer(i,j)    = 0. _d 0
198          DO K=1,nZ          DO K=1,Nr
199           pH (i,j,k)  = 0. _d 0           phiHyd (i,j,k)  = 0. _d 0
200           K13(i,j,k)  = 0. _d 0           K13(i,j,k)  = 0. _d 0
201           K23(i,j,k)  = 0. _d 0           K23(i,j,k)  = 0. _d 0
202           K33(i,j,k)  = 0. _d 0           K33(i,j,k)  = 0. _d 0
203           KappaZT(i,j,k) = 0. _d 0           KappaRT(i,j,k) = 0. _d 0
204             KappaRS(i,j,k) = 0. _d 0
205          ENDDO          ENDDO
206          rhoKM1 (i,j) = 0. _d 0          rhoKM1 (i,j) = 0. _d 0
207          rhok   (i,j) = 0. _d 0          rhok   (i,j) = 0. _d 0
# Line 201  C     uninitialised but inert locations. Line 213  C     uninitialised but inert locations.
213         ENDDO         ENDDO
214        ENDDO        ENDDO
215    
216    
217        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
218         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
219    
# Line 231  C--     Set up work arrays that need val Line 244  C--     Set up work arrays that need val
244          jMin = 1-OLy+1          jMin = 1-OLy+1
245          jMax = sNy+OLy          jMax = sNy+OLy
246    
247    
248          K = 1          K = 1
249          BOTTOM_LAYER = K .EQ. Nz          BOTTOM_LAYER = K .EQ. Nr
250    
251    #ifdef DO_PIPELINED_CORRECTION_STEP
252  C--     Calculate gradient of surface pressure  C--     Calculate gradient of surface pressure
253          CALL CALC_GRAD_ETA_SURF(          CALL CALC_GRAD_ETA_SURF(
254       I       bi,bj,iMin,iMax,jMin,jMax,       I       bi,bj,iMin,iMax,jMin,jMax,
# Line 243  C--     Update fields in top level accor Line 258  C--     Update fields in top level accor
258          CALL CORRECTION_STEP(          CALL CORRECTION_STEP(
259       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
260       I       etaSurfX,etaSurfY,myTime,myThid)       I       etaSurfX,etaSurfY,myTime,myThid)
261            IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K, myThid )
262          IF ( .NOT. BOTTOM_LAYER ) THEN          IF ( .NOT. BOTTOM_LAYER ) THEN
263  C--      Update fields in layer below according to tendency terms  C--      Update fields in layer below according to tendency terms
264           CALL CORRECTION_STEP(           CALL CORRECTION_STEP(
265       I        bi,bj,iMin,iMax,jMin,jMax,K+1,       I        bi,bj,iMin,iMax,jMin,jMax,K+1,
266       I        etaSurfX,etaSurfY,myTime,myThid)       I        etaSurfX,etaSurfY,myTime,myThid)
267             IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )
268          ENDIF          ENDIF
269    #endif
270  C--     Density of 1st level (below W(1)) reference to level 1  C--     Density of 1st level (below W(1)) reference to level 1
271    #ifdef  INCLUDE_FIND_RHO_CALL
272          CALL FIND_RHO(          CALL FIND_RHO(
273       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
274       O     rhoKm1,       O     rhoKm1,
275       I     myThid )       I     myThid )
276    #endif
277    
278          IF ( .NOT. BOTTOM_LAYER ) THEN          IF (       (.NOT. BOTTOM_LAYER)
279    #ifdef ALLOW_KPP
280         &       .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing
281    #endif
282         &     ) THEN
283  C--      Check static stability with layer below  C--      Check static stability with layer below
284  C--      and mix as needed.  C--      and mix as needed.
285    #ifdef  INCLUDE_FIND_RHO_CALL
286           CALL FIND_RHO(           CALL FIND_RHO(
287       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,
288       O      rhoKp1,       O      rhoKp1,
289       I      myThid )       I      myThid )
290    #endif
291    #ifdef  INCLUDE_CONVECT_CALL
292           CALL CONVECT(           CALL CONVECT(
293       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
294       I       myTime,myIter,myThid)       I       myTime,myIter,myThid)
295    #endif
296  C--      Recompute density after mixing  C--      Recompute density after mixing
297    #ifdef  INCLUDE_FIND_RHO_CALL
298           CALL FIND_RHO(           CALL FIND_RHO(
299       I      bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
300       O      rhoKm1,       O      rhoKm1,
301       I      myThid )       I      myThid )
302    #endif
303          ENDIF          ENDIF
304  C--     Calculate buoyancy  C--     Calculate buoyancy
305          CALL CALC_BUOY(          CALL CALC_BUOYANCY(
306       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,
307       O      buoyKm1,       O      buoyKm1,
308       I      myThid )       I      myThid )
309  C--     Integrate hydrostatic balance for pH with BC of pH(z=0)=0  C--     Integrate hydrostatic balance for phiHyd with BC of
310    C--     phiHyd(z=0)=0
311          CALL CALC_PHI_HYD(          CALL CALC_PHI_HYD(
312       I      bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1,       I      bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1,
313       U      phiHyd,       U      phiHyd,
314       I      myThid )       I      myThid )
315    
316          DO K=2,Nz          DO K=2,Nr
317           BOTTOM_LAYER = K .EQ. Nz           BOTTOM_LAYER = K .EQ. Nr
318    #ifdef DO_PIPELINED_CORRECTION_STEP
319           IF ( .NOT. BOTTOM_LAYER ) THEN           IF ( .NOT. BOTTOM_LAYER ) THEN
320  C--       Update fields in layer below according to tendency terms  C--       Update fields in layer below according to tendency terms
321            CALL CORRECTION_STEP(            CALL CORRECTION_STEP(
322       I         bi,bj,iMin,iMax,jMin,jMax,K+1,       I         bi,bj,iMin,iMax,jMin,jMax,K+1,
323       I         etaSurfX,etaSurfY,myTime,myThid)       I         etaSurfX,etaSurfY,myTime,myThid)
324              IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )
325           ENDIF           ENDIF
326    #endif
327  C--      Density of K level (below W(K)) reference to K level  C--      Density of K level (below W(K)) reference to K level
328    #ifdef  INCLUDE_FIND_RHO_CALL
329           CALL FIND_RHO(           CALL FIND_RHO(
330       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,
331       O      rhoK,       O      rhoK,
332       I      myThid )       I      myThid )
333           IF ( .NOT. BOTTOM_LAYER ) THEN  #endif
334             IF (       (.NOT. BOTTOM_LAYER)
335    #ifdef ALLOW_KPP
336         &       .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing
337    #endif
338         &      ) THEN
339  C--       Check static stability with layer below and mix as needed.  C--       Check static stability with layer below and mix as needed.
340  C--       Density of K+1 level (below W(K+1)) reference to K level.  C--       Density of K+1 level (below W(K+1)) reference to K level.
341    #ifdef  INCLUDE_FIND_RHO_CALL
342            CALL FIND_RHO(            CALL FIND_RHO(
343       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,
344       O       rhoKp1,       O       rhoKp1,
345       I       myThid )       I       myThid )
346    #endif
347    #ifdef  INCLUDE_CONVECT_CALL
348            CALL CONVECT(            CALL CONVECT(
349       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,
350       I        myTime,myIter,myThid)       I        myTime,myIter,myThid)
351    #endif
352  C--       Recompute density after mixing  C--       Recompute density after mixing
353    #ifdef  INCLUDE_FIND_RHO_CALL
354            CALL FIND_RHO(            CALL FIND_RHO(
355       I       bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I       bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
356       O       rhoK,       O       rhoK,
357       I       myThid )       I       myThid )
358    #endif
359           ENDIF           ENDIF
360  C--      Calculate buoyancy  C--      Calculate buoyancy
361           CALL CALC_BUOY(           CALL CALC_BUOYANCY(
362       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoK,       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoK,
363       O       buoyK,       O       buoyK,
364       I       myThid )       I       myThid )
365  C--      Integrate hydrostatic balance for pH with BC of pH(z=0)=0  C--      Integrate hydrostatic balance for phiHyd with BC of
366    C--      phiHyd(z=0)=0
367           CALL CALC_PHI_HYD(           CALL CALC_PHI_HYD(
368       I        bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK,       I        bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK,
369       U        phiHyd,       U        phiHyd,
370       I        myThid )       I        myThid )
371  C--      Calculate iso-neutral slopes for the GM/Redi parameterisation  C--      Calculate iso-neutral slopes for the GM/Redi parameterisation
372    #ifdef  INCLUDE_FIND_RHO_CALL
373           CALL FIND_RHO(           CALL FIND_RHO(
374       I        bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,       I        bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,
375       O        rhoTmp,       O        rhoTmp,
376       I        myThid )       I        myThid )
377    #endif
378    #ifdef  INCLUDE_CALC_ISOSLOPES_CALL
379           CALL CALC_ISOSLOPES(           CALL CALC_ISOSLOPES(
380       I        bi, bj, iMin, iMax, jMin, jMax, K,       I        bi, bj, iMin, iMax, jMin, jMax, K,
381       I        rhoKm1, rhoK, rhotmp,       I        rhoKm1, rhoK, rhotmp,
382       O        K13, K23, K33, KapGM,       O        K13, K23, K33, KapGM,
383       I        myThid )       I        myThid )
384    #endif
385           DO J=jMin,jMax           DO J=jMin,jMax
386            DO I=iMin,iMax            DO I=iMin,iMax
387    #ifdef  INCLUDE_FIND_RHO_CALL
388             rhoKm1 (I,J) = rhoK(I,J)             rhoKm1 (I,J) = rhoK(I,J)
389    #endif
390             buoyKm1(I,J) = buoyK(I,J)             buoyKm1(I,J) = buoyK(I,J)
391            ENDDO            ENDDO
392           ENDDO           ENDDO
393          ENDDO ! K          ENDDO ! K
394    
395          DO K = Nz, 1, -1  #ifdef ALLOW_KPP
396    C--     Compute KPP mixing coefficients
397            IF (usingKPPmixing) THEN
398             CALL TIMER_START('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]'
399         I          , myThid)
400             CALL KVMIX(
401         I               bi, bj, myTime, myThid )
402             CALL TIMER_STOP ('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]'
403         I        , myThid)
404            ENDIF
405    #endif
406    
407            DO K = Nr, 1, -1
408    
409           kM1  =max(1,k-1)   ! Points to level above k (=k-1)           kM1  =max(1,k-1)   ! Points to level above k (=k-1)
410           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
# Line 354  C--      Get temporary terms used by ten Line 419  C--      Get temporary terms used by ten
419       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
420       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,
421       I        myThid)       I        myThid)
422    #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
423  C--      Calculate the total vertical diffusivity  C--      Calculate the total vertical diffusivity
424           CALL CALC_DIFFUSIVITY(           CALL CALC_DIFFUSIVITY(
425       I        bi,bj,iMin,iMax,jMin,jMax,K,       I        bi,bj,iMin,iMax,jMin,jMax,K,
426       I        maskC,maskUp,KapGM,K33,       I        maskC,maskUp,KapGM,K33,
427       O        KappaZT,KappaZS,       O        KappaRT,KappaRS,KappaRU,KappaRV,
428       I        myThid)       I        myThid)
429    #endif
430  C--      Calculate accelerations in the momentum equations  C--      Calculate accelerations in the momentum equations
431           IF ( momStepping ) THEN           IF ( momStepping ) THEN
432            CALL CALC_MOM_RHS(            CALL CALC_MOM_RHS(
433       I         bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I         bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
434       I         xA,yA,uTrans,vTrans,rTrans,rVel,maskC,       I         xA,yA,uTrans,vTrans,rTrans,rVel,maskC,
435       I         phiHyd,       I         phiHyd,KappaRU,KappaRV,
436       U         aTerm,xTerm,cTerm,mTerm,pTerm,       U         aTerm,xTerm,cTerm,mTerm,pTerm,
437       U         fZon, fMer, fVerU, fVerV,       U         fZon, fMer, fVerU, fVerV,
438       I         myThid)       I         myTime, myThid)
439           ENDIF           ENDIF
440  C--      Calculate active tracer tendencies  C--      Calculate active tracer tendencies
441           IF ( tempStepping ) THEN           IF ( tempStepping ) THEN
# Line 377  C--      Calculate active tracer tendenc Line 444  C--      Calculate active tracer tendenc
444       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
445       I         K13,K23,KappaRT,KapGM,       I         K13,K23,KappaRT,KapGM,
446       U         aTerm,xTerm,fZon,fMer,fVerT,       U         aTerm,xTerm,fZon,fMer,fVerT,
447       I         myThid)       I         myTime, myThid)
448           ENDIF           ENDIF
449           IF ( saltStepping ) THEN           IF ( saltStepping ) THEN
450            CALL CALC_GS(            CALL CALC_GS(
# Line 385  C--      Calculate active tracer tendenc Line 452  C--      Calculate active tracer tendenc
452       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
453       I         K13,K23,KappaRS,KapGM,       I         K13,K23,KappaRS,KapGM,
454       U         aTerm,xTerm,fZon,fMer,fVerS,       U         aTerm,xTerm,fZon,fMer,fVerS,
455       I         myThid)       I         myTime, myThid)
456           ENDIF           ENDIF
457  C--      Prediction step (step forward all model variables)  C--      Prediction step (step forward all model variables)
458           CALL TIMESTEP(           CALL TIMESTEP(
459       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
460       I       myThid)       I       myThid)
461    C--      Apply open boundary conditions
462             IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid )
463    C--      Freeze water
464             IF (allowFreezing)
465         &   CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid )
466  C--      Diagnose barotropic divergence of predicted fields  C--      Diagnose barotropic divergence of predicted fields
467           CALL CALC_DIV_G(           CALL CALC_DIV_GHAT(
468       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
469       I       xA,yA,       I       xA,yA,
470       I       myThid)       I       myThid)
471    
472  C--      Cumulative diagnostic calculations (ie. time-averaging)  C--      Cumulative diagnostic calculations (ie. time-averaging)
473  #ifdef ALLOW_DIAGNOSTICS  #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE
474           IF (taveFreq.GT.0.) THEN           IF (taveFreq.GT.0.) THEN
475            CALL DO_TIME_AVERAGES(            CALL DO_TIME_AVERAGES(
476       I                           myTime, myIter, bi, bj, K, kUp, kDown,       I                           myTime, myIter, bi, bj, K, kUp, kDown,
# Line 411  C--      Cumulative diagnostic calculati Line 483  C--      Cumulative diagnostic calculati
483    
484  C--     Implicit diffusion  C--     Implicit diffusion
485          IF (implicitDiffusion) THEN          IF (implicitDiffusion) THEN
486           CALL IMPLDIFF( bi, bj, iMin, iMax, jMin, jMax,           IF (tempStepping) CALL IMPLDIFF(
487       I                  KappaZT,KappaZS,       I         bi, bj, iMin, iMax, jMin, jMax,
488       I                  myThid )       I         deltaTtracer, KappaRT,recip_HFacC,
489          ENDIF       U         gTNm1,
490         I         myThid )
491             IF (saltStepping) CALL IMPLDIFF(
492         I         bi, bj, iMin, iMax, jMin, jMax,
493         I         deltaTtracer, KappaRS,recip_HFacC,
494         U         gSNm1,
495         I         myThid )
496             IF (momStepping) THEN
497              CALL IMPLDIFF(
498         I         bi, bj, iMin, iMax, jMin, jMax,
499         I         deltaTmom, KappaRU,recip_HFacW,
500         U         gUNm1,
501         I         myThid )
502              CALL IMPLDIFF(
503         I         bi, bj, iMin, iMax, jMin, jMax,
504         I         deltaTmom, KappaRV,recip_HFacS,
505         U         gVNm1,
506         I         myThid )
507    #ifdef INCLUDE_CD_CODE
508              CALL IMPLDIFF(
509         I         bi, bj, iMin, iMax, jMin, jMax,
510         I         deltaTmom, KappaRU,recip_HFacW,
511         U         vVelD,
512         I         myThid )
513              CALL IMPLDIFF(
514         I         bi, bj, iMin, iMax, jMin, jMax,
515         I         deltaTmom, KappaRV,recip_HFacS,
516         U         uVelD,
517         I         myThid )
518    #endif
519             ENDIF ! momStepping
520            ENDIF ! implicitDiffusion
521    
522         ENDDO         ENDDO
523        ENDDO        ENDDO
# Line 445  C     write(0,*) 'dynamics: gS ',minval( Line 548  C     write(0,*) 'dynamics: gS ',minval(
548  C    &                           maxval(gS(1:sNx,1:sNy,:,:,:))  C    &                           maxval(gS(1:sNx,1:sNy,:,:,:))
549  C     write(0,*) 'dynamics: S  ',minval(salt(1:sNx,1:sNy,:,:,:)),  C     write(0,*) 'dynamics: S  ',minval(salt(1:sNx,1:sNy,:,:,:)),
550  C    &                           maxval(salt(1:sNx,1:sNy,:,:,:))  C    &                           maxval(salt(1:sNx,1:sNy,:,:,:))
551  C     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.),
552  C    &                           maxval(pH/(Gravity*Rhonil))  C    &                           maxval(phiHyd/(Gravity*Rhonil))
553    C     CALL PLOT_FIELD_XYZRL( gU, ' GU exiting dyanmics ' ,
554    C    &Nr, 1, myThid )
555    C     CALL PLOT_FIELD_XYZRL( gV, ' GV exiting dyanmics ' ,
556    C    &Nr, 1, myThid )
557    C     CALL PLOT_FIELD_XYZRL( gS, ' GS exiting dyanmics ' ,
558    C    &Nr, 1, myThid )
559    C     CALL PLOT_FIELD_XYZRL( gT, ' GT exiting dyanmics ' ,
560    C    &Nr, 1, myThid )
561    C     CALL PLOT_FIELD_XYZRL( phiHyd, ' phiHyd exiting dyanmics ' ,
562    C    &Nr, 1, myThid )
563    
564    
565        RETURN        RETURN
566        END        END

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.22