/[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.58 by adcroft, Fri Feb 2 21:04:48 2001 UTC revision 1.64 by jmc, Tue Mar 6 16:59:44 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
 C                              o rVel:   Vertical velocity at upper and  
 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     fVer[STUV]               o fVer: Vertical flux term - note fVer  C     fVer[STUV]               o fVer: Vertical flux term - note fVer
# Line 69  C                      pressure anomaly Line 71  C                      pressure anomaly
71  C                      In p coords phiHydiHyd is the geopotential  C                      In p coords phiHydiHyd is the geopotential
72  C                      surface height  C                      surface height
73  C                      anomaly.  C                      anomaly.
74  C     etaSurfX,      - Holds surface elevation gradient in X and Y.  C     phiSurfX, - gradient of Surface potentiel (Pressure/rho, ocean)
75  C     etaSurfY  C     phiSurfY             or geopotentiel (atmos) in X and Y direction
76  C     KappaRT,       - Total diffusion in vertical for T and S.  C     KappaRT,       - Total diffusion in vertical for T and S.
77  C     KappaRS          (background + spatially varying, isopycnal term).  C     KappaRS          (background + spatially varying, isopycnal term).
78  C     iMin, iMax     - Ranges and sub-block indices on which calculations  C     iMin, iMax     - Ranges and sub-block indices on which calculations
# Line 84  C                      index into fVerTe Line 86  C                      index into fVerTe
86        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
87        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
88        _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)  
89        _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
90        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
91        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
# Line 94  C                      index into fVerTe Line 95  C                      index into fVerTe
95        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
96        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
97        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
98          _RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99          _RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
100        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
101        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
102        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
# Line 102  C                      index into fVerTe Line 105  C                      index into fVerTe
105        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
106        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
107    
108  C This is currently also used by IVDC and Diagnostics  C This is currently used by IVDC and Diagnostics
 C #ifdef INCLUDE_CONVECT_CALL  
109        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
 C #endif  
110    
111        INTEGER iMin, iMax        INTEGER iMin, iMax
112        INTEGER jMin, jMax        INTEGER jMin, jMax
# Line 113  C #endif Line 114  C #endif
114        INTEGER i, j        INTEGER i, j
115        INTEGER k, km1, kup, kDown        INTEGER k, km1, kup, kDown
116    
117    Cjmc : add for phiHyd output <- but not working if multi tile per CPU
118    c     CHARACTER*(MAX_LEN_MBUF) suff
119    c     LOGICAL  DIFFERENT_MULTIPLE
120    c     EXTERNAL DIFFERENT_MULTIPLE
121    Cjmc(end)
122    
123  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
124        INTEGER    isbyte        INTEGER    isbyte
125        PARAMETER( isbyte = 4 )        PARAMETER( isbyte = 4 )
# Line 137  C       "Calculation of Gs" Line 144  C       "Calculation of Gs"
144  C       ===================  C       ===================
145  C       This is where all the accelerations and tendencies (ie.  C       This is where all the accelerations and tendencies (ie.
146  C       physics, parameterizations etc...) are calculated  C       physics, parameterizations etc...) are calculated
 C         rVel = sum_r ( div. u[n] )  
147  C         rho = rho ( theta[n], salt[n] )  C         rho = rho ( theta[n], salt[n] )
148  C         b   = b(rho, theta)  C         b   = b(rho, theta)
149  C         K31 = K31 ( rho )  C         K31 = K31 ( rho )
150  C         Gu[n] = Gu( u[n], v[n], rVel, b, ... )  C         Gu[n] = Gu( u[n], v[n], wVel, b, ... )
151  C         Gv[n] = Gv( u[n], v[n], rVel, b, ... )  C         Gv[n] = Gv( u[n], v[n], wVel, b, ... )
152  C         Gt[n] = Gt( theta[n], u[n], v[n], rVel, K31, ... )  C         Gt[n] = Gt( theta[n], u[n], v[n], wVel, K31, ... )
153  C         Gs[n] = Gs( salt[n], u[n], v[n], rVel, K31, ... )  C         Gs[n] = Gs( salt[n], u[n], v[n], wVel, K31, ... )
154  C  C
155  C       "Time-stepping" or "Prediction"  C       "Time-stepping" or "Prediction"
156  C       ================================  C       ================================
# Line 195  C     uninitialised but inert locations. Line 201  C     uninitialised but inert locations.
201          rhoKM1 (i,j) = 0. _d 0          rhoKM1 (i,j) = 0. _d 0
202          rhok   (i,j) = 0. _d 0          rhok   (i,j) = 0. _d 0
203          maskC  (i,j) = 0. _d 0          maskC  (i,j) = 0. _d 0
204            phiSurfX(i,j) = 0. _d 0
205            phiSurfY(i,j) = 0. _d 0
206         ENDDO         ENDDO
207        ENDDO        ENDDO
208    
# Line 208  CHPF$ INDEPENDENT Line 216  CHPF$ INDEPENDENT
216    
217  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
218  C--    HPF directive to help TAMC  C--    HPF directive to help TAMC
219  CHPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV  CHPF$  INDEPENDENT, NEW (rTrans,fVerT,fVerS,fVerU,fVerV
220  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA
221  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV
222  CHPF$&                  )  CHPF$&                  )
# Line 237  C--     Set up work arrays that need val Line 245  C--     Set up work arrays that need val
245          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
246           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
247            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  
248            fVerT (i,j,1) = 0. _d 0            fVerT (i,j,1) = 0. _d 0
249            fVerT (i,j,2) = 0. _d 0            fVerT (i,j,2) = 0. _d 0
250            fVerS (i,j,1) = 0. _d 0            fVerS (i,j,1) = 0. _d 0
# Line 253  C--     Set up work arrays that need val Line 259  C--     Set up work arrays that need val
259          DO k=1,Nr          DO k=1,Nr
260           DO j=1-OLy,sNy+OLy           DO j=1-OLy,sNy+OLy
261            DO i=1-OLx,sNx+OLx            DO i=1-OLx,sNx+OLx
262  #ifdef INCLUDE_CONVECT_CALL  C This is currently also used by IVDC and Diagnostics
263             ConvectCount(i,j,k) = 0.             ConvectCount(i,j,k) = 0.
 #endif  
264             KappaRT(i,j,k) = 0. _d 0             KappaRT(i,j,k) = 0. _d 0
265             KappaRS(i,j,k) = 0. _d 0             KappaRS(i,j,k) = 0. _d 0
266            ENDDO            ENDDO
# Line 285  C--       Integrate continuity verticall Line 290  C--       Integrate continuity verticall
290    
291  #ifdef    ALLOW_OBCS  #ifdef    ALLOW_OBCS
292  #ifdef    ALLOW_NONHYDROSTATIC  #ifdef    ALLOW_NONHYDROSTATIC
293  C--       Calculate future values on open boundaries  C--       Apply OBC to W if in N-H mode
294            IF (useOBCS.AND.nonHydrostatic) THEN            IF (useOBCS.AND.nonHydrostatic) THEN
295              CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )              CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )
296            ENDIF            ENDIF
# Line 321  c ==> should use sigmaR !!! Line 326  c ==> should use sigmaR !!!
326       I        rhoKm1, rhoK,       I        rhoKm1, rhoK,
327       U        ConvectCount, KappaRT, KappaRS,       U        ConvectCount, KappaRT, KappaRS,
328       I        myTime, myIter, myThid)       I        myTime, myIter, myThid)
329            END IF            ENDIF
330    
331  C--     end of diagnostic k loop (Nr:1)  C--     end of diagnostic k loop (Nr:1)
332          ENDDO          ENDDO
# Line 409  C--       kDown  Cycles through 2,1 to p Line 414  C--       kDown  Cycles through 2,1 to p
414  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
415  CPatrick Is this formula correct?  CPatrick Is this formula correct?
416           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  
417  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte
418  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
419  CADJ STORE KappaRS(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE KappaRS(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
# Line 418  CADJ STORE KappaRS(:,:,:)    = comlev1_b Line 422  CADJ STORE KappaRS(:,:,:)    = comlev1_b
422  C--      Get temporary terms used by tendency routines  C--      Get temporary terms used by tendency routines
423           CALL CALC_COMMON_FACTORS (           CALL CALC_COMMON_FACTORS (
424       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,
425       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,maskC,maskUp,
426       I        myThid)       I        myThid)
427    
428  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
# Line 488  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 522  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 Pressure Gradient (add in TIMESTEP)
536    C       (note: this loop will be replaced by CALL CALC_GRAD_ETA)
537            IF (implicSurfPress.NE.1.) THEN
538              DO j=jMin,jMax
539                DO i=iMin,iMax
540                  phiSurfX(i,j) = _recip_dxC(i,j,bi,bj)*gBaro
541         &           *(etaN(i,j,bi,bj)-etaN(i-1,j,bi,bj))
542                  phiSurfY(i,j) = _recip_dyC(i,j,bi,bj)*gBaro
543         &           *(etaN(i,j,bi,bj)-etaN(i,j-1,bi,bj))
544                ENDDO
545              ENDDO
546            ENDIF
547    
548  C--     Start of dynamics loop  C--     Start of dynamics loop
549          DO k=1,Nr          DO k=1,Nr
# Line 535  C--       kDown  Cycles through 2,1 to p Line 556  C--       kDown  Cycles through 2,1 to p
556            kup  = 1+MOD(k+1,2)            kup  = 1+MOD(k+1,2)
557            kDown= 1+MOD(k,2)            kDown= 1+MOD(k,2)
558    
           iMin = 1-OLx+2  
           iMax = sNx+OLx-1  
           jMin = 1-OLy+2  
           jMax = sNy+OLy-1  
   
559  C--      Integrate hydrostatic balance for phiHyd with BC of  C--      Integrate hydrostatic balance for phiHyd with BC of
560  C        phiHyd(z=0)=0  C        phiHyd(z=0)=0
561  C        distinguishe between Stagger and Non Stagger time stepping  C        distinguishe between Stagger and Non Stagger time stepping
# Line 566  C        and step forward storing the re Line 582  C        and step forward storing the re
582       U         fVerU, fVerV,       U         fVerU, fVerV,
583       I         myTime, myThid)       I         myTime, myThid)
584             CALL TIMESTEP(             CALL TIMESTEP(
585       I         bi,bj,iMin,iMax,jMin,jMax,k,phiHyd,       I         bi,bj,iMin,iMax,jMin,jMax,k,
586         I         phiHyd, phiSurfX, phiSurfY,
587       I         myIter, myThid)       I         myIter, myThid)
588    
589  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
# Line 644  C--      Apply open boundary conditions Line 661  C--      Apply open boundary conditions
661  C--     End If implicitViscosity.AND.momStepping  C--     End If implicitViscosity.AND.momStepping
662          ENDIF          ENDIF
663    
664    Cjmc : add for phiHyd output <- but not working if multi tile per CPU
665    c       IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime+deltaTClock,myTime)
666    c    &  .AND. buoyancyRelation .eq. 'ATMOSPHERIC' ) THEN
667    c         WRITE(suff,'(I10.10)') myIter+1
668    c         CALL WRITE_FLD_XYZ_RL('PH.',suff,phiHyd,myIter+1,myThid)
669    c       ENDIF
670    Cjmc(end)
671    
672    #ifdef ALLOW_TIMEAVE
673            IF (taveFreq.GT.0.) THEN
674              CALL TIMEAVE_CUMULATE(phiHydtave, phiHyd, Nr,
675         I                              deltaTclock, bi, bj, myThid)
676              IF (ivdc_kappa.NE.0.) THEN
677                CALL TIMEAVE_CUMULATE(ConvectCountTave, ConvectCount, Nr,
678         I                              deltaTclock, bi, bj, myThid)
679              ENDIF
680            ENDIF
681    #endif /* ALLOW_TIMEAVE */
682    
683         ENDDO         ENDDO
684        ENDDO        ENDDO
685    

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.64

  ViewVC Help
Powered by ViewVC 1.1.22