/[MITgcm]/MITgcm/pkg/thsice/thsice_advection.F
ViewVC logotype

Contents of /MITgcm/pkg/thsice/thsice_advection.F

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


Revision 1.11 - (show annotations) (download)
Sun Jun 28 01:05:41 2009 UTC (14 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62m, checkpoint62l, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61s, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.10: +2 -2 lines
add bj in exch2 arrays and S/R

1 C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_advection.F,v 1.10 2009/06/11 20:04:24 jmc Exp $
2 C $Name: $
3
4 #include "THSICE_OPTIONS.h"
5 #ifdef ALLOW_GENERIC_ADVDIFF
6 # include "GAD_OPTIONS.h"
7 #endif
8
9 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
10 CBOP
11 C !ROUTINE: THSICE_ADVECTION
12
13 C !INTERFACE: ==========================================================
14 SUBROUTINE THSICE_ADVECTION(
15 I tracerIdentity,
16 I advectionScheme,
17 I useGridVolume,
18 I uTrans, vTrans, maskOc, deltaTadvect, iceEps,
19 U iceVol, iceFld,
20 O afx, afy,
21 I bi, bj, myTime, myIter, myThid)
22
23 C !DESCRIPTION:
24 C Calculates the tendency of a sea-ice field due to advection.
25 C It uses the multi-dimensional method given in \ref{sect:multiDimAdvection}
26 C and can only be used for the non-linear advection schemes such as the
27 C direct-space-time method and flux-limiters.
28 C
29 C This routine is an adaption of the GAD_ADVECTION for 2D-fields.
30 C for Area, effective thickness or other "extensive" sea-ice field,
31 C the contribution iceFld*div(u) (that is present in gad_advection)
32 C is not included here.
33 C
34 C The algorithm is as follows:
35 C \begin{itemize}
36 C \item{$\theta^{(n+1/2)} = \theta^{(n)}
37 C - \Delta t \partial_x (u\theta^{(n)}) + \theta^{(n)} \partial_x u$}
38 C \item{$\theta^{(n+2/2)} = \theta^{(n+1/2)}
39 C - \Delta t \partial_y (v\theta^{(n+1/2)}) + \theta^{(n)} \partial_y v$}
40 C \item{$G_\theta = ( \theta^{(n+2/2)} - \theta^{(n)} )/\Delta t$}
41 C \end{itemize}
42 C
43 C The tendency (output) is over-written by this routine.
44
45 C !USES: ===============================================================
46 IMPLICIT NONE
47 #include "SIZE.h"
48 #include "EEPARAMS.h"
49 #include "PARAMS.h"
50 #include "GRID.h"
51 #include "THSICE_SIZE.h"
52 #ifdef ALLOW_GENERIC_ADVDIFF
53 # include "GAD.h"
54 #endif
55 #ifdef ALLOW_EXCH2
56 #include "W2_EXCH2_SIZE.h"
57 #include "W2_EXCH2_TOPOLOGY.h"
58 #endif /* ALLOW_EXCH2 */
59 #ifdef ALLOW_AUTODIFF_TAMC
60 # include "THSICE_PARAMS.h"
61 # include "tamc.h"
62 # include "tamc_keys.h"
63 #endif
64
65 C !INPUT PARAMETERS: ===================================================
66 C tracerIdentity :: tracer identifier (required only for OBCS)
67 C advectionScheme :: advection scheme to use (Horizontal plane)
68 C useGridVolume :: use grid-cell Area & Volume (instead of "iceVol" field)
69 C uTrans,vTrans :: volume transports at U,V points
70 C maskOc :: oceanic mask
71 C iceVol :: sea-ice volume
72 C iceFld :: sea-ice field
73 C deltaTadvect :: time-step used for advection [s]
74 C iceEps :: small volume (to avoid division by zero if iceVol==0)
75 C bi,bj :: tile indices
76 C myTime :: current time in simulation [s]
77 C myIter :: current iteration number
78 C myThid :: my thread Id. number
79 INTEGER tracerIdentity
80 INTEGER advectionScheme
81 LOGICAL useGridVolume
82 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
83 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
84 _RS maskOc(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
85 _RL iceFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
86 _RL iceVol(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
87 _RL deltaTadvect, iceEps
88 INTEGER bi,bj
89 _RL myTime
90 INTEGER myIter
91 INTEGER myThid
92
93 C !OUTPUT PARAMETERS: ==================================================
94 C iceVol (Updated):: sea-ice volume
95 C iceFld (Updated):: sea-ice field
96 C afx :: horizontal advective flux, x direction
97 C afy :: horizontal advective flux, y direction
98 _RL afx (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99 _RL afy (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
100
101 #ifdef ALLOW_GENERIC_ADVDIFF
102 C !LOCAL VARIABLES: ====================================================
103 C maskLocW :: 2-D array for mask at West points
104 C maskLocS :: 2-D array for mask at South points
105 C iMin,iMax, :: loop range for called routines
106 C jMin,jMax :: loop range for called routines
107 C [iMin,iMax]Upd :: loop range to update sea-ice field
108 C [jMin,jMax]Upd :: loop range to update sea-ice field
109 C i,j :: loop indices
110 C uCfl :: CFL number, zonal direction
111 C vCfl :: CFL number, meridional direction
112 C af :: 2-D array for horizontal advective flux
113 C calc_fluxes_X :: logical to indicate to calculate fluxes in X dir
114 C calc_fluxes_Y :: logical to indicate to calculate fluxes in Y dir
115 C interiorOnly :: only update the interior of myTile, but not the edges
116 C overlapOnly :: only update the edges of myTile, but not the interior
117 C nipass :: number of passes in multi-dimensional method
118 C ipass :: number of the current pass being made
119 C myTile :: variables used to determine which cube face
120 C nCFace :: owns a tile for cube grid runs using
121 C :: multi-dim advection.
122 C [N,S,E,W]_edge :: true if N,S,E,W edge of myTile is an Edge of the cube
123 _RS maskLocW(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
124 _RS maskLocS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
125 INTEGER iMin,iMax,jMin,jMax
126 INTEGER iMinUpd,iMaxUpd,jMinUpd,jMaxUpd
127 INTEGER i,j,k
128 _RL uCfl (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
129 _RL vCfl (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
130 _RL af (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
131 LOGICAL calc_fluxes_X, calc_fluxes_Y, withSigns
132 LOGICAL interiorOnly, overlapOnly
133 INTEGER nipass,ipass
134 INTEGER nCFace
135 LOGICAL N_edge, S_edge, E_edge, W_edge
136 #ifdef ALLOW_EXCH2
137 INTEGER myTile
138 #endif
139 LOGICAL dBugFlag
140 INTEGER idb,jdb,biDb
141 _RL tmpFac
142 _RL tmpVol
143 CEOP
144
145 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
146
147 #ifdef ALLOW_AUTODIFF_TAMC
148 act1 = bi - myBxLo(myThid)
149 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
150 act2 = bj - myByLo(myThid)
151 max2 = myByHi(myThid) - myByLo(myThid) + 1
152 act3 = myThid - 1
153 max3 = nTx*nTy
154 act4 = ikey_dynamics - 1
155 iicekey = (act1 + 1) + act2*max1
156 & + act3*max1*max2
157 & + act4*max1*max2*max3
158 #endif /* ALLOW_AUTODIFF_TAMC */
159
160 k = 1
161 dBugFlag = debugLevel.GE.debLevB
162 & .AND. myIter.EQ.nIter0
163 & .AND. ( tracerIdentity.EQ.GAD_SI_HICE .OR.
164 & tracerIdentity.EQ.GAD_SI_QICE2 )
165 c & .AND. tracerIdentity.EQ.GAD_SI_FRAC
166 idb = MIN(13,sNx)
167 jdb = MOD(17,sNy)
168 biDb = nSx/2
169
170 C-- Set up work arrays with valid (i.e. not NaN) values
171 C These inital values do not alter the numerical results. They
172 C just ensure that all memory references are to valid floating
173 C point numbers. This prevents spurious hardware signals due to
174 C uninitialised but inert locations.
175
176 C-- Set tile-specific parameters for horizontal fluxes
177 IF (useCubedSphereExchange) THEN
178 nipass=3
179 #ifdef ALLOW_EXCH2
180 myTile = W2_myTileList(bi,bj)
181 nCFace = exch2_myFace(myTile)
182 N_edge = exch2_isNedge(myTile).EQ.1
183 S_edge = exch2_isSedge(myTile).EQ.1
184 E_edge = exch2_isEedge(myTile).EQ.1
185 W_edge = exch2_isWedge(myTile).EQ.1
186 #else
187 nCFace = bi
188 N_edge = .TRUE.
189 S_edge = .TRUE.
190 E_edge = .TRUE.
191 W_edge = .TRUE.
192 #endif
193 ELSE
194 nipass=2
195 nCFace = bi
196 N_edge = .FALSE.
197 S_edge = .FALSE.
198 E_edge = .FALSE.
199 W_edge = .FALSE.
200 ENDIF
201
202 iMin = 1-OLx
203 iMax = sNx+OLx
204 jMin = 1-OLy
205 jMax = sNy+OLy
206
207 C-- Start horizontal fluxes
208
209 C-- set mask West & South
210 DO j=1-OLy,sNy+OLy
211 maskLocW(1-Olx,j) = 0.
212 DO i=2-OLx,sNx+OLx
213 maskLocW(i,j) = MIN( maskOc(i-1,j), maskOc(i,j) )
214 ENDDO
215 ENDDO
216 DO i=1-OLx,sNx+OLx
217 maskLocS(i,1-Oly) = 0.
218 ENDDO
219 DO j=2-OLy,sNy+OLy
220 DO i=1-OLx,sNx+OLx
221 maskLocS(i,j) = MIN( maskOc(i,j-1), maskOc(i,j) )
222 ENDDO
223 ENDDO
224
225 #ifndef ALLOW_AUTODIFF_TAMC
226 IF (useCubedSphereExchange) THEN
227 withSigns = .FALSE.
228 CALL FILL_CS_CORNER_UV_RS(
229 & withSigns, maskLocW,maskLocS, bi,bj, myThid )
230 ENDIF
231 #endif
232
233 C-- Multiple passes for different directions on different tiles
234 C-- For cube need one pass for each of red, green and blue axes.
235 DO ipass=1,nipass
236 #ifdef ALLOW_AUTODIFF_TAMC
237 ikey_4 = ipass
238 & + nipass*act1
239 & + nipass*max1*act2
240 & + nipass*max1*max2*act3
241 & + nipass*max1*max2*max3*act4
242 #endif
243
244 #ifdef ALLOW_AUTODIFF_TAMC
245 CADJ STORE iceFld(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
246 CADJ STORE iceVol(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
247 CADJ STORE af(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
248 #endif
249
250 interiorOnly = .FALSE.
251 overlapOnly = .FALSE.
252 IF (useCubedSphereExchange) THEN
253 C-- CubedSphere : pass 3 times, with partial update of local seaice field
254 IF (ipass.EQ.1) THEN
255 overlapOnly = MOD(nCFace,3).EQ.0
256 interiorOnly = MOD(nCFace,3).NE.0
257 calc_fluxes_X = nCFace.EQ.6 .OR. nCFace.EQ.1 .OR. nCFace.EQ.2
258 calc_fluxes_Y = nCFace.EQ.3 .OR. nCFace.EQ.4 .OR. nCFace.EQ.5
259 ELSEIF (ipass.EQ.2) THEN
260 overlapOnly = MOD(nCFace,3).EQ.2
261 interiorOnly = MOD(nCFace,3).EQ.1
262 calc_fluxes_X = nCFace.EQ.2 .OR. nCFace.EQ.3 .OR. nCFace.EQ.4
263 calc_fluxes_Y = nCFace.EQ.5 .OR. nCFace.EQ.6 .OR. nCFace.EQ.1
264 ELSE
265 interiorOnly = .TRUE.
266 calc_fluxes_X = nCFace.EQ.5 .OR. nCFace.EQ.6
267 calc_fluxes_Y = nCFace.EQ.2 .OR. nCFace.EQ.3
268 ENDIF
269 ELSE
270 C-- not CubedSphere
271 calc_fluxes_X = MOD(ipass,2).EQ.1
272 calc_fluxes_Y = .NOT.calc_fluxes_X
273 ENDIF
274 IF (dBugFlag.AND.bi.EQ.biDb ) WRITE(6,'(A,3I4,2I5,4L5)')
275 & 'ICE_adv:', tracerIdentity, ipass, bi, idb, jdb,
276 & calc_fluxes_X, calc_fluxes_Y, overlapOnly, interiorOnly
277
278 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
279 C-- X direction
280
281 IF (calc_fluxes_X) THEN
282
283 C- Do not compute fluxes if
284 C a) needed in overlap only
285 C and b) the overlap of myTile are not cube-face Edges
286 #ifdef ALLOW_AUTODIFF_TAMC
287 CADJ STORE iceFld(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
288 CADJ STORE iceVol(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
289 #endif
290 IF ( .NOT.overlapOnly .OR. N_edge .OR. S_edge ) THEN
291
292 C- Advective flux in X
293 DO j=1-Oly,sNy+Oly
294 DO i=1-Olx,sNx+Olx
295 af(i,j) = 0.
296 ENDDO
297 ENDDO
298
299 #ifndef ALLOW_AUTODIFF_TAMC
300 C- Internal exchange for calculations in X
301 IF ( overlapOnly ) THEN
302 CALL FILL_CS_CORNER_TR_RL( 1, .FALSE.,
303 & iceFld, bi,bj, myThid )
304 IF ( .NOT.useGridVolume )
305 & CALL FILL_CS_CORNER_TR_RL( 1, .FALSE.,
306 & iceVol, bi,bj, myThid )
307 ENDIF
308 #endif
309
310 C- Compute CFL number
311 IF ( useGridVolume ) THEN
312 DO j=1-Oly,sNy+Oly
313 DO i=2-Olx,sNx+Olx
314 uCfl(i,j) = deltaTadvect*(
315 & MAX( uTrans(i,j), 0. _d 0 )*recip_rA(i-1,j,bi,bj)
316 & +MAX(-uTrans(i,j), 0. _d 0 )*recip_rA( i ,j,bi,bj)
317 & )
318 ENDDO
319 ENDDO
320 ELSE
321 DO j=1-Oly,sNy+Oly
322 DO i=2-Olx,sNx+Olx
323 uCfl(i,j) = deltaTadvect*(
324 & MAX( uTrans(i,j), 0. _d 0 )/MAX( iceVol(i-1,j), iceEps )
325 & +MAX(-uTrans(i,j), 0. _d 0 )/MAX( iceVol( i ,j), iceEps )
326 & )
327 ENDDO
328 ENDDO
329 ENDIF
330
331 IF ( advectionScheme.EQ.ENUM_UPWIND_1RST
332 & .OR. advectionScheme.EQ.ENUM_DST2 ) THEN
333 CALL GAD_DST2U1_ADV_X( bi,bj,k, advectionScheme, .FALSE.,
334 I deltaTadvect, uTrans, uCfl, iceFld,
335 O af, myThid )
336 IF (dBugFlag.AND.bi.EQ.biDb ) WRITE(6,'(A,1P4E14.6)')
337 & 'ICE_adv: xFx=', af(idb,jdb), iceFld(idb,jdb),
338 & uTrans(idb,jdb), af(idb,jdb)/uTrans(idb,jdb)
339 ELSEIF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN
340 CALL GAD_FLUXLIMIT_ADV_X( bi,bj,k, .FALSE., deltaTadvect,
341 I uTrans, uCfl, maskLocW, iceFld,
342 O af, myThid )
343 ELSEIF (advectionScheme.EQ.ENUM_DST3 ) THEN
344 CALL GAD_DST3_ADV_X( bi,bj,k, .FALSE., deltaTadvect,
345 I uTrans, uCfl, maskLocW, iceFld,
346 O af, myThid )
347 ELSEIF (advectionScheme.EQ.ENUM_DST3_FLUX_LIMIT ) THEN
348 CALL GAD_DST3FL_ADV_X( bi,bj,k, .FALSE., deltaTadvect,
349 I uTrans, uCfl, maskLocW, iceFld,
350 O af, myThid )
351 ELSE
352 STOP
353 & 'THSICE_ADVECTION: adv. scheme incompatibale with multi-dim'
354 ENDIF
355
356 #ifndef ALLOW_AUTODIFF_TAMC
357 C-- Internal exchange for next calculations in Y
358 IF ( overlapOnly .AND. ipass.EQ.1 ) THEN
359 CALL FILL_CS_CORNER_TR_RL( 2, .FALSE.,
360 & iceFld, bi,bj, myThid )
361 IF ( .NOT.useGridVolume )
362 & CALL FILL_CS_CORNER_TR_RL( 2, .FALSE.,
363 & iceVol, bi,bj, myThid )
364 ENDIF
365 #endif
366
367 C-- Advective flux in X : done
368 ENDIF
369
370 C- Update the local seaice field where needed:
371
372 C update in overlap-Only
373 IF ( overlapOnly ) THEN
374 iMinUpd = 1-OLx+1
375 iMaxUpd = sNx+OLx-1
376 C-- notes: these 2 lines below have no real effect (because recip_hFac=0
377 C in corner region) but safer to keep them.
378 IF ( W_edge ) iMinUpd = 1
379 IF ( E_edge ) iMaxUpd = sNx
380
381 #ifdef ALLOW_AUTODIFF_TAMC
382 CADJ STORE iceFld(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
383 CADJ STORE iceVol(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
384 #endif
385 IF ( S_edge .AND. useGridVolume ) THEN
386 DO j=1-OLy,0
387 DO i=iMinUpd,iMaxUpd
388 iceFld(i,j) = iceFld(i,j)
389 & -deltaTadvect*maskOc(i,j)
390 & *recip_rA(i,j,bi,bj)
391 & *( af(i+1,j)-af(i,j) )
392 ENDDO
393 ENDDO
394 ELSEIF ( S_edge ) THEN
395 DO j=1-OLy,0
396 DO i=iMinUpd,iMaxUpd
397 tmpVol = iceVol(i,j)
398 iceVol(i,j) = iceVol(i,j)
399 & -deltaTadvect*maskOc(i,j)
400 & *( uTrans(i+1,j)-uTrans(i,j) )
401 IF ( iceVol(i,j).GT.iceEps )
402 & iceFld(i,j) = ( iceFld(i,j)*tmpVol
403 & -deltaTadvect*maskOc(i,j)
404 & *( af(i+1,j)-af(i,j) )
405 & )/iceVol(i,j)
406 ENDDO
407 ENDDO
408 ENDIF
409 IF ( N_edge .AND. useGridVolume ) THEN
410 DO j=sNy+1,sNy+OLy
411 DO i=iMinUpd,iMaxUpd
412 iceFld(i,j) = iceFld(i,j)
413 & -deltaTadvect*maskOc(i,j)
414 & *recip_rA(i,j,bi,bj)
415 & *( af(i+1,j)-af(i,j) )
416 ENDDO
417 ENDDO
418 ELSEIF ( N_edge ) THEN
419 DO j=sNy+1,sNy+OLy
420 DO i=iMinUpd,iMaxUpd
421 tmpVol = iceVol(i,j)
422 iceVol(i,j) = iceVol(i,j)
423 & -deltaTadvect*maskOc(i,j)
424 & *( uTrans(i+1,j)-uTrans(i,j) )
425 IF ( iceVol(i,j).GT.iceEps )
426 & iceFld(i,j) = ( iceFld(i,j)*tmpVol
427 & -deltaTadvect*maskOc(i,j)
428 & *( af(i+1,j)-af(i,j) )
429 & )/iceVol(i,j)
430 ENDDO
431 ENDDO
432 ENDIF
433 C-- keep advective flux (for diagnostics)
434 IF ( S_edge ) THEN
435 DO j=1-OLy,0
436 DO i=1-OLx+1,sNx+OLx
437 afx(i,j) = af(i,j)
438 ENDDO
439 ENDDO
440 ENDIF
441 IF ( N_edge ) THEN
442 DO j=sNy+1,sNy+OLy
443 DO i=1-OLx+1,sNx+OLx
444 afx(i,j) = af(i,j)
445 ENDDO
446 ENDDO
447 ENDIF
448
449 ELSE
450 C do not only update the overlap
451 jMinUpd = 1-OLy
452 jMaxUpd = sNy+OLy
453 IF ( interiorOnly .AND. S_edge ) jMinUpd = 1
454 IF ( interiorOnly .AND. N_edge ) jMaxUpd = sNy
455 IF ( useGridVolume ) THEN
456 DO j=jMinUpd,jMaxUpd
457 DO i=1-OLx+1,sNx+OLx-1
458 iceFld(i,j) = iceFld(i,j)
459 & -deltaTadvect*maskOc(i,j)
460 & *recip_rA(i,j,bi,bj)
461 & *( af(i+1,j)-af(i,j) )
462 ENDDO
463 ENDDO
464 ELSE
465 DO j=jMinUpd,jMaxUpd
466 DO i=1-OLx+1,sNx+OLx-1
467 tmpVol = iceVol(i,j)
468 iceVol(i,j) = iceVol(i,j)
469 & -deltaTadvect*maskOc(i,j)
470 & *( uTrans(i+1,j)-uTrans(i,j) )
471 IF ( iceVol(i,j).GT.iceEps )
472 & iceFld(i,j) = ( iceFld(i,j)*tmpVol
473 & -deltaTadvect*maskOc(i,j)
474 & *( af(i+1,j)-af(i,j) )
475 & )/iceVol(i,j)
476 ENDDO
477 ENDDO
478 ENDIF
479 C-- keep advective flux (for diagnostics)
480 DO j=jMinUpd,jMaxUpd
481 DO i=1-OLx+1,sNx+OLx
482 afx(i,j) = af(i,j)
483 ENDDO
484 ENDDO
485
486 C- end if/else update overlap-Only
487 ENDIF
488
489 C-- End of X direction
490 ENDIF
491
492 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
493 C-- Y direction
494
495 IF (calc_fluxes_Y) THEN
496
497 C- Do not compute fluxes if
498 C a) needed in overlap only
499 C and b) the overlap of myTile are not cube-face edges
500 #ifdef ALLOW_AUTODIFF_TAMC
501 CADJ STORE iceFld(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
502 CADJ STORE iceVol(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
503 #endif
504 IF ( .NOT.overlapOnly .OR. E_edge .OR. W_edge ) THEN
505
506 C- Advective flux in Y
507 DO j=1-OLy,sNy+OLy
508 DO i=1-OLx,sNx+OLx
509 af(i,j) = 0.
510 ENDDO
511 ENDDO
512
513 #ifndef ALLOW_AUTODIFF_TAMC
514 C- Internal exchange for calculations in Y
515 IF ( overlapOnly ) THEN
516 CALL FILL_CS_CORNER_TR_RL( 2, .FALSE.,
517 & iceFld, bi,bj, myThid )
518 IF ( .NOT.useGridVolume )
519 & CALL FILL_CS_CORNER_TR_RL( 2, .FALSE.,
520 & iceVol, bi,bj, myThid )
521 ENDIF
522 #endif
523
524 C- Compute CFL number
525 IF ( useGridVolume ) THEN
526 DO j=2-Oly,sNy+Oly
527 DO i=1-Olx,sNx+Olx
528 vCfl(i,j) = deltaTadvect*(
529 & MAX( vTrans(i,j), 0. _d 0 )*recip_rA(i,j-1,bi,bj)
530 & +MAX(-vTrans(i,j), 0. _d 0 )*recip_rA(i, j ,bi,bj)
531 & )
532 ENDDO
533 ENDDO
534 ELSE
535 DO j=2-Oly,sNy+Oly
536 DO i=1-Olx,sNx+Olx
537 vCfl(i,j) = deltaTadvect*(
538 & MAX( vTrans(i,j), 0. _d 0 )/MAX( iceVol(i,j-1), iceEps )
539 & +MAX(-vTrans(i,j), 0. _d 0 )/MAX( iceVol(i, j ), iceEps )
540 & )
541 ENDDO
542 ENDDO
543 ENDIF
544
545 IF ( advectionScheme.EQ.ENUM_UPWIND_1RST
546 & .OR. advectionScheme.EQ.ENUM_DST2 ) THEN
547 CALL GAD_DST2U1_ADV_Y( bi,bj,k, advectionScheme, .FALSE.,
548 I deltaTadvect, vTrans, vCfl, iceFld,
549 O af, myThid )
550 IF (dBugFlag.AND.bi.EQ.biDb ) WRITE(6,'(A,1P4E14.6)')
551 & 'ICE_adv: yFx=', af(idb,jdb), iceFld(idb,jdb),
552 & vTrans(idb,jdb), af(idb,jdb)/vTrans(idb,jdb)
553 ELSEIF (advectionScheme.EQ.ENUM_FLUX_LIMIT) THEN
554 CALL GAD_FLUXLIMIT_ADV_Y( bi,bj,k, .FALSE., deltaTadvect,
555 I vTrans, vCfl, maskLocS, iceFld,
556 O af, myThid )
557 ELSEIF (advectionScheme.EQ.ENUM_DST3 ) THEN
558 CALL GAD_DST3_ADV_Y( bi,bj,k, .FALSE., deltaTadvect,
559 I vTrans, vCfl, maskLocS, iceFld,
560 O af, myThid )
561 ELSEIF (advectionScheme.EQ.ENUM_DST3_FLUX_LIMIT ) THEN
562 CALL GAD_DST3FL_ADV_Y( bi,bj,k, .FALSE., deltaTadvect,
563 I vTrans, vCfl, maskLocS, iceFld,
564 O af, myThid )
565 ELSE
566 STOP
567 & 'THSICE_ADVECTION: adv. scheme incompatibale with mutli-dim'
568 ENDIF
569
570 #ifndef ALLOW_AUTODIFF_TAMC
571 IF ( overlapOnly .AND. ipass.EQ.1 ) THEN
572 CALL FILL_CS_CORNER_TR_RL( 1, .FALSE.,
573 & iceFld, bi,bj, myThid )
574 IF ( .NOT.useGridVolume )
575 & CALL FILL_CS_CORNER_TR_RL( 1, .FALSE.,
576 & iceVol, bi,bj, myThid )
577 ENDIF
578 #endif
579
580 C- Advective flux in Y : done
581 ENDIF
582
583 C- Update the local seaice field where needed:
584
585 C update in overlap-Only
586 IF ( overlapOnly ) THEN
587 jMinUpd = 1-OLy+1
588 jMaxUpd = sNy+OLy-1
589 C- notes: these 2 lines below have no real effect (because recip_hFac=0
590 C in corner region) but safer to keep them.
591 IF ( S_edge ) jMinUpd = 1
592 IF ( N_edge ) jMaxUpd = sNy
593
594 #ifdef ALLOW_AUTODIFF_TAMC
595 CADJ STORE iceFld(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
596 CADJ STORE iceVol(:,:) = comlev1_thsice_4, key=ikey_4, byte=isbyte
597 #endif
598 IF ( W_edge .AND. useGridVolume ) THEN
599 DO j=jMinUpd,jMaxUpd
600 DO i=1-OLx,0
601 iceFld(i,j) = iceFld(i,j)
602 & -deltaTadvect*maskOc(i,j)
603 & *recip_rA(i,j,bi,bj)
604 & *( af(i,j+1)-af(i,j) )
605 ENDDO
606 ENDDO
607 ELSEIF ( W_edge ) THEN
608 DO j=jMinUpd,jMaxUpd
609 DO i=1-OLx,0
610 tmpVol = iceVol(i,j)
611 iceVol(i,j) = iceVol(i,j)
612 & -deltaTadvect*maskOc(i,j)
613 & *( vTrans(i,j+1)-vTrans(i,j) )
614 IF ( iceVol(i,j).GT.iceEps )
615 & iceFld(i,j) = ( iceFld(i,j)*tmpVol
616 & -deltaTadvect*maskOc(i,j)
617 & *( af(i,j+1)-af(i,j) )
618 & )/iceVol(i,j)
619 ENDDO
620 ENDDO
621 ENDIF
622 IF ( E_edge .AND. useGridVolume ) THEN
623 DO j=jMinUpd,jMaxUpd
624 DO i=sNx+1,sNx+OLx
625 iceFld(i,j) = iceFld(i,j)
626 & -deltaTadvect*maskOc(i,j)
627 & *recip_rA(i,j,bi,bj)
628 & *( af(i,j+1)-af(i,j) )
629 ENDDO
630 ENDDO
631 ELSEIF ( E_edge ) THEN
632 DO j=jMinUpd,jMaxUpd
633 DO i=sNx+1,sNx+OLx
634 tmpVol = iceVol(i,j)
635 iceVol(i,j) = iceVol(i,j)
636 & -deltaTadvect*maskOc(i,j)
637 & *( vTrans(i,j+1)-vTrans(i,j) )
638 IF ( iceVol(i,j).GT.iceEps )
639 & iceFld(i,j) = ( iceFld(i,j)*tmpVol
640 & -deltaTadvect*maskOc(i,j)
641 & *( af(i,j+1)-af(i,j) )
642 & )/iceVol(i,j)
643 ENDDO
644 ENDDO
645 ENDIF
646 C-- keep advective flux (for diagnostics)
647 IF ( W_edge ) THEN
648 DO j=1-OLy+1,sNy+OLy
649 DO i=1-OLx,0
650 afy(i,j) = af(i,j)
651 ENDDO
652 ENDDO
653 ENDIF
654 IF ( E_edge ) THEN
655 DO j=1-OLy+1,sNy+OLy
656 DO i=sNx+1,sNx+OLx
657 afy(i,j) = af(i,j)
658 ENDDO
659 ENDDO
660 ENDIF
661
662 ELSE
663 C do not only update the overlap
664 iMinUpd = 1-OLx
665 iMaxUpd = sNx+OLx
666 IF ( interiorOnly .AND. W_edge ) iMinUpd = 1
667 IF ( interiorOnly .AND. E_edge ) iMaxUpd = sNx
668 IF ( useGridVolume ) THEN
669 DO j=1-OLy+1,sNy+OLy-1
670 DO i=iMinUpd,iMaxUpd
671 iceFld(i,j) = iceFld(i,j)
672 & -deltaTadvect*maskOc(i,j)
673 & *recip_rA(i,j,bi,bj)
674 & *( af(i,j+1)-af(i,j) )
675 ENDDO
676 ENDDO
677 ELSE
678 DO j=1-OLy+1,sNy+OLy-1
679 DO i=iMinUpd,iMaxUpd
680 tmpVol = iceVol(i,j)
681 iceVol(i,j) = iceVol(i,j)
682 & -deltaTadvect*maskOc(i,j)
683 & *( vTrans(i,j+1)-vTrans(i,j) )
684 IF ( iceVol(i,j).GT.iceEps )
685 & iceFld(i,j) = ( iceFld(i,j)*tmpVol
686 & -deltaTadvect*maskOc(i,j)
687 & *( af(i,j+1)-af(i,j) )
688 & )/iceVol(i,j)
689 ENDDO
690 ENDDO
691 ENDIF
692 C-- keep advective flux (for diagnostics)
693 DO j=1-OLy+1,sNy+OLy
694 DO i=iMinUpd,iMaxUpd
695 afy(i,j) = af(i,j)
696 ENDDO
697 ENDDO
698
699 C end if/else update overlap-Only
700 ENDIF
701
702 C-- End of Y direction
703 ENDIF
704
705 C-- End of ipass loop
706 ENDDO
707
708 C- explicit advection is done ; add some debugging print
709 IF ( dBugFlag ) THEN
710 DO j=1-OLy,sNy+OLy
711 DO i=1-OLx,sNx+OLx
712 IF ( i.EQ.idb .AND. j.EQ.jdb .AND. bi.EQ.biDb ) THEN
713 tmpFac= deltaTadvect*recip_rA(i,j,bi,bj)
714 WRITE(6,'(A,1P4E14.6)') 'ICE_adv:',
715 & afx(i,j)*tmpFac,afx(i+1,j)*tmpFac,
716 & afy(i,j)*tmpFac,afy(i,j+1)*tmpFac
717 ENDIF
718 ENDDO
719 ENDDO
720 ENDIF
721
722 #ifdef ALLOW_DEBUG
723 IF ( debugLevel .GE. debLevB
724 & .AND. tracerIdentity.EQ.GAD_SI_HICE
725 & .AND. k.LE.3 .AND. myIter.EQ.1+nIter0
726 & .AND. nPx.EQ.1 .AND. nPy.EQ.1
727 & .AND. useCubedSphereExchange ) THEN
728 CALL DEBUG_CS_CORNER_UV( ' afx,afy from THSICE_ADVECTION',
729 & afx,afy, k, standardMessageUnit,bi,bj,myThid )
730 ENDIF
731 #endif /* ALLOW_DEBUG */
732
733 #endif /* ALLOW_GENERIC_ADVDIFF */
734
735 RETURN
736 END

  ViewVC Help
Powered by ViewVC 1.1.22