28 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
29 |
#include "FFIELDS.h" |
#include "FFIELDS.h" |
30 |
#include "THSICE_PARAMS.h" |
#include "THSICE_PARAMS.h" |
31 |
|
#include "THSICE_SIZE.h" |
32 |
#include "THSICE_VARS.h" |
#include "THSICE_VARS.h" |
33 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
34 |
# include "tamc.h" |
# include "tamc.h" |
35 |
# include "tamc_keys.h" |
# include "tamc_keys.h" |
|
C-- |
|
|
# include "THSICE_2DYN.h" |
|
|
C-- |
|
36 |
#endif |
#endif |
37 |
|
|
38 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
94 |
act3 = myThid - 1 |
act3 = myThid - 1 |
95 |
max3 = nTx*nTy |
max3 = nTx*nTy |
96 |
act4 = ikey_dynamics - 1 |
act4 = ikey_dynamics - 1 |
97 |
iicekey = (act1 + 1) + act2*max1 |
ticekey = (act1 + 1) + act2*max1 |
98 |
& + act3*max1*max2 |
& + act3*max1*max2 |
99 |
& + act4*max1*max2*max3 |
& + act4*max1*max2*max3 |
100 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
101 |
|
|
102 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
103 |
CADJ STORE ocefwfx(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE ocefwfx(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
104 |
CADJ STORE oceqnet(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE oceqnet(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
105 |
CADJ STORE ocesflx(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE ocesflx(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
106 |
# ifdef ALLOW_EXF |
# ifdef ALLOW_EXF |
107 |
CADJ STORE qsw(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE qsw(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
108 |
# endif |
# endif |
109 |
#endif |
#endif |
110 |
|
|
|
cph( |
|
|
print *, 'ph-thsice-1 in thsice_main' |
|
|
cph) |
|
111 |
C-- Mixed layer thickness: take the 1rst layer |
C-- Mixed layer thickness: take the 1rst layer |
112 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
113 |
IF ( staggerTimeStep .AND. nonlinFreeSurf.GT.0 ) THEN |
IF ( staggerTimeStep .AND. nonlinFreeSurf.GT.0 ) THEN |
114 |
IF ( select_rStar.GT.0 ) THEN |
IF ( select_rStar.GT.0 ) THEN |
115 |
DO j = jMin, jMax |
DO j=1-OLy,sNy+OLy |
116 |
DO i = iMin, iMax |
DO i=1-OLx,sNx+OLx |
117 |
hOceMxL(i,j,bi,bj) = drF(1)*h0FacC(i,j,1,bi,bj) |
hOceMxL(i,j,bi,bj) = drF(1)*h0FacC(i,j,1,bi,bj) |
118 |
& *rStarFacC(i,j,bi,bj) |
& *rStarFacC(i,j,bi,bj) |
119 |
ENDDO |
ENDDO |
120 |
ENDDO |
ENDDO |
121 |
ELSE |
ELSE |
122 |
DO j = jMin, jMax |
DO j=1-OLy,sNy+OLy |
123 |
DO i = iMin, iMax |
DO i=1-OLx,sNx+OLx |
124 |
IF ( ksurfC(i,j,bi,bj).EQ.1 ) THEN |
IF ( ksurfC(i,j,bi,bj).EQ.1 ) THEN |
125 |
hOceMxL(i,j,bi,bj) = drF(1)*hFac_surfC(i,j,bi,bj) |
hOceMxL(i,j,bi,bj) = drF(1)*hFac_surfC(i,j,bi,bj) |
126 |
ELSE |
ELSE |
133 |
#else /* ndef NONLIN_FRSURF */ |
#else /* ndef NONLIN_FRSURF */ |
134 |
IF (.TRUE.) THEN |
IF (.TRUE.) THEN |
135 |
#endif /* NONLIN_FRSURF */ |
#endif /* NONLIN_FRSURF */ |
136 |
DO j = jMin, jMax |
DO j=1-OLy,sNy+OLy |
137 |
DO i = iMin, iMax |
DO i=1-OLx,sNx+OLx |
138 |
hOceMxL(i,j,bi,bj) = drF(1)*hFacC(i,j,1,bi,bj) |
hOceMxL(i,j,bi,bj) = drF(1)*hFacC(i,j,1,bi,bj) |
139 |
ENDDO |
ENDDO |
140 |
ENDDO |
ENDDO |
141 |
ENDIF |
ENDIF |
142 |
|
|
143 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
144 |
CADJ STORE uvel (:,:,1,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE uvel (:,:,1,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
145 |
CADJ STORE vvel (:,:,1,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE vvel (:,:,1,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
146 |
#endif |
#endif |
147 |
|
|
148 |
DO j = jMin, jMax |
DO j = jMin, jMax |
165 |
ENDDO |
ENDDO |
166 |
|
|
167 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
168 |
CADJ STORE iceMask = comlev1, key = iicekey |
CADJ STORE iceMask(:,:,bi,bj) = comlev1_bibj, key = ticekey |
169 |
CADJ STORE iceHeight = comlev1, key = iicekey |
CADJ STORE iceHeight(:,:,bi,bj) = comlev1_bibj, key = ticekey |
170 |
CADJ STORE snowHeight = comlev1, key = iicekey |
CADJ STORE snowHeight(:,:,bi,bj) = comlev1_bibj, key = ticekey |
171 |
CADJ STORE Tsrf = comlev1, key = iicekey |
CADJ STORE Tsrf(:,:,bi,bj) = comlev1_bibj, key = ticekey |
172 |
CADJ STORE Qice1 = comlev1, key = iicekey |
CADJ STORE Qice1(:,:,bi,bj) = comlev1_bibj, key = ticekey |
173 |
CADJ STORE Qice2 = comlev1, key = iicekey |
CADJ STORE Qice2(:,:,bi,bj) = comlev1_bibj, key = ticekey |
174 |
CADJ STORE snowAge = comlev1, key = iicekey |
CADJ STORE snowAge(:,:,bi,bj) = comlev1_bibj, key = ticekey |
175 |
CADJ STORE snowPrc = comlev1, key = iicekey |
CADJ STORE snowPrc(:,:,bi,bj) = comlev1_bibj, key = ticekey |
176 |
|
|
177 |
CADJ STORE hOceMxL = comlev1, key = iicekey |
CADJ STORE hOceMxL(:,:,bi,bj) = comlev1_bibj, key = ticekey |
178 |
CADJ STORE tOceMxL = comlev1, key = iicekey |
CADJ STORE tOceMxL(:,:,bi,bj) = comlev1_bibj, key = ticekey |
179 |
CADJ STORE sOceMxL = comlev1, key = iicekey |
CADJ STORE sOceMxL(:,:,bi,bj) = comlev1_bibj, key = ticekey |
180 |
CADJ STORE v2ocMxL = comlev1, key = iicekey |
CADJ STORE v2ocMxL(:,:,bi,bj) = comlev1_bibj, key = ticekey |
|
|
|
|
CADJ STORE empmr = comlev1, key = iicekey |
|
|
CADJ STORE qnet = comlev1, key = iicekey |
|
181 |
#endif |
#endif |
182 |
|
|
|
cph( |
|
|
print *, 'ph-thsice-2 in thsice_main' |
|
|
cph) |
|
183 |
C- do sea-ice advection before getting surface fluxes |
C- do sea-ice advection before getting surface fluxes |
184 |
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 |
185 |
IF ( thSIceAdvScheme.GT.0 ) |
IF ( thSIceAdvScheme.GT.0 ) |
205 |
ENDIF |
ENDIF |
206 |
#endif |
#endif |
207 |
|
|
208 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
209 |
cph( |
CADJ STORE sheating(:,:,bi,bj) = comlev1_bibj, key = ticekey |
210 |
print *, 'ph-thsice-3 in thsice_main' |
CADJ STORE tice1(:,:,bi,bj) = comlev1_bibj, key = ticekey |
211 |
cph) |
CADJ STORE tice2(:,:,bi,bj) = comlev1_bibj, key = ticekey |
212 |
|
#endif |
213 |
CALL THSICE_STEP_TEMP( |
CALL THSICE_STEP_TEMP( |
214 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
215 |
I myTime, myIter, myThid ) |
I myTime, myIter, myThid ) |
216 |
|
|
217 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
218 |
CADJ STORE empmr, qnet = comlev1, key = iicekey |
CADJ STORE empmr(:,:,bi,bj) = comlev1_bibj, key = ticekey |
219 |
CADJ STORE iceMask = comlev1, key = iicekey |
CADJ STORE qnet(:,:,bi,bj) = comlev1_bibj, key = ticekey |
220 |
CADJ STORE iceHeight = comlev1, key = iicekey |
CADJ STORE iceMask(:,:,bi,bj) = comlev1_bibj, key = ticekey |
221 |
CADJ STORE snowHeight = comlev1, key = iicekey |
CADJ STORE iceHeight(:,:,bi,bj) = comlev1_bibj, key = ticekey |
222 |
CADJ STORE Tsrf = comlev1, key = iicekey |
CADJ STORE snowHeight(:,:,bi,bj) = comlev1_bibj, key = ticekey |
223 |
CADJ STORE Qice1 = comlev1, key = iicekey |
cphCADJ STORE Tsrf(:,:,bi,bj) = comlev1_bibj, key = ticekey |
224 |
CADJ STORE Qice2 = comlev1, key = iicekey |
CADJ STORE Qice1(:,:,bi,bj) = comlev1_bibj, key = ticekey |
225 |
CADJ STORE snowAge = comlev1, key = iicekey |
CADJ STORE Qice2(:,:,bi,bj) = comlev1_bibj, key = ticekey |
226 |
|
CADJ STORE snowAge(:,:,bi,bj) = comlev1_bibj, key = ticekey |
227 |
|
CADJ STORE sheating(:,:,bi,bj) = comlev1_bibj, key = ticekey |
228 |
#endif |
#endif |
229 |
|
|
|
cph( |
|
|
print *, 'ph-thsice-4 in thsice_main' |
|
|
cph) |
|
230 |
CALL THSICE_STEP_FWD( |
CALL THSICE_STEP_FWD( |
231 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
232 |
I prcAtm, |
I prcAtm, |
233 |
I myTime, myIter, myThid ) |
I myTime, myIter, myThid ) |
234 |
|
|
|
cph( |
|
|
print *, 'ph-thsice-5 in thsice_main' |
|
|
cph) |
|
235 |
CALL THSICE_AVE( |
CALL THSICE_AVE( |
236 |
I bi,bj, myTime, myIter, myThid ) |
I bi,bj, myTime, myIter, myThid ) |
237 |
|
|
241 |
C-- note: If useSEAICE=.true., the stress is computed in seaice_model, |
C-- note: If useSEAICE=.true., the stress is computed in seaice_model, |
242 |
C-- and stressReduction is always set to zero |
C-- and stressReduction is always set to zero |
243 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
244 |
CADJ STORE fu(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE fu(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
245 |
CADJ STORE fv(:,:,bi,bj) = comlev1_bibj, key=iicekey, byte=isbyte |
CADJ STORE fv(:,:,bi,bj) = comlev1_bibj, key=ticekey, byte=isbyte |
246 |
#endif |
#endif |
247 |
IF ( stressReduction.GT. 0. _d 0 ) THEN |
IF ( stressReduction.GT. 0. _d 0 ) THEN |
248 |
DO j = jMin, jMax |
DO j = jMin, jMax |
265 |
ENDDO |
ENDDO |
266 |
ENDDO |
ENDDO |
267 |
|
|
268 |
|
C add a small piece of code to check AddFluid implementation: |
269 |
|
c#include "thsice_test_addfluid.h" |
270 |
|
|
|
cph( |
|
|
print *, 'ph-thsice-6 in thsice_main' |
|
|
cph) |
|
271 |
IF ( useSEAICE .OR. thSIceAdvScheme.GT.0 ) THEN |
IF ( useSEAICE .OR. thSIceAdvScheme.GT.0 ) THEN |
272 |
C-- Exchange fields that are advected by seaice dynamics |
C-- Exchange fields that are advected by seaice dynamics |
273 |
_EXCH_XY_R8( iceMask, myThid ) |
_EXCH_XY_RL( iceMask, myThid ) |
274 |
_EXCH_XY_R8( iceHeight, myThid ) |
_EXCH_XY_RL( iceHeight, myThid ) |
275 |
_EXCH_XY_R8( snowHeight, myThid ) |
_EXCH_XY_RL( snowHeight, myThid ) |
276 |
_EXCH_XY_R8( Qice1, myThid ) |
_EXCH_XY_RL( Qice1, myThid ) |
277 |
_EXCH_XY_R8( Qice2, myThid ) |
_EXCH_XY_RL( Qice2, myThid ) |
278 |
|
|
279 |
#ifdef ATMOSPHERIC_LOADING |
#ifdef ATMOSPHERIC_LOADING |
280 |
IF (useRealFreshWaterFlux) |
IF (useRealFreshWaterFlux) |
281 |
& _EXCH_XY_RS( sIceLoad, myThid ) |
& _EXCH_XY_RS( sIceLoad, myThid ) |