46 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
47 |
#include "THSICE_SIZE.h" |
#include "THSICE_SIZE.h" |
48 |
#include "THSICE_PARAMS.h" |
#include "THSICE_PARAMS.h" |
49 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
50 |
|
# include "SIZE.h" |
51 |
|
# include "tamc.h" |
52 |
|
# include "tamc_keys.h" |
53 |
|
#endif |
54 |
|
|
55 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
56 |
C == Routine Arguments == |
C == Routine Arguments == |
166 |
|
|
167 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
168 |
|
|
169 |
|
#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 |
useBlkFlx = useEXF .OR. useBulkForce |
useBlkFlx = useEXF .OR. useBulkForce |
180 |
|
|
181 |
dt = thSIce_deltaT |
dt = thSIce_dtTemp |
182 |
DO j = jMin, jMax |
DO j = jMin, jMax |
183 |
DO i = iMin, iMax |
DO i = iMin, iMax |
184 |
|
#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 |
IF ( iceMask(i,j).GT.0. _d 0) THEN |
IF ( iceMask(i,j).GT.0. _d 0) THEN |
201 |
hi = hIce(i,j) |
hi = hIce(i,j) |
202 |
hs = hSnow(i,j) |
hs = hSnow(i,j) |
282 |
|
|
283 |
C ----- begin iteration ----- |
C ----- begin iteration ----- |
284 |
DO k = 1,iterMax |
DO k = 1,iterMax |
285 |
|
|
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 |
IF ( ABS(dTsf).GE.Terrmax ) THEN |
IF ( ABS(dTsf).GE.Terrmax ) THEN |
294 |
|
|
295 |
C Save temperatures at start of iteration. |
C Save temperatures at start of iteration. |
327 |
C If Tsfc is computed to be > 0 C, fix Tsfc = 0 and recompute T1 |
C If Tsfc is computed to be > 0 C, fix Tsfc = 0 and recompute T1 |
328 |
C with different coefficients. |
C with different coefficients. |
329 |
|
|
330 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
331 |
|
CADJ STORE tsf = comlev1_thsice_3, key=ikey_3 |
332 |
|
#endif |
333 |
a1 = a10 - k12*df0dT / (k12-df0dT) |
a1 = a10 - k12*df0dT / (k12-df0dT) |
334 |
b1 = b10 - k12*(flx0-df0dT*Tsf) / (k12-df0dT) |
b1 = b10 - k12*(flx0-df0dT*Tsf) / (k12-df0dT) |
335 |
Tice(1) = -(b1 + SQRT(b1*b1-4. _d 0*a1*c1))/(2. _d 0*a1) |
Tice(1) = -(b1 + SQRT(b1*b1-4. _d 0*a1*c1))/(2. _d 0*a1) |