1 |
dimitri |
1.1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_advdiff.F,v 1.60 2012/02/16 01:22:02 gforget Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "SEAICE_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: SEAICE_ADVDIFF |
8 |
|
|
|
9 |
|
|
C !INTERFACE: ========================================================== |
10 |
|
|
SUBROUTINE SEAICE_ADVDIFF( |
11 |
|
|
I myTime, myIter, myThid ) |
12 |
|
|
|
13 |
|
|
C !DESCRIPTION: \bv |
14 |
|
|
C *===========================================================* |
15 |
|
|
C | SUBROUTINE SEAICE_ADVDIFF |
16 |
|
|
C | o driver for different advection routines |
17 |
|
|
C | calls an adaption of gad_advection to call different |
18 |
|
|
C | advection routines of pkg/generic_advdiff |
19 |
|
|
C *===========================================================* |
20 |
|
|
C \ev |
21 |
|
|
|
22 |
|
|
C !USES: =============================================================== |
23 |
|
|
IMPLICIT NONE |
24 |
|
|
|
25 |
|
|
C === Global variables === |
26 |
|
|
C UICE/VICE :: ice velocity |
27 |
|
|
C HEFF :: scalar field to be advected |
28 |
|
|
C HEFFM :: mask for scalar field |
29 |
|
|
#include "SIZE.h" |
30 |
|
|
#include "EEPARAMS.h" |
31 |
|
|
#include "PARAMS.h" |
32 |
|
|
#include "GRID.h" |
33 |
|
|
#include "GAD.h" |
34 |
|
|
#include "SEAICE_SIZE.h" |
35 |
|
|
#include "SEAICE_PARAMS.h" |
36 |
|
|
#include "SEAICE.h" |
37 |
|
|
#include "SEAICE_TRACER.h" |
38 |
|
|
|
39 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
40 |
|
|
# include "tamc.h" |
41 |
|
|
#endif |
42 |
|
|
|
43 |
|
|
C !INPUT PARAMETERS: =================================================== |
44 |
|
|
C === Routine arguments === |
45 |
|
|
C myTime :: current time |
46 |
|
|
C myIter :: iteration number |
47 |
|
|
C myThid :: Thread no. that called this routine. |
48 |
|
|
_RL myTime |
49 |
|
|
INTEGER myIter |
50 |
|
|
INTEGER myThid |
51 |
|
|
CEndOfInterface |
52 |
|
|
|
53 |
|
|
C !LOCAL VARIABLES: ==================================================== |
54 |
|
|
C === Local variables === |
55 |
|
|
C i,j,bi,bj :: Loop counters |
56 |
|
|
C ks :: surface level index |
57 |
|
|
C uc/vc :: current ice velocity on C-grid |
58 |
|
|
C uTrans :: volume transport, x direction |
59 |
|
|
C vTrans :: volume transport, y direction |
60 |
|
|
C afx :: horizontal advective flux, x direction |
61 |
|
|
C afy :: horizontal advective flux, y direction |
62 |
|
|
C gFld :: tendency of seaice field |
63 |
|
|
C xA,yA :: "areas" of X and Y face of tracer cells |
64 |
|
|
INTEGER i, j, bi, bj |
65 |
|
|
INTEGER ks |
66 |
|
|
LOGICAL SEAICEmultiDimAdvection |
67 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
68 |
|
|
INTEGER itmpkey |
69 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
70 |
|
|
#ifdef ALLOW_SITRACER |
71 |
|
|
# ifndef SEAICE_GROWTH_LEGACY |
72 |
|
|
_RL hEffNm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
73 |
|
|
_RL areaNm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
74 |
|
|
# endif /* ndef SEAICE_GROWTH_LEGACY */ |
75 |
|
|
INTEGER iTr, SEAICEadvSchSItr |
76 |
|
|
_RL SEAICEdiffKhSItr |
77 |
|
|
_RL SItrExt (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
78 |
|
|
_RL tmpscal1, tmpscal2 |
79 |
|
|
# ifdef ALLOW_SITRACER_ADVCAP |
80 |
|
|
_RL SItrPrev (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
81 |
|
|
# endif |
82 |
|
|
# ifdef ALLOW_SITRACER_DEBUG_DIAG |
83 |
|
|
_RL DIAGarray (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
84 |
|
|
# endif |
85 |
|
|
#endif /* ALLOW_SITRACER */ |
86 |
|
|
|
87 |
|
|
_RL uc (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
88 |
|
|
_RL vc (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
89 |
|
|
_RL fldNm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
90 |
|
|
_RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
91 |
|
|
_RL vTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
92 |
|
|
_RL afx (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
93 |
|
|
_RL afy (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
94 |
|
|
_RL gFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
95 |
|
|
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
96 |
|
|
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
97 |
|
|
_RL recip_heff(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
98 |
|
|
CEOP |
99 |
|
|
|
100 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
101 |
|
|
|
102 |
|
|
ks = 1 |
103 |
|
|
|
104 |
|
|
C-- make a local copy of the velocities for compatibility with B-grid |
105 |
|
|
C-- alternatively interpolate to C-points if necessary |
106 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
107 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
108 |
|
|
#ifdef SEAICE_CGRID |
109 |
|
|
DO j=1-OLy,sNy+OLy |
110 |
|
|
DO i=1-OLx,sNx+OLx |
111 |
|
|
uc(i,j,bi,bj)=UICE(i,j,bi,bj) |
112 |
|
|
vc(i,j,bi,bj)=VICE(i,j,bi,bj) |
113 |
|
|
ENDDO |
114 |
|
|
ENDDO |
115 |
|
|
#else /* not SEAICE_CGRID = BGRID */ |
116 |
|
|
C average seaice velocity to C-grid |
117 |
|
|
DO j=1-OLy,sNy+OLy-1 |
118 |
|
|
DO i=1-OLx,sNx+OLx-1 |
119 |
|
|
uc(i,j,bi,bj)=.5 _d 0*(UICE(i,j,bi,bj)+UICE(i,j+1,bi,bj)) |
120 |
|
|
vc(i,j,bi,bj)=.5 _d 0*(VICE(i,j,bi,bj)+VICE(i+1,j,bi,bj)) |
121 |
|
|
ENDDO |
122 |
|
|
ENDDO |
123 |
|
|
#endif /* SEAICE_CGRID */ |
124 |
|
|
C- compute cell areas used by all tracers |
125 |
|
|
DO j=1-OLy,sNy+OLy |
126 |
|
|
DO i=1-OLx,sNx+OLx |
127 |
|
|
xA(i,j,bi,bj) = _dyG(i,j,bi,bj)*_maskW(i,j,ks,bi,bj) |
128 |
|
|
yA(i,j,bi,bj) = _dxG(i,j,bi,bj)*_maskS(i,j,ks,bi,bj) |
129 |
|
|
ENDDO |
130 |
|
|
ENDDO |
131 |
|
|
ENDDO |
132 |
|
|
ENDDO |
133 |
|
|
|
134 |
|
|
#ifndef SEAICE_CGRID |
135 |
|
|
C Do we need this? I am afraid so. |
136 |
|
|
CALL EXCH_UV_XY_RL(uc,vc,.TRUE.,myThid) |
137 |
|
|
#endif /* not SEAICE_CGRID */ |
138 |
|
|
|
139 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
140 |
|
|
CADJ STORE uc = comlev1, key = ikey_dynamics, kind=isbyte |
141 |
|
|
CADJ STORE vc = comlev1, key = ikey_dynamics, kind=isbyte |
142 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
143 |
|
|
|
144 |
|
|
SEAICEmultidimadvection = .TRUE. |
145 |
|
|
IF ( SEAICEadvScheme.EQ.ENUM_CENTERED_2ND |
146 |
|
|
& .OR.SEAICEadvScheme.EQ.ENUM_UPWIND_3RD |
147 |
|
|
& .OR.SEAICEadvScheme.EQ.ENUM_CENTERED_4TH ) THEN |
148 |
|
|
SEAICEmultiDimAdvection = .FALSE. |
149 |
|
|
ENDIF |
150 |
|
|
|
151 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
152 |
|
|
CADJ STORE heffm = comlev1, key = ikey_dynamics, kind=isbyte |
153 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
154 |
|
|
IF ( SEAICEmultiDimAdvection ) THEN |
155 |
|
|
|
156 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
157 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
158 |
|
|
C--- loops on tile indices bi,bj |
159 |
|
|
|
160 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
161 |
|
|
C Initialise for TAF |
162 |
|
|
DO j=1-OLy,sNy+OLy |
163 |
|
|
DO i=1-OLx,sNx+OLx |
164 |
|
|
gFld(i,j) = 0. _d 0 |
165 |
|
|
ENDDO |
166 |
|
|
ENDDO |
167 |
|
|
C |
168 |
|
|
act1 = bi - myBxLo(myThid) |
169 |
|
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
170 |
|
|
act2 = bj - myByLo(myThid) |
171 |
|
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
172 |
|
|
act3 = myThid - 1 |
173 |
|
|
max3 = nTx*nTy |
174 |
|
|
act4 = ikey_dynamics - 1 |
175 |
|
|
itmpkey = (act1 + 1) + act2*max1 |
176 |
|
|
& + act3*max1*max2 |
177 |
|
|
& + act4*max1*max2*max3 |
178 |
|
|
C |
179 |
|
|
CADJ STORE area(:,:,bi,bj) = comlev1_bibj, |
180 |
|
|
CADJ & key = itmpkey, kind=isbyte |
181 |
|
|
CADJ STORE heff(:,:,bi,bj) = comlev1_bibj, |
182 |
|
|
CADJ & key = itmpkey, kind=isbyte |
183 |
|
|
CADJ STORE heffm(:,:,bi,bj) = comlev1_bibj, |
184 |
|
|
CADJ & key = itmpkey, kind=isbyte |
185 |
|
|
CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj, |
186 |
|
|
CADJ & key = itmpkey, kind=isbyte |
187 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
188 |
|
|
|
189 |
|
|
DO j=1-OLy,sNy+OLy |
190 |
|
|
DO i=1-OLx,sNx+OLx |
191 |
|
|
#if ( defined (SEAICE_GROWTH_LEGACY) || defined (ALLOW_SITRACER) ) |
192 |
|
|
hEffNm1(i,j,bi,bj) = HEFF(i,j,bi,bj) |
193 |
|
|
areaNm1(i,j,bi,bj) = AREA(i,j,bi,bj) |
194 |
|
|
#endif |
195 |
|
|
recip_heff(i,j) = 1. _d 0 |
196 |
|
|
ENDDO |
197 |
|
|
ENDDO |
198 |
|
|
|
199 |
|
|
C- Calculate "volume transports" through tracer cell faces. |
200 |
|
|
DO j=1-OLy,sNy+OLy |
201 |
|
|
DO i=1-OLx,sNx+OLx |
202 |
|
|
uTrans(i,j) = uc(i,j,bi,bj)*xA(i,j,bi,bj) |
203 |
|
|
vTrans(i,j) = vc(i,j,bi,bj)*yA(i,j,bi,bj) |
204 |
|
|
ENDDO |
205 |
|
|
ENDDO |
206 |
|
|
|
207 |
|
|
C-- Effective Thickness (Volume) |
208 |
|
|
IF ( SEAICEadvHeff ) THEN |
209 |
|
|
CALL SEAICE_ADVECTION( |
210 |
|
|
I GAD_HEFF, SEAICEadvSchHeff, |
211 |
|
|
I uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj), |
212 |
|
|
I uTrans, vTrans, HEFF(1-OLx,1-OLy,bi,bj), recip_heff, |
213 |
|
|
O gFld, afx, afy, |
214 |
|
|
I bi, bj, myTime, myIter, myThid ) |
215 |
|
|
IF ( SEAICEdiffKhHeff .GT. 0. _d 0 ) THEN |
216 |
|
|
C- Add tendency due to diffusion |
217 |
|
|
CALL SEAICE_DIFFUSION( |
218 |
|
|
I GAD_HEFF, SEAICEdiffKhHeff, ONE, |
219 |
|
|
I HEFF(1-OLx,1-OLy,bi,bj), HEFFM, |
220 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
221 |
|
|
U gFld, |
222 |
|
|
I bi, bj, myTime, myIter, myThid ) |
223 |
|
|
ENDIF |
224 |
|
|
C now do the "explicit" time step |
225 |
|
|
DO j=1,sNy |
226 |
|
|
DO i=1,sNx |
227 |
|
|
HEFF(i,j,bi,bj) = HEFFM(i,j,bi,bj) * ( |
228 |
|
|
& HEFF(i,j,bi,bj) + SEAICE_deltaTtherm * gFld(i,j) |
229 |
|
|
& ) |
230 |
|
|
ENDDO |
231 |
|
|
ENDDO |
232 |
|
|
ENDIF |
233 |
|
|
|
234 |
|
|
C-- Fractional area |
235 |
|
|
IF ( SEAICEadvArea ) THEN |
236 |
|
|
CALL SEAICE_ADVECTION( |
237 |
|
|
I GAD_AREA, SEAICEadvSchArea, |
238 |
|
|
I uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj), |
239 |
|
|
I uTrans, vTrans, AREA(1-OLx,1-OLy,bi,bj), recip_heff, |
240 |
|
|
O gFld, afx, afy, |
241 |
|
|
I bi, bj, myTime, myIter, myThid ) |
242 |
|
|
IF ( SEAICEdiffKhArea .GT. 0. _d 0 ) THEN |
243 |
|
|
C- Add tendency due to diffusion |
244 |
|
|
CALL SEAICE_DIFFUSION( |
245 |
|
|
I GAD_AREA, SEAICEdiffKhArea, ONE, |
246 |
|
|
I AREA(1-OLx,1-OLy,bi,bj), HEFFM, |
247 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
248 |
|
|
U gFld, |
249 |
|
|
I bi, bj, myTime, myIter, myThid ) |
250 |
|
|
ENDIF |
251 |
|
|
C now do the "explicit" time step |
252 |
|
|
DO j=1,sNy |
253 |
|
|
DO i=1,sNx |
254 |
|
|
AREA(i,j,bi,bj) = HEFFM(i,j,bi,bj) * ( |
255 |
|
|
& AREA(i,j,bi,bj) + SEAICE_deltaTtherm * gFld(i,j) |
256 |
|
|
& ) |
257 |
|
|
ENDDO |
258 |
|
|
ENDDO |
259 |
|
|
ENDIF |
260 |
|
|
|
261 |
|
|
C-- Effective Snow Thickness (Volume) |
262 |
|
|
IF ( SEAICEadvSnow ) THEN |
263 |
|
|
CALL SEAICE_ADVECTION( |
264 |
|
|
I GAD_SNOW, SEAICEadvSchSnow, |
265 |
|
|
I uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj), |
266 |
|
|
I uTrans, vTrans, HSNOW(1-OLx,1-OLy,bi,bj), recip_heff, |
267 |
|
|
O gFld, afx, afy, |
268 |
|
|
I bi, bj, myTime, myIter, myThid ) |
269 |
|
|
IF ( SEAICEdiffKhSnow .GT. 0. _d 0 ) THEN |
270 |
|
|
C-- Add tendency due to diffusion |
271 |
|
|
CALL SEAICE_DIFFUSION( |
272 |
|
|
I GAD_SNOW, SEAICEdiffKhSnow, ONE, |
273 |
|
|
I HSNOW(1-OLx,1-OLy,bi,bj), HEFFM, |
274 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
275 |
|
|
U gFld, |
276 |
|
|
I bi, bj, myTime, myIter, myThid ) |
277 |
|
|
ENDIF |
278 |
|
|
C now do the "explicit" time step |
279 |
|
|
DO j=1,sNy |
280 |
|
|
DO i=1,sNx |
281 |
|
|
HSNOW(i,j,bi,bj) = HEFFM(i,j,bi,bj) * ( |
282 |
|
|
& HSNOW(i,j,bi,bj) + SEAICE_deltaTtherm * gFld(i,j) |
283 |
|
|
& ) |
284 |
|
|
ENDDO |
285 |
|
|
ENDDO |
286 |
|
|
ENDIF |
287 |
|
|
|
288 |
|
|
#ifdef SEAICE_VARIABLE_SALINITY |
289 |
|
|
C-- Effective Sea Ice Salinity (Mass of salt) |
290 |
|
|
IF ( SEAICEadvSalt ) THEN |
291 |
|
|
CALL SEAICE_ADVECTION( |
292 |
|
|
I GAD_SALT, SEAICEadvSchSalt, |
293 |
|
|
I uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj), |
294 |
|
|
I uTrans, vTrans, HSALT(1-OLx,1-OLy,bi,bj), recip_heff, |
295 |
|
|
O gFld, afx, afy, |
296 |
|
|
I bi, bj, myTime, myIter, myThid ) |
297 |
|
|
IF ( SEAICEdiffKhSalt .GT. 0. _d 0 ) THEN |
298 |
|
|
C-- Add tendency due to diffusion |
299 |
|
|
CALL SEAICE_DIFFUSION( |
300 |
|
|
I GAD_SALT, SEAICEdiffKhSalt, ONE, |
301 |
|
|
I HSALT(1-OLx,1-OLy,bi,bj), HEFFM, |
302 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
303 |
|
|
U gFld, |
304 |
|
|
I bi, bj, myTime, myIter, myThid ) |
305 |
|
|
ENDIF |
306 |
|
|
C now do the "explicit" time step |
307 |
|
|
DO j=1,sNy |
308 |
|
|
DO i=1,sNx |
309 |
|
|
HSALT(i,j,bi,bj) = HEFFM(i,j,bi,bj) * ( |
310 |
|
|
& HSALT(i,j,bi,bj) + SEAICE_deltaTtherm * gFld(i,j) |
311 |
|
|
& ) |
312 |
|
|
ENDDO |
313 |
|
|
ENDDO |
314 |
|
|
ENDIF |
315 |
|
|
#endif /* SEAICE_VARIABLE_SALINITY */ |
316 |
|
|
|
317 |
|
|
#ifdef ALLOW_SITRACER |
318 |
|
|
C-- Sea Ice Tracers |
319 |
|
|
DO iTr = 1, SItrNumInUse |
320 |
|
|
IF ( (SEAICEadvHEFF.AND.(SItrMate(iTr).EQ.'HEFF')).OR. |
321 |
|
|
& (SEAICEadvAREA.AND.(SItrMate(iTr).EQ.'AREA')) ) THEN |
322 |
|
|
C-- scale to effective value |
323 |
|
|
IF (SItrMate(iTr).EQ.'HEFF') THEN |
324 |
|
|
SEAICEadvSchSItr=SEAICEadvSchHEFF |
325 |
|
|
SEAICEdiffKhSItr=SEAICEdiffKhHEFF |
326 |
|
|
DO j=1-OLy,sNy+OLy |
327 |
|
|
DO i=1-OLx,sNx+OLx |
328 |
|
|
SItrExt(i,j,bi,bj) = HEFFM(i,j,bi,bj) * |
329 |
|
|
& SItracer(i,j,bi,bj,iTr) * hEffNm1(i,j,bi,bj) |
330 |
|
|
ENDDO |
331 |
|
|
ENDDO |
332 |
|
|
c TAF? ELSEIF (SItrMate(iTr).EQ.'AREA') THEN |
333 |
|
|
ELSE |
334 |
|
|
SEAICEadvSchSItr=SEAICEadvSchAREA |
335 |
|
|
SEAICEdiffKhSItr=SEAICEdiffKhAREA |
336 |
|
|
DO j=1-OLy,sNy+OLy |
337 |
|
|
DO i=1-OLx,sNx+OLx |
338 |
|
|
SItrExt(i,j,bi,bj) = HEFFM(i,j,bi,bj) * |
339 |
|
|
& SItracer(i,j,bi,bj,iTr) * areaNm1(i,j,bi,bj) |
340 |
|
|
ENDDO |
341 |
|
|
ENDDO |
342 |
|
|
ENDIF |
343 |
|
|
C-- store a couple things |
344 |
|
|
DO j=1-OLy,sNy+OLy |
345 |
|
|
DO i=1-OLx,sNx+OLx |
346 |
|
|
#ifdef ALLOW_SITRACER_ADVCAP |
347 |
|
|
C-- store previous value for spurious maxima treament |
348 |
|
|
SItrPrev(i,j,bi,bj)=SItracer(i,j,bi,bj,iTr) |
349 |
|
|
#endif |
350 |
|
|
#ifdef ALLOW_SITRACER_DEBUG_DIAG |
351 |
|
|
diagArray(I,J,2+(iTr-1)*5) = SItrExt(i,j,bi,bj) |
352 |
|
|
#endif |
353 |
|
|
ENDDO |
354 |
|
|
ENDDO |
355 |
|
|
C-- compute advective tendency |
356 |
|
|
CALL SEAICE_ADVECTION( |
357 |
|
|
I GAD_SITR+iTr-1, SEAICEadvSchSItr, |
358 |
|
|
I uc(1-OLx,1-OLy,bi,bj), vc(1-OLx,1-OLy,bi,bj), |
359 |
|
|
I uTrans, vTrans, SItrExt(1-OLx,1-OLy,bi,bj), |
360 |
|
|
I recip_heff, |
361 |
|
|
O gFld, afx, afy, |
362 |
|
|
I bi, bj, myTime, myIter, myThid ) |
363 |
|
|
IF ( SEAICEdiffKhHeff .GT. 0. _d 0 ) THEN |
364 |
|
|
C-- add diffusive tendency |
365 |
|
|
CALL SEAICE_DIFFUSION( |
366 |
|
|
I GAD_SITR+iTr-1, SEAICEdiffKhSItr, ONE, |
367 |
|
|
I SItrExt(1-OLx,1-OLy,bi,bj), HEFFM, |
368 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
369 |
|
|
U gFld, |
370 |
|
|
I bi, bj, myTime, myIter, myThid ) |
371 |
|
|
ENDIF |
372 |
|
|
C-- apply tendency |
373 |
|
|
DO j=1,sNy |
374 |
|
|
DO i=1,sNx |
375 |
|
|
SItrExt(i,j,bi,bj) = HEFFM(i,j,bi,bj) * ( |
376 |
|
|
& SItrExt(i,j,bi,bj) + SEAICE_deltaTtherm * gFld(i,j) ) |
377 |
|
|
ENDDO |
378 |
|
|
ENDDO |
379 |
|
|
C-- scale back to actual value, or move effective value to ocean bucket |
380 |
|
|
IF (SItrMate(iTr).EQ.'HEFF') THEN |
381 |
|
|
DO j=1,sNy |
382 |
|
|
DO i=1,sNx |
383 |
|
|
if (HEFF(I,J,bi,bj).GE.siEps) then |
384 |
|
|
SItracer(i,j,bi,bj,iTr)=SItrExt(i,j,bi,bj)/HEFF(I,J,bi,bj) |
385 |
|
|
SItrBucket(i,j,bi,bj,iTr)=0. _d 0 |
386 |
|
|
else |
387 |
|
|
SItracer(i,j,bi,bj,iTr)=0. _d 0 |
388 |
|
|
SItrBucket(i,j,bi,bj,iTr)=SItrExt(i,j,bi,bj) |
389 |
|
|
endif |
390 |
|
|
#ifdef ALLOW_SITRACER_ADVCAP |
391 |
|
|
C hack to try avoid 'spontaneous generation' of maxima, which supposedly would |
392 |
|
|
C occur less frequently if we advected SItr with uXheff instead SItrXheff with u |
393 |
|
|
tmpscal1=max(SItrPrev(i,j,bi,bj), |
394 |
|
|
& SItrPrev(i+1,j,bi,bj),SItrPrev(i-1,j,bi,bj), |
395 |
|
|
& SItrPrev(i,j+1,bi,bj),SItrPrev(i,j-1,bi,bj)) |
396 |
|
|
tmpscal2=MAX(ZERO,SItracer(i,j,bi,bj,iTr)-tmpscal1) |
397 |
|
|
SItracer(i,j,bi,bj,iTr)=SItracer(i,j,bi,bj,iTr)-tmpscal2 |
398 |
|
|
SItrBucket(i,j,bi,bj,iTr)=SItrBucket(i,j,bi,bj,iTr) |
399 |
|
|
& +tmpscal2*HEFF(I,J,bi,bj) |
400 |
|
|
#endif |
401 |
|
|
C treat case of potential negative value |
402 |
|
|
if (HEFF(I,J,bi,bj).GE.siEps) then |
403 |
|
|
tmpscal1=MIN(0. _d 0,SItracer(i,j,bi,bj,iTr)) |
404 |
|
|
SItracer(i,j,bi,bj,iTr)=SItracer(i,j,bi,bj,iTr)-tmpscal1 |
405 |
|
|
SItrBucket(i,j,bi,bj,iTr)=SItrBucket(i,j,bi,bj,iTr) |
406 |
|
|
& +HEFF(I,J,bi,bj)*tmpscal1 |
407 |
|
|
endif |
408 |
|
|
#ifdef ALLOW_SITRACER_DEBUG_DIAG |
409 |
|
|
diagArray(I,J,1+(iTr-1)*5)= - SItrBucket(i,j,bi,bj,iTr) |
410 |
|
|
& *HEFFM(I,J,bi,bj)/SEAICE_deltaTtherm*SEAICE_rhoIce |
411 |
|
|
tmpscal1= ( HEFF(I,J,bi,bj)*SItracer(i,j,bi,bj,iTr) |
412 |
|
|
& + SItrBucket(i,j,bi,bj,iTr) )*HEFFM(I,J,bi,bj) |
413 |
|
|
diagArray(I,J,2+(iTr-1)*5)= tmpscal1-diagArray(I,J,2+(iTr-1)*5) |
414 |
|
|
diagArray(I,J,3+(iTr-1)*5)=HEFFM(i,j,bi,bj) * |
415 |
|
|
& SEAICE_deltaTtherm * gFld(i,j) |
416 |
|
|
#endif |
417 |
|
|
ENDDO |
418 |
|
|
ENDDO |
419 |
|
|
c TAF? ELSEIF (SItrMate(iTr).EQ.'AREA') THEN |
420 |
|
|
ELSE |
421 |
|
|
DO j=1,sNy |
422 |
|
|
DO i=1,sNx |
423 |
|
|
if (AREA(I,J,bi,bj).GE.SEAICE_area_floor) then |
424 |
|
|
SItracer(i,j,bi,bj,iTr)=SItrExt(i,j,bi,bj)/AREA(I,J,bi,bj) |
425 |
|
|
else |
426 |
|
|
SItracer(i,j,bi,bj,iTr)=0. _d 0 |
427 |
|
|
endif |
428 |
|
|
SItrBucket(i,j,bi,bj,iTr)=0. _d 0 |
429 |
|
|
#ifdef ALLOW_SITRACER_ADVCAP |
430 |
|
|
tmpscal1=max(SItrPrev(i,j,bi,bj), |
431 |
|
|
& SItrPrev(i+1,j,bi,bj),SItrPrev(i-1,j,bi,bj), |
432 |
|
|
& SItrPrev(i,j+1,bi,bj),SItrPrev(i,j-1,bi,bj)) |
433 |
|
|
tmpscal2=MAX(ZERO,SItracer(i,j,bi,bj,iTr)-tmpscal1) |
434 |
|
|
SItracer(i,j,bi,bj,iTr)=SItracer(i,j,bi,bj,iTr)-tmpscal2 |
435 |
|
|
#endif |
436 |
|
|
C treat case of potential negative value |
437 |
|
|
if (AREA(I,J,bi,bj).GE.SEAICE_area_floor) then |
438 |
|
|
tmpscal1=MIN(0. _d 0,SItracer(i,j,bi,bj,iTr)) |
439 |
|
|
SItracer(i,j,bi,bj,iTr)=SItracer(i,j,bi,bj,iTr)-tmpscal1 |
440 |
|
|
endif |
441 |
|
|
#ifdef ALLOW_SITRACER_DEBUG_DIAG |
442 |
|
|
diagArray(I,J,1+(iTr-1)*5)= 0. _d 0 |
443 |
|
|
diagArray(I,J,2+(iTr-1)*5)= - diagArray(I,J,2+(iTr-1)*5) |
444 |
|
|
& + AREA(I,J,bi,bj)*SItracer(i,j,bi,bj,iTr)*HEFFM(I,J,bi,bj) |
445 |
|
|
diagArray(I,J,3+(iTr-1)*5)=HEFFM(i,j,bi,bj) * |
446 |
|
|
& SEAICE_deltaTtherm * gFld(i,j) |
447 |
|
|
#endif |
448 |
|
|
ENDDO |
449 |
|
|
ENDDO |
450 |
|
|
ENDIF |
451 |
|
|
C-- |
452 |
|
|
ENDIF |
453 |
|
|
ENDDO |
454 |
|
|
#ifdef ALLOW_SITRACER_DEBUG_DIAG |
455 |
|
|
c CALL DIAGNOSTICS_FILL(DIAGarray,'UDIAG2 ',0,Nr,2,bi,bj,myThid) |
456 |
|
|
#endif |
457 |
|
|
#endif /* ALLOW_SITRACER */ |
458 |
|
|
|
459 |
|
|
C--- end bi,bj loops |
460 |
|
|
ENDDO |
461 |
|
|
ENDDO |
462 |
|
|
|
463 |
|
|
ELSE |
464 |
|
|
C-- if not multiDimAdvection |
465 |
|
|
|
466 |
|
|
Cold This has to be done to comply with the time stepping in advect.F: |
467 |
|
|
Cold Making sure that the following routines see the different |
468 |
|
|
Cold time levels correctly |
469 |
|
|
Cold At the end of the routine ADVECT, |
470 |
|
|
Cold timelevel 1 is updated with advection contribution |
471 |
|
|
Cold and diffusion contribution |
472 |
|
|
Cold (which was computed in DIFFUS on timelevel 3) |
473 |
|
|
Cold timelevel 2 is the previous timelevel 1 |
474 |
|
|
Cold timelevel 3 is the total diffusion tendency * deltaT |
475 |
|
|
Cold (empty if no diffusion) |
476 |
|
|
C-- This is what remains from old 3-level storage of AREA & HEFF: still |
477 |
|
|
C needed for SEAICE_GROWTH, Legacy branch. Left old comments here above. |
478 |
|
|
#ifdef SEAICE_GROWTH_LEGACY |
479 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
480 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
481 |
|
|
DO j=1-OLy,sNy+OLy |
482 |
|
|
DO i=1-OLx,sNx+OLx |
483 |
|
|
hEffNm1(i,j,bi,bj) = HEFF(i,j,bi,bj) |
484 |
|
|
areaNm1(i,j,bi,bj) = AREA(i,j,bi,bj) |
485 |
|
|
ENDDO |
486 |
|
|
ENDDO |
487 |
|
|
ENDDO |
488 |
|
|
ENDDO |
489 |
|
|
#endif |
490 |
|
|
|
491 |
|
|
IF ( SEAICEadvHEff ) THEN |
492 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
493 |
|
|
CADJ STORE heff = comlev1, key = ikey_dynamics, kind=isbyte |
494 |
|
|
#endif |
495 |
|
|
CALL ADVECT( uc, vc, hEff, fldNm1, HEFFM, myThid ) |
496 |
|
|
IF ( SEAICEdiffKhHeff .GT. 0. _d 0 ) THEN |
497 |
|
|
C- Add tendency due to diffusion |
498 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
499 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
500 |
|
|
CALL SEAICE_DIFFUSION( |
501 |
|
|
I GAD_HEFF, SEAICEdiffKhHeff, SEAICE_deltaTtherm, |
502 |
|
|
I fldNm1(1-OLx,1-OLy,bi,bj), HEFFM, |
503 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
504 |
|
|
U HEFF(1-OLx,1-OLy,bi,bj), |
505 |
|
|
I bi, bj, myTime, myIter, myThid ) |
506 |
|
|
ENDDO |
507 |
|
|
ENDDO |
508 |
|
|
ENDIF |
509 |
|
|
ENDIF |
510 |
|
|
IF ( SEAICEadvArea ) THEN |
511 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
512 |
|
|
CADJ STORE area = comlev1, key = ikey_dynamics, kind=isbyte |
513 |
|
|
#endif |
514 |
|
|
CALL ADVECT( uc, vc, area, fldNm1, HEFFM, myThid ) |
515 |
|
|
IF ( SEAICEdiffKhArea .GT. 0. _d 0 ) THEN |
516 |
|
|
C- Add tendency due to diffusion |
517 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
518 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
519 |
|
|
CALL SEAICE_DIFFUSION( |
520 |
|
|
I GAD_AREA, SEAICEdiffKhArea, SEAICE_deltaTtherm, |
521 |
|
|
I fldNm1(1-OLx,1-OLy,bi,bj), HEFFM, |
522 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
523 |
|
|
U Area(1-OLx,1-OLy,bi,bj), |
524 |
|
|
I bi, bj, myTime, myIter, myThid ) |
525 |
|
|
ENDDO |
526 |
|
|
ENDDO |
527 |
|
|
ENDIF |
528 |
|
|
ENDIF |
529 |
|
|
IF ( SEAICEadvSnow ) THEN |
530 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
531 |
|
|
CADJ STORE hsnow = comlev1, key = ikey_dynamics, kind=isbyte |
532 |
|
|
#endif |
533 |
|
|
CALL ADVECT( uc, vc, HSNOW, fldNm1, HEFFM, myThid ) |
534 |
|
|
IF ( SEAICEdiffKhSnow .GT. 0. _d 0 ) THEN |
535 |
|
|
C- Add tendency due to diffusion |
536 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
537 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
538 |
|
|
CALL SEAICE_DIFFUSION( |
539 |
|
|
I GAD_SNOW, SEAICEdiffKhSnow, SEAICE_deltaTtherm, |
540 |
|
|
I fldNm1(1-OLx,1-OLy,bi,bj), HEFFM, |
541 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
542 |
|
|
U HSNOW(1-OLx,1-OLy,bi,bj), |
543 |
|
|
I bi, bj, myTime, myIter, myThid ) |
544 |
|
|
ENDDO |
545 |
|
|
ENDDO |
546 |
|
|
ENDIF |
547 |
|
|
ENDIF |
548 |
|
|
|
549 |
|
|
#ifdef SEAICE_VARIABLE_SALINITY |
550 |
|
|
IF ( SEAICEadvSalt ) THEN |
551 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
552 |
|
|
CADJ STORE hsalt = comlev1, key = ikey_dynamics, kind=isbyte |
553 |
|
|
#endif |
554 |
|
|
CALL ADVECT( uc, vc, HSALT, fldNm1, HEFFM, myThid ) |
555 |
|
|
IF ( SEAICEdiffKhSalt .GT. 0. _d 0 ) THEN |
556 |
|
|
C- Add tendency due to diffusion |
557 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
558 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
559 |
|
|
CALL SEAICE_DIFFUSION( |
560 |
|
|
I GAD_SALT, SEAICEdiffKhSalt, SEAICE_deltaTtherm, |
561 |
|
|
I fldNm1(1-OLx,1-OLy,bi,bj), HEFFM, |
562 |
|
|
I xA(1-OLx,1-OLy,bi,bj), yA(1-OLx,1-OLy,bi,bj), |
563 |
|
|
U HSALT(1-OLx,1-OLy,bi,bj), |
564 |
|
|
I bi, bj, myTime, myIter, myThid ) |
565 |
|
|
ENDDO |
566 |
|
|
ENDDO |
567 |
|
|
ENDIF |
568 |
|
|
ENDIF |
569 |
|
|
#endif /* SEAICE_VARIABLE_SALINITY */ |
570 |
|
|
|
571 |
|
|
C-- end if multiDimAdvection |
572 |
|
|
ENDIF |
573 |
|
|
|
574 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
575 |
|
|
CADJ STORE AREA = comlev1, key = ikey_dynamics, kind=isbyte |
576 |
|
|
#endif |
577 |
|
|
IF ( .NOT. usePW79thermodynamics ) THEN |
578 |
|
|
C Hiblers "ridging function": Do it now if not in seaice_growth |
579 |
|
|
C in principle we should add a "real" ridging function here (or |
580 |
|
|
C somewhere after doing the advection) |
581 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
582 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
583 |
|
|
DO j=1-OLy,sNy+OLy |
584 |
|
|
DO i=1-OLx,sNx+OLx |
585 |
|
|
AREA(I,J,bi,bj) = MIN(ONE,AREA(I,J,bi,bj)) |
586 |
|
|
ENDDO |
587 |
|
|
ENDDO |
588 |
|
|
ENDDO |
589 |
|
|
ENDDO |
590 |
|
|
ENDIF |
591 |
|
|
|
592 |
|
|
RETURN |
593 |
|
|
END |