/[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.59 by cnh, Sun Feb 4 14:38:47 2001 UTC revision 1.63 by jmc, Tue Feb 20 15:06:21 2001 UTC
# Line 40  C     == Global variables === Line 40  C     == Global variables ===
40  # include "KPP.h"  # include "KPP.h"
41  #endif  #endif
42    
43    #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE
44    #include "AVER.h"
45    #endif
46    
47  C     == Routine arguments ==  C     == Routine arguments ==
48  C     myTime - Current time in simulation  C     myTime - Current time in simulation
49  C     myIter - Current iteration number in simulation  C     myIter - Current iteration number in simulation
# Line 52  C     == Local variables Line 56  C     == Local variables
56  C     xA, yA                 - Per block temporaries holding face areas  C     xA, yA                 - Per block temporaries holding face areas
57  C     uTrans, vTrans, rTrans - Per block temporaries holding flow  C     uTrans, vTrans, rTrans - Per block temporaries holding flow
58  C                              transport  C                              transport
59  C     rVel                     o uTrans: Zonal transport  C                              o uTrans: Zonal transport
60  C                              o vTrans: Meridional transport  C                              o vTrans: Meridional transport
61  C                              o rTrans: Vertical transport  C                              o rTrans: Vertical transport
 C                              o rVel:   Vertical velocity at upper and  
 C                                        lower cell faces.  
62  C     maskC,maskUp             o maskC: land/water mask for tracer cells  C     maskC,maskUp             o maskC: land/water mask for tracer cells
63  C                              o maskUp: land/water mask for W points  C                              o maskUp: land/water mask for W points
64  C     fVer[STUV]               o fVer: Vertical flux term - note fVer  C     fVer[STUV]               o fVer: Vertical flux term - note fVer
# Line 70  C                      pressure anomaly Line 72  C                      pressure anomaly
72  C                      In p coords phiHydiHyd is the geopotential  C                      In p coords phiHydiHyd is the geopotential
73  C                      surface height  C                      surface height
74  C                      anomaly.  C                      anomaly.
75  C     etaSurfX,      - Holds surface elevation gradient in X and Y.  C     phiSurfX, - gradient of Surface potentiel (Pressure/rho, ocean)
76  C     etaSurfY  C     phiSurfY             or geopotentiel (atmos) in X and Y direction
77  C     KappaRT,       - Total diffusion in vertical for T and S.  C     KappaRT,       - Total diffusion in vertical for T and S.
78  C     KappaRS          (background + spatially varying, isopycnal term).  C     KappaRS          (background + spatially varying, isopycnal term).
79  C     iMin, iMax     - Ranges and sub-block indices on which calculations  C     iMin, iMax     - Ranges and sub-block indices on which calculations
# Line 85  C                      index into fVerTe Line 87  C                      index into fVerTe
87        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
88        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89        _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)  
90        _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
91        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
92        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
# Line 95  C                      index into fVerTe Line 96  C                      index into fVerTe
96        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
97        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
98        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99          _RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
100          _RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
101        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
102        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
103        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
# Line 103  C                      index into fVerTe Line 106  C                      index into fVerTe
106        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
107        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
108    
109  C This is currently also used by IVDC and Diagnostics  C This is currently used by IVDC and Diagnostics
 C #ifdef INCLUDE_CONVECT_CALL  
110        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
 C #endif  
111    
112        INTEGER iMin, iMax        INTEGER iMin, iMax
113        INTEGER jMin, jMax        INTEGER jMin, jMax
# Line 114  C #endif Line 115  C #endif
115        INTEGER i, j        INTEGER i, j
116        INTEGER k, km1, kup, kDown        INTEGER k, km1, kup, kDown
117    
118    Cjmc : add for phiHyd output <- but not working if multi tile per CPU
119    c     CHARACTER*(MAX_LEN_MBUF) suff
120    c     LOGICAL  DIFFERENT_MULTIPLE
121    c     EXTERNAL DIFFERENT_MULTIPLE
122    Cjmc(end)
123    
124  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
125        INTEGER    isbyte        INTEGER    isbyte
126        PARAMETER( isbyte = 4 )        PARAMETER( isbyte = 4 )
# Line 138  C       "Calculation of Gs" Line 145  C       "Calculation of Gs"
145  C       ===================  C       ===================
146  C       This is where all the accelerations and tendencies (ie.  C       This is where all the accelerations and tendencies (ie.
147  C       physics, parameterizations etc...) are calculated  C       physics, parameterizations etc...) are calculated
 C         rVel = sum_r ( div. u[n] )  
148  C         rho = rho ( theta[n], salt[n] )  C         rho = rho ( theta[n], salt[n] )
149  C         b   = b(rho, theta)  C         b   = b(rho, theta)
150  C         K31 = K31 ( rho )  C         K31 = K31 ( rho )
151  C         Gu[n] = Gu( u[n], v[n], rVel, b, ... )  C         Gu[n] = Gu( u[n], v[n], wVel, b, ... )
152  C         Gv[n] = Gv( u[n], v[n], rVel, b, ... )  C         Gv[n] = Gv( u[n], v[n], wVel, b, ... )
153  C         Gt[n] = Gt( theta[n], u[n], v[n], rVel, K31, ... )  C         Gt[n] = Gt( theta[n], u[n], v[n], wVel, K31, ... )
154  C         Gs[n] = Gs( salt[n], u[n], v[n], rVel, K31, ... )  C         Gs[n] = Gs( salt[n], u[n], v[n], wVel, K31, ... )
155  C  C
156  C       "Time-stepping" or "Prediction"  C       "Time-stepping" or "Prediction"
157  C       ================================  C       ================================
# Line 196  C     uninitialised but inert locations. Line 202  C     uninitialised but inert locations.
202          rhoKM1 (i,j) = 0. _d 0          rhoKM1 (i,j) = 0. _d 0
203          rhok   (i,j) = 0. _d 0          rhok   (i,j) = 0. _d 0
204          maskC  (i,j) = 0. _d 0          maskC  (i,j) = 0. _d 0
205            phiSurfX(i,j) = 0. _d 0
206            phiSurfY(i,j) = 0. _d 0
207         ENDDO         ENDDO
208        ENDDO        ENDDO
209    
# Line 209  CHPF$ INDEPENDENT Line 217  CHPF$ INDEPENDENT
217    
218  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
219  C--    HPF directive to help TAMC  C--    HPF directive to help TAMC
220  CHPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV  CHPF$  INDEPENDENT, NEW (rTrans,fVerT,fVerS,fVerU,fVerV
221  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA
222  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV
223  CHPF$&                  )  CHPF$&                  )
# Line 238  C--     Set up work arrays that need val Line 246  C--     Set up work arrays that need val
246          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
247           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
248            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  
249            fVerT (i,j,1) = 0. _d 0            fVerT (i,j,1) = 0. _d 0
250            fVerT (i,j,2) = 0. _d 0            fVerT (i,j,2) = 0. _d 0
251            fVerS (i,j,1) = 0. _d 0            fVerS (i,j,1) = 0. _d 0
# Line 254  C--     Set up work arrays that need val Line 260  C--     Set up work arrays that need val
260          DO k=1,Nr          DO k=1,Nr
261           DO j=1-OLy,sNy+OLy           DO j=1-OLy,sNy+OLy
262            DO i=1-OLx,sNx+OLx            DO i=1-OLx,sNx+OLx
263  #ifdef INCLUDE_CONVECT_CALL  C This is currently also used by IVDC and Diagnostics
264             ConvectCount(i,j,k) = 0.             ConvectCount(i,j,k) = 0.
 #endif  
265             KappaRT(i,j,k) = 0. _d 0             KappaRT(i,j,k) = 0. _d 0
266             KappaRS(i,j,k) = 0. _d 0             KappaRS(i,j,k) = 0. _d 0
267            ENDDO            ENDDO
# Line 286  C--       Integrate continuity verticall Line 291  C--       Integrate continuity verticall
291    
292  #ifdef    ALLOW_OBCS  #ifdef    ALLOW_OBCS
293  #ifdef    ALLOW_NONHYDROSTATIC  #ifdef    ALLOW_NONHYDROSTATIC
294  C--       Calculate future values on open boundaries  C--       Apply OBC to W if in N-H mode
295            IF (useOBCS.AND.nonHydrostatic) THEN            IF (useOBCS.AND.nonHydrostatic) THEN
296              CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )              CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )
297            ENDIF            ENDIF
# Line 322  c ==> should use sigmaR !!! Line 327  c ==> should use sigmaR !!!
327       I        rhoKm1, rhoK,       I        rhoKm1, rhoK,
328       U        ConvectCount, KappaRT, KappaRS,       U        ConvectCount, KappaRT, KappaRS,
329       I        myTime, myIter, myThid)       I        myTime, myIter, myThid)
330            END IF            ENDIF
331    
332  C--     end of diagnostic k loop (Nr:1)  C--     end of diagnostic k loop (Nr:1)
333          ENDDO          ENDDO
# Line 410  C--       kDown  Cycles through 2,1 to p Line 415  C--       kDown  Cycles through 2,1 to p
415  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
416  CPatrick Is this formula correct?  CPatrick Is this formula correct?
417           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  
418  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte
419  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
420  CADJ STORE KappaRS(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE KappaRS(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
# Line 419  CADJ STORE KappaRS(:,:,:)    = comlev1_b Line 423  CADJ STORE KappaRS(:,:,:)    = comlev1_b
423  C--      Get temporary terms used by tendency routines  C--      Get temporary terms used by tendency routines
424           CALL CALC_COMMON_FACTORS (           CALL CALC_COMMON_FACTORS (
425       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,
426       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,maskC,maskUp,
427       I        myThid)       I        myThid)
428    
429  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
# Line 489  CPatrick? What about this one? Line 493  CPatrick? What about this one?
493  C--     Implicit diffusion  C--     Implicit diffusion
494          IF (implicitDiffusion) THEN          IF (implicitDiffusion) THEN
495    
496            IF (tempStepping) THEN           IF (tempStepping) THEN
497  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
498              idkey = iikey + 1              idkey = iikey + 1
499  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
# Line 523  C--      Apply open boundary conditions Line 527  C--      Apply open boundary conditions
527  C--     End If implicitDiffusion  C--     End If implicitDiffusion
528          ENDIF          ENDIF
529    
530    C--     Start computation of dynamics
531            iMin = 1-OLx+2
532            iMax = sNx+OLx-1
533            jMin = 1-OLy+2
534            jMax = sNy+OLy-1
535    
536    C--     Explicit part of the Surface Pressure Gradient (add in TIMESTEP)
537    C       (note: this loop will be replaced by CALL CALC_GRAD_ETA)
538            IF (implicSurfPress.NE.1.) THEN
539              DO j=jMin,jMax
540                DO i=iMin,iMax
541                  phiSurfX(i,j) = _recip_dxC(i,j,bi,bj)*gBaro
542         &           *(cg2d_x(i,j,bi,bj)-cg2d_x(i-1,j,bi,bj))
543                  phiSurfY(i,j) = _recip_dyC(i,j,bi,bj)*gBaro
544         &           *(cg2d_x(i,j,bi,bj)-cg2d_x(i,j-1,bi,bj))
545                ENDDO
546              ENDDO
547            ENDIF
548    
549  C--     Start of dynamics loop  C--     Start of dynamics loop
550          DO k=1,Nr          DO k=1,Nr
# Line 536  C--       kDown  Cycles through 2,1 to p Line 557  C--       kDown  Cycles through 2,1 to p
557            kup  = 1+MOD(k+1,2)            kup  = 1+MOD(k+1,2)
558            kDown= 1+MOD(k,2)            kDown= 1+MOD(k,2)
559    
           iMin = 1-OLx+2  
           iMax = sNx+OLx-1  
           jMin = 1-OLy+2  
           jMax = sNy+OLy-1  
   
560  C--      Integrate hydrostatic balance for phiHyd with BC of  C--      Integrate hydrostatic balance for phiHyd with BC of
561  C        phiHyd(z=0)=0  C        phiHyd(z=0)=0
562  C        distinguishe between Stagger and Non Stagger time stepping  C        distinguishe between Stagger and Non Stagger time stepping
# Line 567  C        and step forward storing the re Line 583  C        and step forward storing the re
583       U         fVerU, fVerV,       U         fVerU, fVerV,
584       I         myTime, myThid)       I         myTime, myThid)
585             CALL TIMESTEP(             CALL TIMESTEP(
586       I         bi,bj,iMin,iMax,jMin,jMax,k,phiHyd,       I         bi,bj,iMin,iMax,jMin,jMax,k,
587         I         phiHyd, phiSurfX, phiSurfY,
588       I         myIter, myThid)       I         myIter, myThid)
589    
590  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
# Line 645  C--      Apply open boundary conditions Line 662  C--      Apply open boundary conditions
662  C--     End If implicitViscosity.AND.momStepping  C--     End If implicitViscosity.AND.momStepping
663          ENDIF          ENDIF
664    
665    Cjmc : add for phiHyd output <- but not working if multi tile per CPU
666    c       IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime+deltaTClock,myTime)
667    c    &  .AND. buoyancyRelation .eq. 'ATMOSPHERIC' ) THEN
668    c         WRITE(suff,'(I10.10)') myIter+1
669    c         CALL WRITE_FLD_XYZ_RL('PH.',suff,phiHyd,myIter+1,myThid)
670    c       ENDIF
671    Cjmc(end)
672    
673    #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE
674            IF (taveFreq.GT.0.) THEN
675             DO K=1,Nr
676              CALL TIMEAVER_1FLD_XYZ(phiHyd, phiHydtave,
677         I                              deltaTclock, bi, bj, K, myThid)
678              IF (ivdc_kappa.NE.0.) THEN
679                CALL TIMEAVER_1FLD_XYZ(ConvectCount, ConvectCountTave,
680         I                              deltaTclock, bi, bj, K, myThid)
681              ENDIF
682             ENDDO
683            ENDIF
684    #endif /* INCLUDE_DIAGNOSTICS_INTERFACE_CODE */
685    
686         ENDDO         ENDDO
687        ENDDO        ENDDO
688    

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.63

  ViewVC Help
Powered by ViewVC 1.1.22