/[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.3 by adcroft, Tue Jan 9 14:39:34 2001 UTC revision 1.54.2.13 by jmc, Wed Jan 31 16:14:04 2001 UTC
# Line 58  C                              o rVel: Line 58  C                              o rVel:
58  C                                        lower cell faces.  C                                        lower cell faces.
59  C     maskC,maskUp             o maskC: land/water mask for tracer cells  C     maskC,maskUp             o maskC: land/water mask for tracer cells
60  C                              o maskUp: land/water mask for W points  C                              o maskUp: land/water mask for W points
61  C     aTerm, xTerm, cTerm    - Work arrays for holding separate terms in  C     fVer[STUV]               o fVer: Vertical flux term - note fVer
 C     mTerm, pTerm,            tendency equations.  
 C     fZon, fMer, fVer[STUV]   o aTerm: Advection term  
 C                              o xTerm: Mixing term  
 C                              o cTerm: Coriolis term  
 C                              o mTerm: Metric term  
 C                              o pTerm: Pressure term  
 C                              o fZon: Zonal flux term  
 C                              o fMer: Meridional flux term  
 C                              o fVer: Vertical flux term - note fVer  
62  C                                      is "pipelined" in the vertical  C                                      is "pipelined" in the vertical
63  C                                      so we need an fVer for each  C                                      so we need an fVer for each
64  C                                      variable.  C                                      variable.
65  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.  
66  C     phiHyd         - Hydrostatic part of the potential phiHydi.  C     phiHyd         - Hydrostatic part of the potential phiHydi.
67  C                      In z coords phiHydiHyd is the hydrostatic  C                      In z coords phiHydiHyd is the hydrostatic
68  C                      pressure anomaly  C                      pressure anomaly
# Line 99  C                      index into fVerTe Line 87  C                      index into fVerTe
87        _RL rVel    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _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)
       _RL aTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL xTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL cTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL mTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL pTerm   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL fZon    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL fMer    (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)
91        _RL fVerS   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerS   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
92        _RL fVerU   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerU   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
93        _RL fVerV   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerV   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
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)
       _RL rhokp1  (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)
       _RL buoyKM1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL buoyK   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL rhotmp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
97        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
98        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
99        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)        _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
# Line 207  C     uninitialised but inert locations. Line 184  C     uninitialised but inert locations.
184          yA(i,j)      = 0. _d 0          yA(i,j)      = 0. _d 0
185          uTrans(i,j)  = 0. _d 0          uTrans(i,j)  = 0. _d 0
186          vTrans(i,j)  = 0. _d 0          vTrans(i,j)  = 0. _d 0
         aTerm(i,j)   = 0. _d 0  
         xTerm(i,j)   = 0. _d 0  
         cTerm(i,j)   = 0. _d 0  
         mTerm(i,j)   = 0. _d 0  
         pTerm(i,j)   = 0. _d 0  
         fZon(i,j)    = 0. _d 0  
         fMer(i,j)    = 0. _d 0  
187          DO k=1,Nr          DO k=1,Nr
188           phiHyd (i,j,k)  = 0. _d 0           phiHyd(i,j,k)  = 0. _d 0
189           KappaRU(i,j,k) = 0. _d 0           KappaRU(i,j,k) = 0. _d 0
190           KappaRV(i,j,k) = 0. _d 0           KappaRV(i,j,k) = 0. _d 0
191           sigmaX(i,j,k) = 0. _d 0           sigmaX(i,j,k) = 0. _d 0
# Line 224  C     uninitialised but inert locations. Line 194  C     uninitialised but inert locations.
194          ENDDO          ENDDO
195          rhoKM1 (i,j) = 0. _d 0          rhoKM1 (i,j) = 0. _d 0
196          rhok   (i,j) = 0. _d 0          rhok   (i,j) = 0. _d 0
         rhoKP1 (i,j) = 0. _d 0  
         rhoTMP (i,j) = 0. _d 0  
         buoyKM1(i,j) = 0. _d 0  
         buoyK  (i,j) = 0. _d 0  
197          maskC  (i,j) = 0. _d 0          maskC  (i,j) = 0. _d 0
198         ENDDO         ENDDO
199        ENDDO        ENDDO
# Line 281  C--     Set up work arrays that need val Line 247  C--     Set up work arrays that need val
247            fVerU (i,j,2) = 0. _d 0            fVerU (i,j,2) = 0. _d 0
248            fVerV (i,j,1) = 0. _d 0            fVerV (i,j,1) = 0. _d 0
249            fVerV (i,j,2) = 0. _d 0            fVerV (i,j,2) = 0. _d 0
           phiHyd(i,j,1) = 0. _d 0  
250           ENDDO           ENDDO
251          ENDDO          ENDDO
252    
# Line 312  C? Do we still need this? Line 277  C? Do we still need this?
277           kkey = (ikey-1)*(Nr-2+1) + (k-2) + 1           kkey = (ikey-1)*(Nr-2+1) + (k-2) + 1
278  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
279    
 #ifdef ALLOW_OBCS  
 C--       Calculate future values on open boundaries  
           IF (openBoundaries) THEN  
 Caja        CALL CYCLE_OBCS( k, bi, bj, myThid )  
 c new args! CALL SET_OBCS( k, bi, bj, myTime, myThid )  
 c +deltaT?  
           ENDIF  
 #endif  
   
280  C--       Integrate continuity vertically for vertical velocity  C--       Integrate continuity vertically for vertical velocity
281            CALL INTEGRATE_FOR_W(            CALL INTEGRATE_FOR_W(
282       I                         bi, bj, k, uVel, vVel,       I                         bi, bj, k, uVel, vVel,
283       O                         wVel,       O                         wVel,
284       I                         myThid )       I                         myThid )
285  #ifdef ALLOW_OBCS  
286            IF (openBoundaries) THEN  #ifdef    ALLOW_OBCS
287  c new subr  CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )  #ifdef    ALLOW_NONHYDROSTATIC
288    C--       Calculate future values on open boundaries
289              IF (useOBCS.AND.nonHydrostatic) THEN
290                CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid )
291            ENDIF            ENDIF
292  #endif  #endif    /* ALLOW_NONHYDROSTATIC */
293    #endif    /* ALLOW_OBCS */
294    
295  C--       Calculate gradients of potential density for isoneutral  C--       Calculate gradients of potential density for isoneutral
296  C         slope terms (e.g. GM/Redi tensor or IVDC diffusivity)  C         slope terms (e.g. GM/Redi tensor or IVDC diffusivity)
297            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
298              IF ( useGMRedi .OR. (k.GT.1 .AND. ivdc_kappa.NE.0.) ) THEN
299              CALL FIND_RHO(              CALL FIND_RHO(
300       I        bi, bj, iMin, iMax, jMin, jMax, k, k, eosType,       I        bi, bj, iMin, iMax, jMin, jMax, k, k, eosType,
301         I        theta, salt,
302       O        rhoK,       O        rhoK,
303       I        myThid )       I        myThid )
304              CALL FIND_RHO(              IF (k.GT.1) CALL FIND_RHO(
305       I        bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType,       I        bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType,
306         I        theta, salt,
307       O        rhoKm1,       O        rhoKm1,
308       I        myThid )       I        myThid )
309              CALL GRAD_SIGMA(              CALL GRAD_SIGMA(
# Line 351  C         slope terms (e.g. GM/Redi tens Line 314  C         slope terms (e.g. GM/Redi tens
314            ENDIF            ENDIF
315    
316  C--       Implicit Vertical Diffusion for Convection  C--       Implicit Vertical Diffusion for Convection
317    c ==> should use sigmaR !!!
318            IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN            IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN
319              CALL CALC_IVDC(              CALL CALC_IVDC(
320       I        bi, bj, iMin, iMax, jMin, jMax, k,       I        bi, bj, iMin, iMax, jMin, jMax, k,
321       I        rhoKm1, rhoK,       I        rhoKm1, rhoK,
 c should use sigmaR !!!  
322       U        ConvectCount, KappaRT, KappaRS,       U        ConvectCount, KappaRT, KappaRS,
323       I        myTime, myIter, myThid)       I        myTime, myIter, myThid)
324            END IF            END IF
# Line 363  c should use sigmaR !!! Line 326  c should use sigmaR !!!
326  C--     end of diagnostic k loop (Nr:1)  C--     end of diagnostic k loop (Nr:1)
327          ENDDO          ENDDO
328    
329    #ifdef  ALLOW_OBCS
330    C--     Calculate future values on open boundaries
331            IF (useOBCS) THEN
332              CALL OBCS_CALC( bi, bj, myTime+deltaT,
333         I            uVel, vVel, wVel, theta, salt,
334         I            myThid )
335            ENDIF
336    #endif  /* ALLOW_OBCS */
337    
338    C--     Determines forcing terms based on external fields
339    C       relaxation terms, etc.
340            CALL EXTERNAL_FORCING_SURF(
341         I             bi, bj, iMin, iMax, jMin, jMax,
342         I             myThid )
343    
344  #ifdef  ALLOW_GMREDI  #ifdef  ALLOW_GMREDI
345  C--     Calculate iso-neutral slopes for the GM/Redi parameterisation  C--     Calculate iso-neutral slopes for the GM/Redi parameterisation
346          IF (useGMRedi) THEN          IF (useGMRedi) THEN
# Line 383  C--     Compute KPP mixing coefficients Line 361  C--     Compute KPP mixing coefficients
361          ENDIF          ENDIF
362  #endif  /* ALLOW_KPP */  #endif  /* ALLOW_KPP */
363    
 C--     Determines forcing terms based on external fields  
 C       relaxation terms, etc.  
         CALL EXTERNAL_FORCING_SURF(  
      I             bi, bj, iMin, iMax, jMin, jMax,  
      I             myThid )  
   
364  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
365  CADJ STORE KappaRT(:,:,:)     = comlev1_bibj, key = ikey, byte = isbyte  CADJ STORE KappaRT(:,:,:)     = comlev1_bibj, key = ikey, byte = isbyte
366  CADJ STORE KappaRS(:,:,:)     = comlev1_bibj, key = ikey, byte = isbyte  CADJ STORE KappaRS(:,:,:)     = comlev1_bibj, key = ikey, byte = isbyte
# Line 398  CADJ STORE uvel (:,:,:,bi,bj) = comlev1_ Line 370  CADJ STORE uvel (:,:,:,bi,bj) = comlev1_
370  CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte  CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte
371  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
372    
373    #ifdef ALLOW_AIM
374    C       AIM - atmospheric intermediate model, physics package code.
375    C note(jmc) : phiHyd=0 at this point but is not really used in Molteni Physics
376            IF ( useAIM ) THEN
377             CALL TIMER_START('AIM_DO_ATMOS_PHYS      [DYNAMICS]', myThid)
378             CALL AIM_DO_ATMOS_PHYSICS( phiHyd, myTime, myThid )
379             CALL TIMER_STOP ('AIM_DO_ATMOS_PHYS      [DYNAMICS]', myThid)
380            ENDIF
381    #endif /* ALLOW_AIM */
382    
383    
384  C--     Start of thermodynamics loop  C--     Start of thermodynamics loop
385          DO k=Nr,1,-1          DO k=Nr,1,-1
# Line 446  C        and step forward storing result Line 428  C        and step forward storing result
428       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,
429       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
430       I         KappaRT,       I         KappaRT,
431       U         aTerm,xTerm,fZon,fMer,fVerT,       U         fVerT,
432       I         myTime, myThid)       I         myTime, myThid)
433             CALL TIMESTEP_TRACER(             CALL TIMESTEP_TRACER(
434       I         bi,bj,iMin,iMax,jMin,jMax,k,       I         bi,bj,iMin,iMax,jMin,jMax,k,
# Line 459  C        and step forward storing result Line 441  C        and step forward storing result
441       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,       I         bi,bj,iMin,iMax,jMin,jMax, k,km1,kup,kDown,
442       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
443       I         KappaRS,       I         KappaRS,
444       U         aTerm,xTerm,fZon,fMer,fVerS,       U         fVerS,
445       I         myTime, myThid)       I         myTime, myThid)
446             CALL TIMESTEP_TRACER(             CALL TIMESTEP_TRACER(
447       I         bi,bj,iMin,iMax,jMin,jMax,k,       I         bi,bj,iMin,iMax,jMin,jMax,k,
# Line 467  C        and step forward storing result Line 449  C        and step forward storing result
449       U         gSnm1,       U         gSnm1,
450       I         myIter, myThid)       I         myIter, myThid)
451           ENDIF           ENDIF
452  #ifdef ALLOW_OBCS  
453    #ifdef   ALLOW_OBCS
454  C--      Apply open boundary conditions  C--      Apply open boundary conditions
455           IF (openBoundaries) THEN           IF (useOBCS) THEN
456  #ifdef ALLOW_AUTODIFF_TAMC             CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid )
 CADJ STORE gwnm1(:,:,k,bi,bj) = comlev1_bibj_k  
 CADJ &   , key = kkey, byte = isbyte  
 #endif /* ALLOW_AUTODIFF_TAMC */  
 c new subr  CALL OBCS_APPLY_TS( bi, bj, k, myThid )  
457           END IF           END IF
458  #endif  #endif   /* ALLOW_OBCS */
459    
460  C--      Freeze water  C--      Freeze water
461           IF (allowFreezing) THEN           IF (allowFreezing) THEN
462  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
# Line 521  C--     Implicit diffusion Line 501  C--     Implicit diffusion
501       I         myThid )       I         myThid )
502           ENDIF           ENDIF
503    
504    #ifdef   ALLOW_OBCS
505    C--      Apply open boundary conditions
506             IF (useOBCS) THEN
507               DO K=1,Nr
508                 CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid )
509               ENDDO
510             END IF
511    #endif   /* ALLOW_OBCS */
512    
513  C--     End If implicitDiffusion  C--     End If implicitDiffusion
514          ENDIF          ENDIF
515    
516    
517    
518  C--     Start of dynamics loop  C--     Start of dynamics loop
519          DO k=1,Nr          DO k=1,Nr
520    
# Line 540  C--       kDown  Cycles through 2,1 to p Line 531  C--       kDown  Cycles through 2,1 to p
531            jMin = 1-OLy+2            jMin = 1-OLy+2
532            jMax = sNy+OLy-1            jMax = sNy+OLy-1
533    
 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 )  
   
534  C--      Integrate hydrostatic balance for phiHyd with BC of  C--      Integrate hydrostatic balance for phiHyd with BC of
535  C--      phiHyd(z=0)=0  C        phiHyd(z=0)=0
536           CALL CALC_PHI_HYD(  C        distinguishe between Stagger and Non Stagger time stepping
537       I        bi,bj,iMin,iMax,jMin,jMax,k,buoyKm1,buoyK,           IF (staggerTimeStep) THEN
538               CALL CALC_PHI_HYD(
539         I        bi,bj,iMin,iMax,jMin,jMax,k,
540         I        gTnm1, gSnm1,
541       U        phiHyd,       U        phiHyd,
542       I        myThid )       I        myThid )
543             ELSE
544  C--      Get temporary terms used by tendency routines             CALL CALC_PHI_HYD(
545           CALL CALC_COMMON_FACTORS (       I        bi,bj,iMin,iMax,jMin,jMax,k,
546       I        bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,       I        theta, salt,
547       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       U        phiHyd,
548       I        myThid)       I        myThid )
549             ENDIF
550    
551  C--      Calculate accelerations in the momentum equations (gU, gV, ...)  C--      Calculate accelerations in the momentum equations (gU, gV, ...)
552  C        and step forward storing the result in gUnm1, gVnm1, etc...  C        and step forward storing the result in gUnm1, gVnm1, etc...
553           IF ( momStepping ) THEN           IF ( momStepping ) THEN
554             CALL CALC_MOM_RHS(             CALL CALC_MOM_RHS(
555       I         bi,bj,iMin,iMax,jMin,jMax,k,km1,kup,kDown,       I         bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown,
      I         xA,yA,uTrans,vTrans,maskC,  
556       I         phiHyd,KappaRU,KappaRV,       I         phiHyd,KappaRU,KappaRV,
557       U         fVerU, fVerV,       U         fVerU, fVerV,
558       I         myTime, myThid)       I         myTime, myThid)
559             CALL TIMESTEP(             CALL TIMESTEP(
560       I         bi,bj,iMin,iMax,jMin,jMax,k,       I         bi,bj,iMin,iMax,jMin,jMax,k,phiHyd,
561       I         myIter, myThid)       I         myIter, myThid)
562    
563    #ifdef   ALLOW_OBCS
564    C--      Apply open boundary conditions
565             IF (useOBCS) THEN
566               CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )
567             END IF
568    #endif   /* ALLOW_OBCS */
569    
570  #ifdef   ALLOW_AUTODIFF_TAMC  #ifdef   ALLOW_AUTODIFF_TAMC
571  #ifdef   INCLUDE_CD_CODE  #ifdef   INCLUDE_CD_CODE
572           ELSE           ELSE
# Line 621  C--     Implicit viscosity Line 605  C--     Implicit viscosity
605       U         gVNm1,       U         gVNm1,
606       I         myThid )       I         myThid )
607    
608    #ifdef   ALLOW_OBCS
609    C--      Apply open boundary conditions
610             IF (useOBCS) THEN
611               DO K=1,Nr
612                 CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )
613               ENDDO
614             END IF
615    #endif   /* ALLOW_OBCS */
616    
617  #ifdef    INCLUDE_CD_CODE  #ifdef    INCLUDE_CD_CODE
618  #ifdef    ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
619            idkey = iikey + 5            idkey = iikey + 5

Legend:
Removed from v.1.54.2.3  
changed lines
  Added in v.1.54.2.13

  ViewVC Help
Powered by ViewVC 1.1.22