/[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.65 by jmc, Thu Mar 8 20:25:01 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 65  C                                      v Line 67  C                                      v
67  C     rhoK, rhoKM1   - Density at current level, and level above  C     rhoK, rhoKM1   - Density at current level, and level above
68  C     phiHyd         - Hydrostatic part of the potential phiHydi.  C     phiHyd         - Hydrostatic part of the potential phiHydi.
69  C                      In z coords phiHydiHyd is the hydrostatic  C                      In z coords phiHydiHyd is the hydrostatic
70  C                      pressure anomaly  C                      Potential (=pressure/rho0) 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 anomaly.
73  C                      anomaly.  C     phiSurfX, - gradient of Surface potentiel (Pressure/rho, ocean)
74  C     etaSurfX,      - Holds surface elevation gradient in X and Y.  C     phiSurfY             or geopotentiel (atmos) in X and Y direction
 C     etaSurfY  
75  C     KappaRT,       - Total diffusion in vertical for T and S.  C     KappaRT,       - Total diffusion in vertical for T and S.
76  C     KappaRS          (background + spatially varying, isopycnal term).  C     KappaRS          (background + spatially varying, isopycnal term).
77  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 85  C                      index into fVerTe
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)  
88        _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskC   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
90        _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 94  C                      index into fVerTe
94        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL phiHyd  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
95        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
96        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
97          _RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
98          _RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
100        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
101        _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 104  C                      index into fVerTe
104        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
105        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
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 113  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 137  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 195  C     uninitialised but inert locations. Line 200  C     uninitialised but inert locations.
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          maskC  (i,j) = 0. _d 0          maskC  (i,j) = 0. _d 0
203            phiSurfX(i,j) = 0. _d 0
204            phiSurfY(i,j) = 0. _d 0
205         ENDDO         ENDDO
206        ENDDO        ENDDO
207    
# Line 208  CHPF$ INDEPENDENT Line 215  CHPF$ INDEPENDENT
215    
216  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
217  C--    HPF directive to help TAMC  C--    HPF directive to help TAMC
218  CHPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV  CHPF$  INDEPENDENT, NEW (rTrans,fVerT,fVerS,fVerU,fVerV
219  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA  CHPF$&                  ,phiHyd,utrans,vtrans,maskc,xA,yA
220  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV  CHPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV
221  CHPF$&                  )  CHPF$&                  )
# Line 237  C--     Set up work arrays that need val Line 244  C--     Set up work arrays that need val
244          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
245           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
246            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  
247            fVerT (i,j,1) = 0. _d 0            fVerT (i,j,1) = 0. _d 0
248            fVerT (i,j,2) = 0. _d 0            fVerT (i,j,2) = 0. _d 0
249            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 258  C--     Set up work arrays that need val
258          DO k=1,Nr          DO k=1,Nr
259           DO j=1-OLy,sNy+OLy           DO j=1-OLy,sNy+OLy
260            DO i=1-OLx,sNx+OLx            DO i=1-OLx,sNx+OLx
261  #ifdef INCLUDE_CONVECT_CALL  C This is currently also used by IVDC and Diagnostics
262             ConvectCount(i,j,k) = 0.             ConvectCount(i,j,k) = 0.
 #endif  
263             KappaRT(i,j,k) = 0. _d 0             KappaRT(i,j,k) = 0. _d 0
264             KappaRS(i,j,k) = 0. _d 0             KappaRS(i,j,k) = 0. _d 0
265            ENDDO            ENDDO
# Line 285  C--       Integrate continuity verticall Line 289  C--       Integrate continuity verticall
289    
290  #ifdef    ALLOW_OBCS  #ifdef    ALLOW_OBCS
291  #ifdef    ALLOW_NONHYDROSTATIC  #ifdef    ALLOW_NONHYDROSTATIC
292  C--       Calculate future values on open boundaries  C--       Apply OBC to W if in N-H mode
293            IF (useOBCS.AND.nonHydrostatic) THEN            IF (useOBCS.AND.nonHydrostatic) THEN
294              CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )              CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )
295            ENDIF            ENDIF
# Line 321  c ==> should use sigmaR !!! Line 325  c ==> should use sigmaR !!!
325       I        rhoKm1, rhoK,       I        rhoKm1, rhoK,
326       U        ConvectCount, KappaRT, KappaRS,       U        ConvectCount, KappaRT, KappaRS,
327       I        myTime, myIter, myThid)       I        myTime, myIter, myThid)
328            END IF            ENDIF
329    
330  C--     end of diagnostic k loop (Nr:1)  C--     end of diagnostic k loop (Nr:1)
331          ENDDO          ENDDO
# Line 409  C--       kDown  Cycles through 2,1 to p Line 413  C--       kDown  Cycles through 2,1 to p
413  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
414  CPatrick Is this formula correct?  CPatrick Is this formula correct?
415           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  
416  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE rTrans(:,:)       = comlev1_bibj_k, key = kkey, byte = isbyte
417  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte  CADJ STORE KappaRT(:,:,:)    = comlev1_bibj_k, key = kkey, byte = isbyte
418  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 421  CADJ STORE KappaRS(:,:,:)    = comlev1_b
421  C--      Get temporary terms used by tendency routines  C--      Get temporary terms used by tendency routines
422           CALL CALC_COMMON_FACTORS (           CALL CALC_COMMON_FACTORS (
423       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,
424       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,maskC,maskUp,
425       I        myThid)       I        myThid)
426    
427  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
# Line 488  CPatrick? What about this one? Line 491  CPatrick? What about this one?
491  C--     Implicit diffusion  C--     Implicit diffusion
492          IF (implicitDiffusion) THEN          IF (implicitDiffusion) THEN
493    
494            IF (tempStepping) THEN           IF (tempStepping) THEN
495  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
496              idkey = iikey + 1              idkey = iikey + 1
497  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
# Line 522  C--      Apply open boundary conditions Line 525  C--      Apply open boundary conditions
525  C--     End If implicitDiffusion  C--     End If implicitDiffusion
526          ENDIF          ENDIF
527    
528    C--     Start computation of dynamics
529            iMin = 1-OLx+2
530            iMax = sNx+OLx-1
531            jMin = 1-OLy+2
532            jMax = sNy+OLy-1
533    
534    C--     Explicit part of the Surface Potentiel Gradient (add in TIMESTEP)
535    C       (note: this loop will be replaced by CALL CALC_GRAD_ETA)
536            IF (implicSurfPress.NE.1.) THEN
537              CALL CALC_GRAD_PHI_SURF(
538         I         bi,bj,iMin,iMax,jMin,jMax,
539         I         etaN,
540         O         phiSurfX,phiSurfY,
541         I         myThid )                        
542            ENDIF
543    
544  C--     Start of dynamics loop  C--     Start of dynamics loop
545          DO k=1,Nr          DO k=1,Nr
# Line 535  C--       kDown  Cycles through 2,1 to p Line 552  C--       kDown  Cycles through 2,1 to p
552            kup  = 1+MOD(k+1,2)            kup  = 1+MOD(k+1,2)
553            kDown= 1+MOD(k,2)            kDown= 1+MOD(k,2)
554    
           iMin = 1-OLx+2  
           iMax = sNx+OLx-1  
           jMin = 1-OLy+2  
           jMax = sNy+OLy-1  
   
555  C--      Integrate hydrostatic balance for phiHyd with BC of  C--      Integrate hydrostatic balance for phiHyd with BC of
556  C        phiHyd(z=0)=0  C        phiHyd(z=0)=0
557  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 578  C        and step forward storing the re
578       U         fVerU, fVerV,       U         fVerU, fVerV,
579       I         myTime, myThid)       I         myTime, myThid)
580             CALL TIMESTEP(             CALL TIMESTEP(
581       I         bi,bj,iMin,iMax,jMin,jMax,k,phiHyd,       I         bi,bj,iMin,iMax,jMin,jMax,k,
582         I         phiHyd, phiSurfX, phiSurfY,
583       I         myIter, myThid)       I         myIter, myThid)
584    
585  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
# Line 644  C--      Apply open boundary conditions Line 657  C--      Apply open boundary conditions
657  C--     End If implicitViscosity.AND.momStepping  C--     End If implicitViscosity.AND.momStepping
658          ENDIF          ENDIF
659    
660    Cjmc : add for phiHyd output <- but not working if multi tile per CPU
661    c       IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime+deltaTClock,myTime)
662    c    &  .AND. buoyancyRelation .eq. 'ATMOSPHERIC' ) THEN
663    c         WRITE(suff,'(I10.10)') myIter+1
664    c         CALL WRITE_FLD_XYZ_RL('PH.',suff,phiHyd,myIter+1,myThid)
665    c       ENDIF
666    Cjmc(end)
667    
668    #ifdef ALLOW_TIMEAVE
669            IF (taveFreq.GT.0.) THEN
670              CALL TIMEAVE_CUMULATE(phiHydtave, phiHyd, Nr,
671         I                              deltaTclock, bi, bj, myThid)
672              IF (ivdc_kappa.NE.0.) THEN
673                CALL TIMEAVE_CUMULATE(ConvectCountTave, ConvectCount, Nr,
674         I                              deltaTclock, bi, bj, myThid)
675              ENDIF
676            ENDIF
677    #endif /* ALLOW_TIMEAVE */
678    
679         ENDDO         ENDDO
680        ENDDO        ENDDO
681    

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

  ViewVC Help
Powered by ViewVC 1.1.22