1 |
jmc |
1.20 |
C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_solve4temp.F,v 1.19 2010/03/16 00:23:59 jmc 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 |
jmc |
1.17 |
I iMin,iMax, jMin,jMax, dBugFlag, |
12 |
mlosch |
1.9 |
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 |
jmc |
1.19 |
C.. See Bitz, C. M. and W. H. Lipscomb, 1999: An energy-conserving |
31 |
|
|
C.. thermodynamic sea ice model for climate study. |
32 |
|
|
C.. J. Geophys. Res., 104, 15669 - 15677. |
33 |
jmc |
1.8 |
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.18 |
C frsnow :: fractional snow cover |
139 |
|
|
C fswpen :: SW penetrating beneath surface (W m-2) |
140 |
|
|
C fswdn :: SW absorbed at surface (W m-2) |
141 |
|
|
C fswint :: SW absorbed in ice (W m-2) |
142 |
|
|
C fswocn :: SW passed through ice to ocean (W m-2) |
143 |
jmc |
1.20 |
C flx0exSW :: net surface heat flux over melting snow/ice, except short-wave. |
144 |
|
|
C flxTexSW :: net surface heat flux, except short-wave (W/m2) |
145 |
|
|
C evap0 :: evaporation over melting snow/ice [kg/m2/s] (>0 if evaporate) |
146 |
|
|
C evapT :: evaporation over snow/ice [kg/m2/s] (>0 if evaporate) |
147 |
jmc |
1.18 |
C dEvdT :: derivative of evap. with respect to Tsf [kg/m2/s/K] |
148 |
jmc |
1.20 |
C flxNet :: net surf heat flux (+=down), from Atmos. to sea-ice (W m-2) |
149 |
jmc |
1.18 |
C fct :: heat conducted to top surface |
150 |
jmc |
1.20 |
C dFlxdT :: deriv of flxNet wrt Tsf (W m-2 deg-1) |
151 |
jmc |
1.18 |
C k12, k32 :: thermal conductivity terms |
152 |
|
|
C a10, b10 :: coefficients in quadratic eqn for T1 |
153 |
|
|
C a1, b1, c1 :: coefficients in quadratic eqn for T1 |
154 |
|
|
C Tsf_start :: old value of Tsf |
155 |
|
|
C dt :: timestep |
156 |
jmc |
1.8 |
INTEGER i,j |
157 |
jmc |
1.6 |
INTEGER k, iterMax |
158 |
jmc |
1.18 |
_RL frsnow |
159 |
|
|
_RL fswpen |
160 |
|
|
_RL fswdn |
161 |
|
|
_RL fswint |
162 |
|
|
_RL fswocn |
163 |
jmc |
1.20 |
_RL flx0exSW |
164 |
|
|
_RL flxTexSW |
165 |
|
|
_RL evap0, evapT, dEvdT |
166 |
|
|
_RL flxNet |
167 |
jmc |
1.18 |
_RL fct |
168 |
jmc |
1.20 |
_RL dFlxdT |
169 |
jmc |
1.18 |
_RL k12, k32 |
170 |
|
|
_RL a10, b10 |
171 |
|
|
_RL a1, b1, c1 |
172 |
|
|
c _RL Tsf_start |
173 |
|
|
_RL dt |
174 |
jmc |
1.17 |
_RL recip_dhSnowLin |
175 |
mlosch |
1.9 |
LOGICAL useBlkFlx |
176 |
jmc |
1.1 |
|
177 |
jmc |
1.8 |
C- define grid-point location where to print debugging values |
178 |
|
|
#include "THSICE_DEBUG.h" |
179 |
jmc |
1.1 |
|
180 |
jmc |
1.7 |
1010 FORMAT(A,I3,3F11.6) |
181 |
|
|
1020 FORMAT(A,1P4E14.6) |
182 |
jmc |
1.1 |
|
183 |
jmc |
1.8 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
184 |
|
|
|
185 |
heimbach |
1.14 |
#ifdef ALLOW_AUTODIFF_TAMC |
186 |
heimbach |
1.15 |
act1 = bi - myBxLo(myThid) |
187 |
|
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
188 |
|
|
act2 = bj - myByLo(myThid) |
189 |
|
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
190 |
|
|
act3 = myThid - 1 |
191 |
|
|
max3 = nTx*nTy |
192 |
|
|
act4 = ikey_dynamics - 1 |
193 |
heimbach |
1.14 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
194 |
|
|
|
195 |
mlosch |
1.9 |
useBlkFlx = useEXF .OR. useBulkForce |
196 |
jmc |
1.17 |
IF ( dhSnowLin.GT.0. _d 0 ) THEN |
197 |
|
|
recip_dhSnowLin = 1. _d 0 / dhSnowLin |
198 |
|
|
ELSE |
199 |
|
|
recip_dhSnowLin = 0. _d 0 |
200 |
|
|
ENDIF |
201 |
mlosch |
1.9 |
|
202 |
jscott |
1.13 |
dt = thSIce_dtTemp |
203 |
jmc |
1.8 |
DO j = jMin, jMax |
204 |
|
|
DO i = iMin, iMax |
205 |
heimbach |
1.14 |
#ifdef ALLOW_AUTODIFF_TAMC |
206 |
|
|
ikey_1 = i |
207 |
|
|
& + sNx*(j-1) |
208 |
|
|
& + sNx*sNy*act1 |
209 |
|
|
& + sNx*sNy*max1*act2 |
210 |
|
|
& + sNx*sNy*max1*max2*act3 |
211 |
|
|
& + sNx*sNy*max1*max2*max3*act4 |
212 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
213 |
|
|
C-- |
214 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
215 |
heimbach |
1.15 |
CADJ STORE devdt = comlev1_thsice_1, key=ikey_1 |
216 |
jmc |
1.20 |
CADJ STORE dFlxdT = comlev1_thsice_1, key=ikey_1 |
217 |
heimbach |
1.15 |
CADJ STORE flxexceptsw = comlev1_thsice_1, key=ikey_1 |
218 |
|
|
CADJ STORE flxsw(i,j) = comlev1_thsice_1, key=ikey_1 |
219 |
|
|
CADJ STORE qic1(i,j) = comlev1_thsice_1, key=ikey_1 |
220 |
|
|
CADJ STORE qic2(i,j) = comlev1_thsice_1, key=ikey_1 |
221 |
|
|
CADJ STORE tsrf(i,j) = comlev1_thsice_1, key=ikey_1 |
222 |
heimbach |
1.14 |
#endif |
223 |
jmc |
1.8 |
IF ( iceMask(i,j).GT.0. _d 0) THEN |
224 |
|
|
hi = hIce(i,j) |
225 |
|
|
hs = hSnow(i,j) |
226 |
|
|
Tf = tFrz(i,j) |
227 |
|
|
netSW = flxSW(i,j) |
228 |
|
|
qicen(1)= qIc1(i,j) |
229 |
|
|
qicen(2)= qIc2(i,j) |
230 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
231 |
|
|
#ifdef ALLOW_DBUG_THSICE |
232 |
|
|
IF ( dBug(i,j,bi,bj) ) WRITE(6,'(A,2I4,2I2)') |
233 |
|
|
& 'ThSI_SOLVE4T: i,j=',i,j,bi,bj |
234 |
|
|
#endif |
235 |
jmc |
1.16 |
IF ( hi.LT.hIceMin ) THEN |
236 |
|
|
C If hi < hIceMin, melt the ice. |
237 |
|
|
STOP 'THSICE_SOLVE4TEMP: should not enter if hi<hIceMin' |
238 |
heimbach |
1.15 |
ENDIF |
239 |
jmc |
1.1 |
|
240 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
241 |
|
|
|
242 |
|
|
C fractional snow cover |
243 |
jmc |
1.17 |
C assume a linear distribution of snow thickness, with dhSnowLin slope, |
244 |
|
|
C from hs-dhSnowLin to hs+dhSnowLin if full ice & snow cover. |
245 |
|
|
C frsnow = fraction of snow over the ice-covered part of the grid cell |
246 |
|
|
IF ( hs .GT. iceMask(i,j)*dhSnowLin ) THEN |
247 |
|
|
frsnow = 1. _d 0 |
248 |
|
|
ELSE |
249 |
|
|
frsnow = hs*recip_dhSnowLin/iceMask(i,j) |
250 |
|
|
IF ( frsnow.GT.0. _d 0 ) frsnow = SQRT(frsnow) |
251 |
|
|
ENDIF |
252 |
jmc |
1.1 |
|
253 |
|
|
C Compute SW flux absorbed at surface and penetrating to layer 1. |
254 |
jmc |
1.16 |
fswpen = netSW * (1. _d 0 - frsnow) * i0swFrac |
255 |
jmc |
1.1 |
fswocn = fswpen * exp(-ksolar*hi) |
256 |
|
|
fswint = fswpen - fswocn |
257 |
|
|
|
258 |
jmc |
1.8 |
fswdn = netSW - fswpen |
259 |
jmc |
1.1 |
|
260 |
|
|
C Compute conductivity terms at layer interfaces. |
261 |
|
|
|
262 |
jmc |
1.16 |
k12 = 4. _d 0*kIce*kSnow / (kSnow*hi + 4. _d 0*kIce*hs) |
263 |
|
|
k32 = 2. _d 0*kIce / hi |
264 |
jmc |
1.1 |
|
265 |
|
|
C compute ice temperatures |
266 |
jmc |
1.16 |
a1 = cpIce |
267 |
|
|
b1 = qicen(1) + (cpWater-cpIce )*Tmlt1 - Lfresh |
268 |
jmc |
1.1 |
c1 = Lfresh * Tmlt1 |
269 |
jmc |
1.6 |
Tice(1) = 0.5 _d 0 *(-b1 - SQRT(b1*b1-4. _d 0*a1*c1))/a1 |
270 |
jmc |
1.16 |
Tice(2) = (Lfresh-qicen(2)) / cpIce |
271 |
jmc |
1.1 |
|
272 |
jmc |
1.12 |
IF (Tice(1).GT.0. _d 0 ) THEN |
273 |
jmc |
1.17 |
WRITE (standardMessageUnit,'(A,I12,1PE14.6)') |
274 |
jmc |
1.12 |
& ' BBerr: Tice(1) > 0 ; it=', myIter, qicen(1) |
275 |
mlosch |
1.10 |
WRITE (standardMessageUnit,'(A,4I5,2F11.4)') |
276 |
jmc |
1.12 |
& ' BBerr: i,j,bi,bj,Tice = ',i,j,bi,bj,Tice |
277 |
mlosch |
1.10 |
ENDIF |
278 |
|
|
IF ( Tice(2).GT.0. _d 0) THEN |
279 |
jmc |
1.17 |
WRITE (standardMessageUnit,'(A,I12,1PE14.6)') |
280 |
jmc |
1.12 |
& ' BBerr: Tice(2) > 0 ; it=', myIter, qicen(2) |
281 |
mlosch |
1.10 |
WRITE (standardMessageUnit,'(A,4I5,2F11.4)') |
282 |
jmc |
1.12 |
& ' BBerr: i,j,bi,bj,Tice = ',i,j,bi,bj,Tice |
283 |
jmc |
1.6 |
ENDIF |
284 |
jmc |
1.8 |
#ifdef ALLOW_DBUG_THSICE |
285 |
|
|
IF ( dBug(i,j,bi,bj) ) WRITE(6,1010) |
286 |
jmc |
1.20 |
& 'ThSI_SOLVE4T: k, Ts, Tice=',0,tSrf(i,j),Tice |
287 |
jmc |
1.8 |
#endif |
288 |
jmc |
1.1 |
|
289 |
|
|
C Compute coefficients used in quadratic formula. |
290 |
|
|
|
291 |
jmc |
1.16 |
a10 = rhoi*cpIce *hi/(2. _d 0*dt) + |
292 |
|
|
& k32 * (4. _d 0*dt*k32 + rhoi*cpIce *hi) |
293 |
|
|
& / (6. _d 0*dt*k32 + rhoi*cpIce *hi) |
294 |
jmc |
1.1 |
b10 = -hi* |
295 |
jmc |
1.16 |
& (rhoi*cpIce*Tice(1)+rhoi*Lfresh*Tmlt1/Tice(1)) |
296 |
jmc |
1.1 |
& /(2. _d 0*dt) |
297 |
jmc |
1.16 |
& - k32 * (4. _d 0*dt*k32*Tf+rhoi*cpIce *hi*Tice(2)) |
298 |
|
|
& / (6. _d 0*dt*k32 + rhoi*cpIce *hi) - fswint |
299 |
jmc |
1.1 |
c1 = rhoi*Lfresh*hi*Tmlt1 / (2. _d 0*dt) |
300 |
|
|
|
301 |
jmc |
1.4 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
302 |
jmc |
1.20 |
C get surface fluxes over melting surface |
303 |
|
|
IF ( useBlkFlx ) THEN |
304 |
|
|
Tsf = 0. |
305 |
|
|
IF ( useEXF ) THEN |
306 |
|
|
CALL THSICE_GET_EXF( |
307 |
|
|
I hSnow(i,j), Tsf, |
308 |
|
|
O flx0exSW, dFlxdT, evap0, dEvdT, |
309 |
|
|
I i,j,bi,bj,myThid ) |
310 |
|
|
C could add this "ifdef" to hide THSICE_GET_BULKF from TAF |
311 |
|
|
c#ifdef ALLOW_BULK_FORCE |
312 |
|
|
ELSEIF ( useBulkForce ) THEN |
313 |
|
|
CALL THSICE_GET_BULKF( |
314 |
|
|
I hSnow(i,j), Tsf, |
315 |
|
|
O flx0exSW, dFlxdT, evap0, dEvdT, |
316 |
|
|
I i,j,bi,bj,myThid ) |
317 |
|
|
c#endif /* ALLOW_BULK_FORCE */ |
318 |
|
|
ENDIF |
319 |
|
|
ELSE |
320 |
|
|
flx0exSW = flxExSW(i,j,0) |
321 |
|
|
ENDIF |
322 |
|
|
|
323 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
324 |
jmc |
1.1 |
C Compute new surface and internal temperatures; iterate until |
325 |
|
|
C Tsfc converges. |
326 |
|
|
|
327 |
jmc |
1.6 |
IF ( useBlkFlx ) THEN |
328 |
|
|
iterMax = nitMaxTsf |
329 |
|
|
ELSE |
330 |
|
|
iterMax = 1 |
331 |
|
|
ENDIF |
332 |
jmc |
1.20 |
Tsf = tSrf(i,j) |
333 |
jmc |
1.6 |
dTsf = Terrmax |
334 |
|
|
|
335 |
jmc |
1.1 |
C ----- begin iteration ----- |
336 |
jmc |
1.6 |
DO k = 1,iterMax |
337 |
heimbach |
1.14 |
|
338 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
339 |
|
|
ikey_3 = (ikey_1-1)*MaxTsf + k |
340 |
|
|
#endif |
341 |
|
|
|
342 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
343 |
heimbach |
1.15 |
CADJ STORE tsf = comlev1_thsice_3, key=ikey_3 |
344 |
|
|
CADJ STORE dtsf = comlev1_thsice_3, key=ikey_3 |
345 |
jmc |
1.20 |
CADJ STORE dFlxdT = comlev1_thsice_3, key=ikey_3 |
346 |
heimbach |
1.15 |
CADJ STORE flxexceptsw = comlev1_thsice_3, key=ikey_3 |
347 |
heimbach |
1.14 |
#endif |
348 |
jmc |
1.6 |
IF ( ABS(dTsf).GE.Terrmax ) THEN |
349 |
jmc |
1.1 |
|
350 |
|
|
C Save temperatures at start of iteration. |
351 |
|
|
c Tsf_start = Tsf |
352 |
|
|
|
353 |
|
|
IF ( useBlkFlx ) THEN |
354 |
heimbach |
1.15 |
#ifdef ALLOW_AUTODIFF_TAMC |
355 |
|
|
CADJ STORE tsf = comlev1_thsice_3, key=ikey_3 |
356 |
|
|
#endif |
357 |
jmc |
1.1 |
C Compute top surface flux. |
358 |
jmc |
1.20 |
IF ( useEXF ) THEN |
359 |
|
|
CALL THSICE_GET_EXF ( |
360 |
|
|
I hs, Tsf, |
361 |
|
|
O flxTexSW, dFlxdT, evapT, dEvdT, |
362 |
|
|
I i,j,bi,bj,myThid ) |
363 |
|
|
C could add this "ifdef" to hide THSICE_GET_BULKF from TAF |
364 |
|
|
c#ifdef ALLOW_BULK_FORCE |
365 |
|
|
ELSEIF ( useBulkForce ) THEN |
366 |
mlosch |
1.9 |
CALL THSICE_GET_BULKF( |
367 |
jmc |
1.20 |
I hs, Tsf, |
368 |
|
|
O flxTexSW, dFlxdT, evapT, dEvdT, |
369 |
mlosch |
1.9 |
I i,j,bi,bj,myThid ) |
370 |
jmc |
1.20 |
c#endif /* ALLOW_BULK_FORCE */ |
371 |
mlosch |
1.9 |
ENDIF |
372 |
jmc |
1.1 |
ELSE |
373 |
jmc |
1.20 |
flxTexSW = flxExSW(i,j,1) |
374 |
|
|
dFlxdT = flxExSW(i,j,2) |
375 |
jmc |
1.1 |
ENDIF |
376 |
jmc |
1.20 |
flxNet = fswdn + flxTexSW |
377 |
jmc |
1.8 |
#ifdef ALLOW_DBUG_THSICE |
378 |
|
|
IF ( dBug(i,j,bi,bj) ) WRITE(6,1020) |
379 |
jmc |
1.20 |
& 'ThSI_SOLVE4T: flxNet,dFlxdT,k12,D=', |
380 |
|
|
& flxNet, dFlxdT, k12, k12-dFlxdT |
381 |
jmc |
1.8 |
#endif |
382 |
jmc |
1.1 |
|
383 |
|
|
C Compute new top layer and surface temperatures. |
384 |
|
|
C If Tsfc is computed to be > 0 C, fix Tsfc = 0 and recompute T1 |
385 |
jmc |
1.7 |
C with different coefficients. |
386 |
jmc |
1.1 |
|
387 |
heimbach |
1.14 |
#ifdef ALLOW_AUTODIFF_TAMC |
388 |
|
|
CADJ STORE tsf = comlev1_thsice_3, key=ikey_3 |
389 |
|
|
#endif |
390 |
jmc |
1.20 |
a1 = a10 - k12*dFlxdT / (k12-dFlxdT) |
391 |
|
|
b1 = b10 - k12*(flxNet-dFlxdT*Tsf) / (k12-dFlxdT) |
392 |
jmc |
1.6 |
Tice(1) = -(b1 + SQRT(b1*b1-4. _d 0*a1*c1))/(2. _d 0*a1) |
393 |
jmc |
1.20 |
dTsf = (flxNet + k12*(Tice(1)-Tsf)) / (k12-dFlxdT) |
394 |
jmc |
1.1 |
Tsf = Tsf + dTsf |
395 |
jmc |
1.6 |
IF (Tsf .GT. 0. _d 0) THEN |
396 |
jmc |
1.8 |
#ifdef ALLOW_DBUG_THSICE |
397 |
|
|
IF ( dBug(i,j,bi,bj) ) WRITE(6,1010) |
398 |
|
|
& 'ThSI_SOLVE4T: k,ts,t1,dTs=', k,Tsf,Tice(1),dTsf |
399 |
|
|
#endif |
400 |
jmc |
1.1 |
a1 = a10 + k12 |
401 |
jmc |
1.18 |
C note: b1 = b10 - k12*Tf0 |
402 |
|
|
b1 = b10 |
403 |
jmc |
1.6 |
Tice(1) = (-b1 - SQRT(b1*b1-4. _d 0*a1*c1))/(2. _d 0*a1) |
404 |
jmc |
1.1 |
Tsf = 0. _d 0 |
405 |
|
|
IF ( useBlkFlx ) THEN |
406 |
jmc |
1.20 |
flxTexSW = flx0exSW |
407 |
|
|
evapT = evap0 |
408 |
jmc |
1.1 |
dTsf = 0. _d 0 |
409 |
|
|
ELSE |
410 |
jmc |
1.20 |
flxTexSW = flxExSW(i,j,0) |
411 |
jmc |
1.1 |
dTsf = 1000. |
412 |
jmc |
1.20 |
dFlxdT = 0. |
413 |
jmc |
1.1 |
ENDIF |
414 |
jmc |
1.20 |
flxNet = fswdn + flxTexSW |
415 |
jmc |
1.6 |
ENDIF |
416 |
jmc |
1.1 |
|
417 |
|
|
C Check for convergence. If no convergence, then repeat. |
418 |
|
|
C |
419 |
jmc |
1.7 |
C Convergence test: Make sure Tsfc has converged, within prescribed error. |
420 |
jmc |
1.1 |
C (Energy conservation is guaranteed within machine roundoff, even |
421 |
|
|
C if Tsfc has not converged.) |
422 |
|
|
C If no convergence, then repeat. |
423 |
|
|
|
424 |
jmc |
1.8 |
#ifdef ALLOW_DBUG_THSICE |
425 |
|
|
IF ( dBug(i,j,bi,bj) ) WRITE(6,1010) |
426 |
|
|
& 'ThSI_SOLVE4T: k,ts,t1,dTs=', k,Tsf,Tice(1),dTsf |
427 |
|
|
#endif |
428 |
jmc |
1.6 |
IF ( useBlkFlx .AND. k.EQ.nitMaxTsf |
429 |
|
|
& .AND. ABS(dTsf).GE.Terrmax ) THEN |
430 |
jmc |
1.11 |
WRITE (6,'(A,4I4,I12,F15.9)') |
431 |
jmc |
1.12 |
& ' BB: not converge: i,j,it,hi=',i,j,bi,bj, |
432 |
jmc |
1.11 |
& myIter,hi |
433 |
jmc |
1.12 |
WRITE (6,*) 'BB: not converge: Tsf, dTsf=', Tsf,dTsf |
434 |
jmc |
1.20 |
WRITE (6,*) 'BB: not converge: flxNet,dFlxT=',flxNet,dFlxdT |
435 |
jmc |
1.6 |
IF (Tsf.LT.-70. _d 0) STOP |
436 |
jmc |
1.1 |
ENDIF |
437 |
|
|
|
438 |
jmc |
1.6 |
ENDIF |
439 |
|
|
ENDDO |
440 |
jmc |
1.1 |
C ------ end iteration ------------ |
441 |
|
|
|
442 |
|
|
C Compute new bottom layer temperature. |
443 |
|
|
|
444 |
heimbach |
1.15 |
#ifdef ALLOW_AUTODIFF_TAMC |
445 |
|
|
CADJ STORE Tice(:) = comlev1_thsice_1, key=ikey_1 |
446 |
jmc |
1.20 |
CADJ STORE dFlxdT = comlev1_thsice_1, key=ikey_1 |
447 |
heimbach |
1.15 |
#endif |
448 |
jmc |
1.1 |
Tice(2) = (2. _d 0*dt*k32*(Tice(1)+2. _d 0*Tf) |
449 |
jmc |
1.16 |
& + rhoi*cpIce *hi*Tice(2)) |
450 |
|
|
& /(6. _d 0*dt*k32 + rhoi*cpIce *hi) |
451 |
jmc |
1.8 |
#ifdef ALLOW_DBUG_THSICE |
452 |
|
|
IF ( dBug(i,j,bi,bj) ) WRITE(6,1010) |
453 |
|
|
& 'ThSI_SOLVE4T: k, Ts, Tice=',k,Tsf,Tice |
454 |
|
|
#endif |
455 |
jmc |
1.1 |
|
456 |
|
|
C Compute final flux values at surfaces. |
457 |
|
|
|
458 |
|
|
fct = k12*(Tsf-Tice(1)) |
459 |
jmc |
1.16 |
flxCnB(i,j) = 4. _d 0*kIce *(Tice(2)-Tf)/hi |
460 |
jmc |
1.20 |
flxNet = flxNet + dFlxdT*dTsf |
461 |
jmc |
1.1 |
IF ( useBlkFlx ) THEN |
462 |
|
|
C-- needs to update also Evap (Tsf changes) since Latent heat has been updated |
463 |
jmc |
1.20 |
evpAtm(i,j) = evapT + dEvdT*dTsf |
464 |
jmc |
1.1 |
ELSE |
465 |
jmc |
1.7 |
C- WARNING: Evap & +Evap*Lfresh are missing ! (but only affects Diagnostics) |
466 |
jmc |
1.8 |
evpAtm(i,j) = 0. |
467 |
jmc |
1.1 |
ENDIF |
468 |
jmc |
1.7 |
C- energy flux to Atmos: use net short-wave flux at surf. and |
469 |
|
|
C use latent heat = Lvap (energy=0 for liq. water at 0.oC) |
470 |
jmc |
1.20 |
flxAtm(i,j) = netSW + flxTexSW |
471 |
|
|
& + dFlxdT*dTsf + evpAtm(i,j)*Lfresh |
472 |
jmc |
1.7 |
C- excess of energy @ surface (used for surface melting): |
473 |
jmc |
1.20 |
sHeat(i,j) = flxNet - fct |
474 |
jmc |
1.1 |
|
475 |
|
|
C- SW flux at sea-ice base left to the ocean |
476 |
jmc |
1.8 |
flxSW(i,j) = fswocn |
477 |
jmc |
1.1 |
|
478 |
jmc |
1.8 |
#ifdef ALLOW_DBUG_THSICE |
479 |
|
|
IF ( dBug(i,j,bi,bj) ) WRITE(6,1020) |
480 |
jmc |
1.20 |
& 'ThSI_SOLVE4T: flxNet,fct,Dif,flxCnB=', |
481 |
|
|
& flxNet,fct,flxNet-fct,flxCnB(i,j) |
482 |
jmc |
1.8 |
#endif |
483 |
jmc |
1.1 |
|
484 |
|
|
C Compute new enthalpy for each layer. |
485 |
|
|
|
486 |
jmc |
1.16 |
qicen(1) = -cpWater*Tmlt1 + cpIce *(Tmlt1-Tice(1)) |
487 |
jmc |
1.7 |
& + Lfresh*(1. _d 0-Tmlt1/Tice(1)) |
488 |
jmc |
1.16 |
qicen(2) = -cpIce *Tice(2) + Lfresh |
489 |
jmc |
1.1 |
|
490 |
|
|
C Make sure internal ice temperatures do not exceed Tmlt. |
491 |
jmc |
1.16 |
C (This should not happen for reasonable values of i0swFrac) |
492 |
jmc |
1.1 |
|
493 |
jmc |
1.7 |
IF (Tice(1) .GE. Tmlt1) THEN |
494 |
jmc |
1.6 |
WRITE (6,'(A,2I4,2I3,1P2E14.6)') |
495 |
jmc |
1.12 |
& ' BBerr - Bug: IceT(1) > Tmlt',i,j,bi,bj,Tice(1),Tmlt1 |
496 |
jmc |
1.6 |
ENDIF |
497 |
|
|
IF (Tice(2) .GE. 0. _d 0) THEN |
498 |
|
|
WRITE (6,'(A,2I4,2I3,1P2E14.6)') |
499 |
jmc |
1.12 |
& ' BBerr - Bug: IceT(2) > 0',i,j,bi,bj,Tice(2) |
500 |
jmc |
1.6 |
ENDIF |
501 |
jmc |
1.1 |
|
502 |
jmc |
1.8 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
503 |
|
|
C-- Update Sea-Ice state : |
504 |
|
|
tSrf(i,j) = Tsf |
505 |
|
|
tIc1(i,j) = Tice(1) |
506 |
|
|
tic2(i,j) = Tice(2) |
507 |
|
|
qIc1(i,j) = qicen(1) |
508 |
|
|
qIc2(i,j) = qicen(2) |
509 |
|
|
c dTsrf(i,j) = dTsf |
510 |
|
|
IF ( .NOT.useBlkFlx ) dTsrf(i,j) = dTsf |
511 |
|
|
c sHeat(i,j) = sHeating |
512 |
|
|
c flxCnB(i,j)= flxCnB |
513 |
|
|
c flxAtm(i,j)= flxAtm |
514 |
|
|
c evpAtm(i,j)= evpAtm |
515 |
|
|
#ifdef ALLOW_DBUG_THSICE |
516 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
517 |
|
|
WRITE(6,1020) 'ThSI_SOLV_4T: Tsf, Tice(1,2), dTsurf=', |
518 |
|
|
& Tsf, Tice, dTsf |
519 |
|
|
WRITE(6,1020) 'ThSI_SOLV_4T: sHeat, flxCndBt, Qice =', |
520 |
|
|
& sHeat(i,j), flxCnB(i,j), qicen |
521 |
|
|
WRITE(6,1020) 'ThSI_SOLV_4T: flxA, evpA, fxSW_bf,af=', |
522 |
|
|
& flxAtm(i,j), evpAtm(i,j), netSW, flxSW(i,j) |
523 |
|
|
ENDIF |
524 |
|
|
#endif |
525 |
|
|
ELSE |
526 |
|
|
IF ( .NOT.useBlkFlx ) dTsrf(i,j) = 0. _d 0 |
527 |
|
|
ENDIF |
528 |
|
|
ENDDO |
529 |
|
|
ENDDO |
530 |
jmc |
1.1 |
#endif /* ALLOW_THSICE */ |
531 |
|
|
|
532 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
533 |
|
|
|
534 |
|
|
RETURN |
535 |
|
|
END |