File indexing completed on 2024-06-06 05:10:50 UTC
view on githubraw file Latest commit af61e5eb on 2024-06-06 03:30:35 UTC
2fa42a6013 Alis*0001 #include "KPP_OPTIONS.h"
853c5e0e2c Jean*0002 #ifdef ALLOW_AUTODIFF
0003 # include "AUTODIFF_OPTIONS.h"
0004 #endif
1f89baba18 Patr*0005 #ifdef ALLOW_SALT_PLUME
853c5e0e2c Jean*0006 # include "SALT_PLUME_OPTIONS.h"
1f89baba18 Patr*0007 #endif
2fa42a6013 Alis*0008
2b4c90c108 Mart*0009
0010
0011
0012
0013
0014
ef080e1d37 Dimi*0015
0016
0017
0018
c417c38d79 Jean*0019 SUBROUTINE KPP_CALC(
0020 I bi, bj, myTime, myIter, myThid )
ef080e1d37 Dimi*0021
0022
c417c38d79 Jean*0023
2fa42a6013 Alis*0024
0025
c417c38d79 Jean*0026
2fa42a6013 Alis*0027
0028
c417c38d79 Jean*0029
2fa42a6013 Alis*0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
a9d2e4c565 Jean*0049
2fa42a6013 Alis*0050
0051
0052
0053
a9d2e4c565 Jean*0054
2fa42a6013 Alis*0055
a9d2e4c565 Jean*0056
2fa42a6013 Alis*0057
0058
a9d2e4c565 Jean*0059
2fa42a6013 Alis*0060
0061
a9d2e4c565 Jean*0062
c417c38d79 Jean*0063
a9d2e4c565 Jean*0064
2fa42a6013 Alis*0065
0066
0067
0068
0069
a9d2e4c565 Jean*0070
2fa42a6013 Alis*0071
0072
0073
0074
0075
0076
a9d2e4c565 Jean*0077
0078
2fa42a6013 Alis*0079
0080
0081
a9d2e4c565 Jean*0082
0083
2fa42a6013 Alis*0084
0085
a9d2e4c565 Jean*0086
2fa42a6013 Alis*0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
63ceaaa79c Dimi*0098
2fa42a6013 Alis*0099
0100
0101
c572a3ecb8 Jean*0102
1d478690dc Patr*0103
2fa42a6013 Alis*0104
ef080e1d37 Dimi*0105
2fa42a6013 Alis*0106
ef080e1d37 Dimi*0107
2b4c90c108 Mart*0108 IMPLICIT NONE
2fa42a6013 Alis*0109 #include "SIZE.h"
0110 #include "EEPARAMS.h"
0111 #include "PARAMS.h"
0112 #include "DYNVARS.h"
0113 #include "KPP.h"
0114 #include "KPP_PARAMS.h"
0115 #include "FFIELDS.h"
0116 #include "GRID.h"
059d9fc14f Dimi*0117 #include "GAD.h"
8749f0b4bc Dimi*0118 #ifdef ALLOW_SALT_PLUME
0119 # include "SALT_PLUME.h"
0120 #endif /* ALLOW_SALT_PLUME */
36aa272a96 Mart*0121 #ifdef ALLOW_SHELFICE
0122 # include "SHELFICE.h"
0123 #endif /* ALLOW_SHELFICE */
2fa42a6013 Alis*0124 #ifdef ALLOW_AUTODIFF_TAMC
8749f0b4bc Dimi*0125 # include "tamc.h"
2fa42a6013 Alis*0126 #endif /* ALLOW_AUTODIFF_TAMC */
0127
ef080e1d37 Dimi*0128
2fa42a6013 Alis*0129
c417c38d79 Jean*0130
0131
0132
0133
2fa42a6013 Alis*0134 INTEGER bi, bj
0135 _RL myTime
c417c38d79 Jean*0136 INTEGER myIter
0137 INTEGER myThid
2fa42a6013 Alis*0138
0139 #ifdef ALLOW_KPP
2b4c90c108 Mart*0140
0141 LOGICAL DIFFERENT_MULTIPLE
0142 EXTERNAL DIFFERENT_MULTIPLE
2fa42a6013 Alis*0143
ef080e1d37 Dimi*0144
956c0a5824 Patr*0145
0146
7c50f07931 Mart*0147
956c0a5824 Patr*0148 _RL minusone
2b4c90c108 Mart*0149 PARAMETER( minusone=-1.0)
fe66051ebd Dimi*0150 _RL p0 , p5 , p25 , p125 , p0625
2b4c90c108 Mart*0151 PARAMETER( p0=0.0, p5=0.5, p25=0.25, p125=0.125, p0625=0.0625 )
7c50f07931 Mart*0152 INTEGER iMin ,iMax ,jMin ,jMax
0153 PARAMETER(iMin=2-OLx,iMax=sNx+OLx-1,jMin=2-OLy,jMax=sNy+OLy-1)
956c0a5824 Patr*0154
2fa42a6013 Alis*0155
0156
1f89baba18 Patr*0157
2fa42a6013 Alis*0158
0159
0160
1f89baba18 Patr*0161
2fa42a6013 Alis*0162
0163
0164
0165
0166
0167
0168
0169
0170
42e0e34daa Dimi*0171
0172
2fa42a6013 Alis*0173
0174
0175
2b4c90c108 Mart*0176 INTEGER work1 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
fe66051ebd Dimi*0177 _RL worka ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
0178 _RL work2 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
0179 _RL ustar ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
0180 _RL bo ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
0181 _RL bosol ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
63ceaaa79c Dimi*0182 #ifdef ALLOW_SALT_PLUME
1f89baba18 Patr*0183 _RL temp1 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
0184 _RL temp2 ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
0185 _RL boplume ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nrp1 )
0186 #ifdef SALT_PLUME_SPLIT_BASIN
0187 _RL lon ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
0188 _RL lat ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
0189 #endif /* SALT_PLUME_SPLIT_BASIN */
63ceaaa79c Dimi*0190 #endif /* ALLOW_SALT_PLUME */
fe66051ebd Dimi*0191 _RL shsq ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
0192 _RL dVsq ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
0193 _RL dbloc ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
0194 _RL Ritop ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
0195 _RL vddiff( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, 0:Nrp1, mdiff )
0196 _RL ghat ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nr )
0197 _RL hbl ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy )
277d95ff7e Patr*0198
fe66051ebd Dimi*0199 _RL TTALPHA( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nrp1 )
0200 _RL SSBETA ( 1-OLx:sNx+OLx, 1-OLy:sNy+OLy, Nrp1 )
277d95ff7e Patr*0201
7c50f07931 Mart*0202 integer i, j, kSurf, k, kp1, km1, im1, ip1, jm1, jp1
edb6656069 Mart*0203
0204 integer ikey
853c5e0e2c Jean*0205
2fa42a6013 Alis*0206
ab9b91ea7a Patr*0207 #ifdef ALLOW_AUTODIFF_TAMC
edb6656069 Mart*0208 ikey = bi + (bj-1)*nSx + (ikey_dynamics-1)*nSx*nSy
853c5e0e2c Jean*0209 #else /* ALLOW_AUTODIFF_TAMC */
edb6656069 Mart*0210 ikey = 0
ab9b91ea7a Patr*0211 #endif /* ALLOW_AUTODIFF_TAMC */
0212
2fa42a6013 Alis*0213
94a46dfe0d Jean*0214 IF ( DIFFERENT_MULTIPLE(kpp_freq,myTime,deltaTClock)
adf557b193 Jean*0215 1 .OR. myTime .EQ. startTime ) THEN
c417c38d79 Jean*0216
2fa42a6013 Alis*0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
ba0b047096 Mart*0248
2fa42a6013 Alis*0249
0250
0251 CALL STATEKPP(
25c3477f99 Mart*0252 O work2, dbloc, Ritop,
0253 O TTALPHA, SSBETA,
edb6656069 Mart*0254 I ikey, bi, bj, myThid )
2fa42a6013 Alis*0255
0256 DO k = 1, Nr
a67734cba4 Mart*0257 DO j = 1-OLy, sNy+OLy
0258 DO i = 1-OLx, sNx+OLx
0259 ghat(i,j,k) = dbloc(i,j,k)
0260 ENDDO
0261 ENDDO
2fa42a6013 Alis*0262 ENDDO
0263
956c0a5824 Patr*0264 #ifdef KPP_SMOOTH_DBLOC
0265
0266
0267
0268
0269
0270 DO k = 1, Nr-1
a67734cba4 Mart*0271 CALL SMOOTH_HORIZ (
0272 I k+1, bi, bj,
0273 U ghat (1-OLx,1-OLy,k),
0274 I myThid )
956c0a5824 Patr*0275 ENDDO
0276
2fa42a6013 Alis*0277 #endif /* KPP_SMOOTH_DBLOC */
0278
0279 #ifdef KPP_SMOOTH_DENS
0280
fe66051ebd Dimi*0281 CALL SMOOTH_HORIZ (
956c0a5824 Patr*0282 I 1, bi, bj,
c417c38d79 Jean*0283 U work2,
25c3477f99 Mart*0284 I myThid )
2fa42a6013 Alis*0285 DO k = 1, Nr
fe66051ebd Dimi*0286 CALL SMOOTH_HORIZ (
956c0a5824 Patr*0287 I k+1, bi, bj,
c417c38d79 Jean*0288 U dbloc (1-OLx,1-OLy,k),
25c3477f99 Mart*0289 I myThid )
fe66051ebd Dimi*0290 CALL SMOOTH_HORIZ (
2fa42a6013 Alis*0291 I k, bi, bj,
c417c38d79 Jean*0292 U Ritop (1-OLx,1-OLy,k),
25c3477f99 Mart*0293 I myThid )
fe66051ebd Dimi*0294 CALL SMOOTH_HORIZ (
2fa42a6013 Alis*0295 I k, bi, bj,
c417c38d79 Jean*0296 U TTALPHA(1-OLx,1-OLy,k),
25c3477f99 Mart*0297 I myThid )
fe66051ebd Dimi*0298 CALL SMOOTH_HORIZ (
2fa42a6013 Alis*0299 I k, bi, bj,
c417c38d79 Jean*0300 U SSBETA(1-OLx,1-OLy,k),
25c3477f99 Mart*0301 I myThid )
2fa42a6013 Alis*0302 ENDDO
0303 #endif /* KPP_SMOOTH_DENS */
0304
7c50f07931 Mart*0305
0306 kSurf = 1
2fa42a6013 Alis*0307 DO k = 1, Nr
a67734cba4 Mart*0308 km1 = max(1,k-1)
2b4c90c108 Mart*0309 kp1 = min(Nr,k+1)
a67734cba4 Mart*0310 DO j = 1-OLy, sNy+OLy
0311 DO i = 1-OLx, sNx+OLx
2fa42a6013 Alis*0312
0313
2b4c90c108 Mart*0314
0315
0316
0317
a67734cba4 Mart*0318 dbloc(i,j,k) = dbloc(i,j,k) * maskC(i,j,k,bi,bj)
2b4c90c108 Mart*0319 & * maskC(i,j,kp1,bi,bj)
a67734cba4 Mart*0320 ghat(i,j,k) = ghat(i,j,k) * maskC(i,j,k,bi,bj)
2b4c90c108 Mart*0321 & * maskC(i,j,kp1,bi,bj)
7c50f07931 Mart*0322 #ifdef ALLOW_SHELFICE
0323 IF ( useShelfIce ) kSurf = MAX(1,kTopC(i,j,bi,bj))
0324 #endif /* ALLOW_SHELFICE */
a67734cba4 Mart*0325 Ritop(i,j,k) = Ritop(i,j,k) * maskC(i,j,k,bi,bj)
2b4c90c108 Mart*0326 & * maskC(i,j,kSurf,bi,bj)
0327 IF(k.EQ.nzmax(i,j,bi,bj)) THEN
a67734cba4 Mart*0328 dbloc(i,j,k) = p0
0329 ghat(i,j,k) = p0
0330 Ritop(i,j,k) = p0
2b4c90c108 Mart*0331 ENDIF
2fa42a6013 Alis*0332
0333
0334
0335
a67734cba4 Mart*0336 Ritop(i,j,k) = (zgrid(1)-zgrid(k)) * Ritop(i,j,k)
2fa42a6013 Alis*0337
a67734cba4 Mart*0338 ENDDO
0339 ENDDO
c417c38d79 Jean*0340 ENDDO
2fa42a6013 Alis*0341
32e2940ee8 Patr*0342
0343
853c5e0e2c Jean*0344 #ifdef ALLOW_AUTODIFF_TAMC
edb6656069 Mart*0345
3067745c9b Patr*0346 #ifdef KPP_AUTODIFF_EXCESSIVE_STORE
edb6656069 Mart*0347
0348
0349
32e2940ee8 Patr*0350 #endif
853c5e0e2c Jean*0351 #endif /* ALLOW_AUTODIFF_TAMC */
32e2940ee8 Patr*0352
0353
36aa272a96 Mart*0354
a9d2e4c565 Jean*0355
36aa272a96 Mart*0356
a9d2e4c565 Jean*0357
36aa272a96 Mart*0358
0359
6af7e0efdf Mart*0360
0361
7c50f07931 Mart*0362
0363
a9d2e4c565 Jean*0364
6af7e0efdf Mart*0365
a9d2e4c565 Jean*0366
6af7e0efdf Mart*0367
c417c38d79 Jean*0368
0369
36aa272a96 Mart*0370
32e2940ee8 Patr*0371
2fa42a6013 Alis*0372
6af7e0efdf Mart*0373
0374
0375
0376
0377
0378
0379
0380
63ceaaa79c Dimi*0381
1f89baba18 Patr*0382
0383
6af7e0efdf Mart*0384
2fa42a6013 Alis*0385
0386
0387
0388
0389
0390
a9d2e4c565 Jean*0391
6af7e0efdf Mart*0392
0393
0394
2fa42a6013 Alis*0395
c417c38d79 Jean*0396
1f89baba18 Patr*0397 #ifdef ALLOW_SALT_PLUME
7c50f07931 Mart*0398 DO j=jMin,jMax
0399 DO i=iMin,iMax
1f89baba18 Patr*0400 #ifndef SALT_PLUME_VOLUME
0401 temp1(i,j,1) = saltPlumeFlux(i,j,bi,bj)
0402 temp2(i,j,1) = 0. _d 0
0403 DO k=2,Nr
0404 temp1(i,j,k) = 0. _d 0
0405 temp2(i,j,k) = 0. _d 0
0406 ENDDO
0407 #else /* def SALT_PLUME_VOLUME */
0408 DO k=1,Nr
0409 temp1(i,j,k) = SPforcingS(i,j,k,bi,bj)
0410 temp2(i,j,k) = SPforcingT(i,j,k,bi,bj)
0411 ENDDO
0412 #endif /* SALT_PLUME_VOLUME */
0413 ENDDO
0414 ENDDO
0415 #endif /* ALLOW_SALT_PLUME */
0416
6af7e0efdf Mart*0417 CALL KPP_FORCING_SURF(
0418 I work2, surfaceForcingU, surfaceForcingV,
16fe9e8e73 Jean*0419 I surfaceForcingT, surfaceForcingS, adjustColdSST_diag,
a9d2e4c565 Jean*0420 I Qsw,
a67734cba4 Mart*0421 #ifdef KPP_ESTIMATE_UREF
0422 I dbloc,
0423 #endif /* KPP_ESTIMATE_UREF */
63ceaaa79c Dimi*0424 #ifdef ALLOW_SALT_PLUME
1f89baba18 Patr*0425 I temp1, temp2,
63ceaaa79c Dimi*0426 #endif /* ALLOW_SALT_PLUME */
0427 I ttalpha, ssbeta,
a9d2e4c565 Jean*0428 O ustar, bo, bosol,
63ceaaa79c Dimi*0429 #ifdef ALLOW_SALT_PLUME
0430 O boplume,
0431 #endif /* ALLOW_SALT_PLUME */
0432 O dVsq,
edb6656069 Mart*0433 I ikey, iMin, iMax, jMin, jMax, bi, bj, myTime, myThid )
2fa42a6013 Alis*0434
6af7e0efdf Mart*0435
853c5e0e2c Jean*0436
edb6656069 Mart*0437
853c5e0e2c Jean*0438
6af7e0efdf Mart*0439
2fa42a6013 Alis*0440
6af7e0efdf Mart*0441
2fa42a6013 Alis*0442 DO k = 1, Nr
6af7e0efdf Mart*0443 DO j = 1-OLy, sNy+OLy
0444 DO i = 1-OLx, sNx+OLx
0445 shsq(i,j,k) = p0
c417c38d79 Jean*0446 ENDDO
0447 ENDDO
0448 ENDDO
2fa42a6013 Alis*0449
0450
0451 DO k = 1, Nrm1
6af7e0efdf Mart*0452 kp1 = k + 1
7c50f07931 Mart*0453 DO j = jMin, jMax
6af7e0efdf Mart*0454 jm1 = j - 1
0455 jp1 = j + 1
7c50f07931 Mart*0456 DO i = iMin, iMax
6af7e0efdf Mart*0457 im1 = i - 1
0458 ip1 = i + 1
0459 shsq(i,j,k) = p5 * (
c417c38d79 Jean*0460 & (uVel(i, j, k,bi,bj)-uVel(i, j, kp1,bi,bj)) *
0461 & (uVel(i, j, k,bi,bj)-uVel(i, j, kp1,bi,bj)) +
0462 & (uVel(ip1,j, k,bi,bj)-uVel(ip1,j, kp1,bi,bj)) *
0463 & (uVel(ip1,j, k,bi,bj)-uVel(ip1,j, kp1,bi,bj)) +
0464 & (vVel(i, j, k,bi,bj)-vVel(i, j, kp1,bi,bj)) *
0465 & (vVel(i, j, k,bi,bj)-vVel(i, j, kp1,bi,bj)) +
0466 & (vVel(i, jp1,k,bi,bj)-vVel(i, jp1,kp1,bi,bj)) *
0467 & (vVel(i, jp1,k,bi,bj)-vVel(i, jp1,kp1,bi,bj)) )
2fa42a6013 Alis*0468 #ifdef KPP_SMOOTH_SHSQ
6af7e0efdf Mart*0469 shsq(i,j,k) = p5 * shsq(i,j,k) + p125 * (
c417c38d79 Jean*0470 & (uVel(i, jm1,k,bi,bj)-uVel(i, jm1,kp1,bi,bj)) *
0471 & (uVel(i, jm1,k,bi,bj)-uVel(i, jm1,kp1,bi,bj)) +
0472 & (uVel(ip1,jm1,k,bi,bj)-uVel(ip1,jm1,kp1,bi,bj)) *
0473 & (uVel(ip1,jm1,k,bi,bj)-uVel(ip1,jm1,kp1,bi,bj)) +
0474 & (uVel(i, jp1,k,bi,bj)-uVel(i, jp1,kp1,bi,bj)) *
0475 & (uVel(i, jp1,k,bi,bj)-uVel(i, jp1,kp1,bi,bj)) +
0476 & (uVel(ip1,jp1,k,bi,bj)-uVel(ip1,jp1,kp1,bi,bj)) *
0477 & (uVel(ip1,jp1,k,bi,bj)-uVel(ip1,jp1,kp1,bi,bj)) +
0478 & (vVel(im1,j, k,bi,bj)-vVel(im1,j, kp1,bi,bj)) *
0479 & (vVel(im1,j, k,bi,bj)-vVel(im1,j, kp1,bi,bj)) +
0480 & (vVel(im1,jp1,k,bi,bj)-vVel(im1,jp1,kp1,bi,bj)) *
0481 & (vVel(im1,jp1,k,bi,bj)-vVel(im1,jp1,kp1,bi,bj)) +
0482 & (vVel(ip1,j, k,bi,bj)-vVel(ip1,j, kp1,bi,bj)) *
0483 & (vVel(ip1,j, k,bi,bj)-vVel(ip1,j, kp1,bi,bj)) +
0484 & (vVel(ip1,jp1,k,bi,bj)-vVel(ip1,jp1,kp1,bi,bj)) *
0485 & (vVel(ip1,jp1,k,bi,bj)-vVel(ip1,jp1,kp1,bi,bj)) )
2fa42a6013 Alis*0486 #endif
c417c38d79 Jean*0487 ENDDO
0488 ENDDO
0489 ENDDO
2fa42a6013 Alis*0490
2b4c90c108 Mart*0491 #ifdef ALLOW_DIAGNOSTICS
0492 IF ( useDiagnostics ) THEN
0493 CALL DIAGNOSTICS_FILL(shsq, 'KPPshsq ',0,Nr,2,bi,bj,myThid)
0494 ENDIF
0495 #endif /* ALLOW_DIAGNOSTICS */
32e2940ee8 Patr*0496
853c5e0e2c Jean*0497 #ifdef ALLOW_AUTODIFF_TAMC
3067745c9b Patr*0498 #ifdef KPP_AUTODIFF_EXCESSIVE_STORE
edb6656069 Mart*0499
32e2940ee8 Patr*0500 #endif
853c5e0e2c Jean*0501 #endif /* ALLOW_AUTODIFF_TAMC */
32e2940ee8 Patr*0502
0503
2fa42a6013 Alis*0504
0505
0506
0507
af61e5eb16 Mart*0508 #if (
0509
0510
0511 #endif
059d9fc14f Dimi*0512
0513
0514 CALL CALC_3D_DIFFUSIVITY(
853c5e0e2c Jean*0515 I bi,bj,1-OLx,sNx+OLx,1-OLy,sNy+OLy,
059d9fc14f Dimi*0516 I GAD_SALINITY, .FALSE., .FALSE.,
853c5e0e2c Jean*0517 O KPPdiffKzS(1-OLx,1-OLy,1,bi,bj),
059d9fc14f Dimi*0518 I myThid)
0519 CALL CALC_3D_DIFFUSIVITY(
853c5e0e2c Jean*0520 I bi,bj,1-OLx,sNx+OLx,1-OLy,sNy+OLy,
059d9fc14f Dimi*0521 I GAD_TEMPERATURE, .FALSE., .FALSE.,
853c5e0e2c Jean*0522 O KPPdiffKzT(1-OLx,1-OLy,1,bi,bj),
059d9fc14f Dimi*0523 I myThid)
e750a5e49e Mart*0524 #ifndef EXCLUDE_KPP_DOUBLEDIFF
0525 IF ( KPPuseDoubleDiff ) THEN
a9d2e4c565 Jean*0526
e750a5e49e Mart*0527
a9d2e4c565 Jean*0528
e750a5e49e Mart*0529
0530 CALL KPP_DOUBLEDIFF(
0531 I TTALPHA, SSBETA,
853c5e0e2c Jean*0532 U KPPdiffKzT(1-OLx,1-OLy,1,bi,bj),
0533 U KPPdiffKzS(1-OLx,1-OLy,1,bi,bj),
edb6656069 Mart*0534 I ikey,1-OLx,sNx+OLx,1-OLy,sNy+OLy,bi,bj,myThid)
e750a5e49e Mart*0535 ENDIF
0536 #endif /* ndef EXCLUDE_KPP_DOUBLEDIFF */
059d9fc14f Dimi*0537
4fa51dc730 Dimi*0538 DO j = 1-OLy, sNy+OLy
0539 DO i = 1-OLx, sNx+OLx
2fa42a6013 Alis*0540 work1(i,j) = nzmax(i,j,bi,bj)
0541 work2(i,j) = Fcori(i,j,bi,bj)
c417c38d79 Jean*0542 ENDDO
0543 ENDDO
2fa42a6013 Alis*0544 CALL KPPMIX (
edb6656069 Mart*0545 I work1, shsq, dVsq, ustar,
0546 I maskC(1-OLx,1-OLy,1,bi,bj),
0547 I bo, bosol,
63ceaaa79c Dimi*0548 #ifdef ALLOW_SALT_PLUME
edb6656069 Mart*0549 I boplume, SaltPlumeDepth(1-OLx,1-OLy,bi,bj),
1f89baba18 Patr*0550 #ifdef SALT_PLUME_SPLIT_BASIN
edb6656069 Mart*0551 I XC(1-OLx,1-OLy,bi,bj), YC(1-OLx,1-OLy,bi,bj),
1f89baba18 Patr*0552 #endif /* SALT_PLUME_SPLIT_BASIN */
63ceaaa79c Dimi*0553 #endif /* ALLOW_SALT_PLUME */
edb6656069 Mart*0554 I dbloc, Ritop, work2,
0555 I KPPdiffKzS(1-OLx,1-OLy,1,bi,bj),
0556 I KPPdiffKzT(1-OLx,1-OLy,1,bi,bj),
0557 I ikey,
0558 O vddiff,
0559 U ghat,
0560 O hbl,
0561 I bi, bj, myTime, myIter, myThid )
2fa42a6013 Alis*0562
0563
956c0a5824 Patr*0564
2fa42a6013 Alis*0565
0566
a67734cba4 Mart*0567 DO k = 1, Nr
0568 km1 = max(1,k-1)
7c50f07931 Mart*0569 DO j = jMin, jMax
0570 DO i = iMin, iMax
c572a3ecb8 Jean*0571 KPPviscAz(i,j,k,bi,bj) = vddiff(i,j,k-1,1) * maskC(i,j,k,bi,bj)
36aa272a96 Mart*0572 & * maskC(i,j,km1,bi,bj)
c572a3ecb8 Jean*0573 KPPdiffKzS(i,j,k,bi,bj)= vddiff(i,j,k-1,2) * maskC(i,j,k,bi,bj)
36aa272a96 Mart*0574 & * maskC(i,j,km1,bi,bj)
c572a3ecb8 Jean*0575 KPPdiffKzT(i,j,k,bi,bj)= vddiff(i,j,k-1,3) * maskC(i,j,k,bi,bj)
36aa272a96 Mart*0576 & * maskC(i,j,km1,bi,bj)
c572a3ecb8 Jean*0577 KPPghat(i,j,k,bi,bj) = ghat(i,j,k) * maskC(i,j,k,bi,bj)
36aa272a96 Mart*0578 & * maskC(i,j,km1,bi,bj)
c417c38d79 Jean*0579 ENDDO
a67734cba4 Mart*0580 ENDDO
0581 ENDDO
7c50f07931 Mart*0582 kSurf = 1
0583 DO j = jMin, jMax
0584 DO i = iMin, iMax
36aa272a96 Mart*0585 #ifdef ALLOW_SHELFICE
7c50f07931 Mart*0586 IF ( useShelfIce ) kSurf = MAX(1,kTopC(i,j,bi,bj))
36aa272a96 Mart*0587 #endif /* ALLOW_SHELFICE */
2b4c90c108 Mart*0588 KPPhbl(i,j,bi,bj) = hbl(i,j) * maskC(i,j,kSurf,bi,bj)
c417c38d79 Jean*0589 ENDDO
0590 ENDDO
2fa42a6013 Alis*0591
0592 #ifdef KPP_SMOOTH_VISC
0593
0594 DO k = 1, Nr
956c0a5824 Patr*0595 CALL SMOOTH_HORIZ (
2fa42a6013 Alis*0596 I k, bi, bj,
c417c38d79 Jean*0597 U KPPviscAz(1-OLx,1-OLy,k,bi,bj),
25c3477f99 Mart*0598 I myThid )
c417c38d79 Jean*0599 ENDDO
0600
6637358eea Jean*0601
2fa42a6013 Alis*0602 #endif /* KPP_SMOOTH_VISC */
0603
0604 #ifdef KPP_SMOOTH_DIFF
0605
0606 DO k = 1, Nr
956c0a5824 Patr*0607 CALL SMOOTH_HORIZ (
2fa42a6013 Alis*0608 I k, bi, bj,
c417c38d79 Jean*0609 U KPPdiffKzS(1-OLx,1-OLy,k,bi,bj),
25c3477f99 Mart*0610 I myThid )
956c0a5824 Patr*0611 CALL SMOOTH_HORIZ (
2fa42a6013 Alis*0612 I k, bi, bj,
c417c38d79 Jean*0613 U KPPdiffKzT(1-OLx,1-OLy,k,bi,bj),
25c3477f99 Mart*0614 I myThid )
c417c38d79 Jean*0615 ENDDO
2fa42a6013 Alis*0616 #endif /* KPP_SMOOTH_DIFF */
0617
32e2940ee8 Patr*0618
0619
853c5e0e2c Jean*0620 #ifdef ALLOW_AUTODIFF_TAMC
edb6656069 Mart*0621
853c5e0e2c Jean*0622 #endif /* ALLOW_AUTODIFF_TAMC */
32e2940ee8 Patr*0623
0624
2fa42a6013 Alis*0625
0626
0627 DO j=1-OLy,sNy+OLy
0628 DO i=1-OLx,sNx+OLx
0629 worka(i,j) = KPPhbl(i,j,bi,bj)
0630 ENDDO
0631 ENDDO
0632 CALL SWFRAC(
956c0a5824 Patr*0633 I (sNx+2*OLx)*(sNy+2*OLy), minusone,
c417c38d79 Jean*0634 U worka,
0635 I myTime, myIter, myThid )
2fa42a6013 Alis*0636 DO j=1-OLy,sNy+OLy
0637 DO i=1-OLx,sNx+OLx
956c0a5824 Patr*0638 KPPfrac(i,j,bi,bj) = worka(i,j)
2fa42a6013 Alis*0639 ENDDO
0640 ENDDO
0641
63ceaaa79c Dimi*0642 #ifdef ALLOW_SALT_PLUME
0643
0644
30c6f5b1cd An T*0645 IF ( useSALT_PLUME ) THEN
1f89baba18 Patr*0646 #ifndef SALT_PLUME_VOLUME
a67734cba4 Mart*0647 DO j=1-OLy,sNy+OLy
0648 DO i=1-OLx,sNx+OLx
0649 work2(i,j) = SaltPlumeDepth(i,j,bi,bj)
0650 worka(i,j) = KPPhbl(i,j,bi,bj)
1f89baba18 Patr*0651 #ifdef SALT_PLUME_SPLIT_BASIN
a67734cba4 Mart*0652 lon(i,j) = XC(i,j,bi,bj)
0653 lat(i,j) = YC(i,j,bi,bj)
1f89baba18 Patr*0654 #endif /* SALT_PLUME_SPLIT_BASIN */
30c6f5b1cd An T*0655 ENDDO
a67734cba4 Mart*0656 ENDDO
0657 CALL SALT_PLUME_FRAC(
0658 I (sNx+2*OLx)*(sNy+2*OLy), minusone, work2,
1f89baba18 Patr*0659 #ifdef SALT_PLUME_SPLIT_BASIN
a67734cba4 Mart*0660 I lon,lat,
1f89baba18 Patr*0661 #endif /* SALT_PLUME_SPLIT_BASIN */
a67734cba4 Mart*0662 U worka,
0663 I myTime, myIter, myThid )
0664 DO j=1-OLy,sNy+OLy
0665 DO i=1-OLx,sNx+OLx
0666 KPPplumefrac(i,j,bi,bj) = 1. _d 0 - worka(i,j)
30c6f5b1cd An T*0667 ENDDO
a67734cba4 Mart*0668 ENDDO
1f89baba18 Patr*0669 #else /* SALT_PLUME_VOLUME */
a67734cba4 Mart*0670 DO j=1-OLy,sNy+OLy
0671 DO i=1-OLx,sNx+OLx
0672 KPPplumefrac(i,j,bi,bj) = 0. _d 0
1f89baba18 Patr*0673 ENDDO
a67734cba4 Mart*0674 ENDDO
1f89baba18 Patr*0675 #endif /* SALT_PLUME_VOLUME */
30c6f5b1cd An T*0676 ENDIF
63ceaaa79c Dimi*0677 #endif /* ALLOW_SALT_PLUME */
0678
2fa42a6013 Alis*0679 ENDIF
0680
3587afcb9b Alis*0681 #endif /* ALLOW_KPP */
2fa42a6013 Alis*0682
0683 RETURN
0684 END
b7230be7a5 Patr*0685
a9d2e4c565 Jean*0686
2b4c90c108 Mart*0687
0688
a9d2e4c565 Jean*0689
2b4c90c108 Mart*0690
c417c38d79 Jean*0691 SUBROUTINE KPP_CALC_DUMMY(
0692 I bi, bj, myTime, myIter, myThid )
2b4c90c108 Mart*0693
0694
c417c38d79 Jean*0695
b7230be7a5 Patr*0696
0697
0698
c417c38d79 Jean*0699
b7230be7a5 Patr*0700
2b4c90c108 Mart*0701
0702 IMPLICIT NONE
b7230be7a5 Patr*0703 #include "SIZE.h"
0704 #include "EEPARAMS.h"
0705 #include "PARAMS.h"
0706 #include "KPP.h"
0707 #include "KPP_PARAMS.h"
0708 #include "GRID.h"
059d9fc14f Dimi*0709 #include "GAD.h"
af61e5eb16 Mart*0710 #ifdef ALLOW_AUTODIFF_TAMC
0711 # include "tamc.h"
0712 #endif /* ALLOW_AUTODIFF_TAMC */
b7230be7a5 Patr*0713
2b4c90c108 Mart*0714
c417c38d79 Jean*0715
0716
0717
0718
b7230be7a5 Patr*0719 INTEGER bi, bj
0720 _RL myTime
c417c38d79 Jean*0721 INTEGER myIter
0722 INTEGER myThid
b7230be7a5 Patr*0723
0724 #ifdef ALLOW_KPP
2b4c90c108 Mart*0725
0726 INTEGER i, j, k
af61e5eb16 Mart*0727 #if (
0728 INTEGER ikey
0729 #endif
2b4c90c108 Mart*0730
b7230be7a5 Patr*0731
0732 DO j=1-OLy,sNy+OLy
0733 DO i=1-OLx,sNx+OLx
0734 KPPhbl (i,j,bi,bj) = 1.0
0735 KPPfrac(i,j,bi,bj) = 0.0
63ceaaa79c Dimi*0736 #ifdef ALLOW_SALT_PLUME
0737 KPPplumefrac(i,j,bi,bj) = 0.0
0738 #endif /* ALLOW_SALT_PLUME */
b7230be7a5 Patr*0739 DO k = 1,Nr
0740 KPPghat (i,j,k,bi,bj) = 0.0
a9d2e4c565 Jean*0741 KPPviscAz (i,j,k,bi,bj) = viscArNr(1)
b7230be7a5 Patr*0742 ENDDO
0743 ENDDO
0744 ENDDO
059d9fc14f Dimi*0745
af61e5eb16 Mart*0746 #if (
0747 ikey = bi + (bj-1)*nSx + (ikey_dynamics-1)*nSx*nSy
0748
0749
0750 #endif
059d9fc14f Dimi*0751 CALL CALC_3D_DIFFUSIVITY(
853c5e0e2c Jean*0752 I bi,bj,1-OLx,sNx+OLx,1-OLy,sNy+OLy,
059d9fc14f Dimi*0753 I GAD_SALINITY, .FALSE., .FALSE.,
853c5e0e2c Jean*0754 O KPPdiffKzS(1-OLx,1-OLy,1,bi,bj),
059d9fc14f Dimi*0755 I myThid)
0756 CALL CALC_3D_DIFFUSIVITY(
853c5e0e2c Jean*0757 I bi,bj,1-OLx,sNx+OLx,1-OLy,sNy+OLy,
059d9fc14f Dimi*0758 I GAD_TEMPERATURE, .FALSE., .FALSE.,
853c5e0e2c Jean*0759 O KPPdiffKzT(1-OLx,1-OLy,1,bi,bj),
059d9fc14f Dimi*0760 I myThid)
0761
b7230be7a5 Patr*0762 #endif
0763 RETURN
0764 END