/[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.11 by jmc, Wed Mar 6 02:01:54 2002 UTC revision 1.16 by heimbach, Tue Nov 25 23:31:44 2003 UTC
# Line 28  C  time-stepping. Line 28  C  time-stepping.
28  C  \end{itemize}  C  \end{itemize}
29  CEOI  CEOI
30    
31    #include "PACKAGES_CONFIG.h"
32  #include "GAD_OPTIONS.h"  #include "GAD_OPTIONS.h"
33    #ifdef ALLOW_AUTODIFF
34    # include "CPP_OPTIONS.h"
35    #endif
36    
37  CBOP  CBOP
38  C !ROUTINE: GAD_ADVECTION  C !ROUTINE: GAD_ADVECTION
# Line 128  C  ipass                :: number of the Line 132  C  ipass                :: number of the
132  CEOP  CEOP
133    
134  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
135              act0 = tracerIdentity - 1
136              max0 = maxpass
137            act1 = bi - myBxLo(myThid)            act1 = bi - myBxLo(myThid)
138            max1 = myBxHi(myThid) - myBxLo(myThid) + 1            max1 = myBxHi(myThid) - myBxLo(myThid) + 1
139            act2 = bj - myByLo(myThid)            act2 = bj - myByLo(myThid)
# Line 135  CEOP Line 141  CEOP
141            act3 = myThid - 1            act3 = myThid - 1
142            max3 = nTx*nTy            max3 = nTx*nTy
143            act4 = ikey_dynamics - 1            act4 = ikey_dynamics - 1
144            ikey = (act1 + 1) + act2*max1            igadkey = (act0 + 1)
145       &                      + act3*max1*max2       &                      + act1*max0
146       &                      + act4*max1*max2*max3       &                      + act2*max0*max1
147         &                      + act3*max0*max1*max2
148         &                      + act4*max0*max1*max2*max3
149              if (tracerIdentity.GT.maxpass) then
150                 print *, 'ph-pass gad_advection ', maxpass, tracerIdentity
151                 STOP 'maxpass seems smaller than tracerIdentity'
152              endif
153  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
154    
155  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 166  C     uninitialised but inert locations. Line 178  C     uninitialised but inert locations.
178  C--   Start of k loop for horizontal fluxes  C--   Start of k loop for horizontal fluxes
179        DO k=1,Nr        DO k=1,Nr
180  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
181           kkey = (ikey-1)*Nr + k           kkey = (igadkey-1)*Nr + k
182  CADJ STORE tracer(:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ STORE tracer(:,:,k,bi,bj) =
183    CADJ &     comlev1_bibj_k_gad, key=kkey, byte=isbyte
184  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
185    
186  C--   Get temporary terms used by tendency routines  C--   Get temporary terms used by tendency routines
# Line 192  C--   Make local copy of tracer array Line 205  C--   Make local copy of tracer array
205    
206        IF (useCubedSphereExchange) THEN        IF (useCubedSphereExchange) THEN
207         nipass=3         nipass=3
208    #ifdef ALLOW_AUTODIFF_TAMC
209           if ( nipass.GT.maxcube )
210         &      STOP 'maxcube needs to be = 3'
211    #endif
212        ELSE        ELSE
213         nipass=1         nipass=1
214        ENDIF        ENDIF
# Line 200  cph       nipass=1 Line 217  cph       nipass=1
217  C--   Multiple passes for different directions on different tiles  C--   Multiple passes for different directions on different tiles
218        DO ipass=1,nipass        DO ipass=1,nipass
219  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
220           passkey = ipass + (k-1)   *maxpass           passkey = ipass + (k-1)      *maxcube
221       &                   + (ikey-1)*maxpass*Nr       &                   + (igadkey-1)*maxcube*Nr
222           IF (nipass .GT. maxpass) THEN           IF (nipass .GT. maxpass) THEN
223            STOP 'GAD_ADVECTION: nipass > maxpass. check tamc.h'            STOP 'GAD_ADVECTION: nipass > maxcube. check tamc.h'
224           ENDIF           ENDIF
225  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
226    
# Line 252  C-    Advective flux in X Line 269  C-    Advective flux in X
269    
270  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
271  #ifndef DISABLE_MULTIDIM_ADVECTION  #ifndef DISABLE_MULTIDIM_ADVECTION
272  CADJ STORE localTij(:,:)  = comlev1_bibj_pass, key=passkey, byte=isbyte  CADJ STORE localTij(:,:)  =
273    CADJ &     comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
274  #endif  #endif
275  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
276    
# Line 266  CADJ STORE localTij(:,:)  = comlev1_bibj Line 284  CADJ STORE localTij(:,:)  = comlev1_bibj
284         CALL GAD_DST3FL_ADV_X(         CALL GAD_DST3FL_ADV_X(
285       &       bi,bj,k,deltaTtracer,uTrans,uVel,localTij,af,myThid)       &       bi,bj,k,deltaTtracer,uTrans,uVel,localTij,af,myThid)
286        ELSE        ELSE
        write(0,*) advectionScheme  
287         STOP 'GAD_ADVECTION: adv. scheme incompatibale with multi-dim'         STOP 'GAD_ADVECTION: adv. scheme incompatibale with multi-dim'
288        ENDIF        ENDIF
289    
# Line 319  C-    Advective flux in Y Line 336  C-    Advective flux in Y
336    
337  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
338  #ifndef DISABLE_MULTIDIM_ADVECTION  #ifndef DISABLE_MULTIDIM_ADVECTION
339  CADJ STORE localTij(:,:)  = comlev1_bibj_pass, key=passkey, byte=isbyte  CADJ STORE localTij(:,:)  =
340    CADJ &     comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
341  #endif  #endif
342  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
343    
# Line 376  C--   End of K loop for horizontal fluxe Line 394  C--   End of K loop for horizontal fluxe
394  C--   Start of k loop for vertical flux  C--   Start of k loop for vertical flux
395        DO k=Nr,1,-1        DO k=Nr,1,-1
396  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
397           kkey = (ikey-1)*Nr + k           kkey = (igadkey-1)*Nr + k
398  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
399    
400  C--   kup    Cycles through 1,2 to point to w-layer above  C--   kup    Cycles through 1,2 to point to w-layer above
# Line 387  c     kp1=min(Nr,k+1) Line 405  c     kp1=min(Nr,k+1)
405        kp1Msk=1.        kp1Msk=1.
406        if (k.EQ.Nr) kp1Msk=0.        if (k.EQ.Nr) kp1Msk=0.
407    
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE localTijk(:,:,k)    
 CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte  
 #endif /* ALLOW_AUTODIFF_TAMC */  
   
408  C-- Compute Vertical transport  C-- Compute Vertical transport
409  C     Note: wVel needs to be masked  C     Note: wVel needs to be masked
410    
# Line 403  C- Surface interface : Line 416  C- Surface interface :
416           rTransKp1(i,j) = rTrans(i,j)           rTransKp1(i,j) = rTrans(i,j)
417           rTrans(i,j) = 0.           rTrans(i,j) = 0.
418           fVerT(i,j,kUp) = 0.           fVerT(i,j,kUp) = 0.
419             af(i,j) = 0.
420          ENDDO          ENDDO
421         ENDDO         ENDDO
422    
# Line 424  C--   Residual transp = Bolus transp + E Line 438  C--   Residual transp = Bolus transp + E
438       &                    rTrans, bi, bj, k, myThid)       &                    rTrans, bi, bj, k, myThid)
439  #endif /* ALLOW_GMREDI */  #endif /* ALLOW_GMREDI */
440    
441    #ifdef ALLOW_AUTODIFF_TAMC
442    CADJ STORE localTijk(:,:,k)  
443    CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
444    CADJ STORE rTrans(:,:)  
445    CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
446    #endif /* ALLOW_AUTODIFF_TAMC */
447    
448  C-    Compute vertical advective flux in the interior:  C-    Compute vertical advective flux in the interior:
449         IF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN         IF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN
450          CALL GAD_FLUXLIMIT_ADV_R(          CALL GAD_FLUXLIMIT_ADV_R(
# Line 447  C-    add the advective flux to fVerT Line 468  C-    add the advective flux to fVerT
468  C- end Surface/Interior if bloc  C- end Surface/Interior if bloc
469        ENDIF        ENDIF
470    
471    #ifdef ALLOW_AUTODIFF_TAMC
472    CADJ STORE rTrans(:,:)  
473    CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
474    CADJ STORE rTranskp1(:,:)  
475    CADJ &     = comlev1_bibj_k_gad, key=kkey, byte=isbyte
476    #endif /* ALLOW_AUTODIFF_TAMC */
477    
478  C--   Divergence of fluxes  C--   Divergence of fluxes
479        DO j=1-Oly,sNy+Oly        DO j=1-Oly,sNy+Oly
480         DO i=1-Olx,sNx+Olx         DO i=1-Olx,sNx+Olx

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.22