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

Annotation of /MITgcm/pkg/thsice/thsice_solve4temp.F

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


Revision 1.14 - (hide annotations) (download)
Mon Apr 16 22:38:24 2007 UTC (17 years, 1 month ago) by heimbach
Branch: MAIN
Changes since 1.13: +43 -1 lines
First set of modifs for TAF-ing thsice.

1 heimbach 1.14 C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_solve4temp.F,v 1.13 2007/04/09 17:44:13 jscott Exp $
2 jmc 1.1 C $Name: $
3    
4     #include "THSICE_OPTIONS.h"
5    
6     CBOP
7     C !ROUTINE: THSICE_SOLVE4TEMP
8     C !INTERFACE:
9     SUBROUTINE THSICE_SOLVE4TEMP(
10 jmc 1.8 I bi, bj, siLo, siHi, sjLo, sjHi,
11 mlosch 1.9 I iMin,iMax, jMin,jMax, dBugFlag,
12     I useBulkForce, useEXF,
13 jmc 1.8 I iceMask, hIce, hSnow, tFrz, flxExSW,
14     U flxSW, tSrf, qIc1, qIc2,
15     O tIc1, tIc2, dTsrf,
16     O sHeat, flxCnB, flxAtm, evpAtm,
17     I myTime, myIter, myThid )
18 jmc 1.1 C !DESCRIPTION: \bv
19     C *==========================================================*
20     C | S/R THSICE_SOLVE4TEMP
21     C *==========================================================*
22     C | Solve (implicitly) for sea-ice and surface temperature
23     C *==========================================================*
24     C \ev
25    
26 jmc 1.8 C ADAPTED FROM:
27     C LANL CICE.v2.0.2
28     C-----------------------------------------------------------------------
29     C.. thermodynamics (vertical physics) based on M. Winton 3-layer model
30     C.. See Bitz, C. M. and W. H. Lipscomb, 1999: "An energy-conserving
31     C.. thermodynamic sea ice model for climate study." J. Geophys.
32     C.. Res., 104, 15669 - 15677.
33     C.. Winton, M., 1999: "A reformulated three-layer sea ice model."
34     C.. Submitted to J. Atmos. Ocean. Technol.
35     C.. authors Elizabeth C. Hunke and William Lipscomb
36     C.. Fluid Dynamics Group, Los Alamos National Laboratory
37     C-----------------------------------------------------------------------
38     Cc****subroutine thermo_winton(n,fice,fsnow,dqice,dTsfc)
39     C.. Compute temperature change using Winton model with 2 ice layers, of
40     C.. which only the top layer has a variable heat capacity.
41    
42 jmc 1.1 C !USES:
43     IMPLICIT NONE
44    
45     C == Global variables ===
46 jmc 1.5 #include "EEPARAMS.h"
47 jmc 1.1 #include "THSICE_SIZE.h"
48     #include "THSICE_PARAMS.h"
49 heimbach 1.14 #ifdef ALLOW_AUTODIFF_TAMC
50     # include "SIZE.h"
51     # include "tamc.h"
52     # include "tamc_keys.h"
53     #endif
54 jmc 1.1
55     C !INPUT/OUTPUT PARAMETERS:
56     C == Routine Arguments ==
57 jmc 1.8 C siLo,siHi :: size of input/output array: 1rst dim. lower,higher bounds
58     C sjLo,sjHi :: size of input/output array: 2nd dim. lower,higher bounds
59     C bi,bj :: tile indices
60     C iMin,iMax :: computation domain: 1rst index range
61     C jMin,jMax :: computation domain: 2nd index range
62     C dBugFlag :: allow to print debugging stuff (e.g. on 1 grid point).
63 mlosch 1.9 C useBulkForce:: use surf. fluxes from bulk-forcing external S/R
64     C useEXF :: use surf. fluxes from exf external S/R
65 jmc 1.8 C--- Input:
66     C iceMask :: sea-ice fractional mask [0-1]
67     C hIce (hi) :: ice height [m]
68     C hSnow (hs) :: snow height [m]
69     C tFrz (Tf) :: sea-water freezing temperature [oC] (function of S)
70     C flxExSW (=) :: surf. heat flux (+=down) except SW, function of surf. temp Ts:
71     C 0: Flx(Ts=0) ; 1: Flx(Ts=Ts^n) ; 2: d.Flx/dTs(Ts=Ts^n)
72     C--- Modified (input&output):
73     C flxSW (netSW) :: net Short-Wave flux (+=down) [W/m2]: input= at surface
74     C (=) :: output= below sea-ice, into the ocean
75     C tSrf (Tsf) :: surface (ice or snow) temperature
76     C qIc1 (qicen) :: ice enthalpy (J/kg), 1rst level
77     C qIc2 (qicen) :: ice enthalpy (J/kg), 2nd level
78     C--- Output
79     C tIc1 (Tice) :: temperature of ice layer 1 [oC]
80     C tIc2 (Tice) :: temperature of ice layer 2 [oC]
81     C dTsrf (dTsf) :: surf. temp adjusment: Ts^n+1 - Ts^n
82     C sHeat(sHeating):: surf heating flux left to melt snow or ice (= Atmos-conduction)
83     C flxCnB (=) :: heat flux conducted through the ice to bottom surface
84     C flxAtm (=) :: net flux of energy from the atmosphere [W/m2] (+=down)
85     C without snow precip. (energy=0 for liquid water at 0.oC)
86     C evpAtm (=) :: evaporation to the atmosphere [kg/m2/s] (>0 if evaporate)
87     C--- Input:
88     C myTime :: current Time of simulation [s]
89     C myIter :: current Iteration number in simulation
90     C myThid :: my Thread Id number
91     INTEGER siLo, siHi, sjLo, sjHi
92     INTEGER bi,bj
93     INTEGER iMin, iMax
94     INTEGER jMin, jMax
95     LOGICAL dBugFlag
96 mlosch 1.9 LOGICAL useBulkForce
97     LOGICAL useEXF
98 jmc 1.8 _RL iceMask(siLo:siHi,sjLo:sjHi)
99     _RL hIce (siLo:siHi,sjLo:sjHi)
100     _RL hSnow (siLo:siHi,sjLo:sjHi)
101     _RL tFrz (siLo:siHi,sjLo:sjHi)
102     _RL flxExSW(iMin:iMax,jMin:jMax,0:2)
103     _RL flxSW (siLo:siHi,sjLo:sjHi)
104     _RL tSrf (siLo:siHi,sjLo:sjHi)
105     _RL qIc1 (siLo:siHi,sjLo:sjHi)
106     _RL qIc2 (siLo:siHi,sjLo:sjHi)
107     _RL tIc1 (siLo:siHi,sjLo:sjHi)
108     _RL tIc2 (siLo:siHi,sjLo:sjHi)
109     c _RL dTsrf (siLo:siHi,sjLo:sjHi)
110     _RL dTsrf (iMin:iMax,jMin:jMax)
111     _RL sHeat (siLo:siHi,sjLo:sjHi)
112     _RL flxCnB (siLo:siHi,sjLo:sjHi)
113     _RL flxAtm (siLo:siHi,sjLo:sjHi)
114     _RL evpAtm (siLo:siHi,sjLo:sjHi)
115     _RL myTime
116     INTEGER myIter
117     INTEGER myThid
118     CEOP
119    
120     #ifdef ALLOW_THSICE
121     C !LOCAL VARIABLES:
122     C--- local copy of input/output argument list variables (see description above)
123     c _RL flxExcSw(0:2)
124 jmc 1.1 _RL Tf
125     _RL hi
126     _RL hs
127 jmc 1.8 _RL netSW
128 jmc 1.1 _RL Tsf
129     _RL qicen(nlyr)
130     _RL Tice (nlyr)
131 jmc 1.8 c _RL sHeating
132     c _RL flxCnB
133 jmc 1.1 _RL dTsf
134 jmc 1.8 c _RL flxAtm
135     c _RL evpAtm
136 jmc 1.1
137     C == Local Variables ==
138 jmc 1.8 INTEGER i,j
139 jmc 1.6 INTEGER k, iterMax
140 jmc 1.1
141     _RL frsnow ! fractional snow cover
142     _RL fswpen ! SW penetrating beneath surface (W m-2)
143     _RL fswdn ! SW absorbed at surface (W m-2)
144     _RL fswint ! SW absorbed in ice (W m-2)
145     _RL fswocn ! SW passed through ice to ocean (W m-2)
146     _RL flxExceptSw ! net surface heat flux, except short-wave (W/m2)
147     C evap :: evaporation over snow/ice [kg/m2/s] (>0 if evaporate)
148     C dEvdT :: derivative of evap. with respect to Tsf [kg/m2/s/K]
149     _RL evap, dEvdT
150     _RL flx0 ! net surf heat flux, from Atmos. to sea-ice (W m-2)
151     _RL fct ! heat conducted to top surface
152     _RL df0dT ! deriv of flx0 wrt Tsf (W m-2 deg-1)
153     _RL k12, k32 ! thermal conductivity terms
154     _RL a10, b10 ! coefficients in quadratic eqn for T1
155     _RL a1, b1, c1 ! coefficients in quadratic eqn for T1
156     c _RL Tsf_start ! old value of Tsf
157     _RL dt ! timestep
158 jmc 1.8 INTEGER iceornot
159 mlosch 1.9 LOGICAL useBlkFlx
160 jmc 1.1
161 jmc 1.8 C- define grid-point location where to print debugging values
162     #include "THSICE_DEBUG.h"
163 jmc 1.1
164 jmc 1.7 1010 FORMAT(A,I3,3F11.6)
165     1020 FORMAT(A,1P4E14.6)
166 jmc 1.1
167 jmc 1.8 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
168    
169 heimbach 1.14 #ifdef ALLOW_AUTODIFF_TAMC
170     act1 = bi - myBxLo(myThid)
171     max1 = myBxHi(myThid) - myBxLo(myThid) + 1
172     act2 = bj - myByLo(myThid)
173     max2 = myByHi(myThid) - myByLo(myThid) + 1
174     act3 = myThid - 1
175     max3 = nTx*nTy
176     act4 = ikey_dynamics - 1
177     #endif /* ALLOW_AUTODIFF_TAMC */
178    
179 mlosch 1.9 useBlkFlx = useEXF .OR. useBulkForce
180    
181 jscott 1.13 dt = thSIce_dtTemp
182 jmc 1.8 DO j = jMin, jMax
183     DO i = iMin, iMax
184 heimbach 1.14 #ifdef ALLOW_AUTODIFF_TAMC
185     ikey_1 = i
186     & + sNx*(j-1)
187     & + sNx*sNy*act1
188     & + sNx*sNy*max1*act2
189     & + sNx*sNy*max1*max2*act3
190     & + sNx*sNy*max1*max2*max3*act4
191     #endif /* ALLOW_AUTODIFF_TAMC */
192     C--
193     #ifdef ALLOW_AUTODIFF_TAMC
194     CADJ STORE df0dt = comlev1_thsice_1, key=ikey_1
195     CADJ STORE flxsw(i,j) = comlev1_thsice_1, key=ikey_1
196     CADJ STORE qic1(i,j) = comlev1_thsice_1, key=ikey_1
197     CADJ STORE qic2(i,j) = comlev1_thsice_1, key=ikey_1
198     CADJ STORE tsrf(i,j) = comlev1_thsice_1, key=ikey_1
199     #endif
200 jmc 1.8 IF ( iceMask(i,j).GT.0. _d 0) THEN
201     hi = hIce(i,j)
202     hs = hSnow(i,j)
203     Tf = tFrz(i,j)
204     netSW = flxSW(i,j)
205     Tsf = tSrf(i,j)
206     qicen(1)= qIc1(i,j)
207     qicen(2)= qIc2(i,j)
208     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
209     #ifdef ALLOW_DBUG_THSICE
210     IF ( dBug(i,j,bi,bj) ) WRITE(6,'(A,2I4,2I2)')
211     & 'ThSI_SOLVE4T: i,j=',i,j,bi,bj
212     #endif
213 jmc 1.6 IF ( hi.LT.himin ) THEN
214 jmc 1.1 C If hi < himin, melt the ice.
215 jmc 1.3 STOP 'THSICE_SOLVE4TEMP: should not enter if hi<himin'
216 jmc 1.6 ENDIF
217 jmc 1.1
218     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
219    
220     C fractional snow cover
221     frsnow = 0. _d 0
222 jmc 1.6 IF (hs .GT. 0. _d 0) frsnow = 1. _d 0
223 jmc 1.1
224     C Compute SW flux absorbed at surface and penetrating to layer 1.
225 jmc 1.8 fswpen = netSW * (1. _d 0 - frsnow) * i0
226 jmc 1.1 fswocn = fswpen * exp(-ksolar*hi)
227     fswint = fswpen - fswocn
228    
229 jmc 1.8 fswdn = netSW - fswpen
230 jmc 1.1
231     C Compute conductivity terms at layer interfaces.
232    
233     k12 = 4. _d 0*kice*ksnow / (ksnow*hi + 4. _d 0*kice*hs)
234     k32 = 2. _d 0*kice / hi
235    
236     C compute ice temperatures
237     a1 = cpice
238     b1 = qicen(1) + (cpwater-cpice )*Tmlt1 - Lfresh
239     c1 = Lfresh * Tmlt1
240 jmc 1.6 Tice(1) = 0.5 _d 0 *(-b1 - SQRT(b1*b1-4. _d 0*a1*c1))/a1
241 jmc 1.1 Tice(2) = (Lfresh-qicen(2)) / cpice
242    
243 jmc 1.12 IF (Tice(1).GT.0. _d 0 ) THEN
244     WRITE (standardMessageUnit,'(A,I12,1PE14.6)')
245     & ' BBerr: Tice(1) > 0 ; it=', myIter, qicen(1)
246 mlosch 1.10 WRITE (standardMessageUnit,'(A,4I5,2F11.4)')
247 jmc 1.12 & ' BBerr: i,j,bi,bj,Tice = ',i,j,bi,bj,Tice
248 mlosch 1.10 ENDIF
249     IF ( Tice(2).GT.0. _d 0) THEN
250 jmc 1.12 WRITE (standardMessageUnit,'(A,I12,1PE14.6)')
251     & ' BBerr: Tice(2) > 0 ; it=', myIter, qicen(2)
252 mlosch 1.10 WRITE (standardMessageUnit,'(A,4I5,2F11.4)')
253 jmc 1.12 & ' BBerr: i,j,bi,bj,Tice = ',i,j,bi,bj,Tice
254 jmc 1.6 ENDIF
255 jmc 1.8 #ifdef ALLOW_DBUG_THSICE
256     IF ( dBug(i,j,bi,bj) ) WRITE(6,1010)
257     & 'ThSI_SOLVE4T: k, Ts, Tice=',0,Tsf,Tice
258     #endif
259 jmc 1.1
260     C Compute coefficients used in quadratic formula.
261    
262     a10 = rhoi*cpice *hi/(2. _d 0*dt) +
263     & k32 * (4. _d 0*dt*k32 + rhoi*cpice *hi)
264     & / (6. _d 0*dt*k32 + rhoi*cpice *hi)
265     b10 = -hi*
266     & (rhoi*cpice*Tice(1)+rhoi*Lfresh*Tmlt1/Tice(1))
267     & /(2. _d 0*dt)
268     & - k32 * (4. _d 0*dt*k32*Tf+rhoi*cpice *hi*Tice(2))
269     & / (6. _d 0*dt*k32 + rhoi*cpice *hi) - fswint
270     c1 = rhoi*Lfresh*hi*Tmlt1 / (2. _d 0*dt)
271    
272 jmc 1.4 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
273 jmc 1.1 C Compute new surface and internal temperatures; iterate until
274     C Tsfc converges.
275    
276 jmc 1.6 IF ( useBlkFlx ) THEN
277     iterMax = nitMaxTsf
278     ELSE
279     iterMax = 1
280     ENDIF
281     dTsf = Terrmax
282    
283 jmc 1.1 C ----- begin iteration -----
284 jmc 1.6 DO k = 1,iterMax
285 heimbach 1.14
286     #ifdef ALLOW_AUTODIFF_TAMC
287     ikey_3 = (ikey_1-1)*MaxTsf + k
288     #endif
289    
290     #ifdef ALLOW_AUTODIFF_TAMC
291     CADJ STORE dtsf = comlev1_thsice_3, key=ikey_3
292     #endif
293 jmc 1.6 IF ( ABS(dTsf).GE.Terrmax ) THEN
294 jmc 1.1
295     C Save temperatures at start of iteration.
296     c Tsf_start = Tsf
297    
298     IF ( useBlkFlx ) THEN
299     C Compute top surface flux.
300 jmc 1.6 IF (hs.GT.3. _d -1) THEN
301 jmc 1.1 iceornot=2
302 jmc 1.6 ELSE
303 jmc 1.1 iceornot=1
304 jmc 1.6 ENDIF
305 mlosch 1.9 IF ( useBulkForce ) THEN
306     CALL THSICE_GET_BULKF(
307     I iceornot, Tsf,
308     O flxExceptSw, df0dT, evap, dEvdT,
309     I i,j,bi,bj,myThid )
310     ELSEIF ( useEXF ) THEN
311     CALL THSICE_GET_EXF (
312     I iceornot, Tsf,
313     O flxExceptSw, df0dT, evap, dEvdT,
314     I i,j,bi,bj,myThid )
315     ENDIF
316 jmc 1.1 ELSE
317 jmc 1.8 flxExceptSw = flxExSW(i,j,1)
318     df0dT = flxExSW(i,j,2)
319 jmc 1.1 ENDIF
320 jmc 1.7 flx0 = fswdn + flxExceptSw
321 jmc 1.8 #ifdef ALLOW_DBUG_THSICE
322     IF ( dBug(i,j,bi,bj) ) WRITE(6,1020)
323     & 'ThSI_SOLVE4T: flx0,df0dT,k12,D=', flx0,df0dT,k12,k12-df0dT
324     #endif
325 jmc 1.1
326     C Compute new top layer and surface temperatures.
327     C If Tsfc is computed to be > 0 C, fix Tsfc = 0 and recompute T1
328 jmc 1.7 C with different coefficients.
329 jmc 1.1
330 heimbach 1.14 #ifdef ALLOW_AUTODIFF_TAMC
331     CADJ STORE tsf = comlev1_thsice_3, key=ikey_3
332     #endif
333 jmc 1.1 a1 = a10 - k12*df0dT / (k12-df0dT)
334     b1 = b10 - k12*(flx0-df0dT*Tsf) / (k12-df0dT)
335 jmc 1.6 Tice(1) = -(b1 + SQRT(b1*b1-4. _d 0*a1*c1))/(2. _d 0*a1)
336 jmc 1.1 dTsf = (flx0 + k12*(Tice(1)-Tsf)) / (k12-df0dT)
337     Tsf = Tsf + dTsf
338 jmc 1.6 IF (Tsf .GT. 0. _d 0) THEN
339 jmc 1.8 #ifdef ALLOW_DBUG_THSICE
340     IF ( dBug(i,j,bi,bj) ) WRITE(6,1010)
341     & 'ThSI_SOLVE4T: k,ts,t1,dTs=', k,Tsf,Tice(1),dTsf
342     #endif
343 jmc 1.1 a1 = a10 + k12
344     b1 = b10 ! note b1 = b10 - k12*Tf0
345 jmc 1.6 Tice(1) = (-b1 - SQRT(b1*b1-4. _d 0*a1*c1))/(2. _d 0*a1)
346 jmc 1.1 Tsf = 0. _d 0
347     IF ( useBlkFlx ) THEN
348 jmc 1.6 IF (hs.GT.3. _d -1) THEN
349 jmc 1.1 iceornot=2
350 jmc 1.6 ELSE
351 jmc 1.1 iceornot=1
352 jmc 1.6 ENDIF
353 mlosch 1.9 IF ( useBulkForce ) THEN
354     CALL THSICE_GET_BULKF(
355     I iceornot, Tsf,
356     O flxExceptSw, df0dT, evap, dEvdT,
357     I i,j,bi,bj,myThid )
358     ELSEIF ( useEXF ) THEN
359     CALL THSICE_GET_EXF (
360     I iceornot, Tsf,
361     O flxExceptSw, df0dT, evap, dEvdT,
362     I i,j,bi,bj,myThid )
363     ENDIF
364 jmc 1.1 dTsf = 0. _d 0
365     ELSE
366 jmc 1.8 flxExceptSw = flxExSW(i,j,0)
367 jmc 1.1 dTsf = 1000.
368     df0dT = 0.
369     ENDIF
370 jmc 1.7 flx0 = fswdn + flxExceptSw
371 jmc 1.6 ENDIF
372 jmc 1.1
373     C Check for convergence. If no convergence, then repeat.
374     C
375 jmc 1.7 C Convergence test: Make sure Tsfc has converged, within prescribed error.
376 jmc 1.1 C (Energy conservation is guaranteed within machine roundoff, even
377     C if Tsfc has not converged.)
378     C If no convergence, then repeat.
379    
380 jmc 1.8 #ifdef ALLOW_DBUG_THSICE
381     IF ( dBug(i,j,bi,bj) ) WRITE(6,1010)
382     & 'ThSI_SOLVE4T: k,ts,t1,dTs=', k,Tsf,Tice(1),dTsf
383     #endif
384 jmc 1.6 IF ( useBlkFlx .AND. k.EQ.nitMaxTsf
385     & .AND. ABS(dTsf).GE.Terrmax ) THEN
386 jmc 1.11 WRITE (6,'(A,4I4,I12,F15.9)')
387 jmc 1.12 & ' BB: not converge: i,j,it,hi=',i,j,bi,bj,
388 jmc 1.11 & myIter,hi
389 jmc 1.12 WRITE (6,*) 'BB: not converge: Tsf, dTsf=', Tsf,dTsf
390     WRITE (6,*) 'BB: not converge: flx0,dfdT=',flx0,df0dT
391 jmc 1.6 IF (Tsf.LT.-70. _d 0) STOP
392 jmc 1.1 ENDIF
393    
394 jmc 1.6 ENDIF
395     ENDDO
396 jmc 1.1 C ------ end iteration ------------
397    
398     C Compute new bottom layer temperature.
399    
400     Tice(2) = (2. _d 0*dt*k32*(Tice(1)+2. _d 0*Tf)
401     & + rhoi*cpice *hi*Tice(2))
402     & /(6. _d 0*dt*k32 + rhoi*cpice *hi)
403 jmc 1.8 #ifdef ALLOW_DBUG_THSICE
404     IF ( dBug(i,j,bi,bj) ) WRITE(6,1010)
405     & 'ThSI_SOLVE4T: k, Ts, Tice=',k,Tsf,Tice
406     #endif
407 jmc 1.1
408     C Compute final flux values at surfaces.
409    
410     fct = k12*(Tsf-Tice(1))
411 jmc 1.8 flxCnB(i,j) = 4. _d 0*kice *(Tice(2)-Tf)/hi
412 jmc 1.1 flx0 = flx0 + df0dT*dTsf
413     IF ( useBlkFlx ) THEN
414     C-- needs to update also Evap (Tsf changes) since Latent heat has been updated
415 jmc 1.8 evpAtm(i,j) = evap + dEvdT*dTsf
416 jmc 1.1 ELSE
417 jmc 1.7 C- WARNING: Evap & +Evap*Lfresh are missing ! (but only affects Diagnostics)
418 jmc 1.8 evpAtm(i,j) = 0.
419 jmc 1.1 ENDIF
420 jmc 1.7 C- energy flux to Atmos: use net short-wave flux at surf. and
421     C use latent heat = Lvap (energy=0 for liq. water at 0.oC)
422 jmc 1.8 flxAtm(i,j) = netSW + flxExceptSw
423     & + df0dT*dTsf + evpAtm(i,j)*Lfresh
424 jmc 1.7 C- excess of energy @ surface (used for surface melting):
425 jmc 1.8 sHeat(i,j) = flx0 - fct
426 jmc 1.1
427     C- SW flux at sea-ice base left to the ocean
428 jmc 1.8 flxSW(i,j) = fswocn
429 jmc 1.1
430 jmc 1.8 #ifdef ALLOW_DBUG_THSICE
431     IF ( dBug(i,j,bi,bj) ) WRITE(6,1020)
432     & 'ThSI_SOLVE4T: flx0,fct,Dif,flxCnB=',
433     & flx0,fct,flx0-fct,flxCnB(i,j)
434     #endif
435 jmc 1.1
436     C Compute new enthalpy for each layer.
437    
438 jmc 1.7 qicen(1) = -cpwater*Tmlt1 + cpice *(Tmlt1-Tice(1))
439     & + Lfresh*(1. _d 0-Tmlt1/Tice(1))
440 jmc 1.1 qicen(2) = -cpice *Tice(2) + Lfresh
441    
442     C Make sure internal ice temperatures do not exceed Tmlt.
443     C (This should not happen for reasonable values of i0.)
444    
445 jmc 1.7 IF (Tice(1) .GE. Tmlt1) THEN
446 jmc 1.6 WRITE (6,'(A,2I4,2I3,1P2E14.6)')
447 jmc 1.12 & ' BBerr - Bug: IceT(1) > Tmlt',i,j,bi,bj,Tice(1),Tmlt1
448 jmc 1.6 ENDIF
449     IF (Tice(2) .GE. 0. _d 0) THEN
450     WRITE (6,'(A,2I4,2I3,1P2E14.6)')
451 jmc 1.12 & ' BBerr - Bug: IceT(2) > 0',i,j,bi,bj,Tice(2)
452 jmc 1.6 ENDIF
453 jmc 1.1
454 jmc 1.8 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
455     C-- Update Sea-Ice state :
456     tSrf(i,j) = Tsf
457     tIc1(i,j) = Tice(1)
458     tic2(i,j) = Tice(2)
459     qIc1(i,j) = qicen(1)
460     qIc2(i,j) = qicen(2)
461     c dTsrf(i,j) = dTsf
462     IF ( .NOT.useBlkFlx ) dTsrf(i,j) = dTsf
463     c sHeat(i,j) = sHeating
464     c flxCnB(i,j)= flxCnB
465     c flxAtm(i,j)= flxAtm
466     c evpAtm(i,j)= evpAtm
467     #ifdef ALLOW_DBUG_THSICE
468     IF ( dBug(i,j,bi,bj) ) THEN
469     WRITE(6,1020) 'ThSI_SOLV_4T: Tsf, Tice(1,2), dTsurf=',
470     & Tsf, Tice, dTsf
471     WRITE(6,1020) 'ThSI_SOLV_4T: sHeat, flxCndBt, Qice =',
472     & sHeat(i,j), flxCnB(i,j), qicen
473     WRITE(6,1020) 'ThSI_SOLV_4T: flxA, evpA, fxSW_bf,af=',
474     & flxAtm(i,j), evpAtm(i,j), netSW, flxSW(i,j)
475     ENDIF
476     #endif
477     ELSE
478     IF ( .NOT.useBlkFlx ) dTsrf(i,j) = 0. _d 0
479     ENDIF
480     ENDDO
481     ENDDO
482 jmc 1.1 #endif /* ALLOW_THSICE */
483    
484     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
485    
486     RETURN
487     END

  ViewVC Help
Powered by ViewVC 1.1.22