1 |
jmc |
1.8 |
C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_advdiff.F,v 1.7 2007/08/27 13:20:57 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 |
|
|
#include "THSICE_2DYN.h" |
42 |
jmc |
1.3 |
#ifdef ALLOW_GENERIC_ADVDIFF |
43 |
|
|
# include "GAD.h" |
44 |
|
|
#endif |
45 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
46 |
|
|
# include "tamc.h" |
47 |
|
|
# include "tamc_keys.h" |
48 |
|
|
#endif |
49 |
jmc |
1.1 |
|
50 |
|
|
C !INPUT PARAMETERS: =================================================== |
51 |
|
|
C === Routine arguments === |
52 |
|
|
C uIce/vIce :: ice velocity on C-grid [m/s] |
53 |
|
|
C bi,bj :: Tile indices |
54 |
|
|
C myTime :: Current time in simulation (s) |
55 |
|
|
C myIter :: Current iteration number |
56 |
|
|
C myThid :: My Thread Id. number |
57 |
|
|
_RL uIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
58 |
|
|
_RL vIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
59 |
|
|
INTEGER bi,bj |
60 |
|
|
_RL myTime |
61 |
|
|
INTEGER myIter |
62 |
|
|
INTEGER myThid |
63 |
|
|
CEndOfInterface |
64 |
|
|
|
65 |
|
|
#ifdef ALLOW_THSICE |
66 |
|
|
C !LOCAL VARIABLES: ==================================================== |
67 |
|
|
C === Local variables === |
68 |
|
|
C i,j, :: Loop counters |
69 |
|
|
C uTrans :: sea-ice area transport, x direction |
70 |
|
|
C vTrans :: sea-ice area transport, y direction |
71 |
|
|
C uTrIce :: sea-ice volume transport, x direction |
72 |
|
|
C vTrIce :: sea-ice volume transport, y direction |
73 |
|
|
C afx :: horizontal advective flux, x direction |
74 |
|
|
C afy :: horizontal advective flux, y direction |
75 |
|
|
C iceFrc :: (new) sea-ice fraction |
76 |
|
|
C iceVol :: temporary array used in advection S/R |
77 |
|
|
C oldVol :: (old) sea-ice volume |
78 |
|
|
C msgBuf :: Informational/error meesage buffer |
79 |
|
|
INTEGER i, j |
80 |
|
|
LOGICAL thSIce_multiDimAdv |
81 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
82 |
|
|
|
83 |
|
|
_RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
84 |
|
|
_RL vTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
85 |
|
|
_RL uTrIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
86 |
|
|
_RL vTrIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
87 |
|
|
_RL afx (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
88 |
|
|
_RL afy (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
89 |
|
|
_RS maskOce (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
90 |
|
|
_RL iceFrc (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
91 |
|
|
_RL iceVol (1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
92 |
|
|
_RL oldVol (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 |
|
|
iicekey = (act1 + 1) + act2*max1 |
121 |
|
|
& + 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 |
|
|
dBugFlag = debugLevel.GE.debLevB |
134 |
|
|
|
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 |
|
|
C-- Initialisation (+ build oceanic mask) |
155 |
|
|
DO j=1-OLy,sNy+OLy |
156 |
|
|
DO i=1-OLx,sNx+OLx |
157 |
|
|
maskOce(i,j) = 0. _d 0 |
158 |
|
|
IF ( hOceMxL(i,j,bi,bj).GT.0. ) maskOce(i,j) = 1. |
159 |
|
|
iceVol(i,j) = 0. _d 0 |
160 |
|
|
uTrans(i,j) = 0. _d 0 |
161 |
|
|
vTrans(i,j) = 0. _d 0 |
162 |
|
|
uTrIce(i,j) = 0. _d 0 |
163 |
|
|
vTrIce(i,j) = 0. _d 0 |
164 |
|
|
oceFWfx(i,j,bi,bj) = 0. _d 0 |
165 |
|
|
oceSflx(i,j,bi,bj) = 0. _d 0 |
166 |
|
|
oceQnet(i,j,bi,bj) = 0. _d 0 |
167 |
|
|
ENDDO |
168 |
|
|
ENDDO |
169 |
|
|
|
170 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
171 |
jmc |
1.8 |
CADJ STORE iceHeight(i,j,bi,bj) |
172 |
heimbach |
1.5 |
CADJ & = comlev1_bibj, key=iicekey, byte=isbyte |
173 |
jmc |
1.8 |
CADJ STORE snowHeight(i,j,bi,bj) |
174 |
heimbach |
1.5 |
CADJ & = comlev1_bibj, key=iicekey, byte=isbyte |
175 |
|
|
#endif |
176 |
jmc |
1.1 |
IF ( thSIce_diffK .GT. 0. ) THEN |
177 |
|
|
CALL THSICE_DIFFUSION( |
178 |
|
|
I maskOce, |
179 |
|
|
U uIce, vIce, |
180 |
|
|
I bi, bj, myTime, myIter, myThid ) |
181 |
|
|
ENDIF |
182 |
|
|
|
183 |
|
|
IF ( thSIce_multiDimAdv ) THEN |
184 |
|
|
|
185 |
|
|
C- Calculate ice transports through tracer cell faces. |
186 |
|
|
DO j=1-Oly,sNy+Oly |
187 |
|
|
DO i=1-Olx+1,sNx+Olx |
188 |
|
|
uTrIce(i,j) = uIce(i,j)*_dyG(i,j,bi,bj) |
189 |
|
|
& *maskOce(i-1,j)*maskOce(i,j) |
190 |
|
|
ENDDO |
191 |
|
|
ENDDO |
192 |
|
|
DO j=1-Oly+1,sNy+Oly |
193 |
|
|
DO i=1-Olx,sNx+Olx |
194 |
|
|
vTrIce(i,j) = vIce(i,j)*_dxG(i,j,bi,bj) |
195 |
|
|
& *maskOce(i,j-1)*maskOce(i,j) |
196 |
|
|
ENDDO |
197 |
|
|
ENDDO |
198 |
|
|
|
199 |
|
|
C-- Fractional area |
200 |
|
|
DO j=1-Oly,sNy+Oly |
201 |
|
|
DO i=1-Olx,sNx+Olx |
202 |
|
|
iceFrc(i,j) = iceMask(i,j,bi,bj) |
203 |
|
|
ENDDO |
204 |
|
|
ENDDO |
205 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
206 |
|
|
CADJ STORE icevol(i,j) = comlev1_bibj, key=iicekey, byte=isbyte |
207 |
|
|
CADJ STORE utrice(i,j) = comlev1_bibj, key=iicekey, byte=isbyte |
208 |
|
|
CADJ STORE vtrice(i,j) = comlev1_bibj, key=iicekey, byte=isbyte |
209 |
|
|
#endif |
210 |
jmc |
1.1 |
CALL THSICE_ADVECTION( |
211 |
|
|
I GAD_SI_FRAC, thSIceAdvScheme, .TRUE., |
212 |
|
|
I uTrIce, vTrIce, maskOce, thSIce_deltaT, areaEpsil, |
213 |
|
|
U iceVol, iceFrc, |
214 |
|
|
O uTrans, vTrans, |
215 |
|
|
I bi, bj, myTime, myIter, myThid ) |
216 |
|
|
|
217 |
|
|
C-- Snow thickness |
218 |
|
|
DO j=1-Oly,sNy+Oly |
219 |
|
|
DO i=1-Olx,sNx+Olx |
220 |
|
|
iceVol(i,j) = iceMask(i,j,bi,bj)*rA(i,j,bi,bj) |
221 |
|
|
ENDDO |
222 |
|
|
ENDDO |
223 |
|
|
CALL THSICE_ADVECTION( |
224 |
|
|
I GAD_SI_HSNOW, thSIceAdvScheme, .FALSE., |
225 |
|
|
I uTrans, vTrans, maskOce, thSIce_deltaT, areaEpsil, |
226 |
|
|
U iceVol, snowHeight(1-Olx,1-Oly,bi,bj), |
227 |
|
|
O afx, afy, |
228 |
|
|
I bi, bj, myTime, myIter, myThid ) |
229 |
|
|
|
230 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
231 |
|
|
CADJ STORE iceHeight(i,j,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
232 |
|
|
CADJ STORE iceMask(i,j,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
233 |
|
|
#endif |
234 |
jmc |
1.1 |
C-- sea-ice Thickness |
235 |
|
|
DO j=1-Oly,sNy+Oly |
236 |
|
|
DO i=1-Olx,sNx+Olx |
237 |
|
|
iceVol(i,j) = iceMask(i,j,bi,bj)*rA(i,j,bi,bj) |
238 |
|
|
oldVol(i,j) = iceVol(i,j)*iceHeight(i,j,bi,bj) |
239 |
|
|
ENDDO |
240 |
|
|
ENDDO |
241 |
|
|
CALL THSICE_ADVECTION( |
242 |
|
|
I GAD_SI_HICE, thSIceAdvScheme, .FALSE., |
243 |
|
|
I uTrans, vTrans, maskOce, thSIce_deltaT, areaEpsil, |
244 |
|
|
U iceVol, iceHeight(1-Olx,1-Oly,bi,bj), |
245 |
|
|
O uTrIce, vTrIce, |
246 |
|
|
I bi, bj, myTime, myIter, myThid ) |
247 |
heimbach |
1.5 |
|
248 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
249 |
|
|
CADJ STORE qice2(i,j,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
250 |
|
|
CADJ STORE utrice(i,j) = comlev1_bibj, key=iicekey, byte=isbyte |
251 |
|
|
CADJ STORE vtrice(i,j) = comlev1_bibj, key=iicekey, byte=isbyte |
252 |
|
|
#endif |
253 |
|
|
|
254 |
jmc |
1.1 |
#ifdef ALLOW_DBUG_THSICE |
255 |
|
|
IF ( dBugFlag ) THEN |
256 |
|
|
sumVar1 = 0. |
257 |
|
|
sumVar2 = 0. |
258 |
|
|
DO j=1,sNy |
259 |
|
|
DO i=1,sNx |
260 |
|
|
C- Check that updated iceVol = iceFrc*rA |
261 |
|
|
tmpVar = ABS(iceVol(i,j)-iceFrc(i,j)*rA(i,j,bi,bj)) |
262 |
|
|
IF ( tmpVar.GT.0. ) THEN |
263 |
|
|
sumVar1 = sumVar1 + 1. |
264 |
|
|
sumVar2 = sumVar2 + tmpVar |
265 |
|
|
ENDIF |
266 |
|
|
IF ( tmpVar.GT.vol_Epsil ) THEN |
267 |
|
|
WRITE(6,'(A,2I4,2I2,I12)') 'ARE_ADV: ij,bij,it=', |
268 |
|
|
& i,j,bi,bj,myIter |
269 |
|
|
WRITE(6,'(2(A,1P2E14.6))') 'ARE_ADV: iceVol,iceFrc*rA=', |
270 |
|
|
& iceVol(i,j),iceFrc(i,j)*rA(i,j,bi,bj), |
271 |
|
|
& ' , diff=', tmpVar |
272 |
|
|
ENDIF |
273 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
274 |
|
|
WRITE(6,'(A,2I4,2I2,I12)') 'ICE_ADV: ij,bij,it=', |
275 |
|
|
& i,j,bi,bj,myIter |
276 |
|
|
WRITE(6,'(2(A,1P2E14.6))') |
277 |
|
|
& 'ICE_ADV: uIce=', uIce(i,j), uIce(i+1,j), |
278 |
|
|
& ' , vIce=', vIce(i,j), vIce(i,j+1) |
279 |
|
|
WRITE(6,'(2(A,1P2E14.6))') |
280 |
jmc |
1.7 |
& 'ICE_ADV: area_b,a=', iceMask(i,j,bi,bj), iceFrc(i,j), |
281 |
|
|
& ' , Heff_b,a=', oldVol(i,j)*recip_rA(i,j,bi,bj), |
282 |
|
|
& iceHeight(i,j,bi,bj)*iceFrc(i,j) |
283 |
jmc |
1.1 |
ENDIF |
284 |
|
|
ENDDO |
285 |
|
|
ENDDO |
286 |
|
|
IF ( sumVar2.GT.vol_Epsil ) |
287 |
|
|
& WRITE(6,'(A,2I2,I10,A,I4,1P2E14.6)') 'ARE_ADV: bij,it:', |
288 |
|
|
& bi,bj,myIter, ' ; Npts,aveDiff,Epsil=', |
289 |
|
|
& INT(sumVar1),sumVar2/sumVar1,vol_Epsil |
290 |
|
|
ENDIF |
291 |
|
|
#endif |
292 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
293 |
|
|
C-- Diagnosse advective fluxes (ice-fraction, snow & ice thickness): |
294 |
|
|
IF ( useDiagnostics ) THEN |
295 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_FRAC, myThid ) |
296 |
|
|
diagName = 'ADVx'//diagSufx |
297 |
|
|
CALL DIAGNOSTICS_FILL( uTrans, diagName, 1,1,2,bi,bj, myThid ) |
298 |
|
|
diagName = 'ADVy'//diagSufx |
299 |
|
|
CALL DIAGNOSTICS_FILL( vTrans, diagName, 1,1,2,bi,bj, myThid ) |
300 |
|
|
|
301 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_HSNOW, myThid ) |
302 |
|
|
diagName = 'ADVx'//diagSufx |
303 |
|
|
CALL DIAGNOSTICS_FILL( afx, diagName, 1,1,2,bi,bj, myThid ) |
304 |
|
|
diagName = 'ADVy'//diagSufx |
305 |
|
|
CALL DIAGNOSTICS_FILL( afy, diagName, 1,1,2,bi,bj, myThid ) |
306 |
|
|
|
307 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_HICE, myThid ) |
308 |
|
|
diagName = 'ADVx'//diagSufx |
309 |
|
|
CALL DIAGNOSTICS_FILL( uTrIce, diagName, 1,1,2,bi,bj, myThid ) |
310 |
|
|
diagName = 'ADVy'//diagSufx |
311 |
|
|
CALL DIAGNOSTICS_FILL( vTrIce, diagName, 1,1,2,bi,bj, myThid ) |
312 |
|
|
ENDIF |
313 |
|
|
#endif |
314 |
|
|
|
315 |
|
|
C-- Enthalpy in layer 1 |
316 |
|
|
DO j=1-Oly,sNy+Oly |
317 |
|
|
DO i=1-Olx,sNx+Olx |
318 |
|
|
iceVol(i,j) = oldVol(i,j) |
319 |
|
|
ENDDO |
320 |
|
|
ENDDO |
321 |
|
|
CALL THSICE_ADVECTION( |
322 |
|
|
I GAD_SI_QICE1, thSIceAdvScheme, .FALSE., |
323 |
|
|
I uTrIce, vTrIce, maskOce, thSIce_deltaT, vol_Epsil, |
324 |
|
|
U iceVol, Qice1(1-Olx,1-Oly,bi,bj), |
325 |
|
|
O afx, afy, |
326 |
|
|
I bi, bj, myTime, myIter, myThid ) |
327 |
|
|
#ifdef ALLOW_DBUG_THSICE |
328 |
|
|
IF ( dBugFlag ) THEN |
329 |
|
|
DO j=1,sNy |
330 |
|
|
DO i=1,sNx |
331 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
332 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: Qice1_b,a=', |
333 |
|
|
c & Qice1(i,j,bi,bj), |
334 |
|
|
c & ( iceFld(i,j) + thSIce_deltaT * gFld(i,j) |
335 |
|
|
c & ) * recip_heff(i,j) |
336 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: q1Fx=', gFld(i,j) |
337 |
|
|
ENDIF |
338 |
|
|
ENDDO |
339 |
|
|
ENDDO |
340 |
|
|
ENDIF |
341 |
|
|
#endif |
342 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
343 |
|
|
IF ( useDiagnostics ) THEN |
344 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_QICE1, myThid ) |
345 |
|
|
diagName = 'ADVx'//diagSufx |
346 |
|
|
CALL DIAGNOSTICS_FILL( afx, diagName, 1,1,2,bi,bj, myThid ) |
347 |
|
|
diagName = 'ADVy'//diagSufx |
348 |
|
|
CALL DIAGNOSTICS_FILL( afy, diagName, 1,1,2,bi,bj, myThid ) |
349 |
|
|
ENDIF |
350 |
|
|
#endif |
351 |
|
|
|
352 |
|
|
C-- Enthalpy in layer 2 |
353 |
|
|
DO j=1-Oly,sNy+Oly |
354 |
|
|
DO i=1-Olx,sNx+Olx |
355 |
|
|
iceVol(i,j) = oldVol(i,j) |
356 |
|
|
ENDDO |
357 |
|
|
ENDDO |
358 |
|
|
CALL THSICE_ADVECTION( |
359 |
|
|
I GAD_SI_QICE2, thSIceAdvScheme, .FALSE., |
360 |
|
|
I uTrIce, vTrIce, maskOce, thSIce_deltaT, vol_Epsil, |
361 |
|
|
U iceVol, Qice2(1-Olx,1-Oly,bi,bj), |
362 |
|
|
O afx, afy, |
363 |
|
|
I bi, bj, myTime, myIter, myThid ) |
364 |
|
|
#ifdef ALLOW_DBUG_THSICE |
365 |
|
|
IF ( dBugFlag ) THEN |
366 |
|
|
sumVar1 = 0. |
367 |
|
|
sumVar2 = 0. |
368 |
|
|
DO j=1,sNy |
369 |
|
|
DO i=1,sNx |
370 |
|
|
C- Check that updated iceVol = Hic*Frc*rA |
371 |
|
|
tmpVar = ABS(iceVol(i,j) |
372 |
|
|
& -iceHeight(i,j,bi,bj)*iceFrc(i,j)*rA(i,j,bi,bj)) |
373 |
|
|
IF ( tmpVar.GT.0. ) THEN |
374 |
|
|
sumVar1 = sumVar1 + 1. |
375 |
|
|
sumVar2 = sumVar2 + tmpVar |
376 |
|
|
ENDIF |
377 |
|
|
IF ( tmpVar.GT.vol_Epsil ) THEN |
378 |
|
|
WRITE(6,'(A,2I4,2I2,I12)') 'VOL_ADV: ij,bij,it=', |
379 |
|
|
& i,j,bi,bj,myIter |
380 |
|
|
WRITE(6,'(2(A,1P2E14.6))') 'VOL_ADV: iceVol,Hic*Frc*rA=', |
381 |
|
|
& iceVol(i,j),iceHeight(i,j,bi,bj)*iceFrc(i,j)*rA(i,j,bi,bj), |
382 |
|
|
& ' , diff=', tmpVar |
383 |
|
|
ENDIF |
384 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
385 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: Qice2_b,a=', |
386 |
|
|
c & Qice2(i,j,bi,bj), |
387 |
|
|
c & ( iceFld(i,j) + thSIce_deltaT * gFld(i,j) |
388 |
|
|
c & ) * recip_heff(i,j) |
389 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: q2Fx=', gFld(i,j) |
390 |
|
|
ENDIF |
391 |
|
|
ENDDO |
392 |
|
|
ENDDO |
393 |
|
|
IF ( sumVar2.GT.vol_Epsil ) |
394 |
|
|
& WRITE(6,'(A,2I2,I10,A,I4,1P2E14.6)') 'VOL_ADV: bij,it:', |
395 |
|
|
& bi,bj,myIter, ' ; Npts,aveDiff,Epsil=', |
396 |
|
|
& INT(sumVar1),sumVar2/sumVar1,vol_Epsil |
397 |
|
|
ENDIF |
398 |
|
|
#endif |
399 |
|
|
#ifdef ALLOW_DIAGNOSTICS |
400 |
|
|
IF ( useDiagnostics ) THEN |
401 |
|
|
diagSufx = THSICE_DIAG_SUFX( GAD_SI_QICE2, myThid ) |
402 |
|
|
diagName = 'ADVx'//diagSufx |
403 |
|
|
CALL DIAGNOSTICS_FILL( afx, diagName, 1,1,2,bi,bj, myThid ) |
404 |
|
|
diagName = 'ADVy'//diagSufx |
405 |
|
|
CALL DIAGNOSTICS_FILL( afy, diagName, 1,1,2,bi,bj, myThid ) |
406 |
|
|
ENDIF |
407 |
|
|
#endif |
408 |
|
|
|
409 |
heimbach |
1.5 |
#ifdef ALLOW_AUTODIFF_TAMC |
410 |
jmc |
1.8 |
CADJ STORE iceHeight(:,:,bi,bj) = |
411 |
heimbach |
1.5 |
CADJ & comlev1_bibj, key=iicekey, byte=isbyte |
412 |
jmc |
1.8 |
CADJ STORE snowHeight(:,:,bi,bj) = |
413 |
heimbach |
1.5 |
CADJ & comlev1_bibj, key=iicekey, byte=isbyte |
414 |
jmc |
1.8 |
CADJ STORE iceFrc(:,:) = |
415 |
heimbach |
1.5 |
CADJ & comlev1_bibj, key=iicekey, byte=isbyte |
416 |
|
|
#endif |
417 |
|
|
|
418 |
jmc |
1.4 |
C-- Update Ice Fraction: ensure that fraction is > iceMaskMin & < 1 |
419 |
|
|
C and adjust Ice thickness and snow thickness accordingly |
420 |
jmc |
1.1 |
DO j=1,sNy |
421 |
|
|
DO i=1,sNx |
422 |
jmc |
1.4 |
IF ( iceFrc(i,j) .GT. 1. _d 0 ) THEN |
423 |
jmc |
1.7 |
c IF ( dBug(i,j,bi,bj) ) |
424 |
jmc |
1.1 |
iceMask(i,j,bi,bj) = 1. _d 0 |
425 |
jmc |
1.4 |
iceHeight(i,j,bi,bj) = iceHeight(i,j,bi,bj) *iceFrc(i,j) |
426 |
jmc |
1.1 |
snowHeight(i,j,bi,bj) = snowHeight(i,j,bi,bj)*iceFrc(i,j) |
427 |
jmc |
1.4 |
ELSEIF ( iceFrc(i,j) .LT. iceMaskMin ) THEN |
428 |
jmc |
1.7 |
c IF ( dBug(i,j,bi,bj) ) |
429 |
jmc |
1.4 |
iceMask(i,j,bi,bj) = iceMaskMin |
430 |
|
|
iceHeight(i,j,bi,bj) = iceHeight(i,j,bi,bj) |
431 |
|
|
& *iceFrc(i,j)*r_minArea |
432 |
jmc |
1.1 |
snowHeight(i,j,bi,bj) = snowHeight(i,j,bi,bj) |
433 |
|
|
& *iceFrc(i,j)*r_minArea |
434 |
jmc |
1.4 |
ELSE |
435 |
jmc |
1.1 |
iceMask(i,j,bi,bj) = iceFrc(i,j) |
436 |
jmc |
1.4 |
ENDIF |
437 |
|
|
ENDDO |
438 |
|
|
ENDDO |
439 |
jmc |
1.8 |
C- adjust sea-ice state if ice is too thin. |
440 |
jmc |
1.4 |
DO j=1,sNy |
441 |
|
|
DO i=1,sNx |
442 |
jmc |
1.6 |
IF ( iceHeight(i,j,bi,bj).LT.hIceMin ) THEN |
443 |
jmc |
1.8 |
iceVol(i,j) = iceMask(i,j,bi,bj)*iceHeight(i,j,bi,bj) |
444 |
|
|
c IF ( dBug(i,j,bi,bj) ) |
445 |
|
|
IF ( iceVol(i,j).GE.hIceMin*iceMaskMin ) THEN |
446 |
|
|
iceMask(i,j,bi,bj) = iceVol(i,j)/hIceMin |
447 |
|
|
snowHeight(i,j,bi,bj) = snowHeight(i,j,bi,bj) |
448 |
|
|
& *hIceMin/iceHeight(i,j,bi,bj) |
449 |
|
|
iceHeight(i,j,bi,bj) = hIceMin |
450 |
|
|
ELSE |
451 |
jmc |
1.2 |
C- Not enough ice, melt the tiny amount of snow & ice: |
452 |
jmc |
1.4 |
C and return fresh-water, salt & energy to the ocean (flx > 0 = into ocean) |
453 |
jmc |
1.2 |
C- - Note: using 1rst.Order Upwind, I can get the same results as when |
454 |
|
|
C using seaice_advdiff (with SEAICEadvScheme=1) providing I comment |
455 |
|
|
C out the following lines (and then loose conservation). |
456 |
|
|
C- - |
457 |
jmc |
1.4 |
oceFWfx(i,j,bi,bj) = ( rhos*snowHeight(i,j,bi,bj) |
458 |
|
|
& +rhoi*iceHeight(i,j,bi,bj) |
459 |
|
|
& )*iceMask(i,j,bi,bj)/thSIce_deltaT |
460 |
jmc |
1.6 |
oceSflx(i,j,bi,bj) = rhoi*iceHeight(i,j,bi,bj)*saltIce |
461 |
jmc |
1.4 |
& *iceMask(i,j,bi,bj)/thSIce_deltaT |
462 |
|
|
oceQnet(i,j,bi,bj) = -( rhos*snowHeight(i,j,bi,bj)*qsnow |
463 |
|
|
& +rhoi*iceHeight(i,j,bi,bj) |
464 |
|
|
& *( Qice1(i,j,bi,bj) |
465 |
|
|
& +Qice2(i,j,bi,bj) )*0.5 _d 0 |
466 |
|
|
& )*iceMask(i,j,bi,bj)/thSIce_deltaT |
467 |
jmc |
1.2 |
C- - |
468 |
jmc |
1.1 |
c flx2oc (i,j) = flx2oc (i,j) + |
469 |
|
|
c frw2oc (i,j) = frw2oc (i,j) + |
470 |
|
|
c fsalt (i,j) = fsalt (i,j) + |
471 |
|
|
iceMask (i,j,bi,bj) = 0. _d 0 |
472 |
|
|
iceHeight (i,j,bi,bj) = 0. _d 0 |
473 |
|
|
snowHeight(i,j,bi,bj) = 0. _d 0 |
474 |
|
|
Qice1 (i,j,bi,bj) = 0. _d 0 |
475 |
|
|
Qice2 (i,j,bi,bj) = 0. _d 0 |
476 |
|
|
snowAge (i,j,bi,bj) = 0. _d 0 |
477 |
jmc |
1.8 |
ENDIF |
478 |
jmc |
1.1 |
ENDIF |
479 |
|
|
ENDDO |
480 |
|
|
ENDDO |
481 |
|
|
|
482 |
|
|
#ifdef ALLOW_DBUG_THSICE |
483 |
|
|
IF ( dBugFlag ) THEN |
484 |
|
|
DO j=1,sNy |
485 |
|
|
DO i=1,sNx |
486 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
487 |
|
|
WRITE(6,'(2(A,1P2E14.6))') |
488 |
|
|
c & 'ICE_ADV: area_b,a=', AREA(i,j,2,bi,bj),AREA(i,j,1,bi,bj) |
489 |
|
|
c WRITE(6,'(A,1P4E14.6)') 'ICE_ADV: mFx=', gFld(i,j) |
490 |
|
|
ENDIF |
491 |
|
|
ENDDO |
492 |
|
|
ENDDO |
493 |
|
|
ENDIF |
494 |
|
|
#endif |
495 |
|
|
|
496 |
|
|
ELSE |
497 |
|
|
C--- if not multiDimAdvection |
498 |
|
|
|
499 |
|
|
WRITE(msgBuf,'(2A)') 'S/R THSICE_ADVDIFF: ', |
500 |
|
|
& 'traditional advection/diffusion not yet implemented' |
501 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
502 |
|
|
WRITE(msgBuf,'(2A)') ' ', |
503 |
|
|
& 'for ThSice variable Qice1, Qice2, SnowHeight. Sorry!' |
504 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
505 |
|
|
STOP 'ABNORMAL: END: S/R THSICE_ADVDIFF' |
506 |
|
|
|
507 |
|
|
C--- end if multiDimAdvection |
508 |
|
|
ENDIF |
509 |
|
|
|
510 |
jmc |
1.7 |
#ifdef ALLOW_DIAGNOSTICS |
511 |
|
|
IF ( useDiagnostics ) THEN |
512 |
|
|
CALL DIAGNOSTICS_FILL(iceMask,'SI_AdvFr',0,1,1,bi,bj,myThid) |
513 |
|
|
C- Ice-fraction weighted quantities: |
514 |
|
|
tmpFac = 1. _d 0 |
515 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
516 |
|
|
I iceHeight, iceMask,tmpFac,1,'SI_AdvHi', |
517 |
|
|
I 0,1,1,bi,bj,myThid) |
518 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
519 |
|
|
I snowHeight,iceMask,tmpFac,1,'SI_AdvHs', |
520 |
|
|
I 0,1,1,bi,bj,myThid) |
521 |
|
|
C- Ice-Volume weighted quantities: |
522 |
|
|
IF ( DIAGNOSTICS_IS_ON('SI_AdvQ1',myThid) .OR. |
523 |
|
|
& DIAGNOSTICS_IS_ON('SI_AdvQ2',myThid) ) THEN |
524 |
|
|
DO j=1,sNy |
525 |
|
|
DO i=1,sNx |
526 |
|
|
iceVol(i,j) = iceMask(i,j,bi,bj)*iceHeight(i,j,bi,bj) |
527 |
|
|
ENDDO |
528 |
|
|
ENDDO |
529 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
530 |
|
|
I Qice1(1-OLx,1-OLy,bi,bj), |
531 |
|
|
I iceVol,tmpFac,1,'SI_AdvQ1', |
532 |
|
|
I 0,1,2,bi,bj,myThid) |
533 |
|
|
CALL DIAGNOSTICS_FRACT_FILL( |
534 |
|
|
I Qice2(1-OLx,1-OLy,bi,bj), |
535 |
|
|
I iceVol,tmpFac,1,'SI_AdvQ2', |
536 |
|
|
I 0,1,2,bi,bj,myThid) |
537 |
|
|
ENDIF |
538 |
|
|
ENDIF |
539 |
|
|
#endif /* ALLOW_DIAGNOSTICS */ |
540 |
|
|
|
541 |
jmc |
1.1 |
#endif /* ALLOW_THSICE */ |
542 |
|
|
|
543 |
|
|
RETURN |
544 |
|
|
END |