/[MITgcm]/MITgcm/pkg/generic_advdiff/gad_advection.F
ViewVC logotype

Diff of /MITgcm/pkg/generic_advdiff/gad_advection.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8 by adcroft, Fri Sep 28 16:49:54 2001 UTC revision 1.20 by edhill, Sun Mar 28 19:28:34 2004 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
 CBOI  
 C !TITLE: pkg/generic\_advdiff  
 C !AUTHORS: adcroft@mit.edu  
 C !INTRODUCTION: Generic Advection Diffusion Package  
 C  
 C Package "generic\_advdiff" provides a common set of routines for calculating  
 C advective/diffusive fluxes for tracers (cell centered quantities on a C-grid).  
 C  
 C Many different advection schemes are available: the standard centered  
 C second order, centered fourth order and upwind biased third order schemes  
 C are known as linear methods and require some stable time-stepping method  
 C such as Adams-Bashforth. Alternatives such as flux-limited schemes are  
 C stable in the forward sense and are best combined with the multi-dimensional  
 C method provided in gad\_advection.  
 C  
 C There are two high-level routines:  
 C  \begin{itemize}  
 C  \item{GAD\_CALC\_RHS} calculates all fluxes at time level "n" and is used  
 C  for the standard linear schemes. This must be used in conjuction with  
 C  Adams-Bashforth time-stepping. Diffusive and parameterized fluxes are  
 C  always calculated here.  
 C  \item{GAD\_ADVECTION} calculates just the advective fluxes using the  
 C  non-linear schemes and can not be used in conjuction with Adams-Bashforth  
 C  time-stepping.  
 C  \end{itemize}  
 CEOI  
   
4  #include "GAD_OPTIONS.h"  #include "GAD_OPTIONS.h"
5    
6    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7  CBOP  CBOP
8  C !ROUTINE: GAD_ADVECTION  C !ROUTINE: GAD_ADVECTION
9    
10  C !INTERFACE: ==========================================================  C !INTERFACE: ==========================================================
11        SUBROUTINE GAD_ADVECTION(bi,bj,advectionScheme,tracerIdentity,        SUBROUTINE GAD_ADVECTION(
12       U                         Tracer,Gtracer,       I           implicitAdvection, advectionScheme, tracerIdentity,
13       I                         myTime,myIter,myThid)       I           uVel, vVel, wVel, tracer,
14         O           gTracer,
15         I           bi,bj, myTime,myIter,myThid)
16    
17  C !DESCRIPTION:  C !DESCRIPTION:
18  C Calculates the tendancy of a tracer due to advection.  C Calculates the tendancy of a tracer due to advection.
# Line 62  C !USES: =============================== Line 38  C !USES: ===============================
38  #include "SIZE.h"  #include "SIZE.h"
39  #include "EEPARAMS.h"  #include "EEPARAMS.h"
40  #include "PARAMS.h"  #include "PARAMS.h"
 #include "DYNVARS.h"  
41  #include "GRID.h"  #include "GRID.h"
42  #include "GAD.h"  #include "GAD.h"
43  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
# Line 71  C !USES: =============================== Line 46  C !USES: ===============================
46  #endif  #endif
47    
48  C !INPUT PARAMETERS: ===================================================  C !INPUT PARAMETERS: ===================================================
49  C  bi,bj                :: tile indices  C  implicitAdvection    :: vertical advection treated implicitly (later on)
50  C  advectionScheme      :: advection scheme to use  C  advectionScheme      :: advection scheme to use
51  C  tracerIdentity       :: identifier for the tracer (required only for OBCS)  C  tracerIdentity       :: identifier for the tracer (required only for OBCS)
52  C  Tracer               :: tracer field  C  uVel                 :: velocity, zonal component
53    C  vVel                 :: velocity, meridional component
54    C  wVel                 :: velocity, vertical component
55    C  tracer               :: tracer field
56    C  bi,bj                :: tile indices
57  C  myTime               :: current time  C  myTime               :: current time
58  C  myIter               :: iteration number  C  myIter               :: iteration number
59  C  myThid               :: thread number  C  myThid               :: thread number
60        INTEGER bi,bj        LOGICAL implicitAdvection
61        INTEGER advectionScheme        INTEGER advectionScheme
62        INTEGER tracerIdentity        INTEGER tracerIdentity
63        _RL Gtracer(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)        _RL uVel  (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
64          _RL vVel  (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
65          _RL wVel  (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
66          _RL tracer(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
67          INTEGER bi,bj
68        _RL myTime        _RL myTime
69        INTEGER myIter        INTEGER myIter
70        INTEGER myThid        INTEGER myThid
71    
72  C !OUTPUT PARAMETERS: ==================================================  C !OUTPUT PARAMETERS: ==================================================
73  C  gTracer              :: tendancy array  C  gTracer              :: tendancy array
74        _RL Tracer(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)        _RL gTracer(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
75    
76  C !LOCAL VARIABLES: ====================================================  C !LOCAL VARIABLES: ====================================================
77  C  maskUp               :: 2-D array for mask at W points  C  maskUp               :: 2-D array for mask at W points
# Line 99  C  kdown                :: index into 2 Line 82  C  kdown                :: index into 2
82  C  kp1                  :: =k+1 for k<Nr, =Nr for k=Nr  C  kp1                  :: =k+1 for k<Nr, =Nr for k=Nr
83  C  xA,yA                :: areas of X and Y face of tracer cells  C  xA,yA                :: areas of X and Y face of tracer cells
84  C  uTrans,vTrans,rTrans :: 2-D arrays of volume transports at U,V and W points  C  uTrans,vTrans,rTrans :: 2-D arrays of volume transports at U,V and W points
85    C  rTransKp1            :: vertical volume transport at interface k+1
86  C  af                   :: 2-D array for horizontal advective flux  C  af                   :: 2-D array for horizontal advective flux
87  C  fVerT                :: 2 1/2D arrays for vertical advective flux  C  fVerT                :: 2 1/2D arrays for vertical advective flux
88  C  localTij             :: 2-D array used as temporary local copy of tracer fld  C  localTij             :: 2-D array used as temporary local copy of tracer fld
# Line 110  C  nipass               :: number of pas Line 94  C  nipass               :: number of pas
94  C  ipass                :: number of the current pass being made  C  ipass                :: number of the current pass being made
95        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
96        INTEGER iMin,iMax,jMin,jMax        INTEGER iMin,iMax,jMin,jMax
97        INTEGER i,j,k,kup,kDown,kp1        INTEGER i,j,k,kup,kDown
98        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
100        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
101        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
102        _RL rTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
103          _RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
104        _RL af      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL af      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
105        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerT   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
106        _RL localTij(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL localTij(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 126  C  ipass                :: number of the Line 111  C  ipass                :: number of the
111  CEOP  CEOP
112    
113  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
114              act0 = tracerIdentity - 1
115              max0 = maxpass
116            act1 = bi - myBxLo(myThid)            act1 = bi - myBxLo(myThid)
117            max1 = myBxHi(myThid) - myBxLo(myThid) + 1            max1 = myBxHi(myThid) - myBxLo(myThid) + 1
118            act2 = bj - myByLo(myThid)            act2 = bj - myByLo(myThid)
# Line 133  CEOP Line 120  CEOP
120            act3 = myThid - 1            act3 = myThid - 1
121            max3 = nTx*nTy            max3 = nTx*nTy
122            act4 = ikey_dynamics - 1            act4 = ikey_dynamics - 1
123            ikey = (act1 + 1) + act2*max1            igadkey = (act0 + 1)
124       &                      + act3*max1*max2       &                      + act1*max0
125       &                      + act4*max1*max2*max3       &                      + act2*max0*max1
126         &                      + act3*max0*max1*max2
127         &                      + act4*max0*max1*max2*max3
128              if (tracerIdentity.GT.maxpass) then
129                 print *, 'ph-pass gad_advection ', maxpass, tracerIdentity
130                 STOP 'maxpass seems smaller than tracerIdentity'
131              endif
132  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
133    
134  C--   Set up work arrays with valid (i.e. not NaN) values  C--   Set up work arrays with valid (i.e. not NaN) values
# Line 152  C     uninitialised but inert locations. Line 145  C     uninitialised but inert locations.
145          rTrans(i,j)  = 0. _d 0          rTrans(i,j)  = 0. _d 0
146          fVerT(i,j,1) = 0. _d 0          fVerT(i,j,1) = 0. _d 0
147          fVerT(i,j,2) = 0. _d 0          fVerT(i,j,2) = 0. _d 0
148            rTransKp1(i,j)= 0. _d 0
149         ENDDO         ENDDO
150        ENDDO        ENDDO
151    
# Line 163  C     uninitialised but inert locations. Line 157  C     uninitialised but inert locations.
157  C--   Start of k loop for horizontal fluxes  C--   Start of k loop for horizontal fluxes
158        DO k=1,Nr        DO k=1,Nr
159  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
160           kkey = (ikey-1)*Nr + k           kkey = (igadkey-1)*Nr + k
161  CADJ STORE tracer(:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ STORE tracer(:,:,k,bi,bj) =
162    CADJ &     comlev1_bibj_k_gad, key=kkey, byte=isbyte
163  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
164    
165  C--   Get temporary terms used by tendency routines  C--   Get temporary terms used by tendency routines
# Line 173  C--   Get temporary terms used by tenden Line 168  C--   Get temporary terms used by tenden
168       O         xA,yA,uTrans,vTrans,rTrans,maskUp,       O         xA,yA,uTrans,vTrans,rTrans,maskUp,
169       I         myThid)       I         myThid)
170    
171    #ifdef ALLOW_GMREDI
172    C--   Residual transp = Bolus transp + Eulerian transp
173           IF (useGMRedi)
174         &   CALL GMREDI_CALC_UVFLOW(
175         &            uTrans, vTrans, bi, bj, k, myThid)
176    #endif /* ALLOW_GMREDI */
177    
178  C--   Make local copy of tracer array  C--   Make local copy of tracer array
179        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
180         DO i=1-OLx,sNx+OLx         DO i=1-OLx,sNx+OLx
# Line 182  C--   Make local copy of tracer array Line 184  C--   Make local copy of tracer array
184    
185        IF (useCubedSphereExchange) THEN        IF (useCubedSphereExchange) THEN
186         nipass=3         nipass=3
187    #ifdef ALLOW_AUTODIFF_TAMC
188           if ( nipass.GT.maxcube )
189         &      STOP 'maxcube needs to be = 3'
190    #endif
191        ELSE        ELSE
192         nipass=1         nipass=1
193        ENDIF        ENDIF
# Line 190  cph       nipass=1 Line 196  cph       nipass=1
196  C--   Multiple passes for different directions on different tiles  C--   Multiple passes for different directions on different tiles
197        DO ipass=1,nipass        DO ipass=1,nipass
198  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
199           passkey = ipass + (k-1)   *maxpass           passkey = ipass + (k-1)      *maxcube
200       &                   + (ikey-1)*maxpass*Nr       &                   + (igadkey-1)*maxcube*Nr
201           IF (nipass .GT. maxpass) THEN           IF (nipass .GT. maxpass) THEN
202            STOP 'GAD_ADVECTION: nipass > maxpass. check tamc.h'            STOP 'GAD_ADVECTION: nipass > maxcube. check tamc.h'
203           ENDIF           ENDIF
204  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
205    
# Line 242  C-    Advective flux in X Line 248  C-    Advective flux in X
248    
249  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
250  #ifndef DISABLE_MULTIDIM_ADVECTION  #ifndef DISABLE_MULTIDIM_ADVECTION
251  CADJ STORE localTij(:,:)  = comlev1_bibj_pass, key=passkey, byte=isbyte  CADJ STORE localTij(:,:)  =
252    CADJ &     comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
253  #endif  #endif
254  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
255    
# Line 256  CADJ STORE localTij(:,:)  = comlev1_bibj Line 263  CADJ STORE localTij(:,:)  = comlev1_bibj
263         CALL GAD_DST3FL_ADV_X(         CALL GAD_DST3FL_ADV_X(
264       &       bi,bj,k,deltaTtracer,uTrans,uVel,localTij,af,myThid)       &       bi,bj,k,deltaTtracer,uTrans,uVel,localTij,af,myThid)
265        ELSE        ELSE
266         STOP 'GAD_ADVECTION: adv. scheme incompatibale with mutli-dim'         STOP 'GAD_ADVECTION: adv. scheme incompatibale with multi-dim'
267        ENDIF        ENDIF
268    
269        DO j=1-Oly,sNy+Oly        DO j=1-Oly,sNy+Oly
# Line 308  C-    Advective flux in Y Line 315  C-    Advective flux in Y
315    
316  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
317  #ifndef DISABLE_MULTIDIM_ADVECTION  #ifndef DISABLE_MULTIDIM_ADVECTION
318  CADJ STORE localTij(:,:)  = comlev1_bibj_pass, key=passkey, byte=isbyte  CADJ STORE localTij(:,:)  =
319    CADJ &     comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
320  #endif  #endif
321  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
322    
# Line 350  C--   Apply open boundary conditions Line 358  C--   Apply open boundary conditions
358  C--   End of Y direction  C--   End of Y direction
359        ENDIF        ENDIF
360    
       DO j=1-Oly,sNy+Oly  
        DO i=1-Olx,sNx+Olx  
         localTijk(i,j,k)=localTij(i,j)  
        ENDDO  
       ENDDO  
   
361  C--   End of ipass loop  C--   End of ipass loop
362        ENDDO        ENDDO
363    
364          IF ( implicitAdvection ) THEN
365    C-    explicit advection is done ; store tendency in gTracer:
366            DO j=1-Oly,sNy+Oly
367             DO i=1-Olx,sNx+Olx
368              gTracer(i,j,k,bi,bj)=
369         &     (localTij(i,j)-tracer(i,j,k,bi,bj))/deltaTtracer
370             ENDDO
371            ENDDO
372          ELSE
373    C-    horizontal advection done; store intermediate result in 3D array:
374           DO j=1-Oly,sNy+Oly
375            DO i=1-Olx,sNx+Olx
376             localTijk(i,j,k)=localTij(i,j)
377            ENDDO
378           ENDDO
379          ENDIF
380    
381  C--   End of K loop for horizontal fluxes  C--   End of K loop for horizontal fluxes
382        ENDDO        ENDDO
383    
384          IF ( .NOT.implicitAdvection ) THEN
385  C--   Start of k loop for vertical flux  C--   Start of k loop for vertical flux
386        DO k=Nr,1,-1         DO k=Nr,1,-1
387  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
388           kkey = (ikey-1)*Nr + k           kkey = (igadkey-1)*Nr + k
389  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
   
390  C--   kup    Cycles through 1,2 to point to w-layer above  C--   kup    Cycles through 1,2 to point to w-layer above
391  C--   kDown  Cycles through 2,1 to point to w-layer below  C--   kDown  Cycles through 2,1 to point to w-layer below
392        kup  = 1+MOD(k+1,2)          kup  = 1+MOD(k+1,2)
393        kDown= 1+MOD(k,2)          kDown= 1+MOD(k,2)
394    c       kp1=min(Nr,k+1)
395  C--   Get temporary terms used by tendency routines          kp1Msk=1.
396        CALL CALC_COMMON_FACTORS (          if (k.EQ.Nr) kp1Msk=0.
397       I         bi,bj,iMin,iMax,jMin,jMax,k,  
398       O         xA,yA,uTrans,vTrans,rTrans,maskUp,  C-- Compute Vertical transport
399       I         myThid)          IF (k.EQ.1) THEN
400    
401  C-    Advective flux in R  C- Surface interface :
402        DO j=1-Oly,sNy+Oly           DO j=1-Oly,sNy+Oly
403         DO i=1-Olx,sNx+Olx            DO i=1-Olx,sNx+Olx
404          af(i,j) = 0.             rTransKp1(i,j) = rTrans(i,j)
405         ENDDO             rTrans(i,j) = 0.
406        ENDDO             fVerT(i,j,kUp) = 0.
407               af(i,j) = 0.
408              ENDDO
409             ENDDO
410    
411            ELSE
412    C- Interior interface :
413    
414             DO j=1-Oly,sNy+Oly
415              DO i=1-Olx,sNx+Olx
416               rTransKp1(i,j) = kp1Msk*rTrans(i,j)
417               rTrans(i,j) = wVel(i,j,k,bi,bj)*rA(i,j,bi,bj)
418         &                 *maskC(i,j,k-1,bi,bj)
419               af(i,j) = 0.
420              ENDDO
421             ENDDO
422    
423    #ifdef ALLOW_GMREDI
424    C--   Residual transp = Bolus transp + Eulerian transp
425             IF (useGMRedi)
426         &   CALL GMREDI_CALC_WFLOW(
427         &                    rTrans, bi, bj, k, myThid)
428    #endif /* ALLOW_GMREDI */
429    
430  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
431  CADJ STORE localTijk(:,:,k)    CADJ STORE localTijk(:,:,k)  
432  CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
433    CADJ STORE rTrans(:,:)  
434    CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
435  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
436    
 C     Note: wVel needs to be masked  
       IF (K.GE.2) THEN  
437  C-    Compute vertical advective flux in the interior:  C-    Compute vertical advective flux in the interior:
438         IF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN           IF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN
439          CALL GAD_FLUXLIMIT_ADV_R(            CALL GAD_FLUXLIMIT_ADV_R(
440       &       bi,bj,k,deltaTtracer,rTrans,wVel,localTijk,af,myThid)       &        bi,bj,k,deltaTtracer,rTrans,wVel,localTijk,af,myThid)
441         ELSEIF (advectionScheme.EQ.ENUM_DST3 ) THEN           ELSEIF (advectionScheme.EQ.ENUM_DST3 ) THEN
442          CALL GAD_DST3_ADV_R(            CALL GAD_DST3_ADV_R(
443       &       bi,bj,k,deltaTtracer,rTrans,wVel,localTijk,af,myThid)       &        bi,bj,k,deltaTtracer,rTrans,wVel,localTijk,af,myThid)
444         ELSEIF (advectionScheme.EQ.ENUM_DST3_FLUX_LIMIT ) THEN           ELSEIF (advectionScheme.EQ.ENUM_DST3_FLUX_LIMIT ) THEN
445          CALL GAD_DST3FL_ADV_R(            CALL GAD_DST3FL_ADV_R(
446       &       bi,bj,k,deltaTtracer,rTrans,wVel,localTijk,af,myThid)       &        bi,bj,k,deltaTtracer,rTrans,wVel,localTijk,af,myThid)
447         ELSE           ELSE
448          STOP 'GAD_ADVECTION: adv. scheme incompatibale with mutli-dim'            STOP 'GAD_ADVECTION: adv. scheme incompatibale with mutli-dim'
449         ENDIF           ENDIF
 C-    Surface "correction" term at k>1 :  
        DO j=1-Oly,sNy+Oly  
         DO i=1-Olx,sNx+Olx  
          af(i,j) = af(i,j)  
      &           + (maskC(i,j,k,bi,bj)-maskC(i,j,k-1,bi,bj))*  
      &             rTrans(i,j)*localTijk(i,j,k)  
         ENDDO  
        ENDDO  
       ELSE  
 C-    Surface "correction" term at k=1 :  
        DO j=1-Oly,sNy+Oly  
         DO i=1-Olx,sNx+Olx  
          af(i,j) = rTrans(i,j)*localTijk(i,j,k)  
         ENDDO  
        ENDDO  
       ENDIF  
450  C-    add the advective flux to fVerT  C-    add the advective flux to fVerT
451        DO j=1-Oly,sNy+Oly           DO j=1-Oly,sNy+Oly
452         DO i=1-Olx,sNx+Olx            DO i=1-Olx,sNx+Olx
453          fVerT(i,j,kUp) = af(i,j)             fVerT(i,j,kUp) = af(i,j)
454         ENDDO            ENDDO
455        ENDDO           ENDDO
456    
457  C--   Divergence of fluxes  C- end Surface/Interior if bloc
458        kp1=min(Nr,k+1)          ENDIF
459        kp1Msk=1.  
460        if (k.EQ.Nr) kp1Msk=0.  #ifdef ALLOW_AUTODIFF_TAMC
461        DO j=1-Oly,sNy+Oly  CADJ STORE rTrans(:,:)  
462         DO i=1-Olx,sNx+Olx  CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
463          localTij(i,j)=localTijk(i,j,k)-deltaTtracer*  CADJ STORE rTranskp1(:,:)  
464       &    _recip_hFacC(i,j,k,bi,bj)*recip_drF(k)  CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
465       &    *recip_rA(i,j,bi,bj)  #endif /* ALLOW_AUTODIFF_TAMC */
466       &    *( fVerT(i,j,kUp)-fVerT(i,j,kDown)  
467       &      -tracer(i,j,k,bi,bj)*rA(i,j,bi,bj)*  C--   Divergence of vertical fluxes
468       &        (wVel(i,j,k,bi,bj)-kp1Msk*wVel(i,j,kp1,bi,bj))          DO j=1-Oly,sNy+Oly
469       &     )*rkFac           DO i=1-Olx,sNx+Olx
470          gTracer(i,j,k,bi,bj)=            localTij(i,j)=localTijk(i,j,k)-deltaTtracer*
471       &   (localTij(i,j)-tracer(i,j,k,bi,bj))/deltaTtracer       &     _recip_hFacC(i,j,k,bi,bj)*recip_drF(k)
472         ENDDO       &     *recip_rA(i,j,bi,bj)
473        ENDDO       &     *( fVerT(i,j,kUp)-fVerT(i,j,kDown)
474         &       -tracer(i,j,k,bi,bj)*(rTrans(i,j)-rTransKp1(i,j))
475         &      )*rkFac
476              gTracer(i,j,k,bi,bj)=
477         &     (localTij(i,j)-tracer(i,j,k,bi,bj))/deltaTtracer
478             ENDDO
479            ENDDO
480    
481  C--   End of K loop for vertical flux  C--   End of K loop for vertical flux
482        ENDDO         ENDDO
483    C--   end of if not.implicitAdvection block
484          ENDIF
485    
486        RETURN        RETURN
487        END        END

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.22