1 |
heimbach |
1.14 |
C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_advdiff.F,v 1.13 2013/01/21 22:54:54 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "THSICE_OPTIONS.h" |
5 |
jmc |
1.3 |
#ifdef ALLOW_GENERIC_ADVDIFF |
6 |
|
|
# include "GAD_OPTIONS.h" |
7 |
|
|
#endif |
8 |
jmc |
1.1 |
|
9 |
|
|
CBOP |
10 |
|
|
C !ROUTINE: THSICE_ADVDIFF |
11 |
|
|
|
12 |
|
|
C !INTERFACE: ========================================================== |
13 |
|
|
SUBROUTINE THSICE_ADVDIFF( |
14 |
|
|
U uIce, vIce, |
15 |
|
|
I bi, bj, myTime, myIter, myThid ) |
16 |
|
|
|
17 |
|
|
C !DESCRIPTION: \bv |
18 |
|
|
C *===========================================================* |
19 |
|
|
C | SUBROUTINE THSICE_ADVDIFF |
20 |
|
|
C | o driver for different advection routines |
21 |
|
|
C | calls an adaption of gad_advection to call different |
22 |
|
|
C | advection routines of pkg/generic_advdiff |
23 |
|
|
C *===========================================================* |
24 |
|
|
C \ev |
25 |
|
|
|
26 |
|
|
C !USES: =============================================================== |
27 |
|
|
IMPLICIT NONE |
28 |
|
|
|
29 |
|
|
C === Global variables === |
30 |
|
|
C oceFWfx :: fresh water flux to the ocean [kg/m^2/s] |
31 |
|
|
C oceSflx :: salt flux to the ocean [psu.kg/m^2/s] (~g/m^2/s) |
32 |
|
|
C oceQnet :: heat flux to the ocean [W/m^2] |
33 |
|
|
|
34 |
|
|
#include "SIZE.h" |
35 |
|
|
#include "EEPARAMS.h" |
36 |
|
|
#include "PARAMS.h" |
37 |
|
|
#include "GRID.h" |
38 |
|
|
#include "THSICE_SIZE.h" |
39 |
|
|
#include "THSICE_PARAMS.h" |
40 |
|
|
#include "THSICE_VARS.h" |
41 |
jmc |
1.3 |
#ifdef ALLOW_GENERIC_ADVDIFF |
42 |
|
|
# include "GAD.h" |
43 |
|
|
#endif |
44 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
45 |
|
|
# include "tamc.h" |
46 |
|
|
# include "tamc_keys.h" |
47 |
|
|
#endif |
48 |
jmc |
1.1 |
|
49 |
|
|
C !INPUT PARAMETERS: =================================================== |
50 |
|
|
C === Routine arguments === |
51 |
|
|
C uIce/vIce :: ice velocity on C-grid [m/s] |
52 |
|
|
C bi,bj :: Tile indices |
53 |
|
|
C myTime :: Current time in simulation (s) |
54 |
|
|
C myIter :: Current iteration number |
55 |
|
|
C myThid :: My Thread Id. number |
56 |
|
|
_RL uIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
57 |
|
|
_RL vIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
58 |
|
|
INTEGER bi,bj |
59 |
|
|
_RL myTime |
60 |
|
|
INTEGER myIter |
61 |
|
|
INTEGER myThid |
62 |
|
|
CEndOfInterface |
63 |
|
|
|
64 |
|
|
#ifdef ALLOW_THSICE |
65 |
|
|
C !LOCAL VARIABLES: ==================================================== |
66 |
|
|
C === Local variables === |
67 |
|
|
C i,j, :: Loop counters |
68 |
|
|
C uTrans :: sea-ice area transport, x direction |
69 |
|
|
C vTrans :: sea-ice area transport, y direction |
70 |
|
|
C uTrIce :: sea-ice volume transport, x direction |
71 |
|
|
C vTrIce :: sea-ice volume transport, y direction |
72 |
|
|
C afx :: horizontal advective flux, x direction |
73 |
|
|
C afy :: horizontal advective flux, y direction |
74 |
|
|
C iceFrc :: (new) sea-ice fraction |
75 |
|
|
C iceVol :: temporary array used in advection S/R |
76 |
|
|
C oldVol :: (old) sea-ice volume |
77 |
jmc |
1.13 |
C msgBuf :: Informational/error message buffer |
78 |
jmc |
1.1 |
INTEGER i, j |
79 |
|
|
LOGICAL thSIce_multiDimAdv |
80 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
81 |
|
|
|
82 |
|
|
_RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
83 |
|
|
_RL vTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
84 |
|
|
_RL uTrIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
85 |
|
|
_RL vTrIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
86 |
|
|
_RL afx (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
87 |
|
|
_RL afy (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
88 |
|
|
_RS maskOce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
89 |
|
|
_RL iceFrc (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
90 |
jmc |
1.13 |
_RL iceVol (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
91 |
|
|
_RL oldVol (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
92 |
heimbach |
1.14 |
_RL iceTmp (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
93 |
jmc |
1.4 |
_RL r_minArea |
94 |
jmc |
1.1 |
_RL meanCellArea, areaEpsil, vol_Epsil |
95 |
jmc |
1.2 |
#ifdef ALLOW_DIAGNOSTICS |
96 |
|
|
CHARACTER*8 diagName |
97 |
|
|
CHARACTER*4 THSICE_DIAG_SUFX, diagSufx |
98 |
|
|
EXTERNAL THSICE_DIAG_SUFX |
99 |
jmc |
1.7 |
LOGICAL DIAGNOSTICS_IS_ON |
100 |
|
|
EXTERNAL DIAGNOSTICS_IS_ON |
101 |
|
|
_RL tmpFac |
102 |
jmc |
1.2 |
#endif |
103 |
jmc |
1.1 |
#ifdef ALLOW_DBUG_THSICE |
104 |
|
|
_RL tmpVar, sumVar1, sumVar2 |
105 |
|
|
#endif |
106 |
|
|
LOGICAL dBugFlag |
107 |
|
|
#include "THSICE_DEBUG.h" |
108 |
|
|
CEOP |
109 |
|
|
|
110 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
111 |
heimbach |
1.5 |
|
112 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
113 |
|
|
act1 = bi - myBxLo(myThid) |
114 |
|
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
115 |
|
|
act2 = bj - myByLo(myThid) |
116 |
|
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
117 |
|
|
act3 = myThid - 1 |
118 |
|
|
max3 = nTx*nTy |
119 |
|
|
act4 = ikey_dynamics - 1 |
120 |
gforget |
1.11 |
ticekey = (act1 + 1) + act2*max1 |
121 |
heimbach |
1.5 |
& + act3*max1*max2 |
122 |
|
|
& + act4*max1*max2*max3 |
123 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
124 |
|
|
|
125 |
jmc |
1.1 |
C areaEpsil, vol_Epsil are 2 small numbers for ice area & ice volume: |
126 |
|
|
C if ice area (=ice fraction * grid-cell area) or ice volume (= effective |
127 |
|
|
C thickness * grid-cell area) are too small (i.e.: < areaEpsil,vol_Epsil) |
128 |
|
|
C will assume that ice is gone, and will loose mass or energy. |
129 |
|
|
C However, if areaEpsil,vol_Epsil are much smaller than minimun ice area |
130 |
jmc |
1.6 |
C (iceMaskMin*rAc) and minimum ice volume (iceMaskMin*hIceMin*rAc), |
131 |
jmc |
1.1 |
C good chance that this will never happen within 1 time step. |
132 |
|
|
|
133 |
jmc |
1.12 |
dBugFlag = debugLevel.GE.debLevC |
134 |
jmc |
1.1 |
|
135 |
|
|
C- definitively not an accurate computation of mean grid-cell area; |
136 |
|
|
C but what matter here is just to have the right order of magnitude. |
137 |
|
|
meanCellArea = Nx*Ny |
138 |
|
|
meanCellArea = globalArea / meanCellArea |
139 |
|
|
areaEpsil = 1. _d -10 * meanCellArea |
140 |
|
|
vol_Epsil = 1. _d -15 * meanCellArea |
141 |
|
|
|
142 |
|
|
r_minArea = 0. _d 0 |
143 |
jmc |
1.4 |
IF ( iceMaskMin.GT.0. _d 0 ) r_minArea = 1. _d 0 / iceMaskMin |
144 |
jmc |
1.1 |
|
145 |
|
|
thSIce_multiDimAdv = .TRUE. |
146 |
jmc |
1.3 |
#ifdef ALLOW_GENERIC_ADVDIFF |
147 |
jmc |
1.1 |
IF ( thSIceAdvScheme.EQ.ENUM_CENTERED_2ND |
148 |
|
|
& .OR.thSIceAdvScheme.EQ.ENUM_UPWIND_3RD |
149 |
|
|
& .OR.thSIceAdvScheme.EQ.ENUM_CENTERED_4TH ) THEN |
150 |
|
|
thSIce_multiDimAdv = .FALSE. |
151 |
|
|
ENDIF |
152 |
jmc |
1.3 |
#endif /* ALLOW_GENERIC_ADVDIFF */ |
153 |
jmc |
1.1 |
|
154 |
jmc |
1.13 |
#ifndef OLD_THSICE_CALL_SEQUENCE |
155 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
156 |
|
|
IF ( useDiagnostics ) THEN |
157 |
|
|
CALL DIAGNOSTICS_FILL(iceMask,'SI_AdvFr',0,1,1,bi,bj,myThid) |
158 |
|
|
C- Ice-fraction weighted quantities: |
159 |
|
|
tmpFac = 1. _d 0 |
160 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
161 |
|
|
I iceHeight, iceMask,tmpFac,1,'SI_AdvHi', |
162 |
|
|
I 0,1,1,bi,bj,myThid) |
163 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
164 |
|
|
I snowHeight,iceMask,tmpFac,1,'SI_AdvHs', |
165 |
|
|
I 0,1,1,bi,bj,myThid) |
166 |
|
|
C- Ice-Volume weighted quantities: |
167 |
|
|
IF ( DIAGNOSTICS_IS_ON('SI_AdvQ1',myThid) .OR. |
168 |
|
|
& DIAGNOSTICS_IS_ON('SI_AdvQ2',myThid) ) THEN |
169 |
|
|
DO j=1,sNy |
170 |
|
|
DO i=1,sNx |
171 |
heimbach |
1.14 |
iceTmp(i,j) = iceMask(i,j,bi,bj)*iceHeight(i,j,bi,bj) |
172 |
jmc |
1.13 |
ENDDO |
173 |
|
|
ENDDO |
174 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
175 |
|
|
I Qice1(1-OLx,1-OLy,bi,bj), |
176 |
heimbach |
1.14 |
I iceTmp,tmpFac,1,'SI_AdvQ1', |
177 |
jmc |
1.13 |
I 0,1,2,bi,bj,myThid) |
178 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
179 |
|
|
I Qice2(1-OLx,1-OLy,bi,bj), |
180 |
heimbach |
1.14 |
I iceTmp,tmpFac,1,'SI_AdvQ2', |
181 |
jmc |
1.13 |
I 0,1,2,bi,bj,myThid) |
182 |
|
|
ENDIF |
183 |
|
|
ENDIF |
184 |
|
|
#endif /* ALLOW_DIAGNOSTICS */ |
185 |
|
|
#endif /* ndef OLD_THSICE_CALL_SEQUENCE */ |
186 |
|
|
|
187 |
jmc |
1.1 |
C-- Initialisation (+ build oceanic mask) |
188 |
|
|
DO j=1-OLy,sNy+OLy |
189 |
|
|
DO i=1-OLx,sNx+OLx |
190 |
|
|
maskOce(i,j) = 0. _d 0 |
191 |
|
|
IF ( hOceMxL(i,j,bi,bj).GT.0. ) maskOce(i,j) = 1. |
192 |
|
|
iceVol(i,j) = 0. _d 0 |
193 |
|
|
uTrans(i,j) = 0. _d 0 |
194 |
|
|
vTrans(i,j) = 0. _d 0 |
195 |
|
|
uTrIce(i,j) = 0. _d 0 |
196 |
|
|
vTrIce(i,j) = 0. _d 0 |
197 |
|
|
oceFWfx(i,j,bi,bj) = 0. _d 0 |
198 |
|
|
oceSflx(i,j,bi,bj) = 0. _d 0 |
199 |
|
|
oceQnet(i,j,bi,bj) = 0. _d 0 |
200 |
|
|
ENDDO |
201 |
|
|
ENDDO |
202 |
|
|
|
203 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
204 |
heimbach |
1.10 |
CADJ STORE iceHeight(:,:,bi,bj) |
205 |
gforget |
1.11 |
CADJ & = comlev1_bibj, key=ticekey, byte=isbyte |
206 |
heimbach |
1.10 |
CADJ STORE snowHeight(:,:,bi,bj) |
207 |
gforget |
1.11 |
CADJ & = comlev1_bibj, key=ticekey, byte=isbyte |
208 |
heimbach |
1.5 |
#endif |
209 |
jmc |
1.1 |
IF ( thSIce_diffK .GT. 0. ) THEN |
210 |
|
|
CALL THSICE_DIFFUSION( |
211 |
|
|
I maskOce, |
212 |
|
|
U uIce, vIce, |
213 |
|
|
I bi, bj, myTime, myIter, myThid ) |
214 |
|
|
ENDIF |
215 |
|
|
|
216 |
|
|
IF ( thSIce_multiDimAdv ) THEN |
217 |
|
|
|
218 |
|
|
C- Calculate ice transports through tracer cell faces. |
219 |
jmc |
1.13 |
DO j=1-OLy,sNy+OLy |
220 |
|
|
DO i=1-OLx+1,sNx+OLx |
221 |
jmc |
1.1 |
uTrIce(i,j) = uIce(i,j)*_dyG(i,j,bi,bj) |
222 |
|
|
& *maskOce(i-1,j)*maskOce(i,j) |
223 |
|
|
ENDDO |
224 |
|
|
ENDDO |
225 |
jmc |
1.13 |
DO j=1-OLy+1,sNy+OLy |
226 |
|
|
DO i=1-OLx,sNx+OLx |
227 |
jmc |
1.1 |
vTrIce(i,j) = vIce(i,j)*_dxG(i,j,bi,bj) |
228 |
|
|
& *maskOce(i,j-1)*maskOce(i,j) |
229 |
|
|
ENDDO |
230 |
|
|
ENDDO |
231 |
|
|
|
232 |
|
|
C-- Fractional area |
233 |
jmc |
1.13 |
DO j=1-OLy,sNy+OLy |
234 |
|
|
DO i=1-OLx,sNx+OLx |
235 |
jmc |
1.1 |
iceFrc(i,j) = iceMask(i,j,bi,bj) |
236 |
|
|
ENDDO |
237 |
|
|
ENDDO |
238 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
239 |
gforget |
1.11 |
CADJ STORE icevol(:,:) = comlev1_bibj, key=ticekey, byte=isbyte |
240 |
|
|
CADJ STORE utrice(:,:) = comlev1_bibj, key=ticekey, byte=isbyte |
241 |
|
|
CADJ STORE vtrice(:,:) = comlev1_bibj, key=ticekey, byte=isbyte |
242 |
heimbach |
1.5 |
#endif |
243 |
jmc |
1.1 |
CALL THSICE_ADVECTION( |
244 |
|
|
I GAD_SI_FRAC, thSIceAdvScheme, .TRUE., |
245 |
|
|
I uTrIce, vTrIce, maskOce, thSIce_deltaT, areaEpsil, |
246 |
|
|
U iceVol, iceFrc, |
247 |
|
|
O uTrans, vTrans, |
248 |
|
|
I bi, bj, myTime, myIter, myThid ) |
249 |
|
|
|
250 |
|
|
C-- Snow thickness |
251 |
jmc |
1.13 |
DO j=1-OLy,sNy+OLy |
252 |
|
|
DO i=1-OLx,sNx+OLx |
253 |
jmc |
1.1 |
iceVol(i,j) = iceMask(i,j,bi,bj)*rA(i,j,bi,bj) |
254 |
|
|
ENDDO |
255 |
|
|
ENDDO |
256 |
|
|
CALL THSICE_ADVECTION( |
257 |
|
|
I GAD_SI_HSNOW, thSIceAdvScheme, .FALSE., |
258 |
|
|
I uTrans, vTrans, maskOce, thSIce_deltaT, areaEpsil, |
259 |
jmc |
1.13 |
U iceVol, snowHeight(1-OLx,1-OLy,bi,bj), |
260 |
jmc |
1.1 |
O afx, afy, |
261 |
|
|
I bi, bj, myTime, myIter, myThid ) |
262 |
|
|
|
263 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
264 |
gforget |
1.11 |
CADJ STORE iceHeight(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
265 |
|
|
CADJ STORE iceMask(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
266 |
heimbach |
1.5 |
#endif |
267 |
jmc |
1.1 |
C-- sea-ice Thickness |
268 |
jmc |
1.13 |
DO j=1-OLy,sNy+OLy |
269 |
|
|
DO i=1-OLx,sNx+OLx |
270 |
jmc |
1.1 |
iceVol(i,j) = iceMask(i,j,bi,bj)*rA(i,j,bi,bj) |
271 |
|
|
oldVol(i,j) = iceVol(i,j)*iceHeight(i,j,bi,bj) |
272 |
|
|
ENDDO |
273 |
|
|
ENDDO |
274 |
|
|
CALL THSICE_ADVECTION( |
275 |
|
|
I GAD_SI_HICE, thSIceAdvScheme, .FALSE., |
276 |
|
|
I uTrans, vTrans, maskOce, thSIce_deltaT, areaEpsil, |
277 |
jmc |
1.13 |
U iceVol, iceHeight(1-OLx,1-OLy,bi,bj), |
278 |
jmc |
1.1 |
O uTrIce, vTrIce, |
279 |
|
|
I bi, bj, myTime, myIter, myThid ) |
280 |
heimbach |
1.5 |
|
281 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
282 |
gforget |
1.11 |
CADJ STORE qice2(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
283 |
|
|
CADJ STORE utrice(:,:) = comlev1_bibj, key=ticekey, byte=isbyte |
284 |
|
|
CADJ STORE vtrice(:,:) = comlev1_bibj, key=ticekey, byte=isbyte |
285 |
heimbach |
1.5 |
#endif |
286 |
|
|
|
287 |
jmc |
1.1 |
#ifdef ALLOW_DBUG_THSICE |
288 |
|
|
IF ( dBugFlag ) THEN |
289 |
|
|
sumVar1 = 0. |
290 |
|
|
sumVar2 = 0. |
291 |
|
|
DO j=1,sNy |
292 |
|
|
DO i=1,sNx |
293 |
|
|
C- Check that updated iceVol = iceFrc*rA |
294 |
|
|
tmpVar = ABS(iceVol(i,j)-iceFrc(i,j)*rA(i,j,bi,bj)) |
295 |
|
|
IF ( tmpVar.GT.0. ) THEN |
296 |
|
|
sumVar1 = sumVar1 + 1. |
297 |
|
|
sumVar2 = sumVar2 + tmpVar |
298 |
|
|
ENDIF |
299 |
|
|
IF ( tmpVar.GT.vol_Epsil ) THEN |
300 |
|
|
WRITE(6,'(A,2I4,2I2,I12)') 'ARE_ADV: ij,bij,it=', |
301 |
|
|
& i,j,bi,bj,myIter |
302 |
|
|
WRITE(6,'(2(A,1P2E14.6))') 'ARE_ADV: iceVol,iceFrc*rA=', |
303 |
|
|
& iceVol(i,j),iceFrc(i,j)*rA(i,j,bi,bj), |
304 |
|
|
& ' , diff=', tmpVar |
305 |
|
|
ENDIF |
306 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
307 |
|
|
WRITE(6,'(A,2I4,2I2,I12)') 'ICE_ADV: ij,bij,it=', |
308 |
|
|
& i,j,bi,bj,myIter |
309 |
|
|
WRITE(6,'(2(A,1P2E14.6))') |
310 |
|
|
& 'ICE_ADV: uIce=', uIce(i,j), uIce(i+1,j), |
311 |
|
|
& ' , vIce=', vIce(i,j), vIce(i,j+1) |
312 |
|
|
WRITE(6,'(2(A,1P2E14.6))') |
313 |
jmc |
1.7 |
& 'ICE_ADV: area_b,a=', iceMask(i,j,bi,bj), iceFrc(i,j), |
314 |
|
|
& ' , Heff_b,a=', oldVol(i,j)*recip_rA(i,j,bi,bj), |
315 |
|
|
& iceHeight(i,j,bi,bj)*iceFrc(i,j) |
316 |
jmc |
1.1 |
ENDIF |
317 |
|
|
ENDDO |
318 |
|
|
ENDDO |
319 |
|
|
IF ( sumVar2.GT.vol_Epsil ) |
320 |
|
|
& WRITE(6,'(A,2I2,I10,A,I4,1P2E14.6)') 'ARE_ADV: bij,it:', |
321 |
|
|
& bi,bj,myIter, ' ; Npts,aveDiff,Epsil=', |
322 |
|
|
& INT(sumVar1),sumVar2/sumVar1,vol_Epsil |
323 |
|
|
ENDIF |
324 |
|
|
#endif |
325 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
326 |
|
|
C-- Diagnosse advective fluxes (ice-fraction, snow & ice thickness): |
327 |
|
|
IF ( useDiagnostics ) THEN |
328 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_FRAC, myThid ) |
329 |
|
|
diagName = 'ADVx'//diagSufx |
330 |
|
|
CALL DIAGNOSTICS_FILL( uTrans, diagName, 1,1,2,bi,bj, myThid ) |
331 |
|
|
diagName = 'ADVy'//diagSufx |
332 |
|
|
CALL DIAGNOSTICS_FILL( vTrans, diagName, 1,1,2,bi,bj, myThid ) |
333 |
|
|
|
334 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_HSNOW, myThid ) |
335 |
|
|
diagName = 'ADVx'//diagSufx |
336 |
|
|
CALL DIAGNOSTICS_FILL( afx, diagName, 1,1,2,bi,bj, myThid ) |
337 |
|
|
diagName = 'ADVy'//diagSufx |
338 |
|
|
CALL DIAGNOSTICS_FILL( afy, diagName, 1,1,2,bi,bj, myThid ) |
339 |
|
|
|
340 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_HICE, myThid ) |
341 |
|
|
diagName = 'ADVx'//diagSufx |
342 |
|
|
CALL DIAGNOSTICS_FILL( uTrIce, diagName, 1,1,2,bi,bj, myThid ) |
343 |
|
|
diagName = 'ADVy'//diagSufx |
344 |
|
|
CALL DIAGNOSTICS_FILL( vTrIce, diagName, 1,1,2,bi,bj, myThid ) |
345 |
|
|
ENDIF |
346 |
|
|
#endif |
347 |
|
|
|
348 |
|
|
C-- Enthalpy in layer 1 |
349 |
jmc |
1.13 |
DO j=1-OLy,sNy+OLy |
350 |
|
|
DO i=1-OLx,sNx+OLx |
351 |
jmc |
1.1 |
iceVol(i,j) = oldVol(i,j) |
352 |
|
|
ENDDO |
353 |
|
|
ENDDO |
354 |
|
|
CALL THSICE_ADVECTION( |
355 |
|
|
I GAD_SI_QICE1, thSIceAdvScheme, .FALSE., |
356 |
|
|
I uTrIce, vTrIce, maskOce, thSIce_deltaT, vol_Epsil, |
357 |
jmc |
1.13 |
U iceVol, Qice1(1-OLx,1-OLy,bi,bj), |
358 |
jmc |
1.1 |
O afx, afy, |
359 |
|
|
I bi, bj, myTime, myIter, myThid ) |
360 |
|
|
#ifdef ALLOW_DBUG_THSICE |
361 |
|
|
IF ( dBugFlag ) THEN |
362 |
|
|
DO j=1,sNy |
363 |
|
|
DO i=1,sNx |
364 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
365 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: Qice1_b,a=', |
366 |
|
|
c & Qice1(i,j,bi,bj), |
367 |
|
|
c & ( iceFld(i,j) + thSIce_deltaT * gFld(i,j) |
368 |
|
|
c & ) * recip_heff(i,j) |
369 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: q1Fx=', gFld(i,j) |
370 |
|
|
ENDIF |
371 |
|
|
ENDDO |
372 |
|
|
ENDDO |
373 |
|
|
ENDIF |
374 |
|
|
#endif |
375 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
376 |
|
|
IF ( useDiagnostics ) THEN |
377 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_QICE1, myThid ) |
378 |
|
|
diagName = 'ADVx'//diagSufx |
379 |
|
|
CALL DIAGNOSTICS_FILL( afx, diagName, 1,1,2,bi,bj, myThid ) |
380 |
|
|
diagName = 'ADVy'//diagSufx |
381 |
|
|
CALL DIAGNOSTICS_FILL( afy, diagName, 1,1,2,bi,bj, myThid ) |
382 |
|
|
ENDIF |
383 |
|
|
#endif |
384 |
|
|
|
385 |
|
|
C-- Enthalpy in layer 2 |
386 |
jmc |
1.13 |
DO j=1-OLy,sNy+OLy |
387 |
|
|
DO i=1-OLx,sNx+OLx |
388 |
jmc |
1.1 |
iceVol(i,j) = oldVol(i,j) |
389 |
|
|
ENDDO |
390 |
|
|
ENDDO |
391 |
|
|
CALL THSICE_ADVECTION( |
392 |
|
|
I GAD_SI_QICE2, thSIceAdvScheme, .FALSE., |
393 |
|
|
I uTrIce, vTrIce, maskOce, thSIce_deltaT, vol_Epsil, |
394 |
jmc |
1.13 |
U iceVol, Qice2(1-OLx,1-OLy,bi,bj), |
395 |
jmc |
1.1 |
O afx, afy, |
396 |
|
|
I bi, bj, myTime, myIter, myThid ) |
397 |
|
|
#ifdef ALLOW_DBUG_THSICE |
398 |
|
|
IF ( dBugFlag ) THEN |
399 |
|
|
sumVar1 = 0. |
400 |
|
|
sumVar2 = 0. |
401 |
|
|
DO j=1,sNy |
402 |
|
|
DO i=1,sNx |
403 |
|
|
C- Check that updated iceVol = Hic*Frc*rA |
404 |
|
|
tmpVar = ABS(iceVol(i,j) |
405 |
|
|
& -iceHeight(i,j,bi,bj)*iceFrc(i,j)*rA(i,j,bi,bj)) |
406 |
|
|
IF ( tmpVar.GT.0. ) THEN |
407 |
|
|
sumVar1 = sumVar1 + 1. |
408 |
|
|
sumVar2 = sumVar2 + tmpVar |
409 |
|
|
ENDIF |
410 |
|
|
IF ( tmpVar.GT.vol_Epsil ) THEN |
411 |
|
|
WRITE(6,'(A,2I4,2I2,I12)') 'VOL_ADV: ij,bij,it=', |
412 |
|
|
& i,j,bi,bj,myIter |
413 |
|
|
WRITE(6,'(2(A,1P2E14.6))') 'VOL_ADV: iceVol,Hic*Frc*rA=', |
414 |
|
|
& iceVol(i,j),iceHeight(i,j,bi,bj)*iceFrc(i,j)*rA(i,j,bi,bj), |
415 |
|
|
& ' , diff=', tmpVar |
416 |
|
|
ENDIF |
417 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
418 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: Qice2_b,a=', |
419 |
|
|
c & Qice2(i,j,bi,bj), |
420 |
|
|
c & ( iceFld(i,j) + thSIce_deltaT * gFld(i,j) |
421 |
|
|
c & ) * recip_heff(i,j) |
422 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: q2Fx=', gFld(i,j) |
423 |
|
|
ENDIF |
424 |
|
|
ENDDO |
425 |
|
|
ENDDO |
426 |
|
|
IF ( sumVar2.GT.vol_Epsil ) |
427 |
|
|
& WRITE(6,'(A,2I2,I10,A,I4,1P2E14.6)') 'VOL_ADV: bij,it:', |
428 |
|
|
& bi,bj,myIter, ' ; Npts,aveDiff,Epsil=', |
429 |
|
|
& INT(sumVar1),sumVar2/sumVar1,vol_Epsil |
430 |
|
|
ENDIF |
431 |
|
|
#endif |
432 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
433 |
|
|
IF ( useDiagnostics ) THEN |
434 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_QICE2, myThid ) |
435 |
|
|
diagName = 'ADVx'//diagSufx |
436 |
|
|
CALL DIAGNOSTICS_FILL( afx, diagName, 1,1,2,bi,bj, myThid ) |
437 |
|
|
diagName = 'ADVy'//diagSufx |
438 |
|
|
CALL DIAGNOSTICS_FILL( afy, diagName, 1,1,2,bi,bj, myThid ) |
439 |
|
|
ENDIF |
440 |
|
|
#endif |
441 |
|
|
|
442 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
443 |
jmc |
1.8 |
CADJ STORE iceHeight(:,:,bi,bj) = |
444 |
gforget |
1.11 |
CADJ & comlev1_bibj, key=ticekey, byte=isbyte |
445 |
jmc |
1.8 |
CADJ STORE snowHeight(:,:,bi,bj) = |
446 |
gforget |
1.11 |
CADJ & comlev1_bibj, key=ticekey, byte=isbyte |
447 |
jmc |
1.8 |
CADJ STORE iceFrc(:,:) = |
448 |
gforget |
1.11 |
CADJ & comlev1_bibj, key=ticekey, byte=isbyte |
449 |
heimbach |
1.5 |
#endif |
450 |
|
|
|
451 |
jmc |
1.4 |
C-- Update Ice Fraction: ensure that fraction is > iceMaskMin & < 1 |
452 |
|
|
C and adjust Ice thickness and snow thickness accordingly |
453 |
jmc |
1.1 |
DO j=1,sNy |
454 |
|
|
DO i=1,sNx |
455 |
jmc |
1.4 |
IF ( iceFrc(i,j) .GT. 1. _d 0 ) THEN |
456 |
jmc |
1.7 |
c IF ( dBug(i,j,bi,bj) ) |
457 |
jmc |
1.1 |
iceMask(i,j,bi,bj) = 1. _d 0 |
458 |
jmc |
1.4 |
iceHeight(i,j,bi,bj) = iceHeight(i,j,bi,bj) *iceFrc(i,j) |
459 |
jmc |
1.1 |
snowHeight(i,j,bi,bj) = snowHeight(i,j,bi,bj)*iceFrc(i,j) |
460 |
jmc |
1.4 |
ELSEIF ( iceFrc(i,j) .LT. iceMaskMin ) THEN |
461 |
jmc |
1.7 |
c IF ( dBug(i,j,bi,bj) ) |
462 |
jmc |
1.4 |
iceMask(i,j,bi,bj) = iceMaskMin |
463 |
|
|
iceHeight(i,j,bi,bj) = iceHeight(i,j,bi,bj) |
464 |
|
|
& *iceFrc(i,j)*r_minArea |
465 |
jmc |
1.1 |
snowHeight(i,j,bi,bj) = snowHeight(i,j,bi,bj) |
466 |
|
|
& *iceFrc(i,j)*r_minArea |
467 |
jmc |
1.4 |
ELSE |
468 |
jmc |
1.1 |
iceMask(i,j,bi,bj) = iceFrc(i,j) |
469 |
jmc |
1.4 |
ENDIF |
470 |
|
|
ENDDO |
471 |
|
|
ENDDO |
472 |
jmc |
1.8 |
C- adjust sea-ice state if ice is too thin. |
473 |
jmc |
1.4 |
DO j=1,sNy |
474 |
|
|
DO i=1,sNx |
475 |
jmc |
1.6 |
IF ( iceHeight(i,j,bi,bj).LT.hIceMin ) THEN |
476 |
jmc |
1.8 |
iceVol(i,j) = iceMask(i,j,bi,bj)*iceHeight(i,j,bi,bj) |
477 |
|
|
c IF ( dBug(i,j,bi,bj) ) |
478 |
|
|
IF ( iceVol(i,j).GE.hIceMin*iceMaskMin ) THEN |
479 |
|
|
iceMask(i,j,bi,bj) = iceVol(i,j)/hIceMin |
480 |
|
|
snowHeight(i,j,bi,bj) = snowHeight(i,j,bi,bj) |
481 |
|
|
& *hIceMin/iceHeight(i,j,bi,bj) |
482 |
|
|
iceHeight(i,j,bi,bj) = hIceMin |
483 |
|
|
ELSE |
484 |
jmc |
1.2 |
C- Not enough ice, melt the tiny amount of snow & ice: |
485 |
jmc |
1.4 |
C and return fresh-water, salt & energy to the ocean (flx > 0 = into ocean) |
486 |
jmc |
1.2 |
C- - Note: using 1rst.Order Upwind, I can get the same results as when |
487 |
|
|
C using seaice_advdiff (with SEAICEadvScheme=1) providing I comment |
488 |
|
|
C out the following lines (and then loose conservation). |
489 |
|
|
C- - |
490 |
jmc |
1.4 |
oceFWfx(i,j,bi,bj) = ( rhos*snowHeight(i,j,bi,bj) |
491 |
|
|
& +rhoi*iceHeight(i,j,bi,bj) |
492 |
|
|
& )*iceMask(i,j,bi,bj)/thSIce_deltaT |
493 |
jmc |
1.6 |
oceSflx(i,j,bi,bj) = rhoi*iceHeight(i,j,bi,bj)*saltIce |
494 |
jmc |
1.4 |
& *iceMask(i,j,bi,bj)/thSIce_deltaT |
495 |
|
|
oceQnet(i,j,bi,bj) = -( rhos*snowHeight(i,j,bi,bj)*qsnow |
496 |
|
|
& +rhoi*iceHeight(i,j,bi,bj) |
497 |
|
|
& *( Qice1(i,j,bi,bj) |
498 |
|
|
& +Qice2(i,j,bi,bj) )*0.5 _d 0 |
499 |
|
|
& )*iceMask(i,j,bi,bj)/thSIce_deltaT |
500 |
jmc |
1.2 |
C- - |
501 |
jmc |
1.1 |
c flx2oc (i,j) = flx2oc (i,j) + |
502 |
|
|
c frw2oc (i,j) = frw2oc (i,j) + |
503 |
|
|
c fsalt (i,j) = fsalt (i,j) + |
504 |
|
|
iceMask (i,j,bi,bj) = 0. _d 0 |
505 |
|
|
iceHeight (i,j,bi,bj) = 0. _d 0 |
506 |
|
|
snowHeight(i,j,bi,bj) = 0. _d 0 |
507 |
|
|
Qice1 (i,j,bi,bj) = 0. _d 0 |
508 |
|
|
Qice2 (i,j,bi,bj) = 0. _d 0 |
509 |
|
|
snowAge (i,j,bi,bj) = 0. _d 0 |
510 |
jmc |
1.8 |
ENDIF |
511 |
jmc |
1.1 |
ENDIF |
512 |
|
|
ENDDO |
513 |
|
|
ENDDO |
514 |
|
|
|
515 |
|
|
#ifdef ALLOW_DBUG_THSICE |
516 |
|
|
IF ( dBugFlag ) THEN |
517 |
|
|
DO j=1,sNy |
518 |
|
|
DO i=1,sNx |
519 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
520 |
|
|
WRITE(6,'(2(A,1P2E14.6))') |
521 |
|
|
c & 'ICE_ADV: area_b,a=', AREA(i,j,2,bi,bj),AREA(i,j,1,bi,bj) |
522 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: mFx=', gFld(i,j) |
523 |
|
|
ENDIF |
524 |
|
|
ENDDO |
525 |
|
|
ENDDO |
526 |
|
|
ENDIF |
527 |
|
|
#endif |
528 |
|
|
|
529 |
|
|
ELSE |
530 |
|
|
C--- if not multiDimAdvection |
531 |
|
|
|
532 |
|
|
WRITE(msgBuf,'(2A)') 'S/R THSICE_ADVDIFF: ', |
533 |
|
|
& 'traditional advection/diffusion not yet implemented' |
534 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
535 |
|
|
WRITE(msgBuf,'(2A)') ' ', |
536 |
|
|
& 'for ThSice variable Qice1, Qice2, SnowHeight. Sorry!' |
537 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
538 |
|
|
STOP 'ABNORMAL: END: S/R THSICE_ADVDIFF' |
539 |
|
|
|
540 |
|
|
C--- end if multiDimAdvection |
541 |
|
|
ENDIF |
542 |
|
|
|
543 |
jmc |
1.13 |
#ifdef OLD_THSICE_CALL_SEQUENCE |
544 |
jmc |
1.7 |
#ifdef ALLOW_DIAGNOSTICS |
545 |
|
|
IF ( useDiagnostics ) THEN |
546 |
|
|
CALL DIAGNOSTICS_FILL(iceMask,'SI_AdvFr',0,1,1,bi,bj,myThid) |
547 |
|
|
C- Ice-fraction weighted quantities: |
548 |
|
|
tmpFac = 1. _d 0 |
549 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
550 |
|
|
I iceHeight, iceMask,tmpFac,1,'SI_AdvHi', |
551 |
|
|
I 0,1,1,bi,bj,myThid) |
552 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
553 |
|
|
I snowHeight,iceMask,tmpFac,1,'SI_AdvHs', |
554 |
|
|
I 0,1,1,bi,bj,myThid) |
555 |
|
|
C- Ice-Volume weighted quantities: |
556 |
|
|
IF ( DIAGNOSTICS_IS_ON('SI_AdvQ1',myThid) .OR. |
557 |
|
|
& DIAGNOSTICS_IS_ON('SI_AdvQ2',myThid) ) THEN |
558 |
|
|
DO j=1,sNy |
559 |
|
|
DO i=1,sNx |
560 |
|
|
iceVol(i,j) = iceMask(i,j,bi,bj)*iceHeight(i,j,bi,bj) |
561 |
|
|
ENDDO |
562 |
|
|
ENDDO |
563 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
564 |
|
|
I Qice1(1-OLx,1-OLy,bi,bj), |
565 |
|
|
I iceVol,tmpFac,1,'SI_AdvQ1', |
566 |
|
|
I 0,1,2,bi,bj,myThid) |
567 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
568 |
|
|
I Qice2(1-OLx,1-OLy,bi,bj), |
569 |
|
|
I iceVol,tmpFac,1,'SI_AdvQ2', |
570 |
|
|
I 0,1,2,bi,bj,myThid) |
571 |
|
|
ENDIF |
572 |
|
|
ENDIF |
573 |
|
|
#endif /* ALLOW_DIAGNOSTICS */ |
574 |
jmc |
1.13 |
#endif /* OLD_THSICE_CALL_SEQUENCE */ |
575 |
jmc |
1.7 |
|
576 |
jmc |
1.1 |
#endif /* ALLOW_THSICE */ |
577 |
|
|
|
578 |
|
|
RETURN |
579 |
|
|
END |