File indexing completed on 2024-10-25 05:11:11 UTC
view on githubraw file Latest commit ee480e77 on 2024-10-24 18:00:25 UTC
809c36b928 Patr*0001 #include "SEAICE_OPTIONS.h"
8377b8ee87 Mart*0002 #ifdef ALLOW_EXF
0003 # include "EXF_OPTIONS.h"
0004 #endif
772b2ed80e Gael*0005 #ifdef ALLOW_AUTODIFF
0006 # include "AUTODIFF_OPTIONS.h"
0007 #endif
7e1af563d8 Jean*0008
ef080e1d37 Dimi*0009
0010
0011
0012
b92ebad606 Jean*0013 SUBROUTINE SEAICE_MODEL( myTime, myIter, myThid )
ef080e1d37 Dimi*0014
0015
ff8e41478f Jean*0016
09510da3bb Dimi*0017
0018
0019
0020
0021
0022
0023
0024
0025
45315406aa Mart*0026
0027
ff8e41478f Jean*0028
809c36b928 Patr*0029 IMPLICIT NONE
7e1af563d8 Jean*0030
0031
ef080e1d37 Dimi*0032
809c36b928 Patr*0033 #include "SIZE.h"
0034 #include "EEPARAMS.h"
0035 #include "DYNVARS.h"
0036 #include "PARAMS.h"
4634ed4578 Dimi*0037 #include "GRID.h"
809c36b928 Patr*0038 #include "FFIELDS.h"
ccaa3c61f4 Patr*0039 #include "SEAICE_SIZE.h"
809c36b928 Patr*0040 #include "SEAICE_PARAMS.h"
ccaa3c61f4 Patr*0041 #include "SEAICE.h"
0042 #include "SEAICE_TRACER.h"
ae1fb66b64 Dimi*0043 #ifdef ALLOW_EXF
0044 # include "EXF_FIELDS.h"
0045 #endif
7109a141b2 Patr*0046 #ifdef ALLOW_AUTODIFF_TAMC
0047 # include "tamc.h"
6060ec2938 Dimi*0048 #endif
baa476eeba Dimi*0049
ef080e1d37 Dimi*0050
f003822524 Jean*0051
0052
0053
809c36b928 Patr*0054 _RL myTime
0055 INTEGER myIter
0056 INTEGER myThid
0057
ef080e1d37 Dimi*0058
a1ab12d5e7 Dimi*0059
e8a5a3baa4 Jean*0060 INTEGER i, j
0061 INTEGER bi, bj
40d541aac0 Jean*0062 #ifdef ALLOW_EXF
0063 INTEGER grpDiag
0064 #endif
f50f58ec54 Gael*0065 #ifdef ALLOW_SITRACER
0066 INTEGER iTr
0067 #endif
45315406aa Mart*0068 #ifdef SEAICE_BGRID_DYNAMICS
f003822524 Jean*0069 _RL uLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0070 _RL vLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0071 #endif
ef080e1d37 Dimi*0072
5fe78992ba Mart*0073 #ifdef ALLOW_DIAGNOSTICS
0074 LOGICAL DIAGNOSTICS_IS_ON
0075 EXTERNAL DIAGNOSTICS_IS_ON
0076 LOGICAL diag_SIenph_isOn
ee480e7782 amc2*0077 _RL mTmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
5fe78992ba Mart*0078 _RL recip_deltaTtherm
ee480e7782 amc2*0079 _RL addSnow
5fe78992ba Mart*0080 #endif
b92ebad606 Jean*0081 #ifdef ALLOW_DEBUG
a8b75793c4 Jean*0082 IF (debugMode) CALL DEBUG_ENTER( 'SEAICE_MODEL', myThid )
b92ebad606 Jean*0083 #endif
0084
0320e25227 Mart*0085 IF ( usingPCoords ) THEN
0086
0087
0088
0089
0090
0091
0092 _EXCH_XY_RL( phiHydLow, myThid )
0093 ENDIF
47852c9c0c Mart*0094 #ifdef ALLOW_THSICE
0095 IF ( useThSice ) THEN
20e951135e Mart*0096
0097
47852c9c0c Mart*0098 CALL SEAICE_MAP_THSICE( myTime, myIter, myThid )
0099 ENDIF
0100 #endif /* ALLOW_THSICE */
d5254b4e3d Mart*0101 #ifdef ALLOW_DIAGNOSTICS
0102 IF ( useDiagnostics ) THEN
0103 diag_SIenph_isOn = DIAGNOSTICS_IS_ON('SIenph ',myThid)
0104 IF ( diag_SIenph_isOn ) THEN
ee480e7782 amc2*0105 IF ( SEAICEaddSnowMass ) THEN
0106 addSnow=1. _d 0
0107 ELSE
0108 addSnow=0. _d 0
0109 ENDIF
d5254b4e3d Mart*0110 DO bj=myByLo(myThid),myByHi(myThid)
0111 DO bi=myBxLo(myThid),myBxHi(myThid)
0112 DO j=1-OLy,sNy+OLy
0113 DO i=1-OLx,sNx+OLx
ee480e7782 amc2*0114 mTmp(i,j,bi,bj)=SEAICE_rhoIce*HEFF(i,j,bi,bj)
0115 & +addSnow*SEAICE_rhoSnow*HSNOW(i,j,bi,bj)
d5254b4e3d Mart*0116 ENDDO
0117 ENDDO
0118 ENDDO
0119 ENDDO
0120 ENDIF
0121 ENDIF
0122 #endif /* ALLOW_DIAGNOSTICS */
47852c9c0c Mart*0123
40d541aac0 Jean*0124 #ifdef ALLOW_EXF
0125 IF ( useEXF ) THEN
0126
0127 CALL EXCH_UV_AGRID_3D_RL( uwind, vwind, .TRUE., 1, myThid )
0128 IF ( useDiagnostics ) THEN
0129
0130 grpDiag = -1
0131 IF ( SEAICEuseDYNAMICS ) grpDiag = 1
0132 CALL EXF_WEIGHT_SFX_DIAGS(
0133 I AREA, grpDiag, myTime, myIter, myThid )
0134 ENDIF
0135 ENDIF
0136 #endif /* ALLOW_EXF */
0137
8377b8ee87 Mart*0138 #ifdef ALLOW_AUTODIFF
c20cddf271 Patr*0139 DO bj=myByLo(myThid),myByHi(myThid)
0140 DO bi=myBxLo(myThid),myBxHi(myThid)
d24acf3cfc Jean*0141 DO j=1-OLy,sNy+OLy
0142 DO i=1-OLx,sNx+OLx
c20cddf271 Patr*0143 uIceNm1(i,j,bi,bj) = 0. _d 0
0144 vIceNm1(i,j,bi,bj) = 0. _d 0
aef1621d33 Patr*0145 # ifdef ALLOW_SITRACER
0146 DO iTr = 1, SItrMaxNum
0147 SItrBucket(i,j,bi,bj,iTr) = 0. _d 0
0148 ENDDO
0149 # endif
c20cddf271 Patr*0150 ENDDO
0151 ENDDO
0152 ENDDO
0153 ENDDO
8377b8ee87 Mart*0154 #endif /* ALLOW_AUTODIFF */
0155 #ifdef ALLOW_AUTODIFF_TAMC
95c72ef3a1 Patr*0156
0157
3cb8290a3c Mart*0158
45315406aa Mart*0159 # ifdef SEAICE_CGRID
95c72ef3a1 Patr*0160
0161
d5254b4e3d Mart*0162 # ifdef SEAICE_ALLOW_EVP
b81c343615 Patr*0163
0164
0165
d5254b4e3d Mart*0166 # endif /* SEAICE_ALLOW_EVP */
45315406aa Mart*0167 # endif /* SEAICE_CGRID */
aef1621d33 Patr*0168 # ifdef ALLOW_SITRACER
d5254b4e3d Mart*0169
0170
aef1621d33 Patr*0171 # endif
7109a141b2 Patr*0172 #endif /* ALLOW_AUTODIFF_TAMC */
0173
45315406aa Mart*0174
0175
0176
b92ebad606 Jean*0177 #ifdef ALLOW_DEBUG
a8b75793c4 Jean*0178 IF (debugMode) CALL DEBUG_CALL( 'SEAICE_DYNSOLVER', myThid )
b92ebad606 Jean*0179 #endif
45315406aa Mart*0180 #ifdef SEAICE_BGRID_DYNAMICS
02aabb8fe5 Dimi*0181 CALL TIMER_START('DYNSOLVER [SEAICE_MODEL]',myThid)
0182 CALL DYNSOLVER ( myTime, myIter, myThid )
0183 CALL TIMER_STOP ('DYNSOLVER [SEAICE_MODEL]',myThid)
45315406aa Mart*0184 #else /* use default C-grid solver */
0185 CALL TIMER_START('SEAICE_DYNSOLVER [SEAICE_MODEL]',myThid)
0186 CALL SEAICE_DYNSOLVER ( myTime, myIter, myThid )
0187 CALL TIMER_STOP ('SEAICE_DYNSOLVER [SEAICE_MODEL]',myThid)
0188 #endif
809c36b928 Patr*0189
0f64a7d6fb Dimi*0190
5459643feb Dimi*0191 #ifdef ALLOW_OBCS
0f64a7d6fb Dimi*0192 # ifndef DISABLE_SEAICE_OBCS
d5254b4e3d Mart*0193 IF ( useOBCS ) CALL OBCS_ADJUST_UVICE( uice, vice, myThid )
0f64a7d6fb Dimi*0194 # endif /* DISABLE_SEAICE_OBCS */
5459643feb Dimi*0195 #endif /* ALLOW_OBCS */
0196
45315406aa Mart*0197 #if ( defined ALLOW_AUTODIFF_TAMC && defined SEAICE_CGRID )
d5254b4e3d Mart*0198
0199
0200
0201
0202
0203
0204
0205
45315406aa Mart*0206 #endif
d5254b4e3d Mart*0207
4a98994c14 Jean*0208 #ifdef ALLOW_THSICE
de80e32bba Jean*0209 IF ( useThSice ) THEN
0210 #ifdef ALLOW_DEBUG
d5254b4e3d Mart*0211 IF (debugMode) CALL DEBUG_CALL( 'THSICE_DO_ADVECT', myThid )
de80e32bba Jean*0212 #endif
d5254b4e3d Mart*0213 CALL THSICE_DO_ADVECT( 0, 0, myTime, myIter, myThid )
de80e32bba Jean*0214 ELSE
bfae2ee370 jm-c 0215 #endif /* ALLOW_THSICE */
ff8e41478f Jean*0216
09e3b53265 Mart*0217
0218
0219
0220
d5254b4e3d Mart*0221 IF ( SEAICEadvHeff .OR. SEAICEadvArea .OR. SEAICEadvSnow
e54fe3e1f9 Gael*0222 & .OR. SEAICEadvSalt ) THEN
b92ebad606 Jean*0223 #ifdef ALLOW_DEBUG
d5254b4e3d Mart*0224 IF (debugMode) CALL DEBUG_CALL( 'SEAICE_ADVDIFF', myThid )
b92ebad606 Jean*0225 #endif
45315406aa Mart*0226
0227
0228 #ifdef SEAICE_BGRID_DYNAMICS
d5254b4e3d Mart*0229 CALL SEAICE_ADVDIFF( uLoc, vLoc, myTime, myIter, myThid )
45315406aa Mart*0230 #else /* default C-grid advection */
0231 CALL SEAICE_ADVDIFF( uIce, vIce, myTime, myIter, myThid )
0232 #endif
d5254b4e3d Mart*0233 ENDIF
0234 #ifdef ALLOW_AUTODIFF_TAMC
0235
0236
0237
0238 # ifdef SEAICE_VARIABLE_SALINITY
0239
0240 # endif
0241
0242
0243 #endif /* ALLOW_AUTODIFF_TAMC */
809c36b928 Patr*0244
1cf549c217 Mart*0245
20970ee22f Jean*0246
1cf549c217 Mart*0247
0248
d5254b4e3d Mart*0249 CALL SEAICE_REG_RIDGE( myTime, myIter, myThid )
1cf549c217 Mart*0250
40d541aac0 Jean*0251 #ifdef ALLOW_EXF
d5254b4e3d Mart*0252 IF ( useEXF .AND. useDiagnostics ) THEN
40d541aac0 Jean*0253
0254 grpDiag = -2
0255 IF ( usePW79thermodynamics ) grpDiag = 2
0256 CALL EXF_WEIGHT_SFX_DIAGS(
0257 I AREA, grpDiag, myTime, myIter, myThid )
d5254b4e3d Mart*0258 ENDIF
40d541aac0 Jean*0259 #endif /* ALLOW_EXF */
0260
bfae2ee370 jm-c 0261 #ifdef DISABLE_SEAICE_GROWTH
0262 IF ( .TRUE. ) THEN
0263 #else /* DISABLE_SEAICE_GROWTH */
09e3b53265 Mart*0264
ff8e41478f Jean*0265
09e3b53265 Mart*0266
0267 IF ( usePW79thermodynamics ) THEN
45315406aa Mart*0268 # ifdef SEAICE_USE_GROWTH_ADX
0269 # ifdef ALLOW_DEBUG
dc54d31829 Ian *0270 IF (debugMode) CALL DEBUG_CALL( 'SEAICE_GROWTH_ADX', myThid )
45315406aa Mart*0271 # endif
dc54d31829 Ian *0272 CALL SEAICE_GROWTH_ADX( myTime, myIter, myThid )
382462ccb5 Mart*0273 # else /* SEAICE_USE_GROWTH_ADX */
45315406aa Mart*0274 # ifdef ALLOW_DEBUG
a8b75793c4 Jean*0275 IF (debugMode) CALL DEBUG_CALL( 'SEAICE_GROWTH', myThid )
45315406aa Mart*0276 # endif
09e3b53265 Mart*0277 CALL SEAICE_GROWTH( myTime, myIter, myThid )
382462ccb5 Mart*0278 # endif /* SEAICE_USE_GROWTH_ADX */
bfae2ee370 jm-c 0279 ELSE
4ce2104710 Patr*0280 #endif /* DISABLE_SEAICE_GROWTH */
bfae2ee370 jm-c 0281 DO bj=myByLo(myThid),myByHi(myThid)
0282 DO bi=myBxLo(myThid),myBxHi(myThid)
0283 DO j=1,sNy
0284 DO i=1,sNx
0285 sIceLoad(i,j,bi,bj) = HEFF(i,j,bi,bj)*SEAICE_rhoIce
0286 & + HSNOW(i,j,bi,bj)*SEAICE_rhoSnow
0287 ENDDO
0288 ENDDO
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298 ENDDO
0299 ENDDO
0300 ENDIF
809c36b928 Patr*0301
f50f58ec54 Gael*0302 #ifdef ALLOW_SITRACER
aef1621d33 Patr*0303 # ifdef ALLOW_AUTODIFF_TAMC
0304
0305 # endif
a746f35887 Jean*0306 CALL SEAICE_TRACER_PHYS ( myTime, myIter, myThid )
f50f58ec54 Gael*0307 #endif
0308
0f64a7d6fb Dimi*0309
a1ab12d5e7 Dimi*0310 #ifdef ALLOW_OBCS
0f64a7d6fb Dimi*0311 # ifndef DISABLE_SEAICE_OBCS
0312 IF ( useOBCS ) CALL OBCS_APPLY_SEAICE( myThid )
0313 # endif /* DISABLE_SEAICE_OBCS */
a1ab12d5e7 Dimi*0314 #endif /* ALLOW_OBCS */
0315
809c36b928 Patr*0316
772590b63c Mart*0317 _EXCH_XY_RL( HEFF, myThid )
0318 _EXCH_XY_RL( AREA, myThid )
0319 _EXCH_XY_RL( HSNOW, myThid )
963c7c7f95 Torg*0320 #ifdef SEAICE_ITD
0321 CALL EXCH_3D_RL( HEFFITD, nITD, myThid )
0322 CALL EXCH_3D_RL( AREAITD, nITD, myThid )
0323 CALL EXCH_3D_RL( HSNOWITD, nITD, myThid )
0324 #endif
a98c4b8072 Ian *0325 #ifdef SEAICE_VARIABLE_SALINITY
772590b63c Mart*0326 _EXCH_XY_RL( HSALT, myThid )
fdfa8e151f Dimi*0327 #endif
f50f58ec54 Gael*0328 #ifdef ALLOW_SITRACER
be02c52974 Gael*0329 DO iTr = 1, SItrNumInUse
d24acf3cfc Jean*0330 _EXCH_XY_RL( SItracer(1-OLx,1-OLy,1,1,iTr),myThid )
f50f58ec54 Gael*0331 ENDDO
0332 #endif
14cee76775 Jean*0333 _EXCH_XY_RS(EmPmR, myThid )
0334 _EXCH_XY_RS(saltFlux, myThid )
0335 _EXCH_XY_RS(Qnet , myThid )
809c36b928 Patr*0336 #ifdef SHORTWAVE_HEATING
14cee76775 Jean*0337 _EXCH_XY_RS(Qsw , myThid )
e4775240e5 Dimi*0338 #endif /* SHORTWAVE_HEATING */
f3ce416a61 Jean*0339 #ifdef ATMOSPHERIC_LOADING
7e1af563d8 Jean*0340 IF ( useRealFreshWaterFlux )
09e3b53265 Mart*0341 & _EXCH_XY_RS( sIceLoad, myThid )
f3ce416a61 Jean*0342 #endif
809c36b928 Patr*0343
4f6e464f38 Jean*0344 #ifdef ALLOW_OBCS
3352db77f4 Jean*0345
0346
0347
0348
0349
d24acf3cfc Jean*0350
3352db77f4 Jean*0351
d24acf3cfc Jean*0352
3352db77f4 Jean*0353
d24acf3cfc Jean*0354
3352db77f4 Jean*0355
a98c4b8072 Ian *0356 #ifdef SEAICE_VARIABLE_SALINITY
d24acf3cfc Jean*0357
3352db77f4 Jean*0358
4f6e464f38 Jean*0359 #endif
3352db77f4 Jean*0360
0361
0362
4f6e464f38 Jean*0363 #endif /* ALLOW_OBCS */
0364
d74b8b60ab Patr*0365 #ifdef ALLOW_DIAGNOSTICS
0366 IF ( useDiagnostics ) THEN
9ef71a93d2 Mart*0367
d5254b4e3d Mart*0368
ead4e7560e Jean*0369 CALL DIAGNOSTICS_FILL_RS(EmPmR,'SIempmr ',0,1 ,0,1,1,myThid)
0370 CALL DIAGNOSTICS_FILL_RS(Qnet ,'SIqnet ',0,1 ,0,1,1,myThid)
0371 CALL DIAGNOSTICS_FILL_RS(Qsw ,'SIqsw ',0,1 ,0,1,1,myThid)
d5254b4e3d Mart*0372
5fe78992ba Mart*0373 IF ( diag_SIenph_isOn ) THEN
0374 recip_deltaTtherm = 1. _d 0 / SEAICE_deltaTtherm
0375 DO bj=myByLo(myThid),myByHi(myThid)
0376 DO bi=myBxLo(myThid),myBxHi(myThid)
0377 DO j=1,sNy
0378 DO i=1,sNx
ee480e7782 amc2*0379 mTmp(i,j,bi,bj) = 0.25 _d 0 * (
5fe78992ba Mart*0380 & uIce (i,j,bi,bj)**2 + uIce (i+1,j, bi,bj)**2
0381 & + vIce (i,j,bi,bj)**2 + vIce (i, j+1,bi,bj)**2 )
ee480e7782 amc2*0382 & * (SEAICE_rhoIce*HEFF(i,j,bi,bj)
0383 & + addSnow*SEAICE_rhoSnow*HSNOW(i,j,bi,bj)
0384 & - mTmp(i,j,bi,bj))
5fe78992ba Mart*0385 & *recip_deltaTtherm
0386 ENDDO
0387 ENDDO
0388 ENDDO
0389 ENDDO
ee480e7782 amc2*0390 CALL DIAGNOSTICS_FILL(mTmp,'SIenph ',0,1,0,1,1,myThid)
5fe78992ba Mart*0391 ENDIF
d74b8b60ab Patr*0392 ENDIF
0393 #endif /* ALLOW_DIAGNOSTICS */
0394
09e3b53265 Mart*0395 #ifdef ALLOW_THSICE
0396
0397 ENDIF
0398 #endif /* ALLOW_THSICE */
0399
0400
0401
fb1912d055 Patr*0402 #ifdef ALLOW_EXF
5d96c49326 Jean*0403 # ifdef ALLOW_AUTODIFF
0404 # ifdef ALLOW_AUTODIFF_MONITOR
d5254b4e3d Mart*0405 CALL EXF_ADJOINT_SNAPSHOTS( 3, myTime, myIter, myThid )
fb1912d055 Patr*0406 # endif
0407 # endif
0408 #endif
0409
b92ebad606 Jean*0410 #ifdef ALLOW_DEBUG
a8b75793c4 Jean*0411 IF (debugMode) CALL DEBUG_LEAVE( 'SEAICE_MODEL', myThid )
b92ebad606 Jean*0412 #endif
0413
809c36b928 Patr*0414 RETURN
0415 END