/[MITgcm]/MITgcm/pkg/seaice/seaice_advection.F
ViewVC logotype

Annotation of /MITgcm/pkg/seaice/seaice_advection.F

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


Revision 1.2 - (hide annotations) (download)
Tue Feb 21 17:20:12 2006 UTC (18 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint58e_post, checkpoint58h_post, checkpoint58j_post, checkpoint58f_post, checkpoint58d_post, checkpoint58c_post, checkpoint58i_post, checkpoint58g_post, checkpoint58b_post
Changes since 1.1: +5 -3 lines
Fix GAD keys that are now also used by seaice.

1 heimbach 1.2 C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_advection.F,v 1.1 2006/02/16 10:41:48 mlosch Exp $
2 mlosch 1.1 C $Name: $
3    
4     #include "GAD_OPTIONS.h"
5    
6     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7     CBOP
8     C !ROUTINE: SEAICE_ADVECTION
9    
10     C !INTERFACE: ==========================================================
11     SUBROUTINE SEAICE_ADVECTION(
12     I advectionScheme,
13     I tracerIdentity,
14     I uVel, vVel, tracer,
15     O gTracer,
16     I bi, bj, myTime, myIter, myThid)
17    
18     C !DESCRIPTION:
19     C Calculates the tendency of a tracer due to advection.
20     C It uses the multi-dimensional method given in \ref{sect:multiDimAdvection}
21     C and can only be used for the non-linear advection schemes such as the
22     C direct-space-time method and flux-limiters.
23     C
24     C This routine is an adaption of the GAD_ADVECTION for 2D-fields.
25     C Seaice velocities are not divergence free; therefore the contribution
26     C tracer*div(u) that is present in gad_advection is removed in this routine.
27     C
28     C The algorithm is as follows:
29     C \begin{itemize}
30     C \item{$\theta^{(n+1/2)} = \theta^{(n)}
31     C - \Delta t \partial_x (u\theta^{(n)}) + \theta^{(n)} \partial_x u$}
32     C \item{$\theta^{(n+2/2)} = \theta^{(n+1/2)}
33     C - \Delta t \partial_y (v\theta^{(n+1/2)}) + \theta^{(n)} \partial_y v$}
34     C \item{$G_\theta = ( \theta^{(n+2/2)} - \theta^{(n)} )/\Delta t$}
35     C \end{itemize}
36     C
37     C The tendency (output) is over-written by this routine.
38    
39     C !USES: ===============================================================
40     IMPLICIT NONE
41     #include "SIZE.h"
42     #include "EEPARAMS.h"
43     #include "PARAMS.h"
44     #include "GRID.h"
45     #include "GAD.h"
46     #include "SEAICE_PARAMS.h"
47     #ifdef ALLOW_AUTODIFF_TAMC
48     # include "tamc.h"
49     # include "tamc_keys.h"
50     #endif
51     #ifdef ALLOW_EXCH2
52     #include "W2_EXCH2_TOPOLOGY.h"
53     #include "W2_EXCH2_PARAMS.h"
54     #endif /* ALLOW_EXCH2 */
55    
56     C !INPUT PARAMETERS: ===================================================
57     C implicitAdvection :: implicit vertical advection (later on)
58     C advectionScheme :: advection scheme to use (Horizontal plane)
59     C tracerIdentity :: tracer identifier (required only for OBCS)
60     C uVel :: velocity, zonal component
61     C vVel :: velocity, meridional component
62     C tracer :: tracer field
63     C bi,bj :: tile indices
64     C myTime :: current time
65     C myIter :: iteration number
66     C myThid :: thread number
67     INTEGER advectionScheme
68     INTEGER tracerIdentity
69     _RL uVel (1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
70     _RL vVel (1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
71     _RL tracer(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
72     INTEGER bi,bj
73     _RL myTime
74     INTEGER myIter
75     INTEGER myThid
76    
77     C !OUTPUT PARAMETERS: ==================================================
78     C gTracer :: tendancy array
79     _RL gTracer(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
80    
81     C !LOCAL VARIABLES: ====================================================
82     C maskLocW :: 2-D array for mask at West points
83     C maskLocS :: 2-D array for mask at South points
84     C iMin,iMax, :: loop range for called routines
85     C jMin,jMax :: loop range for called routines
86     C [iMin,iMax]Upd :: loop range to update tracer field
87     C [jMin,jMax]Upd :: loop range to update tracer field
88     C i,j,k :: loop indices
89     C kp1 :: =k+1 for k<Nr, =Nr for k=Nr
90     C xA,yA :: areas of X and Y face of tracer cells
91     C uTrans,vTrans :: 2-D arrays of volume transports at U,V points
92     C af :: 2-D array for horizontal advective flux
93     C afx :: 2-D array for horizontal advective flux, x direction
94     C afy :: 2-D array for horizontal advective flux, y direction
95     C fVerT :: 2 1/2D arrays for vertical advective flux
96     C localTij :: 2-D array, temporary local copy of tracer fld
97     C localTijk :: 3-D array, temporary local copy of tracer fld
98     C kp1Msk :: flag (0,1) for over-riding mask for W levels
99     C calc_fluxes_X :: logical to indicate to calculate fluxes in X dir
100     C calc_fluxes_Y :: logical to indicate to calculate fluxes in Y dir
101     C interiorOnly :: only update the interior of myTile, but not the edges
102     C overlapOnly :: only update the edges of myTile, but not the interior
103     C nipass :: number of passes in multi-dimensional method
104     C ipass :: number of the current pass being made
105     C myTile :: variables used to determine which cube face
106     C nCFace :: owns a tile for cube grid runs using
107     C :: multi-dim advection.
108     C [N,S,E,W]_edge :: true if N,S,E,W edge of myTile is an Edge of the cube
109     _RS maskLocW(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
110     _RS maskLocS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
111     INTEGER iMin,iMax,jMin,jMax
112     INTEGER iMinUpd,iMaxUpd,jMinUpd,jMaxUpd
113     INTEGER i,j,k
114     _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
115     _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
116     _RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
117     _RL vTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
118     _RL af (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
119     _RL afx (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
120     _RL afy (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
121     _RL fVerT (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
122     _RL localTij(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
123     LOGICAL calc_fluxes_X, calc_fluxes_Y, withSigns
124     LOGICAL interiorOnly, overlapOnly
125     INTEGER nipass,ipass
126     INTEGER nCFace
127     LOGICAL N_edge, S_edge, E_edge, W_edge
128     #ifdef ALLOW_EXCH2
129     INTEGER myTile
130     #endif
131     #ifdef ALLOW_DIAGNOSTICS
132     CHARACTER*8 diagName
133     CHARACTER*4 GAD_DIAG_SUFX, diagSufx
134     EXTERNAL GAD_DIAG_SUFX
135     #endif
136     CEOP
137    
138     #ifdef ALLOW_AUTODIFF_TAMC
139     act0 = tracerIdentity - 1
140     max0 = maxpass
141     act1 = bi - myBxLo(myThid)
142     max1 = myBxHi(myThid) - myBxLo(myThid) + 1
143     act2 = bj - myByLo(myThid)
144     max2 = myByHi(myThid) - myByLo(myThid) + 1
145     act3 = myThid - 1
146     max3 = nTx*nTy
147     act4 = ikey_dynamics - 1
148     igadkey = (act0 + 1)
149     & + act1*max0
150     & + act2*max0*max1
151     & + act3*max0*max1*max2
152     & + act4*max0*max1*max2*max3
153     if (tracerIdentity.GT.maxpass) then
154     print *, 'ph-pass gad_advection ', maxpass, tracerIdentity
155     STOP 'maxpass seems smaller than tracerIdentity'
156     endif
157     #endif /* ALLOW_AUTODIFF_TAMC */
158    
159     CML#ifdef ALLOW_DIAGNOSTICS
160     CMLC-- Set diagnostic suffix for the current tracer
161     CML IF ( useDiagnostics ) THEN
162     CML diagSufx = GAD_DIAG_SUFX( tracerIdentity, myThid )
163     CML ENDIF
164     CML#endif
165    
166     C-- Set up work arrays with valid (i.e. not NaN) values
167     C These inital values do not alter the numerical results. They
168     C just ensure that all memory references are to valid floating
169     C point numbers. This prevents spurious hardware signals due to
170     C uninitialised but inert locations.
171     DO j=1-OLy,sNy+OLy
172     DO i=1-OLx,sNx+OLx
173     xA(i,j) = 0. _d 0
174     yA(i,j) = 0. _d 0
175     uTrans(i,j) = 0. _d 0
176     vTrans(i,j) = 0. _d 0
177     fVerT(i,j,1) = 0. _d 0
178     fVerT(i,j,2) = 0. _d 0
179     #ifdef ALLOW_AUTODIFF_TAMC
180     localTij(i,j) = 0. _d 0
181     #endif
182     ENDDO
183     ENDDO
184    
185     C-- Set tile-specific parameters for horizontal fluxes
186     IF (useCubedSphereExchange) THEN
187     nipass=3
188     #ifdef ALLOW_AUTODIFF_TAMC
189     IF ( nipass.GT.maxcube ) STOP 'maxcube needs to be = 3'
190     #endif
191     #ifdef ALLOW_EXCH2
192     myTile = W2_myTileList(bi)
193     nCFace = exch2_myFace(myTile)
194     N_edge = exch2_isNedge(myTile).EQ.1
195     S_edge = exch2_isSedge(myTile).EQ.1
196     E_edge = exch2_isEedge(myTile).EQ.1
197     W_edge = exch2_isWedge(myTile).EQ.1
198     #else
199     nCFace = bi
200     N_edge = .TRUE.
201     S_edge = .TRUE.
202     E_edge = .TRUE.
203     W_edge = .TRUE.
204     #endif
205     ELSE
206     nipass=2
207     nCFace = bi
208     N_edge = .FALSE.
209     S_edge = .FALSE.
210     E_edge = .FALSE.
211     W_edge = .FALSE.
212     ENDIF
213    
214     iMin = 1-OLx
215     iMax = sNx+OLx
216     jMin = 1-OLy
217     jMax = sNy+OLy
218    
219     C-- Start of k loop for horizontal fluxes
220     k = 1
221     #ifdef ALLOW_AUTODIFF_TAMC
222     kkey = (igadkey-1)*Nr + k
223     CADJ STORE tracer(:,:,bi,bj) =
224     CADJ & comlev1_bibj_k_gad, key=kkey, byte=isbyte
225     #endif /* ALLOW_AUTODIFF_TAMC */
226    
227     C Content of CALC_COMMON_FACTORS, adapted for 2D fields
228     C-- Get temporary terms used by tendency routines
229    
230     C-- Calculate tracer cell face open areas
231     DO j=jMin,jMax
232     DO i=iMin,iMax
233     xA(i,j) = _dyG(i,j,bi,bj) * maskW(i,j,k,bi,bj)
234     yA(i,j) = _dxG(i,j,bi,bj) * maskS(i,j,k,bi,bj)
235     ENDDO
236     ENDDO
237    
238     C-- Calculate velocity field "volume transports" through
239     C-- tracer cell faces.
240     DO j=jMin,jMax
241     DO i=iMin,iMax
242     uTrans(i,j) = uVel(i,j,bi,bj)*xA(i,j)
243     vTrans(i,j) = vVel(i,j,bi,bj)*yA(i,j)
244     ENDDO
245     ENDDO
246     C end of CALC_COMMON_FACTORS, adapted for 2D fields
247    
248     C-- Make local copy of tracer array and mask West & South
249     DO j=1-OLy,sNy+OLy
250     DO i=1-OLx,sNx+OLx
251     localTij(i,j)=tracer(i,j,bi,bj)
252     maskLocW(i,j)=maskW(i,j,k,bi,bj)
253     maskLocS(i,j)=maskS(i,j,k,bi,bj)
254     ENDDO
255     ENDDO
256    
257     #ifndef ALLOW_AUTODIFF_TAMC
258     IF (useCubedSphereExchange) THEN
259     withSigns = .FALSE.
260     CALL FILL_CS_CORNER_UV_RS(
261     & withSigns, maskLocW,maskLocS, bi,bj, myThid )
262     ENDIF
263     #endif
264    
265     C-- Multiple passes for different directions on different tiles
266     C-- For cube need one pass for each of red, green and blue axes.
267     DO ipass=1,nipass
268     #ifdef ALLOW_AUTODIFF_TAMC
269     passkey = ipass + (k-1) *maxcube
270     & + (igadkey-1)*maxcube*Nr
271     IF (nipass .GT. maxpass) THEN
272     STOP 'SEAICE_ADVECTION: nipass > maxcube. check tamc.h'
273     ENDIF
274     #endif /* ALLOW_AUTODIFF_TAMC */
275    
276     interiorOnly = .FALSE.
277     overlapOnly = .FALSE.
278     IF (useCubedSphereExchange) THEN
279     C-- CubedSphere : pass 3 times, with partial update of local tracer field
280     IF (ipass.EQ.1) THEN
281     overlapOnly = MOD(nCFace,3).EQ.0
282     interiorOnly = MOD(nCFace,3).NE.0
283     calc_fluxes_X = nCFace.EQ.6 .OR. nCFace.EQ.1 .OR. nCFace.EQ.2
284     calc_fluxes_Y = nCFace.EQ.3 .OR. nCFace.EQ.4 .OR. nCFace.EQ.5
285     ELSEIF (ipass.EQ.2) THEN
286     overlapOnly = MOD(nCFace,3).EQ.2
287     calc_fluxes_X = nCFace.EQ.2 .OR. nCFace.EQ.3 .OR. nCFace.EQ.4
288     calc_fluxes_Y = nCFace.EQ.5 .OR. nCFace.EQ.6 .OR. nCFace.EQ.1
289     ELSE
290     calc_fluxes_X = nCFace.EQ.5 .OR. nCFace.EQ.6
291     calc_fluxes_Y = nCFace.EQ.2 .OR. nCFace.EQ.3
292     ENDIF
293     ELSE
294     C-- not CubedSphere
295     calc_fluxes_X = MOD(ipass,2).EQ.1
296     calc_fluxes_Y = .NOT.calc_fluxes_X
297     ENDIF
298    
299     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
300     C-- X direction
301     C- Advective flux in X
302     DO j=1-Oly,sNy+Oly
303     DO i=1-Olx,sNx+Olx
304     af(i,j) = 0.
305     ENDDO
306     ENDDO
307     C
308     #ifdef ALLOW_AUTODIFF_TAMC
309     CADJ STORE localTij(:,:) =
310     CADJ & comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
311 heimbach 1.2 # ifndef DISABLE_MULTIDIM_ADVECTION
312 mlosch 1.1 CADJ STORE af(:,:) =
313     CADJ & comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
314 heimbach 1.2 # endif
315 mlosch 1.1 #endif /* ALLOW_AUTODIFF_TAMC */
316     C
317     IF (calc_fluxes_X) THEN
318    
319     C- Do not compute fluxes if
320     C a) needed in overlap only
321     C and b) the overlap of myTile are not cube-face Edges
322     IF ( .NOT.overlapOnly .OR. N_edge .OR. S_edge ) THEN
323    
324     #ifndef ALLOW_AUTODIFF_TAMC
325     C- Internal exchange for calculations in X
326     #ifdef MULTIDIM_OLD_VERSION
327     IF ( useCubedSphereExchange ) THEN
328     #else
329     IF ( useCubedSphereExchange .AND.
330     & ( overlapOnly .OR. ipass.EQ.1 ) ) THEN
331     #endif
332     CALL FILL_CS_CORNER_TR_RL( .TRUE., localTij, bi,bj, myThid )
333     ENDIF
334     #endif
335    
336     #ifdef ALLOW_AUTODIFF_TAMC
337     # ifndef DISABLE_MULTIDIM_ADVECTION
338     CADJ STORE localTij(:,:) =
339     CADJ & comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
340     # endif
341     #endif /* ALLOW_AUTODIFF_TAMC */
342    
343     IF ( advectionScheme.EQ.ENUM_UPWIND_1RST
344     & .OR. advectionScheme.EQ.ENUM_DST2 ) THEN
345     CALL GAD_DST2U1_ADV_X( bi,bj,k, advectionScheme,
346     I SEAICE_deltaTtherm,uTrans,uVel,localTij,
347     O af, myThid )
348     ELSEIF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN
349     CALL GAD_FLUXLIMIT_ADV_X( bi,bj,k, SEAICE_deltaTtherm,
350     I uTrans, uVel, maskLocW, localTij,
351     O af, myThid )
352     ELSEIF (advectionScheme.EQ.ENUM_DST3 ) THEN
353     CALL GAD_DST3_ADV_X( bi,bj,k, SEAICE_deltaTtherm,
354     I uTrans, uVel, maskLocW, localTij,
355     O af, myThid )
356     ELSEIF (advectionScheme.EQ.ENUM_DST3_FLUX_LIMIT ) THEN
357     CALL GAD_DST3FL_ADV_X( bi,bj,k, SEAICE_deltaTtherm,
358     I uTrans, uVel, maskLocW, localTij,
359     O af, myThid )
360     ELSE
361     STOP
362     & 'SEAICE_ADVECTION: adv. scheme incompatibale with multi-dim'
363     ENDIF
364    
365     C-- Advective flux in X : done
366     ENDIF
367    
368     #ifndef ALLOW_AUTODIFF_TAMC
369     C-- Internal exchange for next calculations in Y
370     IF ( overlapOnly .AND. ipass.EQ.1 ) THEN
371     CALL FILL_CS_CORNER_TR_RL(.FALSE., localTij, bi,bj, myThid )
372     ENDIF
373     #endif
374    
375     C- Update the local tracer field where needed:
376    
377     C update in overlap-Only
378     IF ( overlapOnly ) THEN
379     iMinUpd = 1-Olx+1
380     iMaxUpd = sNx+Olx-1
381     C-- notes: these 2 lines below have no real effect (because recip_hFac=0
382     C in corner region) but safer to keep them.
383     IF ( W_edge ) iMinUpd = 1
384     IF ( E_edge ) iMaxUpd = sNx
385    
386     IF ( S_edge ) THEN
387     DO j=1-Oly,0
388     DO i=iMinUpd,iMaxUpd
389     localTij(i,j)=localTij(i,j)-SEAICE_deltaTtherm*
390     & maskC(i,j,k,bi,bj)
391     & *recip_rA(i,j,bi,bj)
392     & *( af(i+1,j)-af(i,j)
393     & )
394     ENDDO
395     ENDDO
396     ENDIF
397     IF ( N_edge ) THEN
398     DO j=sNy+1,sNy+Oly
399     DO i=iMinUpd,iMaxUpd
400     localTij(i,j)=localTij(i,j)-SEAICE_deltaTtherm*
401     & maskC(i,j,k,bi,bj)
402     & *recip_rA(i,j,bi,bj)
403     & *( af(i+1,j)-af(i,j)
404     & )
405     ENDDO
406     ENDDO
407     ENDIF
408    
409     ELSE
410     C do not only update the overlap
411     jMinUpd = 1-Oly
412     jMaxUpd = sNy+Oly
413     IF ( interiorOnly .AND. S_edge ) jMinUpd = 1
414     IF ( interiorOnly .AND. N_edge ) jMaxUpd = sNy
415     DO j=jMinUpd,jMaxUpd
416     DO i=1-Olx+1,sNx+Olx-1
417     localTij(i,j)=localTij(i,j)-SEAICE_deltaTtherm*
418     & maskC(i,j,k,bi,bj)
419     & *recip_rA(i,j,bi,bj)
420     & *( af(i+1,j)-af(i,j)
421     & )
422     ENDDO
423     ENDDO
424     C-- keep advective flux (for diagnostics)
425     DO j=1-Oly,sNy+Oly
426     DO i=1-Olx,sNx+Olx
427     afx(i,j) = af(i,j)
428     ENDDO
429     ENDDO
430    
431     C This is for later
432     CML#ifdef ALLOW_OBCS
433     CMLC- Apply open boundary conditions
434     CML IF ( useOBCS ) THEN
435     CML IF (tracerIdentity.EQ.GAD_HEFF) THEN
436     CML CALL OBCS_APPLY_HEFF( bi, bj, k, localTij, myThid )
437     CML ELSEIF (tracerIdentity.EQ.GAD_AREA) THEN
438     CML CALL OBCS_APPLY_AREA( bi, bj, k, localTij, myThid )
439     CML ENDIF
440     CML ENDIF
441     CML#endif /* ALLOW_OBCS */
442    
443     C- end if/else update overlap-Only
444     ENDIF
445    
446     C-- End of X direction
447     ENDIF
448    
449     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
450     C-- Y direction
451     cph-test
452     C- Advective flux in Y
453     DO j=1-Oly,sNy+Oly
454     DO i=1-Olx,sNx+Olx
455     af(i,j) = 0.
456     ENDDO
457     ENDDO
458     C
459     #ifdef ALLOW_AUTODIFF_TAMC
460 heimbach 1.2 # ifndef DISABLE_MULTIDIM_ADVECTION
461 mlosch 1.1 CADJ STORE localTij(:,:) =
462     CADJ & comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
463     CADJ STORE af(:,:) =
464     CADJ & comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
465 heimbach 1.2 # endif
466 mlosch 1.1 #endif /* ALLOW_AUTODIFF_TAMC */
467     C
468     IF (calc_fluxes_Y) THEN
469    
470     C- Do not compute fluxes if
471     C a) needed in overlap only
472     C and b) the overlap of myTile are not cube-face edges
473     IF ( .NOT.overlapOnly .OR. E_edge .OR. W_edge ) THEN
474    
475     #ifndef ALLOW_AUTODIFF_TAMC
476     C- Internal exchange for calculations in Y
477     #ifdef MULTIDIM_OLD_VERSION
478     IF ( useCubedSphereExchange ) THEN
479     #else
480     IF ( useCubedSphereExchange .AND.
481     & ( overlapOnly .OR. ipass.EQ.1 ) ) THEN
482     #endif
483     CALL FILL_CS_CORNER_TR_RL(.FALSE., localTij, bi,bj, myThid )
484     ENDIF
485     #endif
486    
487     C- Advective flux in Y
488     DO j=1-Oly,sNy+Oly
489     DO i=1-Olx,sNx+Olx
490     af(i,j) = 0.
491     ENDDO
492     ENDDO
493    
494     #ifdef ALLOW_AUTODIFF_TAMC
495     #ifndef DISABLE_MULTIDIM_ADVECTION
496     CADJ STORE localTij(:,:) =
497     CADJ & comlev1_bibj_k_gad_pass, key=passkey, byte=isbyte
498     #endif
499     #endif /* ALLOW_AUTODIFF_TAMC */
500    
501     IF ( advectionScheme.EQ.ENUM_UPWIND_1RST
502     & .OR. advectionScheme.EQ.ENUM_DST2 ) THEN
503     CALL GAD_DST2U1_ADV_Y( bi,bj,k, advectionScheme,
504     I SEAICE_deltaTtherm,vTrans,vVel,localTij,
505     O af, myThid )
506     ELSEIF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN
507     CALL GAD_FLUXLIMIT_ADV_Y( bi,bj,k, SEAICE_deltaTtherm,
508     I vTrans, vVel, maskLocS, localTij,
509     O af, myThid )
510     ELSEIF (advectionScheme.EQ.ENUM_DST3 ) THEN
511     CALL GAD_DST3_ADV_Y( bi,bj,k, SEAICE_deltaTtherm,
512     I vTrans, vVel, maskLocS, localTij,
513     O af, myThid )
514     ELSEIF (advectionScheme.EQ.ENUM_DST3_FLUX_LIMIT ) THEN
515     CALL GAD_DST3FL_ADV_Y( bi,bj,k, SEAICE_deltaTtherm,
516     I vTrans, vVel, maskLocS, localTij,
517     O af, myThid )
518     ELSE
519     STOP
520     & 'SEAICE_ADVECTION: adv. scheme incompatibale with mutli-dim'
521     ENDIF
522    
523     C- Advective flux in Y : done
524     ENDIF
525    
526     #ifndef ALLOW_AUTODIFF_TAMC
527     C- Internal exchange for next calculations in X
528     IF ( overlapOnly .AND. ipass.EQ.1 ) THEN
529     CALL FILL_CS_CORNER_TR_RL( .TRUE., localTij, bi,bj, myThid )
530     ENDIF
531     #endif
532    
533     C- Update the local tracer field where needed:
534    
535     C update in overlap-Only
536     IF ( overlapOnly ) THEN
537     jMinUpd = 1-Oly+1
538     jMaxUpd = sNy+Oly-1
539     C- notes: these 2 lines below have no real effect (because recip_hFac=0
540     C in corner region) but safer to keep them.
541     IF ( S_edge ) jMinUpd = 1
542     IF ( N_edge ) jMaxUpd = sNy
543    
544     IF ( W_edge ) THEN
545     DO j=jMinUpd,jMaxUpd
546     DO i=1-Olx,0
547     localTij(i,j)=localTij(i,j)-SEAICE_deltaTtherm*
548     & maskC(i,j,k,bi,bj)
549     & *recip_rA(i,j,bi,bj)
550     & *( af(i,j+1)-af(i,j)
551     & )
552     ENDDO
553     ENDDO
554     ENDIF
555     IF ( E_edge ) THEN
556     DO j=jMinUpd,jMaxUpd
557     DO i=sNx+1,sNx+Olx
558     localTij(i,j)=localTij(i,j)-SEAICE_deltaTtherm*
559     & maskC(i,j,k,bi,bj)
560     & *recip_rA(i,j,bi,bj)
561     & *( af(i,j+1)-af(i,j)
562     & )
563     ENDDO
564     ENDDO
565     ENDIF
566    
567     ELSE
568     C do not only update the overlap
569     iMinUpd = 1-Olx
570     iMaxUpd = sNx+Olx
571     IF ( interiorOnly .AND. W_edge ) iMinUpd = 1
572     IF ( interiorOnly .AND. E_edge ) iMaxUpd = sNx
573     DO j=1-Oly+1,sNy+Oly-1
574     DO i=iMinUpd,iMaxUpd
575     localTij(i,j)=localTij(i,j)-SEAICE_deltaTtherm*
576     & maskC(i,j,k,bi,bj)
577     & *recip_rA(i,j,bi,bj)
578     & *( af(i,j+1)-af(i,j)
579     & )
580     ENDDO
581     ENDDO
582     C-- keep advective flux (for diagnostics)
583     DO j=1-Oly,sNy+Oly
584     DO i=1-Olx,sNx+Olx
585     afy(i,j) = af(i,j)
586     ENDDO
587     ENDDO
588    
589     C-- Save this for later
590     CML#ifdef ALLOW_OBCS
591     CMLC- Apply open boundary conditions
592     CML IF (useOBCS) THEN
593     CML IF (tracerIdentity.EQ.GAD_HEFF) THEN
594     CML CALL OBCS_APPLY_HEFF( bi, bj, k, localTij, myThid )
595     CML ELSEIF (tracerIdentity.EQ.GAD_AREA) THEN
596     CML CALL OBCS_APPLY_AREA( bi, bj, k, localTij, myThid )
597     CML ENDIF
598     CML ENDIF
599     CML#endif /* ALLOW_OBCS */
600    
601     C end if/else update overlap-Only
602     ENDIF
603    
604     C-- End of Y direction
605     ENDIF
606    
607     C-- End of ipass loop
608     ENDDO
609    
610     C- explicit advection is done ; store tendency in gTracer:
611     DO j=1-Oly,sNy+Oly
612     DO i=1-Olx,sNx+Olx
613     gTracer(i,j,bi,bj)=
614     & (localTij(i,j)-tracer(i,j,bi,bj))/SEAICE_deltaTtherm
615     ENDDO
616     ENDDO
617    
618     CML#ifdef ALLOW_DIAGNOSTICS
619     CML IF ( useDiagnostics ) THEN
620     CML diagName = 'ADVx'//diagSufx
621     CML CALL DIAGNOSTICS_FILL(afx,diagName, k,1, 2,bi,bj, myThid)
622     CML diagName = 'ADVy'//diagSufx
623     CML CALL DIAGNOSTICS_FILL(afy,diagName, k,1, 2,bi,bj, myThid)
624     CML ENDIF
625     CML#endif
626    
627     #ifdef ALLOW_DEBUG
628     IF ( debugLevel .GE. debLevB
629     & .AND. tracerIdentity.EQ.GAD_HEFF
630     & .AND. k.LE.3 .AND. myIter.EQ.1+nIter0
631     & .AND. nPx.EQ.1 .AND. nPy.EQ.1
632     & .AND. useCubedSphereExchange ) THEN
633     CALL DEBUG_CS_CORNER_UV( ' afx,afy from SEAICE_ADVECTION',
634     & afx,afy, k, standardMessageUnit,bi,bj,myThid )
635     ENDIF
636     #endif /* ALLOW_DEBUG */
637    
638     RETURN
639     END

  ViewVC Help
Powered by ViewVC 1.1.22