/[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.23 by jmc, Sat Jun 26 02:38:54 2004 UTC revision 1.24 by dimitri, Mon Jun 28 21:10:55 2004 UTC
# Line 45  C !USES: =============================== Line 45  C !USES: ===============================
45  # include "tamc.h"  # include "tamc.h"
46  # include "tamc_keys.h"  # include "tamc_keys.h"
47  #endif  #endif
48    #ifdef ALLOW_EXCH2
49    #include "W2_EXCH2_TOPOLOGY.h"
50    #include "W2_EXCH2_PARAMS.h"
51    #endif /* ALLOW_EXCH2 */
52    
53  C !INPUT PARAMETERS: ===================================================  C !INPUT PARAMETERS: ===================================================
54  C  implicitAdvection :: implicit vertical advection (later on)  C  implicitAdvection :: implicit vertical advection (later on)
# Line 96  C  calc_fluxes_X :: logical to indicate Line 100  C  calc_fluxes_X :: logical to indicate
100  C  calc_fluxes_Y :: logical to indicate to calculate fluxes in Y dir  C  calc_fluxes_Y :: logical to indicate to calculate fluxes in Y dir
101  C  nipass        :: number of passes in multi-dimensional method  C  nipass        :: number of passes in multi-dimensional method
102  C  ipass         :: number of the current pass being made  C  ipass         :: number of the current pass being made
103    C  myTile        :: variables used to determine which cube face
104    C  nCFace        :: owns a tile for cube grid runs using
105    C                :: multi-dim advection.
106        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS maskUp  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
107        INTEGER iMin,iMax,jMin,jMax        INTEGER iMin,iMax,jMin,jMax
108        INTEGER i,j,k,kup,kDown        INTEGER i,j,k,kup,kDown
# Line 112  C  ipass         :: number of the curren Line 119  C  ipass         :: number of the curren
119        _RL kp1Msk        _RL kp1Msk
120        LOGICAL calc_fluxes_X,calc_fluxes_Y        LOGICAL calc_fluxes_X,calc_fluxes_Y
121        INTEGER nipass,ipass        INTEGER nipass,ipass
122          INTEGER myTile, nCFace
123          LOGICAL southWestCorner
124          LOGICAL southEastCorner
125          LOGICAL northWestCorner
126          LOGICAL northEastCorner
127  CEOP  CEOP
128    
129  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
# Line 187  C--   Make local copy of tracer array Line 199  C--   Make local copy of tracer array
199        ENDDO        ENDDO
200    
201        IF (useCubedSphereExchange) THEN        IF (useCubedSphereExchange) THEN
202           southWestCorner = .TRUE.
203           southEastCorner = .TRUE.
204           northWestCorner = .TRUE.
205           northEastCorner = .TRUE.
206    #ifdef ALLOW_EXCH2
207           myTile = W2_myTileList(bi)
208           nCFace = exch2_myFace(myTile)
209           southWestCorner = exch2_isWedge(myTile).EQ.1
210         &             .AND. exch2_isSedge(myTile).EQ.1
211           southEastCorner = exch2_isEedge(myTile).EQ.1
212         &             .AND. exch2_isSedge(myTile).EQ.1
213           northEastCorner = exch2_isEedge(myTile).EQ.1
214         &             .AND. exch2_isNedge(myTile).EQ.1
215           northWestCorner = exch2_isWedge(myTile).EQ.1
216         &             .AND. exch2_isNedge(myTile).EQ.1
217    #else
218           nCFace = bi
219    #endif
220    
221         nipass=3         nipass=3
222  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
223         if ( nipass.GT.maxcube )         if ( nipass.GT.maxcube )
# Line 198  C--   Make local copy of tracer array Line 229  C--   Make local copy of tracer array
229  cph       nipass=1  cph       nipass=1
230    
231  C--   Multiple passes for different directions on different tiles  C--   Multiple passes for different directions on different tiles
232    C--   For cube need one pass for each of red, green and blue axes.
233        DO ipass=1,nipass        DO ipass=1,nipass
234  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
235           passkey = ipass + (k-1)      *maxcube           passkey = ipass + (k-1)      *maxcube
# Line 210  C--   Multiple passes for different dire Line 242  C--   Multiple passes for different dire
242        IF (nipass.EQ.3) THEN        IF (nipass.EQ.3) THEN
243         calc_fluxes_X=.FALSE.         calc_fluxes_X=.FALSE.
244         calc_fluxes_Y=.FALSE.         calc_fluxes_Y=.FALSE.
245         IF (ipass.EQ.1 .AND. (bi.EQ.1 .OR. bi.EQ.2) ) THEN         IF (ipass.EQ.1 .AND. (nCFace.EQ.1 .OR. nCFace.EQ.2) ) THEN
246          calc_fluxes_X=.TRUE.          calc_fluxes_X=.TRUE.
247         ELSEIF (ipass.EQ.1 .AND. (bi.EQ.4 .OR. bi.EQ.5) ) THEN         ELSEIF (ipass.EQ.1 .AND. (nCFace.EQ.4 .OR. nCFace.EQ.5) ) THEN
248          calc_fluxes_Y=.TRUE.          calc_fluxes_Y=.TRUE.
249         ELSEIF (ipass.EQ.2 .AND. (bi.EQ.1 .OR. bi.EQ.6) ) THEN         ELSEIF (ipass.EQ.2 .AND. (nCFace.EQ.1 .OR. nCFace.EQ.6) ) THEN
250          calc_fluxes_Y=.TRUE.          calc_fluxes_Y=.TRUE.
251         ELSEIF (ipass.EQ.2 .AND. (bi.EQ.3 .OR. bi.EQ.4) ) THEN         ELSEIF (ipass.EQ.2 .AND. (nCFace.EQ.3 .OR. nCFace.EQ.4) ) THEN
252          calc_fluxes_X=.TRUE.          calc_fluxes_X=.TRUE.
253         ELSEIF (ipass.EQ.3 .AND. (bi.EQ.2 .OR. bi.EQ.3) ) THEN         ELSEIF (ipass.EQ.3 .AND. (nCFace.EQ.2 .OR. nCFace.EQ.3) ) THEN
254          calc_fluxes_Y=.TRUE.          calc_fluxes_Y=.TRUE.
255         ELSEIF (ipass.EQ.3 .AND. (bi.EQ.5 .OR. bi.EQ.6) ) THEN         ELSEIF (ipass.EQ.3 .AND. (nCFace.EQ.5 .OR. nCFace.EQ.6) ) THEN
256          calc_fluxes_X=.TRUE.          calc_fluxes_X=.TRUE.
257         ENDIF         ENDIF
258        ELSE        ELSE
# Line 233  C--   X direction Line 265  C--   X direction
265    
266  C--   Internal exchange for calculations in X  C--   Internal exchange for calculations in X
267        IF (useCubedSphereExchange) THEN        IF (useCubedSphereExchange) THEN
268         DO j=1,Oly  C--    For cube face corners we need to duplicate the
269          DO i=1,Olx  C--    i-1 and i+1 values into the null space as follows:
270           localTij( 1-i , 1-j )=localTij( 1-j ,    i    )  C
271           localTij( 1-i ,sNy+j)=localTij( 1-j , sNy+1-i )  C
272           localTij(sNx+i, 1-j )=localTij(sNx+j,    i    )  C      o NW corner: copy T(    0,sNy  ) into T(    0,sNy+1) e.g.
273           localTij(sNx+i,sNy+j)=localTij(sNx+j, sNy+1-i )  C                      |
274          ENDDO  C         x T(0,sNy+1) |
275         ENDDO  C        /\            |
276    C      --||------------|-----------
277    C        ||            |
278    C         x T(0,sNy)   |   x T(1,sNy)
279    C                      |
280    C
281    C      o SW corner: copy T(0,1) into T(0,0) e.g.
282    C                      |
283    C         x T(0,1)     |  x T(1,1)
284    C        ||            |
285    C      --||------------|-----------
286    C        \/            |
287    C         x T(0,0)     |
288    C                      |
289    C
290    C      o NE corner: copy T(sNx+1,sNy  ) into T(sNx+1,sNy+1) e.g.
291    C                      |
292    C                      |   x T(sNx+1,sNy+1)
293    C                      |  /\
294    C      ----------------|--||-------
295    C                      |  ||
296    C         x T(sNx,sNy) |   x T(sNx+1,sNy  )
297    C                      |
298    C      o SE corner: copy T(sNx+1,1    ) into T(sNx+1,0    ) e.g.
299    C                      |
300    C         x T(sNx,1)   |   x T(sNx+1,    1)
301    C                      |  ||
302    C      ----------------|--||-------
303    C                      |  \/
304    C                      |   x T(sNx+1,    0)
305           IF ( southWestCorner ) THEN
306            localTij(0    ,0    )= localTij(0    ,1  )
307           ENDIF
308           IF ( southEastCorner ) THEN
309            localTij(sNx+1,0    )= localTij(sNx+1,1  )
310           ENDIF
311           IF ( northWestCorner ) THEN
312            localTij(0    ,sNy+1)= localTij(0    ,sNy)
313           ENDIF
314           IF ( northEastCorner ) THEN
315            localTij(sNx+1,sNy+1)= localTij(sNx+1,sNy)
316           ENDIF
317        ENDIF        ENDIF
318    
319  C-    Advective flux in X  C-    Advective flux in X
# Line 298  C--   End of X direction Line 371  C--   End of X direction
371  C--   Y direction  C--   Y direction
372        IF (calc_fluxes_Y) THEN        IF (calc_fluxes_Y) THEN
373    
 C--   Internal exchange for calculations in Y  
374        IF (useCubedSphereExchange) THEN        IF (useCubedSphereExchange) THEN
375         DO j=1,Oly  C--   Internal exchange for calculations in Y
376          DO i=1,Olx  C--    For cube face corners we need to duplicate the
377           localTij( 1-i , 1-j )=localTij(   j   , 1-i )  C--    j-1 and j+1 values into the null space as follows:
378           localTij( 1-i ,sNy+j)=localTij(   j   ,sNy+i)  C
379           localTij(sNx+i, 1-j )=localTij(sNx+1-j, 1-i )  C      o SW corner: copy T(0,1) into T(0,0) e.g.
380           localTij(sNx+i,sNy+j)=localTij(sNx+1-j,sNy+i)  C                      |
381          ENDDO  C                      |  x T(1,1)
382         ENDDO  C                      |
383    C      ----------------|-----------
384    C                      |
385    C         x T(0,0)<====== x T(1,0)
386    C                      |
387    C
388    C      o NW corner: copy T(    0,sNy  ) into T(    0,sNy+1) e.g.
389    C                      |
390    C         x T(0,sNy+1)<=== x T(1,sNy+1)
391    C                      |
392    C      ----------------|-----------
393    C                      |
394    C                      |   x T(1,sNy)
395    C                      |
396    C
397    C      o NE corner: copy T(sNx+1,sNy  ) into T(sNx+1,sNy+1) e.g.
398    C                      |
399    C      x T(sNx,sNy+1)=====>x T(sNx+1,sNy+1)
400    C                      |    
401    C      ----------------|-----------
402    C                      |    
403    C      x T(sNx,sNy)    |                      
404    C                      |
405    C      o SE corner: copy T(sNx+1,1    ) into T(sNx+1,0    ) e.g.
406    C                      |
407    C         x T(sNx,1)   |                    
408    C                      |    
409    C      ----------------|-----------
410    C                      |    
411    C         x T(sNx,0) =====>x T(sNx+1,    0)
412           IF ( southWestCorner ) THEN
413             localTij(    0,0    ) = localTij(  1,0    )
414           ENDIF
415           IF ( southEastCorner ) THEN
416             localTij(sNx+1,0    ) = localTij(sNx,0    )
417           ENDIF
418           IF ( northWestCorner ) THEN
419             localTij(0    ,sNy+1) = localTij(  1,sNy+1)
420           ENDIF
421           IF ( northEastCorner ) THEN
422             localTij(sNx+1,sNy+1) = localTij(sNx,sNy+1)
423           ENDIF
424        ENDIF        ENDIF
425    
426  C-    Advective flux in Y  C-    Advective flux in Y

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.22