2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
#include "THSICE_OPTIONS.h" |
#include "THSICE_OPTIONS.h" |
5 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
6 |
|
# ifdef ALLOW_EXF |
7 |
|
# include "EXF_OPTIONS.h" |
8 |
|
# endif |
9 |
|
#endif |
10 |
|
|
11 |
CBOP |
CBOP |
12 |
C !ROUTINE: THSICE_MAIN |
C !ROUTINE: THSICE_MAIN |
28 |
#include "SIZE.h" |
#include "SIZE.h" |
29 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
30 |
#include "PARAMS.h" |
#include "PARAMS.h" |
|
#include "GRID.h" |
|
|
#include "SURFACE.h" |
|
|
#include "DYNVARS.h" |
|
31 |
#include "FFIELDS.h" |
#include "FFIELDS.h" |
32 |
#include "THSICE_PARAMS.h" |
#include "THSICE_PARAMS.h" |
33 |
|
#include "THSICE_SIZE.h" |
34 |
#include "THSICE_VARS.h" |
#include "THSICE_VARS.h" |
35 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
36 |
|
# include "THSICE_TAVE.h" |
37 |
|
# include "THSICE_COST.h" |
38 |
|
# include "DYNVARS.h" |
39 |
# include "tamc.h" |
# include "tamc.h" |
40 |
# include "tamc_keys.h" |
# include "tamc_keys.h" |
41 |
C-- |
# ifdef ALLOW_EXF |
42 |
# include "THSICE_2DYN.h" |
# include "EXF_FIELDS.h" |
43 |
C-- |
# include "EXF_PARAM.h" |
44 |
|
# include "EXF_CONSTANTS.h" |
45 |
|
# endif /* ALLOW_EXF */ |
46 |
#endif |
#endif |
47 |
|
|
48 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
58 |
#ifdef ALLOW_THSICE |
#ifdef ALLOW_THSICE |
59 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
60 |
C === Local variables === |
C === Local variables === |
61 |
|
C prcAtm :: total precip from the atmosphere [kg/m2/s] |
62 |
|
C snowPr :: snow precipitation [kg/m2/s] |
63 |
|
C qPrcRn :: Energy content of Precip+RunOff (+=down) [W/m2] |
64 |
INTEGER i,j |
INTEGER i,j |
65 |
INTEGER bi,bj |
INTEGER bi,bj |
66 |
INTEGER iMin, iMax |
INTEGER iMin, iMax |
67 |
INTEGER jMin, jMax |
INTEGER jMin, jMax |
68 |
_RL prcAtm(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL prcAtm(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
69 |
|
_RL snowPr(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
70 |
|
_RL qPrcRn(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
71 |
c _RL evpAtm(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
c _RL evpAtm(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
72 |
c _RL flxAtm(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
c _RL flxAtm(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
73 |
c _RL flxSW (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
c _RL flxSW (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
|
|
74 |
_RL tauFac |
_RL tauFac |
75 |
|
|
76 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
77 |
|
|
78 |
IF ( stressReduction.GT. 0. _d 0 ) THEN |
C- Only compute/update seaice fields over the interior |
79 |
C- needs new Ice Fraction in halo region to apply wind-stress reduction |
C (excluding overlap) and apply exchanges when needed |
80 |
iMin = 1-OLx |
iMin = 1 |
81 |
iMax = sNx+OLx-1 |
iMax = sNx |
82 |
jMin = 1-OLy |
jMin = 1 |
83 |
jMax = sNy+OLy-1 |
jMax = sNy |
|
#ifdef ATMOSPHERIC_LOADING |
|
|
ELSEIF ( useRealFreshWaterFlux .AND. .NOT.useSEAICE ) THEN |
|
|
C- needs sea-ice loading in part of the halo regions for grad.Phi0surf |
|
|
C to be valid at the boundaries ( d/dx 1:sNx+1 ; d/dy 1:sNy+1 ) |
|
|
iMin = 0 |
|
|
iMax = sNx+1 |
|
|
jMin = 0 |
|
|
jMax = sNy+1 |
|
|
#endif /* ATMOSPHERIC_LOADING */ |
|
|
ELSE |
|
|
iMin = 1 |
|
|
iMax = sNx |
|
|
jMin = 1 |
|
|
jMax = sNy |
|
|
ENDIF |
|
84 |
|
|
85 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
86 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
93 |
act3 = myThid - 1 |
act3 = myThid - 1 |
94 |
max3 = nTx*nTy |
max3 = nTx*nTy |
95 |
act4 = ikey_dynamics - 1 |
act4 = ikey_dynamics - 1 |
96 |
iicekey = (act1 + 1) + act2*max1 |
ticekey = (act1 + 1) + act2*max1 |
97 |
& + act3*max1*max2 |
& + act3*max1*max2 |
98 |
& + act4*max1*max2*max3 |
& + act4*max1*max2*max3 |
99 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
100 |
|
|
101 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
102 |
CADJ STORE ocefwfx(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE ocefwfx(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
103 |
CADJ STORE oceqnet(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE oceqnet(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
104 |
CADJ STORE ocesflx(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE ocesflx(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
105 |
# ifdef ALLOW_EXF |
CADJ STORE qsw(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
106 |
CADJ STORE qsw(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE uvel (:,:,1,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
107 |
# endif |
CADJ STORE vvel (:,:,1,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
|
#endif |
|
|
|
|
|
cph( |
|
|
print *, 'ph-thsice-1 in thsice_main' |
|
|
cph) |
|
|
C-- Mixed layer thickness: take the 1rst layer |
|
|
#ifdef NONLIN_FRSURF |
|
|
IF ( staggerTimeStep .AND. nonlinFreeSurf.GT.0 ) THEN |
|
|
IF ( select_rStar.GT.0 ) THEN |
|
|
DO j = jMin, jMax |
|
|
DO i = iMin, iMax |
|
|
hOceMxL(i,j,bi,bj) = drF(1)*h0FacC(i,j,1,bi,bj) |
|
|
& *rStarFacC(i,j,bi,bj) |
|
|
ENDDO |
|
|
ENDDO |
|
|
ELSE |
|
|
DO j = jMin, jMax |
|
|
DO i = iMin, iMax |
|
|
IF ( ksurfC(i,j,bi,bj).EQ.1 ) THEN |
|
|
hOceMxL(i,j,bi,bj) = drF(1)*hFac_surfC(i,j,bi,bj) |
|
|
ELSE |
|
|
hOceMxL(i,j,bi,bj) = drF(1)*hFacC(i,j,1,bi,bj) |
|
|
ENDIF |
|
|
ENDDO |
|
|
ENDDO |
|
|
ENDIF |
|
|
ELSE |
|
|
#else /* ndef NONLIN_FRSURF */ |
|
|
IF (.TRUE.) THEN |
|
|
#endif /* NONLIN_FRSURF */ |
|
|
DO j = jMin, jMax |
|
|
DO i = iMin, iMax |
|
|
hOceMxL(i,j,bi,bj) = drF(1)*hFacC(i,j,1,bi,bj) |
|
|
ENDDO |
|
|
ENDDO |
|
|
ENDIF |
|
|
|
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
|
|
CADJ STORE uvel (:,:,1,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
|
|
CADJ STORE vvel (:,:,1,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
|
108 |
#endif |
#endif |
109 |
|
|
110 |
DO j = jMin, jMax |
DO j=1-OLy,sNy+OLy |
111 |
DO i = iMin, iMax |
DO i=1-OLx,sNx+OLx |
112 |
tOceMxL(i,j,bi,bj) = theta(i,j,1,bi,bj) |
prcAtm (i,j,bi,bj) = 0. _d 0 |
113 |
sOceMxL(i,j,bi,bj) = salt (i,j,1,bi,bj) |
snowPr (i,j) = 0. _d 0 |
114 |
v2ocMxL(i,j,bi,bj) = |
qPrcRn (i,j) = 0. _d 0 |
|
& ( uvel(i,j,1,bi,bj)*uvel(i,j,1,bi,bj) |
|
|
& + uvel(i+1,j,1,bi,bj)*uvel(i+1,j,1,bi,bj) |
|
|
& + vvel(i,j+1,1,bi,bj)*vvel(i,j+1,1,bi,bj) |
|
|
& + vvel(i,j,1,bi,bj)*vvel(i,j,1,bi,bj) |
|
|
& )*0.5 _d 0 |
|
|
prcAtm(i,j) = 0. |
|
|
icFrwAtm(i,j,bi,bj) = 0. _d 0 |
|
|
icFlxAtm(i,j,bi,bj) = 0. _d 0 |
|
|
icFlxSW (i,j,bi,bj) = 0. _d 0 |
|
|
snowPrc(i,j,bi,bj) = 0. _d 0 |
|
|
siceAlb(i,j,bi,bj) = 0. _d 0 |
|
115 |
ENDDO |
ENDDO |
116 |
ENDDO |
ENDDO |
117 |
|
|
118 |
|
#ifndef ALLOW_AUTODIFF_TAMC |
119 |
|
IF ( .NOT.useCheapAML ) THEN |
120 |
|
#endif |
121 |
|
CALL THSICE_GET_OCEAN( |
122 |
|
I bi, bj, myTime, myIter, myThid ) |
123 |
|
|
124 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
125 |
CADJ STORE iceMask = comlev1, key = iicekey |
CADJ STORE iceMask(:,:,bi,bj) = comlev1_bibj, |
126 |
CADJ STORE iceHeight = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
127 |
CADJ STORE snowHeight = comlev1, key = iicekey |
CADJ STORE iceHeight(:,:,bi,bj) = comlev1_bibj, |
128 |
CADJ STORE Tsrf = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
129 |
CADJ STORE Qice1 = comlev1, key = iicekey |
CADJ STORE snowHeight(:,:,bi,bj) = comlev1_bibj, |
130 |
CADJ STORE Qice2 = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
131 |
CADJ STORE snowAge = comlev1, key = iicekey |
CADJ STORE Tsrf(:,:,bi,bj) = comlev1_bibj, |
132 |
CADJ STORE snowPrc = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
133 |
|
CADJ STORE Qice1(:,:,bi,bj) = comlev1_bibj, |
134 |
CADJ STORE hOceMxL = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
135 |
CADJ STORE tOceMxL = comlev1, key = iicekey |
CADJ STORE Qice2(:,:,bi,bj) = comlev1_bibj, |
136 |
CADJ STORE sOceMxL = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
137 |
CADJ STORE v2ocMxL = comlev1, key = iicekey |
CADJ STORE snowAge(:,:,bi,bj) = comlev1_bibj, |
138 |
|
CADJ & key=ticekey, byte=isbyte |
139 |
CADJ STORE empmr = comlev1, key = iicekey |
|
140 |
CADJ STORE qnet = comlev1, key = iicekey |
CADJ STORE hOceMxL(:,:,bi,bj) = comlev1_bibj, |
141 |
#endif |
CADJ & key=ticekey, byte=isbyte |
142 |
|
CADJ STORE tOceMxL(:,:,bi,bj) = comlev1_bibj, |
143 |
cph( |
CADJ & key=ticekey, byte=isbyte |
144 |
print *, 'ph-thsice-2 in thsice_main' |
CADJ STORE sOceMxL(:,:,bi,bj) = comlev1_bibj, |
145 |
cph) |
CADJ & key=ticekey, byte=isbyte |
146 |
|
CADJ STORE v2ocMxL(:,:,bi,bj) = comlev1_bibj, |
147 |
|
CADJ & key=ticekey, byte=isbyte |
148 |
|
#else |
149 |
|
C- end if not useCheapAML |
150 |
|
ENDIF |
151 |
|
#endif |
152 |
|
|
153 |
|
#ifdef OLD_THSICE_CALL_SEQUENCE |
154 |
C- do sea-ice advection before getting surface fluxes |
C- do sea-ice advection before getting surface fluxes |
155 |
C Note: will inline this S/R once thSIce in Atmos. set-up is settled |
C Note: will inline this S/R once thSIce in Atmos. set-up is settled |
156 |
IF ( thSIceAdvScheme.GT.0 ) |
IF ( thSIceAdvScheme.GT.0 ) |
157 |
& CALL THSICE_DO_ADVECT( |
& CALL THSICE_DO_ADVECT( |
158 |
I bi,bj, myTime, myIter, myThid ) |
I bi,bj, myTime, myIter, myThid ) |
159 |
|
#endif /* OLD_THSICE_CALL_SEQUENCE */ |
160 |
|
|
161 |
#ifdef ALLOW_BULK_FORCE |
#ifndef ALLOW_AUTODIFF_TAMC |
162 |
IF ( useBulkforce ) THEN |
IF ( useBulkforce .OR. useCheapAML ) THEN |
163 |
CALL THSICE_GET_PRECIP( |
CALL THSICE_GET_PRECIP( |
164 |
I iceMask, |
I iceMask, tOceMxL, |
165 |
O prcAtm, snowPrc(1-OLx,1-OLy,bi,bj), |
O prcAtm(1-OLx,1-OLy,bi,bj), |
166 |
|
O snowPr, qPrcRn, |
167 |
O icFlxSW(1-OLx,1-OLy,bi,bj), |
O icFlxSW(1-OLx,1-OLy,bi,bj), |
168 |
I iMin,iMax,jMin,jMax, bi,bj, myThid ) |
I iMin,iMax,jMin,jMax, bi,bj, myThid ) |
169 |
ENDIF |
ENDIF |
170 |
#endif |
#endif |
|
#ifdef ALLOW_EXF |
|
171 |
IF ( useEXF ) THEN |
IF ( useEXF ) THEN |
172 |
CALL THSICE_MAP_EXF( |
CALL THSICE_MAP_EXF( |
173 |
I iceMask, |
I iceMask, tOceMxL, |
174 |
O prcAtm, snowPrc(1-OLx,1-OLy,bi,bj), |
O prcAtm(1-OLx,1-OLy,bi,bj), |
175 |
|
O snowPr, qPrcRn, |
176 |
O icFlxSW(1-OLx,1-OLy,bi,bj), |
O icFlxSW(1-OLx,1-OLy,bi,bj), |
177 |
I iMin,iMax,jMin,jMax, bi,bj, myThid ) |
I iMin,iMax,jMin,jMax, bi,bj, myThid ) |
178 |
ENDIF |
ENDIF |
|
#endif |
|
179 |
|
|
180 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
181 |
cph( |
CADJ STORE sHeating(:,:,bi,bj) = comlev1_bibj, |
182 |
print *, 'ph-thsice-3 in thsice_main' |
CADJ & key=ticekey, byte=isbyte |
183 |
cph) |
CADJ STORE tice1(:,:,bi,bj) = comlev1_bibj, |
184 |
CALL THSICE_STEP_TEMP( |
CADJ & key=ticekey, byte=isbyte |
185 |
|
CADJ STORE tice2(:,:,bi,bj) = comlev1_bibj, |
186 |
|
CADJ & key=ticekey, byte=isbyte |
187 |
|
#else |
188 |
|
IF ( .NOT.( useCheapAML .OR. thSIce_skipThermo ) ) THEN |
189 |
|
#endif |
190 |
|
CALL THSICE_STEP_TEMP( |
191 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
192 |
I myTime, myIter, myThid ) |
I myTime, myIter, myThid ) |
193 |
|
|
194 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
195 |
CADJ STORE empmr, qnet = comlev1, key = iicekey |
CADJ STORE empmr(:,:,bi,bj) = comlev1_bibj, |
196 |
CADJ STORE iceMask = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
197 |
CADJ STORE iceHeight = comlev1, key = iicekey |
CADJ STORE qnet(:,:,bi,bj) = comlev1_bibj, |
198 |
CADJ STORE snowHeight = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
199 |
CADJ STORE Tsrf = comlev1, key = iicekey |
CADJ STORE iceMask(:,:,bi,bj) = comlev1_bibj, |
200 |
CADJ STORE Qice1 = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
201 |
CADJ STORE Qice2 = comlev1, key = iicekey |
CADJ STORE iceHeight(:,:,bi,bj) = comlev1_bibj, |
202 |
CADJ STORE snowAge = comlev1, key = iicekey |
CADJ & key=ticekey, byte=isbyte |
203 |
|
CADJ STORE snowHeight(:,:,bi,bj) = comlev1_bibj, |
204 |
|
CADJ & key=ticekey, byte=isbyte |
205 |
|
cphCADJ STORE Tsrf(:,:,bi,bj) = comlev1_bibj, |
206 |
|
cphCADJ & key=ticekey, byte=isbyte |
207 |
|
CADJ STORE Qice1(:,:,bi,bj) = comlev1_bibj, |
208 |
|
CADJ & key=ticekey, byte=isbyte |
209 |
|
CADJ STORE Qice2(:,:,bi,bj) = comlev1_bibj, |
210 |
|
CADJ & key=ticekey, byte=isbyte |
211 |
|
CADJ STORE snowAge(:,:,bi,bj) = comlev1_bibj, |
212 |
|
CADJ & key=ticekey, byte=isbyte |
213 |
|
CADJ STORE sHeating(:,:,bi,bj) = comlev1_bibj, |
214 |
|
CADJ & key=ticekey, byte=isbyte |
215 |
|
#else |
216 |
|
C- end if not skipThermo / useCheapAML |
217 |
|
ENDIF |
218 |
|
IF ( .NOT.thSIce_skipThermo ) THEN |
219 |
#endif |
#endif |
220 |
|
CALL THSICE_STEP_FWD( |
|
cph( |
|
|
print *, 'ph-thsice-4 in thsice_main' |
|
|
cph) |
|
|
CALL THSICE_STEP_FWD( |
|
221 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
222 |
I prcAtm, |
I prcAtm(1-OLx,1-OLy,bi,bj), |
223 |
|
I snowPr, qPrcRn, |
224 |
I myTime, myIter, myThid ) |
I myTime, myIter, myThid ) |
225 |
|
#ifndef ALLOW_AUTODIFF_TAMC |
226 |
|
ENDIF |
227 |
|
#endif |
228 |
|
|
229 |
cph( |
C-- end bi,bj loop |
230 |
print *, 'ph-thsice-5 in thsice_main' |
ENDDO |
231 |
cph) |
ENDDO |
|
CALL THSICE_AVE( |
|
|
I bi,bj, myTime, myIter, myThid ) |
|
232 |
|
|
233 |
c ENDDO |
#ifdef ALLOW_BALANCE_FLUXES |
234 |
c ENDDO |
C-- Balance net Fresh-Water flux from Atm+Land |
235 |
|
IF ( thSIceBalanceAtmFW.NE.0 ) THEN |
236 |
|
CALL THSICE_BALANCE_FRW( |
237 |
|
I iMin, iMax, jMin, jMax, |
238 |
|
I prcAtm, myTime, myIter, myThid ) |
239 |
|
ENDIF |
240 |
|
#endif |
241 |
|
|
242 |
|
C add a small piece of code to check AddFluid implementation: |
243 |
|
c#include "thsice_test_addfluid.h" |
244 |
|
|
245 |
|
C-- Exchange fields that are advected by seaice dynamics |
246 |
|
IF ( useSEAICE .OR. thSIceAdvScheme.GT.0 |
247 |
|
& .OR. stressReduction.GT.zeroRL ) THEN |
248 |
|
CALL THSICE_DO_EXCH( myThid ) |
249 |
|
ENDIF |
250 |
|
#ifdef OLD_THSICE_CALL_SEQUENCE |
251 |
|
#ifdef ATMOSPHERIC_LOADING |
252 |
|
IF ( useRealFreshWaterFlux ) |
253 |
|
& _EXCH_XY_RS( sIceLoad, myThid ) |
254 |
|
#endif |
255 |
|
#else /* OLD_THSICE_CALL_SEQUENCE */ |
256 |
|
#ifdef ATMOSPHERIC_LOADING |
257 |
|
IF ( useRealFreshWaterFlux .AND. thSIceAdvScheme.LE.0 ) |
258 |
|
& _EXCH_XY_RS( sIceLoad, myThid ) |
259 |
|
#endif |
260 |
|
|
261 |
|
C- when useSEAICE=.true., this S/R is called from SEAICE_MODEL; |
262 |
|
C otherwise, call it from here, after thsice-thermodynamics is done |
263 |
|
IF ( thSIceAdvScheme.GT.0 .AND. .NOT.useSEAICE ) THEN |
264 |
|
CALL THSICE_DO_ADVECT( |
265 |
|
I 0, 0, myTime, myIter, myThid ) |
266 |
|
ENDIF |
267 |
|
#endif /* OLD_THSICE_CALL_SEQUENCE */ |
268 |
|
|
269 |
|
DO bj=myByLo(myThid),myByHi(myThid) |
270 |
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
271 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
272 |
|
act1 = bi - myBxLo(myThid) |
273 |
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
274 |
|
act2 = bj - myByLo(myThid) |
275 |
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
276 |
|
act3 = myThid - 1 |
277 |
|
max3 = nTx*nTy |
278 |
|
act4 = ikey_dynamics - 1 |
279 |
|
ticekey = (act1 + 1) + act2*max1 |
280 |
|
& + act3*max1*max2 |
281 |
|
& + act4*max1*max2*max3 |
282 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
283 |
|
|
284 |
|
C-- Cumulate time-averaged fields and also fill-up flux diagnostics |
285 |
|
C (if not done in THSICE_DO_ADVECT call) |
286 |
|
#ifdef OLD_THSICE_CALL_SEQUENCE |
287 |
|
IF ( .TRUE. ) THEN |
288 |
|
#else /* OLD_THSICE_CALL_SEQUENCE */ |
289 |
|
IF ( thSIceAdvScheme.LE.0 ) THEN |
290 |
|
#endif /* OLD_THSICE_CALL_SEQUENCE */ |
291 |
|
CALL THSICE_AVE( |
292 |
|
I bi,bj, myTime, myIter, myThid ) |
293 |
|
ENDIF |
294 |
C-- note: If useSEAICE=.true., the stress is computed in seaice_model, |
C-- note: If useSEAICE=.true., the stress is computed in seaice_model, |
295 |
C-- and stressReduction is always set to zero |
C-- and stressReduction is always set to zero |
296 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
297 |
CADJ STORE fu(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE fu(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
298 |
CADJ STORE fv(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE fv(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
299 |
#endif |
#endif |
300 |
IF ( stressReduction.GT. 0. _d 0 ) THEN |
IF ( stressReduction.GT. 0. _d 0 ) THEN |
301 |
DO j = jMin, jMax |
DO j = 1-OLy,sNy+OLy-1 |
302 |
DO i = iMin+1,iMax |
DO i = 2-OLx,sNx+OLx-1 |
303 |
tauFac = stressReduction |
tauFac = stressReduction |
304 |
& *(iceMask(i-1,j,bi,bj)+iceMask(i,j,bi,bj))*0.5 _d 0 |
& *(iceMask(i-1,j,bi,bj)+iceMask(i,j,bi,bj))*0.5 _d 0 |
305 |
fu(i,j,bi,bj) = (1. _d 0 - tauFac)*fu(i,j,bi,bj) |
fu(i,j,bi,bj) = (1. _d 0 - tauFac)*fu(i,j,bi,bj) |
306 |
ENDDO |
ENDDO |
307 |
ENDDO |
ENDDO |
308 |
DO j = jMin+1, jMax |
DO j = 2-OLy,sNy+OLy-1 |
309 |
DO i = iMin, iMax |
DO i = 1-OLx,sNx+OLx-1 |
310 |
tauFac = stressReduction |
tauFac = stressReduction |
311 |
& *(iceMask(i,j-1,bi,bj)+iceMask(i,j,bi,bj))*0.5 _d 0 |
& *(iceMask(i,j-1,bi,bj)+iceMask(i,j,bi,bj))*0.5 _d 0 |
312 |
fv(i,j,bi,bj) = (1. _d 0 - tauFac)*fv(i,j,bi,bj) |
fv(i,j,bi,bj) = (1. _d 0 - tauFac)*fv(i,j,bi,bj) |
318 |
ENDDO |
ENDDO |
319 |
ENDDO |
ENDDO |
320 |
|
|
|
|
|
|
cph( |
|
|
print *, 'ph-thsice-6 in thsice_main' |
|
|
cph) |
|
|
IF ( useSEAICE .OR. thSIceAdvScheme.GT.0 ) THEN |
|
|
C-- Exchange fields that are advected by seaice dynamics |
|
|
_EXCH_XY_R8( iceMask, myThid ) |
|
|
_EXCH_XY_R8( iceHeight, myThid ) |
|
|
_EXCH_XY_R8( snowHeight, myThid ) |
|
|
_EXCH_XY_R8( Qice1, myThid ) |
|
|
_EXCH_XY_R8( Qice2, myThid ) |
|
|
#ifdef ATMOSPHERIC_LOADING |
|
|
IF (useRealFreshWaterFlux) |
|
|
& _EXCH_XY_RS( sIceLoad, myThid ) |
|
|
#endif |
|
|
ENDIF |
|
|
|
|
321 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
322 |
#endif /*ALLOW_THSICE*/ |
#endif /*ALLOW_THSICE*/ |
323 |
|
|