30 |
#include "THSICE_VARS.h" |
#include "THSICE_VARS.h" |
31 |
#include "THSICE_TAVE.h" |
#include "THSICE_TAVE.h" |
32 |
#include "THSICE_2DYN.h" |
#include "THSICE_2DYN.h" |
33 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
34 |
|
# include "tamc.h" |
35 |
|
# include "tamc_keys.h" |
36 |
|
#endif |
37 |
|
|
38 |
INTEGER siLo, siHi, sjLo, sjHi |
INTEGER siLo, siHi, sjLo, sjHi |
39 |
PARAMETER ( siLo = 1-OLx , siHi = sNx+OLx ) |
PARAMETER ( siLo = 1-OLx , siHi = sNx+OLx ) |
40 |
PARAMETER ( sjLo = 1-OLy , sjHi = sNy+OLy ) |
PARAMETER ( sjLo = 1-OLy , sjHi = sNy+OLy ) |
102 |
|
|
103 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
104 |
|
|
105 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
106 |
|
act1 = bi - myBxLo(myThid) |
107 |
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
108 |
|
act2 = bj - myByLo(myThid) |
109 |
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
110 |
|
act3 = myThid - 1 |
111 |
|
max3 = nTx*nTy |
112 |
|
act4 = ikey_dynamics - 1 |
113 |
|
iicekey = (act1 + 1) + act2*max1 |
114 |
|
& + act3*max1*max2 |
115 |
|
& + act4*max1*max2*max3 |
116 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
117 |
|
|
118 |
C- Initialise |
C- Initialise |
119 |
dBugFlag = debugLevel.GE.debLevB |
dBugFlag = debugLevel.GE.debLevB |
120 |
DO j = 1-OLy, sNy+OLy |
DO j = 1-OLy, sNy+OLy |
202 |
ENDDO |
ENDDO |
203 |
ENDDO |
ENDDO |
204 |
|
|
205 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
206 |
|
CADJ STORE iceMask(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
207 |
|
#endif |
208 |
|
|
209 |
CALL THSICE_CALC_THICKN( |
CALL THSICE_CALC_THICKN( |
210 |
I bi, bj, siLo, siHi, sjLo, sjHi, |
I bi, bj, siLo, siHi, sjLo, sjHi, |
211 |
I iMin,iMax, jMin,jMax, dBugFlag, |
I iMin,iMax, jMin,jMax, dBugFlag, |
223 |
C-- Net fluxes : |
C-- Net fluxes : |
224 |
DO j = jMin, jMax |
DO j = jMin, jMax |
225 |
DO i = iMin, iMax |
DO i = iMin, iMax |
226 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
227 |
|
ikey_1 = i |
228 |
|
& + sNx*(j-1) |
229 |
|
& + sNx*sNy*act1 |
230 |
|
& + sNx*sNy*max1*act2 |
231 |
|
& + sNx*sNy*max1*max2*act3 |
232 |
|
& + sNx*sNy*max1*max2*max3*act4 |
233 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
234 |
|
C-- |
235 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
236 |
|
CADJ STORE icemask(i,j,bi,bj) = comlev1_thsice_1, key=ikey_1 |
237 |
|
#endif |
238 |
IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN |
IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN |
239 |
C- weighted average net fluxes: |
C- weighted average net fluxes: |
240 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
241 |
|
CADJ STORE fsalt(i,j) = comlev1_thsice_1, key=ikey_1 |
242 |
|
CADJ STORE flx2oc(i,j) = comlev1_thsice_1, key=ikey_1 |
243 |
|
CADJ STORE frw2oc(i,j) = comlev1_thsice_1, key=ikey_1 |
244 |
|
CADJ STORE icemask(i,j,bi,bj) = comlev1_thsice_1, key=ikey_1 |
245 |
|
#endif |
246 |
icFrac = iceMask(i,j,bi,bj) |
icFrac = iceMask(i,j,bi,bj) |
247 |
opFrac= 1. _d 0-icFrac |
opFrac= 1. _d 0-icFrac |
248 |
icFlxAtm(i,j,bi,bj) = icFrac*icFlxAtm(i,j,bi,bj) |
icFlxAtm(i,j,bi,bj) = icFrac*icFlxAtm(i,j,bi,bj) |