/[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.54.2.7 by adcroft, Tue Jan 9 21:26:07 2001 UTC revision 1.65.2.2 by jmc, Mon Apr 9 16:08:34 2001 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2    C $Name$
3    
4  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
5    
# Line 25  C     \================================= Line 26  C     \=================================
26  C     == Global variables ===  C     == Global variables ===
27  #include "SIZE.h"  #include "SIZE.h"
28  #include "EEPARAMS.h"  #include "EEPARAMS.h"
 #include "CG2D.h"  
29  #include "PARAMS.h"  #include "PARAMS.h"
30  #include "DYNVARS.h"  #include "DYNVARS.h"
31  #include "GRID.h"  #include "GRID.h"
# Line 39  C     == Global variables === Line 39  C     == Global variables ===
39  # include "KPP.h"  # include "KPP.h"
40  #endif  #endif
41    
42    #ifdef ALLOW_TIMEAVE
43    #include "TIMEAVE_STATV.h"
44    #endif
45    
46  C     == Routine arguments ==  C     == Routine arguments ==
47  C     myTime - Current time in simulation  C     myTime - Current time in simulation
48  C     myIter - Current iteration number in simulation  C     myIter - Current iteration number in simulation
# Line 51  C     == Local variables Line 55  C     == Local variables
55  C     xA, yA                 - Per block temporaries holding face areas  C     xA, yA                 - Per block temporaries holding face areas
56  C     uTrans, vTrans, rTrans - Per block temporaries holding flow  C     uTrans, vTrans, rTrans - Per block temporaries holding flow
57  C                              transport  C                              transport
58  C     rVel                     o uTrans: Zonal transport  C                              o uTrans: Zonal transport
59  C                              o vTrans: Meridional transport  C                              o vTrans: Meridional transport
60  C                              o rTrans: Vertical transport  C                              o rTrans: Vertical transport
61  C                              o rVel:   Vertical velocity at upper and  C     maskUp                   o maskUp: land/water mask for W points
 C                                        lower cell faces.  
 C     maskC,maskUp             o maskC: land/water mask for tracer cells  
 C                              o maskUp: land/water mask for W points  
62  C     fVer[STUV]               o fVer: Vertical flux term - note fVer  C     fVer[STUV]               o fVer: Vertical flux term - note fVer
63  C                                      is "pipelined" in the vertical  C                                      is "pipelined" in the vertical
64  C                                      so we need an fVer for each  C                                      so we need an fVer for each
65  C                                      variable.  C                                      variable.
66  C     rhoK, rhoKM1   - Density at current level, level above and level  C     rhoK, rhoKM1   - Density at current level, and level above
 C                      below.  
 C     rhoKP1                                                                    
 C     buoyK, buoyKM1 - Buoyancy at current level and level above.  
67  C     phiHyd         - Hydrostatic part of the potential phiHydi.  C     phiHyd         - Hydrostatic part of the potential phiHydi.
68  C                      In z coords phiHydiHyd is the hydrostatic  C                      In z coords phiHydiHyd is the hydrostatic
69  C                      pressure anomaly  C                      Potential (=pressure/rho0) anomaly
70  C                      In p coords phiHydiHyd is the geopotential  C                      In p coords phiHydiHyd is the geopotential
71  C                      surface height  C                      surface height anomaly.
72  C                      anomaly.  C     phiSurfX, - gradient of Surface potentiel (Pressure/rho, ocean)
73  C     etaSurfX,      - Holds surface elevation gradient in X and Y.  C     phiSurfY             or geopotentiel (atmos) in X and Y direction
 C     etaSurfY  
74  C     KappaRT,       - Total diffusion in vertical for T and S.  C     KappaRT,       - Total diffusion in vertical for T and S.
75  C     KappaRS          (background + spatially varying, isopycnal term).  C     KappaRS          (background + spatially varying, isopycnal term).
76  C     iMin, iMax     - Ranges and sub-block indices on which calculations  C     iMin, iMax     - Ranges and sub-block indices on which calculations
# Line 82  C     bi, bj Line 79  C     bi, bj
79  C     k, kup,        - Index for layer above and below. kup and kDown  C     k, kup,        - Index for layer above and below. kup and kDown
80  C     kDown, km1       are switched with layer to be the appropriate  C     kDown, km1       are switched with layer to be the appropriate
81  C                      index into fVerTerm.  C                      index into fVerTerm.
82    C     tauAB - Adams-Bashforth timestepping weight: 0=forward ; 1/2=Adams-Bashf.
83        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
84        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
85        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
86        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
87        _RL rTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
       _RL rVel    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)  
       _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
88        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
90        _RL fVerS   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerS   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
# Line 96  C                      index into fVerTe Line 92  C                      index into fVerTe
92        _RL fVerV   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerV   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
93        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
94        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
       _RL rhokp1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
95        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
96        _RL buoyKM1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
97        _RL buoyK   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
       _RL rhotmp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
98        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
99        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
100        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
# Line 108  C                      index into fVerTe Line 102  C                      index into fVerTe
102        _RL sigmaX  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaX  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
103        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
104        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
105          _RL tauAB
106    
107  C This is currently also used by IVDC and Diagnostics  C This is currently used by IVDC and Diagnostics
 C #ifdef INCLUDE_CONVECT_CALL  
108        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
 C #endif  
109    
110        INTEGER iMin, iMax        INTEGER iMin, iMax
111        INTEGER jMin, jMax        INTEGER jMin, jMax
# Line 120  C #endif Line 113  C #endif
113        INTEGER i, j        INTEGER i, j
114        INTEGER k, km1, kup, kDown        INTEGER k, km1, kup, kDown
115    
116    Cjmc : add for phiHyd output <- but not working if multi tile per CPU
117    c     CHARACTER*(MAX_LEN_MBUF) suff
118    c     LOGICAL  DIFFERENT_MULTIPLE
119    c     EXTERNAL DIFFERENT_MULTIPLE
120    Cjmc(end)
121    
122  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
123        INTEGER    isbyte        INTEGER    isbyte
124        PARAMETER( isbyte = 4 )        PARAMETER( isbyte = 4 )
# Line 144  C       "Calculation of Gs" Line 143  C       "Calculation of Gs"
143  C       ===================  C       ===================
144  C       This is where all the accelerations and tendencies (ie.  C       This is where all the accelerations and tendencies (ie.
145  C       physics, parameterizations etc...) are calculated  C       physics, parameterizations etc...) are calculated
 C         rVel = sum_r ( div. u[n] )  
146  C         rho = rho ( theta[n], salt[n] )  C         rho = rho ( theta[n], salt[n] )
147  C         b   = b(rho, theta)  C         b   = b(rho, theta)
148  C         K31 = K31 ( rho )  C         K31 = K31 ( rho )
149  C         Gu[n] = Gu( u[n], v[n], rVel, b, ... )  C         Gu[n] = Gu( u[n], v[n], wVel, b, ... )
150  C         Gv[n] = Gv( u[n], v[n], rVel, b, ... )  C         Gv[n] = Gv( u[n], v[n], wVel, b, ... )
151  C         Gt[n] = Gt( theta[n], u[n], v[n], rVel, K31, ... )  C         Gt[n] = Gt( theta[n], u[n], v[n], wVel, K31, ... )
152  C         Gs[n] = Gs( salt[n], u[n], v[n], rVel, K31, ... )  C         Gs[n] = Gs( salt[n], u[n], v[n], wVel, K31, ... )
153  C  C
154  C       "Time-stepping" or "Prediction"  C       "Time-stepping" or "Prediction"
155  C       ================================  C       ================================
# Line 192  C     uninitialised but inert locations. Line 190  C     uninitialised but inert locations.
190          uTrans(i,j)  = 0. _d 0          uTrans(i,j)  = 0. _d 0
191          vTrans(i,j)  = 0. _d 0          vTrans(i,j)  = 0. _d 0
192          DO k=1,Nr          DO k=1,Nr
193           phiHyd (i,j,k)  = 0. _d 0           phiHyd(i,j,k)  = 0. _d 0
194           KappaRU(i,j,k) = 0. _d 0           KappaRU(i,j,k) = 0. _d 0
195           KappaRV(i,j,k) = 0. _d 0           KappaRV(i,j,k) = 0. _d 0
196           sigmaX(i,j,k) = 0. _d 0           sigmaX(i,j,k) = 0. _d 0
# Line 201  C     uninitialised but inert locations. Line 199  C     uninitialised but inert locations.
199          ENDDO          ENDDO
200          rhoKM1 (i,j) = 0. _d 0          rhoKM1 (i,j) = 0. _d 0
201          rhok   (i,j) = 0. _d 0          rhok   (i,j) = 0. _d 0
202          rhoKP1 (i,j) = 0. _d 0          phiSurfX(i,j) = 0. _d 0
203          rhoTMP (i,j) = 0. _d 0          phiSurfY(i,j) = 0. _d 0
         buoyKM1(i,j) = 0. _d 0  
         buoyK  (i,j) = 0. _d 0  
         maskC  (i,j) = 0. _d 0  
204         ENDDO         ENDDO
205        ENDDO        ENDDO
206    
# Line 219  CHPF$ INDEPENDENT Line 214  CHPF$ INDEPENDENT
214    
215  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
216  C--    HPF directive to help TAMC  C--    HPF directive to help TAMC
217  CHPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV  CHPF$  INDEPENDENT, NEW (rTrans,fVerT,fVerS,fVerU,fVerV
218  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA  CHPF$&                  ,phiHyd,utrans,vtrans,xA,yA
219  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV
220  CHPF$&                  )  CHPF$&                  )
221  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
# Line 248  C--     Set up work arrays that need val Line 243  C--     Set up work arrays that need val
243          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
244           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
245            rTrans(i,j)   = 0. _d 0            rTrans(i,j)   = 0. _d 0
           rVel  (i,j,1) = 0. _d 0  
           rVel  (i,j,2) = 0. _d 0  
246            fVerT (i,j,1) = 0. _d 0            fVerT (i,j,1) = 0. _d 0
247            fVerT (i,j,2) = 0. _d 0            fVerT (i,j,2) = 0. _d 0
248            fVerS (i,j,1) = 0. _d 0            fVerS (i,j,1) = 0. _d 0
# Line 258  C--     Set up work arrays that need val Line 251  C--     Set up work arrays that need val
251            fVerU (i,j,2) = 0. _d 0            fVerU (i,j,2) = 0. _d 0
252            fVerV (i,j,1) = 0. _d 0            fVerV (i,j,1) = 0. _d 0
253            fVerV (i,j,2) = 0. _d 0            fVerV (i,j,2) = 0. _d 0
           phiHyd(i,j,1) = 0. _d 0  
254           ENDDO           ENDDO
255          ENDDO          ENDDO
256    
257          DO k=1,Nr          DO k=1,Nr
258           DO j=1-OLy,sNy+OLy           DO j=1-OLy,sNy+OLy
259            DO i=1-OLx,sNx+OLx            DO i=1-OLx,sNx+OLx
260  #ifdef INCLUDE_CONVECT_CALL  C This is currently also used by IVDC and Diagnostics
261             ConvectCount(i,j,k) = 0.             ConvectCount(i,j,k) = 0.
 #endif  
262             KappaRT(i,j,k) = 0. _d 0             KappaRT(i,j,k) = 0. _d 0
263             KappaRS(i,j,k) = 0. _d 0             KappaRS(i,j,k) = 0. _d 0
264            ENDDO            ENDDO
# Line 296  C--       Integrate continuity verticall Line 287  C--       Integrate continuity verticall
287       I                         myThid )       I                         myThid )
288    
289  #ifdef    ALLOW_OBCS  #ifdef    ALLOW_OBCS
290  C--       Calculate future values on open boundaries  #ifdef    ALLOW_NONHYDROSTATIC
291            IF (openBoundaries) THEN  C--       Apply OBC to W if in N-H mode
292  #ifdef      ALLOW_NONHYDROSTATIC            IF (useOBCS.AND.nonHydrostatic) THEN
293              IF (nonHydrostatic) THEN              CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )
               CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )  
             ENDIF  
 #endif      /* ALLOW_NONHYDROSTATIC */  
             CALL OBCS_CALC( bi, bj, k, myTime+deltaT, myThid )  
294            ENDIF            ENDIF
295    #endif    /* ALLOW_NONHYDROSTATIC */
296  #endif    /* ALLOW_OBCS */  #endif    /* ALLOW_OBCS */
297    
298  C--       Calculate gradients of potential density for isoneutral  C--       Calculate gradients of potential density for isoneutral
299  C         slope terms (e.g. GM/Redi tensor or IVDC diffusivity)  C         slope terms (e.g. GM/Redi tensor or IVDC diffusivity)
300            IF ( k.GT.1 .AND. (useGMRedi.OR.ivdc_kappa.NE.0.) ) THEN  c         IF ( k.GT.1 .AND. (useGMRedi.OR.ivdc_kappa.NE.0.) ) THEN
301              IF ( useGMRedi .OR. (k.GT.1 .AND. ivdc_kappa.NE.0.) ) THEN
302              CALL FIND_RHO(              CALL FIND_RHO(
303       I        bi, bj, iMin, iMax, jMin, jMax, k, k, eosType,       I        bi, bj, iMin, iMax, jMin, jMax, k, k, eosType,
304         I        theta, salt,
305       O        rhoK,       O        rhoK,
306       I        myThid )       I        myThid )
307              CALL FIND_RHO(              IF (k.GT.1) CALL FIND_RHO(
308       I        bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType,       I        bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType,
309         I        theta, salt,
310       O        rhoKm1,       O        rhoKm1,
311       I        myThid )       I        myThid )
312              CALL GRAD_SIGMA(              CALL GRAD_SIGMA(
# Line 326  C         slope terms (e.g. GM/Redi tens Line 317  C         slope terms (e.g. GM/Redi tens
317            ENDIF            ENDIF
318    
319  C--       Implicit Vertical Diffusion for Convection  C--       Implicit Vertical Diffusion for Convection
320    c ==> should use sigmaR !!!
321            IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN            IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN
322              CALL CALC_IVDC(              CALL CALC_IVDC(
323       I        bi, bj, iMin, iMax, jMin, jMax, k,       I        bi, bj, iMin, iMax, jMin, jMax, k,
324       I        rhoKm1, rhoK,       I        rhoKm1, rhoK,
 c should use sigmaR !!!  
325       U        ConvectCount, KappaRT, KappaRS,       U        ConvectCount, KappaRT, KappaRS,
326       I        myTime, myIter, myThid)       I        myTime, myIter, myThid)
327            END IF            ENDIF
328    
329  C--     end of diagnostic k loop (Nr:1)  C--     end of diagnostic k loop (Nr:1)
330          ENDDO          ENDDO
331    
332    #ifdef  ALLOW_OBCS
333    C--     Calculate future values on open boundaries
334            IF (useOBCS) THEN
335              CALL OBCS_CALC( bi, bj, myTime+deltaT,
336         I            uVel, vVel, wVel, theta, salt,
337         I            myThid )
338            ENDIF
339    #endif  /* ALLOW_OBCS */
340    
341  C--     Determines forcing terms based on external fields  C--     Determines forcing terms based on external fields
342  C       relaxation terms, etc.  C       relaxation terms, etc.
343          CALL EXTERNAL_FORCING_SURF(          CALL EXTERNAL_FORCING_SURF(
# Line 353  C--     Calculate iso-neutral slopes for Line 353  C--     Calculate iso-neutral slopes for
353       I             sigmaX, sigmaY, sigmaR,       I             sigmaX, sigmaY, sigmaR,
354       I             myThid )       I             myThid )
355            ENDDO            ENDDO
356    #ifdef ALLOW_AUTODIFF_TAMC
357            ELSE
358              DO k=1, Nr
359                CALL GMREDI_CALC_TENSOR_DUMMY(
360         I             bi, bj, iMin, iMax, jMin, jMax, k,
361         I             sigmaX, sigmaY, sigmaR,
362         I             myThid )
363              ENDDO
364    #endif /* ALLOW_AUTODIFF_TAMC */
365          ENDIF          ENDIF
366  #endif  /* ALLOW_GMREDI */  #endif  /* ALLOW_GMREDI */
367    
# Line 373  CADJ STORE uvel (:,:,:,bi,bj) = comlev1_ Line 382  CADJ STORE uvel (:,:,:,bi,bj) = comlev1_
382  CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte  CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte
383  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
384    
385    #ifdef ALLOW_AIM
386    C       AIM - atmospheric intermediate model, physics package code.
387    C note(jmc) : phiHyd=0 at this point but is not really used in Molteni Physics
388            IF ( useAIM ) THEN
389             CALL TIMER_START('AIM_DO_ATMOS_PHYS      [DYNAMICS]', myThid)
390             CALL AIM_DO_ATMOS_PHYSICS( phiHyd, myTime, myThid )
391             CALL TIMER_STOP ('AIM_DO_ATMOS_PHYS      [DYNAMICS]', myThid)
392            ENDIF
393    #endif /* ALLOW_AIM */
394    
395    
396  C--     Start of thermodynamics loop  C--     Start of thermodynamics loop
# Line 394  C--       kDown  Cycles through 2,1 to p Line 412  C--       kDown  Cycles through 2,1 to p
412  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
413  CPatrick Is this formula correct?  CPatrick Is this formula correct?
414           kkey = (ikey-1)*(Nr-1+1) + (k-1) + 1           kkey = (ikey-1)*(Nr-1+1) + (k-1) + 1
 CADJ STORE rvel  (:,:,kDown) = comlev1_bibj_k, key = kkey, byte = isbyte  
415  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte
416  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
417  CADJ STORE KappaRS(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE KappaRS(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
# Line 402  CADJ STORE KappaRS(:,:,:)    = comlev1_b Line 419  CADJ STORE KappaRS(:,:,:)    = comlev1_b
419    
420  C--      Get temporary terms used by tendency routines  C--      Get temporary terms used by tendency routines
421           CALL CALC_COMMON_FACTORS (           CALL CALC_COMMON_FACTORS (
422       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,
423       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,maskUp,
424       I        myThid)       I        myThid)
425    
426  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
427  C--      Calculate the total vertical diffusivity  C--      Calculate the total vertical diffusivity
428           CALL CALC_DIFFUSIVITY(           CALL CALC_DIFFUSIVITY(
429       I        bi,bj,iMin,iMax,jMin,jMax,k,       I        bi,bj,iMin,iMax,jMin,jMax,k,
430       I        maskC,maskup,       I        maskUp,
431       O        KappaRT,KappaRS,KappaRU,KappaRV,       O        KappaRT,KappaRS,KappaRU,KappaRV,
432       I        myThid)       I        myThid)
433  #endif  #endif
# Line 420  C        and step forward storing result Line 437  C        and step forward storing result
437           IF ( tempStepping ) THEN           IF ( tempStepping ) THEN
438             CALL CALC_GT(             CALL CALC_GT(
439       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,
440       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,
441       I         KappaRT,       I         KappaRT,
442       U         fVerT,       U         fVerT,
443       I         myTime, myThid)       I         myTime, myThid)
444               tauAB = 0.5d0 + abEps
445             CALL TIMESTEP_TRACER(             CALL TIMESTEP_TRACER(
446       I         bi,bj,iMin,iMax,jMin,jMax,k,       I         bi,bj,iMin,iMax,jMin,jMax,k,tauAB,
447       I         theta, gT,       I         theta, gT,
448       U         gTnm1,       U         gTnm1,
449       I         myIter, myThid)       I         myIter, myThid)
# Line 433  C        and step forward storing result Line 451  C        and step forward storing result
451           IF ( saltStepping ) THEN           IF ( saltStepping ) THEN
452             CALL CALC_GS(             CALL CALC_GS(
453       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,
454       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,
455       I         KappaRS,       I         KappaRS,
456       U         fVerS,       U         fVerS,
457       I         myTime, myThid)       I         myTime, myThid)
458               tauAB = 0.5d0 + abEps
459             CALL TIMESTEP_TRACER(             CALL TIMESTEP_TRACER(
460       I         bi,bj,iMin,iMax,jMin,jMax,k,       I         bi,bj,iMin,iMax,jMin,jMax,k,tauAB,
461       I         salt, gS,       I         salt, gS,
462       U         gSnm1,       U         gSnm1,
463       I         myIter, myThid)       I         myIter, myThid)
# Line 446  C        and step forward storing result Line 465  C        and step forward storing result
465    
466  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
467  C--      Apply open boundary conditions  C--      Apply open boundary conditions
468           IF (openBoundaries) THEN           IF (useOBCS) THEN
469             CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid )             CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid )
470           END IF           END IF
471  #endif   /* ALLOW_OBCS */  #endif   /* ALLOW_OBCS */
# Line 473  CPatrick? What about this one? Line 492  CPatrick? What about this one?
492  C--     Implicit diffusion  C--     Implicit diffusion
493          IF (implicitDiffusion) THEN          IF (implicitDiffusion) THEN
494    
495            IF (tempStepping) THEN           IF (tempStepping) THEN
496  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
497              idkey = iikey + 1              idkey = iikey + 1
498  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
# Line 497  C--     Implicit diffusion Line 516  C--     Implicit diffusion
516    
517  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
518  C--      Apply open boundary conditions  C--      Apply open boundary conditions
519           IF (openBoundaries) THEN           IF (useOBCS) THEN
520             DO K=1,Nr             DO K=1,Nr
521               CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid )               CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid )
522             ENDDO             ENDDO
# Line 507  C--      Apply open boundary conditions Line 526  C--      Apply open boundary conditions
526  C--     End If implicitDiffusion  C--     End If implicitDiffusion
527          ENDIF          ENDIF
528    
529    C--     Start computation of dynamics
530            iMin = 1-OLx+2
531            iMax = sNx+OLx-1
532            jMin = 1-OLy+2
533            jMax = sNy+OLy-1
534    
535    C--     Explicit part of the Surface Potentiel Gradient (add in TIMESTEP)
536    C       (note: this loop will be replaced by CALL CALC_GRAD_ETA)
537            IF (implicSurfPress.NE.1.) THEN
538              CALL CALC_GRAD_PHI_SURF(
539         I         bi,bj,iMin,iMax,jMin,jMax,
540         I         etaN,
541         O         phiSurfX,phiSurfY,
542         I         myThid )                        
543            ENDIF
544    
545  C--     Start of dynamics loop  C--     Start of dynamics loop
546          DO k=1,Nr          DO k=1,Nr
# Line 520  C--       kDown  Cycles through 2,1 to p Line 553  C--       kDown  Cycles through 2,1 to p
553            kup  = 1+MOD(k+1,2)            kup  = 1+MOD(k+1,2)
554            kDown= 1+MOD(k,2)            kDown= 1+MOD(k,2)
555    
           iMin = 1-OLx+2  
           iMax = sNx+OLx-1  
           jMin = 1-OLy+2  
           jMax = sNy+OLy-1  
   
 C--      Calculate buoyancy  
          CALL FIND_RHO(  
      I        bi, bj, iMin, iMax, jMin, jMax, km1, km1, eosType,  
      O        rhoKm1,  
      I        myThid )  
          CALL CALC_BUOYANCY(  
      I        bi,bj,iMin,iMax,jMin,jMax,k,rhoKm1,  
      O        buoyKm1,  
      I        myThid )  
          CALL FIND_RHO(  
      I        bi, bj, iMin, iMax, jMin, jMax, k, k, eosType,  
      O        rhoK,  
      I        myThid )  
          CALL CALC_BUOYANCY(  
      I        bi,bj,iMin,iMax,jMin,jMax,k,rhoK,  
      O        buoyK,  
      I        myThid )  
   
556  C--      Integrate hydrostatic balance for phiHyd with BC of  C--      Integrate hydrostatic balance for phiHyd with BC of
557  C--      phiHyd(z=0)=0  C        phiHyd(z=0)=0
558           CALL CALC_PHI_HYD(  C        distinguishe between Stagger and Non Stagger time stepping
559       I        bi,bj,iMin,iMax,jMin,jMax,k,buoyKm1,buoyK,           IF (staggerTimeStep) THEN
560               CALL CALC_PHI_HYD(
561         I        bi,bj,iMin,iMax,jMin,jMax,k,
562         I        gTnm1, gSnm1,
563       U        phiHyd,       U        phiHyd,
564       I        myThid )       I        myThid )
565             ELSE
566               CALL CALC_PHI_HYD(
567         I        bi,bj,iMin,iMax,jMin,jMax,k,
568         I        theta, salt,
569         U        phiHyd,
570         I        myThid )
571             ENDIF
572    
573  C--      Calculate accelerations in the momentum equations (gU, gV, ...)  C--      Calculate accelerations in the momentum equations (gU, gV, ...)
574  C        and step forward storing the result in gUnm1, gVnm1, etc...  C        and step forward storing the result in gUnm1, gVnm1, etc...
# Line 560  C        and step forward storing the re Line 580  C        and step forward storing the re
580       I         myTime, myThid)       I         myTime, myThid)
581             CALL TIMESTEP(             CALL TIMESTEP(
582       I         bi,bj,iMin,iMax,jMin,jMax,k,       I         bi,bj,iMin,iMax,jMin,jMax,k,
583         I         phiHyd, phiSurfX, phiSurfY,
584       I         myIter, myThid)       I         myIter, myThid)
585    
586  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
587  C--      Apply open boundary conditions  C--      Apply open boundary conditions
588           IF (openBoundaries) THEN           IF (useOBCS) THEN
589             CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )             CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )
590           END IF           END IF
591  #endif   /* ALLOW_OBCS */  #endif   /* ALLOW_OBCS */
# Line 609  C--     Implicit viscosity Line 630  C--     Implicit viscosity
630    
631  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
632  C--      Apply open boundary conditions  C--      Apply open boundary conditions
633           IF (openBoundaries) THEN           IF (useOBCS) THEN
634             DO K=1,Nr             DO K=1,Nr
635               CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )               CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )
636             ENDDO             ENDDO
# Line 637  C--      Apply open boundary conditions Line 658  C--      Apply open boundary conditions
658  C--     End If implicitViscosity.AND.momStepping  C--     End If implicitViscosity.AND.momStepping
659          ENDIF          ENDIF
660    
661    Cjmc : add for phiHyd output <- but not working if multi tile per CPU
662    c       IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime+deltaTClock,myTime)
663    c    &  .AND. buoyancyRelation .eq. 'ATMOSPHERIC' ) THEN
664    c         WRITE(suff,'(I10.10)') myIter+1
665    c         CALL WRITE_FLD_XYZ_RL('PH.',suff,phiHyd,myIter+1,myThid)
666    c       ENDIF
667    Cjmc(end)
668    
669    #ifdef ALLOW_TIMEAVE
670            IF (taveFreq.GT.0.) THEN
671              CALL TIMEAVE_CUMULATE(phiHydtave, phiHyd, Nr,
672         I                              deltaTclock, bi, bj, myThid)
673              IF (ivdc_kappa.NE.0.) THEN
674                CALL TIMEAVE_CUMULATE(ConvectCountTave, ConvectCount, Nr,
675         I                              deltaTclock, bi, bj, myThid)
676              ENDIF
677            ENDIF
678    #endif /* ALLOW_TIMEAVE */
679    
680         ENDDO         ENDDO
681        ENDDO        ENDDO
682    
683        RETURN        RETURN
684        END        END
   
   
 C--      Cumulative diagnostic calculations (ie. time-averaging)  
 #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE  
 c        IF (taveFreq.GT.0.) THEN  
 c         CALL DO_TIME_AVERAGES(  
 c    I                           myTime, myIter, bi, bj, k, kup, kDown,  
 c    I                           ConvectCount,  
 c    I                           myThid )  
 c        ENDIF  
 #endif  
   

Legend:
Removed from v.1.54.2.7  
changed lines
  Added in v.1.65.2.2

  ViewVC Help
Powered by ViewVC 1.1.22