File indexing completed on 2024-06-06 05:11:00 UTC
view on githubraw file Latest commit af61e5eb on 2024-06-06 03:30:35 UTC
b2cb1ccb9a Mart*0001 #include "OBCS_OPTIONS.h"
4e4ad91a39 Jean*0002 #ifdef ALLOW_AUTODIFF
0003 # include "AUTODIFF_OPTIONS.h"
0004 #endif
eb8aff1784 Jean*0005 #undef CHECK_BALANCE
b2cb1ccb9a Mart*0006
4e4ad91a39 Jean*0007
0daa63ec35 Mart*0008
0009
0010
0011
0012
0013
0014
0015
b2cb1ccb9a Mart*0016
0017
0018
eb8aff1784 Jean*0019 SUBROUTINE OBCS_CALC_STEVENS(
b2cb1ccb9a Mart*0020 I futureTime, futureIter,
0021 I myThid )
2c64c37c71 Mart*0022
eb8aff1784 Jean*0023
b2cb1ccb9a Mart*0024
0025
eb8aff1784 Jean*0026
0027
b2cb1ccb9a Mart*0028
0029
0030
eb8aff1784 Jean*0031
0032
b2cb1ccb9a Mart*0033
eb8aff1784 Jean*0034
0035
0036
2c64c37c71 Mart*0037
0038
0039
0040
0041
0042
0043
b2cb1ccb9a Mart*0044
0045
0046
0047
b1353a35da Mart*0048
74019f026d Jean*0049
0050
b1353a35da Mart*0051
0052
b2cb1ccb9a Mart*0053
0054
0daa63ec35 Mart*0055
b2cb1ccb9a Mart*0056
0057
0058
eb8aff1784 Jean*0059
b2cb1ccb9a Mart*0060
eb8aff1784 Jean*0061
0062
b2cb1ccb9a Mart*0063
eb8aff1784 Jean*0064
2c64c37c71 Mart*0065
b2cb1ccb9a Mart*0066
eb8aff1784 Jean*0067 IMPLICIT NONE
b2cb1ccb9a Mart*0068
0069 #include "SIZE.h"
0070 #include "EEPARAMS.h"
0071 #include "PARAMS.h"
eb8aff1784 Jean*0072 #include "GRID.h"
9b4f2a04e2 Jean*0073 #include "OBCS_PARAMS.h"
0074 #include "OBCS_GRID.h"
0075 #include "OBCS_FIELDS.h"
b2cb1ccb9a Mart*0076 #include "DYNVARS.h"
0077 #ifdef ALLOW_PTRACERS
0078 #include "PTRACERS_SIZE.h"
0079 #include "PTRACERS_PARAMS.h"
0080 #include "PTRACERS_FIELDS.h"
0081 #include "OBCS_PTRACERS.h"
0082 #endif /* ALLOW_PTRACERS */
38b71af82a Patr*0083 #ifdef ALLOW_AUTODIFF_TAMC
4e4ad91a39 Jean*0084 # include "tamc.h"
38b71af82a Patr*0085 #endif /* ALLOW_AUTODIFF_TAMC */
b2cb1ccb9a Mart*0086
0087
0088
0089 _RL futureTime
eb8aff1784 Jean*0090 INTEGER futureIter
b2cb1ccb9a Mart*0091 INTEGER myThid
0092
0093 #ifdef ALLOW_OBCS_STEVENS
0094
0095
0096
eb8aff1784 Jean*0097
0098
0099
0100
0101
0102
b2cb1ccb9a Mart*0103
b1353a35da Mart*0104
eb8aff1784 Jean*0105
2c64c37c71 Mart*0106
eb8aff1784 Jean*0107
b2cb1ccb9a Mart*0108 INTEGER bi, bj
4e4ad91a39 Jean*0109 INTEGER i, j, k
eb8aff1784 Jean*0110
2c64c37c71 Mart*0111 _RL cflMer (1-OLy:sNy+OLy,Nr)
0112 _RL gFacM (1-OLy:sNy+OLy,Nr)
e37ac28e89 Mart*0113 _RL uMerPri(Nr)
0114 _RL uMerBar
16a91a6f85 Mart*0115 _RL cflZon (1-OLx:sNx+OLx,Nr)
3cf13754ce Mart*0116 _RL gFacZ (1-OLx:sNx+OLx,Nr)
e37ac28e89 Mart*0117 _RL vZonPri(Nr)
0118 _RL vZonBar
74019f026d Jean*0119 _RL drFBar
2c64c37c71 Mart*0120 _RL gammat, gammas, pFac, aFac
b2cb1ccb9a Mart*0121 #ifdef ALLOW_PTRACERS
eb8aff1784 Jean*0122
b2cb1ccb9a Mart*0123 #endif /* ALLOW_PTRACERS */
4e4ad91a39 Jean*0124 #ifdef ALLOW_AUTODIFF_TAMC
af61e5eb16 Mart*0125
0126 INTEGER tkey
4e4ad91a39 Jean*0127 #endif /* ALLOW_AUTODIFF_TAMC */
eb8aff1784 Jean*0128 #ifdef CHECK_BALANCE
0129 _RL uVelLoc, vVelLoc
0130 _RL vPhase
0131 #endif
b2cb1ccb9a Mart*0132
0133
0134 #ifdef ALLOW_DEBUG
eb8aff1784 Jean*0135 IF (debugMode) CALL DEBUG_ENTER('OBCS_CALC_STEVENS',myThid)
b2cb1ccb9a Mart*0136 #endif
0137
0138 aFac = 1. _d 0
0139 IF (.NOT. useStevensAdvection ) aFac = 0. _d 0
0140 pFac = 1. _d 0
0141 IF (.NOT. useStevensPhaseVel ) pFac = 0. _d 0
0142 gammat = 0. _d 0
0143 IF (TrelaxStevens .GT. 0. _d 0) gammat = 1./TrelaxStevens
0144 gammas = 0. _d 0
0145 IF (SrelaxStevens .GT. 0. _d 0) gammas = 1./SrelaxStevens
0146
0147 DO bj=myByLo(myThid),myByHi(myThid)
0148 DO bi=myBxLo(myThid),myBxHi(myThid)
eb8aff1784 Jean*0149
38b71af82a Patr*0150 #ifdef ALLOW_AUTODIFF_TAMC
af61e5eb16 Mart*0151 tkey = bi + (bj-1)*nSx + (ikey_dynamics-1)*nSx*nSy
0152 # ifdef ALLOW_OBCS_EAST
0153
0154
0155
0156 # endif
0157 # ifdef ALLOW_OBCS_WEST
0158
0159
0160
0161 # endif
0162 # ifdef ALLOW_OBCS_NORTH
0163
0164
0165
0166 # endif
0167 # ifdef ALLOW_OBCS_SOUTH
0168
0169
0170
0171 # endif
38b71af82a Patr*0172 #endif /* ALLOW_AUTODIFF_TAMC */
0173
b2cb1ccb9a Mart*0174 #ifdef ALLOW_OBCS_EAST
0175 IF ( useStevensEast ) THEN
0176
0177 #ifdef ALLOW_DEBUG
eb8aff1784 Jean*0178 IF (debugMode)
b2cb1ccb9a Mart*0179 & CALL DEBUG_MSG('OBCS_CALC_STEVENS: East',myThid)
0180 #endif
eb8aff1784 Jean*0181
9f68a71aa4 Mart*0182
4e4ad91a39 Jean*0183 DO j=1-OLy,sNy+OLy
0184 i = OB_Ie(j,bi,bj)
0185 IF ( i.NE.OB_indexNone ) THEN
e37ac28e89 Mart*0186
0187 drFbar = 0. _d 0
0188 uMerBar = 0. _d 0
4e4ad91a39 Jean*0189 DO k=1,Nr
0190 uMerPri(k) = 0. _d 0
e37ac28e89 Mart*0191 ENDDO
4e4ad91a39 Jean*0192 DO k=1,Nr
2c64c37c71 Mart*0193 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0194 uMerBar = uMerBar + uVel(i-1,j,k,bi,bj)
2c64c37c71 Mart*0195 #else
4e4ad91a39 Jean*0196 uMerBar = uMerBar + OBEuStevens(j,k,bi,bj)
2c64c37c71 Mart*0197 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0198 & *drF(k)* _hFacW(i,j,k,bi,bj)
0199 drFBar = drFBar + drF(k)* _hFacW(i,j,k,bi,bj)
9f68a71aa4 Mart*0200 ENDDO
e37ac28e89 Mart*0201 IF ( drFBar .GT. 0. _d 0 ) uMerBar = uMerBar/drFBar
4e4ad91a39 Jean*0202 DO k=1,Nr
2c64c37c71 Mart*0203 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0204 uMerPri(k) = (uVel(i-1,j,k,bi,bj)-uMerBar)
74019f026d Jean*0205 #else
4e4ad91a39 Jean*0206 uMerPri(k) = (OBEuStevens(j,k,bi,bj)-uMerBar)
2c64c37c71 Mart*0207 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0208 & * _maskW(i,j,k,bi,bj)
9f68a71aa4 Mart*0209 ENDDO
eb8aff1784 Jean*0210
e37ac28e89 Mart*0211 drFbar = 0. _d 0
0212 uMerBar = 0. _d 0
4e4ad91a39 Jean*0213 DO k=1,Nr
0214 uMerBar = uMerBar + OBEu(j,k,bi,bj)
0215 & *drF(k)* _hFacW(i,j,k,bi,bj)
0216 drFBar = drFBar + drF(k)* _hFacW(i,j,k,bi,bj)
9f68a71aa4 Mart*0217 ENDDO
e37ac28e89 Mart*0218 IF ( drFBar .GT. 0. _d 0 ) uMerBar = uMerBar/drFBar
b2cb1ccb9a Mart*0219
e37ac28e89 Mart*0220
4e4ad91a39 Jean*0221 DO k=1,Nr
0222 OBEu(j,k,bi,bj) = (uMerBar + uMerPri(k))
0223 & * _maskW(i,j,k,bi,bj)
9f68a71aa4 Mart*0224
b2cb1ccb9a Mart*0225 #ifdef ALLOW_NONHYDROSTATIC
4e4ad91a39 Jean*0226 OBEw(j,k,bi,bj)=0.
b2cb1ccb9a Mart*0227 #endif
9f68a71aa4 Mart*0228 ENDDO
0229 ENDIF
b2cb1ccb9a Mart*0230 ENDDO
2c64c37c71 Mart*0231 #ifdef NONLIN_FRSURF
0232
0233 IF ( nonlinFreeSurf.GT.0 ) THEN
4e4ad91a39 Jean*0234 DO j=1-OLy,sNy+OLy
0235 i = OB_Ie(j,bi,bj)
0236 IF ( i.NE.OB_indexNone ) THEN
0237 OBEeta(j,bi,bj) = etaN(i-1,j,bi,bj)
2c64c37c71 Mart*0238 ENDIF
0239 ENDDO
0240 ENDIF
0241 #endif /* NONLIN_FRSURF */
b2cb1ccb9a Mart*0242
2c64c37c71 Mart*0243
4e4ad91a39 Jean*0244 DO k=1,Nr
0245 DO j=1-OLy,sNy+OLy
0246 i = OB_Ie(j,bi,bj)
0247 IF ( i.NE.OB_indexNone ) THEN
0248 cflMer(j,k) = 0.5 _d 0 * _dxC(i-1,j,bi,bj)/dTtracerLev(k)
2c64c37c71 Mart*0249
0250
4e4ad91a39 Jean*0251 gFacM(j,k) = ABS(MIN(SIGN(1.D0,uVel(i,j,k,bi,bj)),0.D0))
2c64c37c71 Mart*0252 ELSE
4e4ad91a39 Jean*0253 cflMer(j,k) = 0. _d 0
0254 gFacM (j,k) = 0. _d 0
2c64c37c71 Mart*0255 ENDIF
0256 ENDDO
0257 ENDDO
4e4ad91a39 Jean*0258 # ifdef ALLOW_AUTODIFF_TAMC
af61e5eb16 Mart*0259
4e4ad91a39 Jean*0260 # endif
0daa63ec35 Mart*0261
0262 CALL OBCS_STEVENS_CALC_TRACER_EAST(
4e4ad91a39 Jean*0263 U OBEt,
0264 I OBEtStevens, theta, gammat,
0daa63ec35 Mart*0265 I uVel, cflMer, gFacM, pFac, aFac,
0266 I OB_Ie, OB_indexNone, bi, bj,
0267 I futureTime, futureIter,
0268 I myThid )
0269
0270 CALL OBCS_STEVENS_CALC_TRACER_EAST(
4e4ad91a39 Jean*0271 U OBEs,
0daa63ec35 Mart*0272 I OBEsStevens, salt, gammas,
0273 I uVel, cflMer, gFacM, pFac, aFac,
0274 I OB_Ie, OB_indexNone, bi, bj,
0275 I futureTime, futureIter,
0276 I myThid )
0277
0278
0279
0280
0281
0282
4e4ad91a39 Jean*0283
0284
0daa63ec35 Mart*0285
0286
0287
0288
0289
0290
0291
0292
b2cb1ccb9a Mart*0293
eb8aff1784 Jean*0294 ENDIF
b2cb1ccb9a Mart*0295 #endif /* ALLOW_OBCS_EAST */
eb8aff1784 Jean*0296
b2cb1ccb9a Mart*0297
0298
0299 #ifdef ALLOW_OBCS_WEST
eb8aff1784 Jean*0300 IF ( useStevensWest ) THEN
b2cb1ccb9a Mart*0301
0302 #ifdef ALLOW_DEBUG
eb8aff1784 Jean*0303 IF (debugMode)
0304 & CALL DEBUG_MSG('OBCS_CALC_STEVENS: West',myThid)
b2cb1ccb9a Mart*0305 #endif
eb8aff1784 Jean*0306
9f68a71aa4 Mart*0307
4e4ad91a39 Jean*0308 DO j=1-OLy,sNy+OLy
0309 i = OB_Iw(j,bi,bj)
0310 IF ( i.NE.OB_indexNone ) THEN
e37ac28e89 Mart*0311
0312 drFBar = 0. _d 0
0313 uMerBar = 0. _d 0
4e4ad91a39 Jean*0314 DO k=1,Nr
0315 uMerPri(k) = 0. _d 0
e37ac28e89 Mart*0316 ENDDO
4e4ad91a39 Jean*0317 DO k=1,Nr
2c64c37c71 Mart*0318 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0319 uMerBar = uMerBar + uVel(i+2,j,k,bi,bj)
2c64c37c71 Mart*0320 #else
4e4ad91a39 Jean*0321 uMerBar = uMerBar + OBWuStevens(j,k,bi,bj)
2c64c37c71 Mart*0322 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0323 & *drF(k)* _hFacW(i+1,j,k,bi,bj)
0324 drFBar = drFBar + drF(k)* _hFacW(i+1,j,k,bi,bj)
9f68a71aa4 Mart*0325 ENDDO
e37ac28e89 Mart*0326 IF ( drFBar .GT. 0. _d 0 ) uMerBar = uMerBar/drFBar
4e4ad91a39 Jean*0327 DO k=1,Nr
2c64c37c71 Mart*0328 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0329 uMerPri(k) = (uVel(i+2,j,k,bi,bj)-uMerBar)
2c64c37c71 Mart*0330 #else
4e4ad91a39 Jean*0331 uMerPri(k) = (OBWuStevens(j,k,bi,bj)-uMerBar)
2c64c37c71 Mart*0332 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0333 & * _maskW(i+1,j,k,bi,bj)
9f68a71aa4 Mart*0334 ENDDO
eb8aff1784 Jean*0335
9f68a71aa4 Mart*0336 drFBar = 0. _d 0
e37ac28e89 Mart*0337 uMerBar = 0. _d 0
4e4ad91a39 Jean*0338 DO k=1,Nr
0339 uMerBar = uMerBar + OBWu(j,k,bi,bj)
0340 & *drF(k)* _hFacW(i+1,j,k,bi,bj)
0341 drFBar = drFBar + drF(k)* _hFacW(i+1,j,k,bi,bj)
9f68a71aa4 Mart*0342 ENDDO
e37ac28e89 Mart*0343 IF ( drFBar .GT. 0. _d 0 ) uMerBar = uMerBar/drFBar
b2cb1ccb9a Mart*0344
e37ac28e89 Mart*0345
4e4ad91a39 Jean*0346 DO k=1,Nr
0347 OBWu(j,k,bi,bj) = (uMerBar + uMerPri(k))
0348 & * _maskW(i+1,j,k,bi,bj)
9f68a71aa4 Mart*0349
b2cb1ccb9a Mart*0350 #ifdef ALLOW_NONHYDROSTATIC
4e4ad91a39 Jean*0351 OBWw(j,k,bi,bj)=0.
b2cb1ccb9a Mart*0352 #endif
9f68a71aa4 Mart*0353 ENDDO
0354 ENDIF
eb8aff1784 Jean*0355 ENDDO
2c64c37c71 Mart*0356 #ifdef NONLIN_FRSURF
0357
0358 IF ( nonlinFreeSurf.GT.0 ) THEN
4e4ad91a39 Jean*0359 DO j=1-OLy,sNy+OLy
0360 i = OB_Iw(j,bi,bj)
0361 IF ( i.NE.OB_indexNone ) THEN
0362 OBWeta(j,bi,bj) = etaN(i+1,j,bi,bj)
2c64c37c71 Mart*0363 ENDIF
0364 ENDDO
0365 ENDIF
0366 #endif /* NONLIN_FRSURF */
b2cb1ccb9a Mart*0367
74019f026d Jean*0368
4e4ad91a39 Jean*0369 DO k=1,Nr
0370 DO j=1-OLy,sNy+OLy
0371 i = OB_Iw(j,bi,bj)
0372 IF ( i.NE.OB_indexNone ) THEN
0373 cflMer(j,k) = 0.5 _d 0 * _dxC(i+2,j,bi,bj)/dTtracerLev(k)
2c64c37c71 Mart*0374
0375
4e4ad91a39 Jean*0376 gFacM(j,k) = ABS(MAX(SIGN(1.D0,uVel(i+1,j,k,bi,bj)),0.D0))
2c64c37c71 Mart*0377 ELSE
4e4ad91a39 Jean*0378 cflMer(j,k) = 0. _d 0
0379 gFacM (j,k) = 0. _d 0
2c64c37c71 Mart*0380 ENDIF
0381 ENDDO
0382 ENDDO
4e4ad91a39 Jean*0383 # ifdef ALLOW_AUTODIFF_TAMC
af61e5eb16 Mart*0384
4e4ad91a39 Jean*0385 # endif
0daa63ec35 Mart*0386
0387 CALL OBCS_STEVENS_CALC_TRACER_WEST(
4e4ad91a39 Jean*0388 U OBWt,
0389 I OBWtStevens, theta, gammat,
0daa63ec35 Mart*0390 I uVel, cflMer, gFacM, pFac, aFac,
0391 I OB_Iw, OB_indexNone, bi, bj,
0392 I futureTime, futureIter,
0393 I myThid )
0394
0395 CALL OBCS_STEVENS_CALC_TRACER_WEST(
4e4ad91a39 Jean*0396 U OBWs,
0daa63ec35 Mart*0397 I OBWsStevens, salt, gammas,
0398 I uVel, cflMer, gFacM, pFac, aFac,
0399 I OB_Iw, OB_indexNone, bi, bj,
0400 I futureTime, futureIter,
0401 I myThid )
0402
0403
eb8aff1784 Jean*0404 ENDIF
b2cb1ccb9a Mart*0405 #endif /* ALLOW_OBCS_WEST */
0406
0407
0408
0409 #ifdef ALLOW_OBCS_NORTH
eb8aff1784 Jean*0410 IF ( useStevensNorth ) THEN
b2cb1ccb9a Mart*0411
0412 #ifdef ALLOW_DEBUG
eb8aff1784 Jean*0413 IF (debugMode)
0414 & CALL DEBUG_MSG('OBCS_CALC_STEVENS: North',myThid)
b2cb1ccb9a Mart*0415 #endif
9f68a71aa4 Mart*0416
0417
4e4ad91a39 Jean*0418 DO i=1-OLx,sNx+OLx
0419 j = OB_Jn(i,bi,bj)
0420 IF ( j.NE.OB_indexNone ) THEN
e37ac28e89 Mart*0421
9f68a71aa4 Mart*0422 drFBar = 0. _d 0
e37ac28e89 Mart*0423 vZonBar = 0. _d 0
4e4ad91a39 Jean*0424 DO k=1,Nr
0425 vZonPri(k) = 0. _d 0
e37ac28e89 Mart*0426 ENDDO
4e4ad91a39 Jean*0427 DO k=1,Nr
9f68a71aa4 Mart*0428 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0429 vZonBar = vZonBar + vVel(i,j-1,k,bi,bj)
9f68a71aa4 Mart*0430 #else
4e4ad91a39 Jean*0431 vZonBar = vZonBar + OBNvStevens(i,k,bi,bj)
9f68a71aa4 Mart*0432 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0433 & *drF(k)* _hFacS(i,j,k,bi,bj)
0434 drFBar = drFBar + drF(k)* _hFacS(i,j,k,bi,bj)
9f68a71aa4 Mart*0435 ENDDO
e37ac28e89 Mart*0436 IF ( drFBar .GT. 0. _d 0 ) vZonBar = vZonBar/drFBar
4e4ad91a39 Jean*0437 DO k=1,Nr
9f68a71aa4 Mart*0438 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0439 vZonPri(k) = (vVel(i,j-1,k,bi,bj)-vZonBar)
9f68a71aa4 Mart*0440 #else
4e4ad91a39 Jean*0441 vZonPri(k) = (OBNvStevens(i,k,bi,bj)-vZonBar)
9f68a71aa4 Mart*0442 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0443 & * _maskS(i,j,k,bi,bj)
9f68a71aa4 Mart*0444 ENDDO
0445
0446 drFBar = 0. _d 0
e37ac28e89 Mart*0447 vZonBar = 0. _d 0
4e4ad91a39 Jean*0448 DO k=1,Nr
0449 vZonBar = vZonBar + OBNv(i,k,bi,bj)
0450 & *drF(k)* _hFacS(i,j,k,bi,bj)
0451 drFBar = drFBar + drF(k)* _hFacS(i,j,k,bi,bj)
9f68a71aa4 Mart*0452 ENDDO
e37ac28e89 Mart*0453 IF ( drFBar .GT. 0. _d 0 ) vZonBar = vZonBar/drFBar
9f68a71aa4 Mart*0454
e37ac28e89 Mart*0455
4e4ad91a39 Jean*0456 DO k=1,Nr
0457 OBNv(i,k,bi,bj) = (vZonBar + vZonPri(k))
0458 & * _maskS(i,j,k,bi,bj)
9f68a71aa4 Mart*0459
b2cb1ccb9a Mart*0460 #ifdef ALLOW_NONHYDROSTATIC
4e4ad91a39 Jean*0461 OBNw(i,k,bi,bj)=0.
b2cb1ccb9a Mart*0462 #endif
9f68a71aa4 Mart*0463 ENDDO
0464 ENDIF
0465 ENDDO
b2cb1ccb9a Mart*0466 #ifdef NONLIN_FRSURF
9f68a71aa4 Mart*0467
0468 IF ( nonlinFreeSurf.GT.0 ) THEN
4e4ad91a39 Jean*0469 DO i=1-OLx,sNx+OLx
0470 j = OB_Jn(i,bi,bj)
0471 IF ( j.NE.OB_indexNone ) THEN
0472 OBNeta(i,bi,bj) = etaN(i,j-1,bi,bj)
9f68a71aa4 Mart*0473 ENDIF
0474 ENDDO
0475 ENDIF
0476 #endif /* NONLIN_FRSURF */
0477
74019f026d Jean*0478
4e4ad91a39 Jean*0479 DO k=1,Nr
0480 DO i=1-OLx,sNx+OLx
0481 j = OB_Jn(i,bi,bj)
0482 IF ( j.NE.OB_indexNone ) THEN
0483 cflZon(i,k) = 0.5 _d 0 * _dyC(i,j-1,bi,bj)/dTtracerLev(k)
9f68a71aa4 Mart*0484
0485
4e4ad91a39 Jean*0486 gFacZ(i,k) = ABS(MIN(SIGN(1.D0,vVel(i,j,k,bi,bj)),0.D0))
9f68a71aa4 Mart*0487 ELSE
4e4ad91a39 Jean*0488 cflZon(i,k) = 0. _d 0
0489 gFacZ (i,k) = 0. _d 0
9f68a71aa4 Mart*0490 ENDIF
0491 ENDDO
0492 ENDDO
4e4ad91a39 Jean*0493 # ifdef ALLOW_AUTODIFF_TAMC
af61e5eb16 Mart*0494
4e4ad91a39 Jean*0495 # endif
0daa63ec35 Mart*0496
0497 CALL OBCS_STEVENS_CALC_TRACER_NORTH(
4e4ad91a39 Jean*0498 U OBNt,
0daa63ec35 Mart*0499 I OBNtStevens, theta, gammat,
4e4ad91a39 Jean*0500 I vVel, cflZon, gFacZ, pFac, aFac,
0daa63ec35 Mart*0501 I OB_Jn, OB_indexNone, bi, bj,
0502 I futureTime, futureIter,
0503 I myThid )
0504
0505 CALL OBCS_STEVENS_CALC_TRACER_NORTH(
4e4ad91a39 Jean*0506 U OBNs,
0daa63ec35 Mart*0507 I OBNsStevens, salt, gammas,
4e4ad91a39 Jean*0508 I vVel, cflZon, gFacZ, pFac, aFac,
0daa63ec35 Mart*0509 I OB_Jn, OB_indexNone, bi, bj,
0510 I futureTime, futureIter,
0511 I myThid )
0512
0513
eb8aff1784 Jean*0514 ENDIF
b2cb1ccb9a Mart*0515 #endif /* ALLOW_OBCS_NORTH */
0516
0517
0518
0519 #ifdef ALLOW_OBCS_SOUTH
eb8aff1784 Jean*0520 IF ( useStevensSouth ) THEN
b2cb1ccb9a Mart*0521
0522 #ifdef ALLOW_DEBUG
eb8aff1784 Jean*0523 IF (debugMode)
0524 & CALL DEBUG_MSG('OBCS_CALC_STEVENS: South',myThid)
b2cb1ccb9a Mart*0525 #endif
9f68a71aa4 Mart*0526
0527
4e4ad91a39 Jean*0528 DO i=1-OLx,sNx+OLx
0529 j = OB_Js(i,bi,bj)
0530 IF ( j.NE.OB_indexNone ) THEN
e37ac28e89 Mart*0531
9f68a71aa4 Mart*0532 drFBar = 0. _d 0
e37ac28e89 Mart*0533 vZonBar = 0. _d 0
4e4ad91a39 Jean*0534 DO k=1,Nr
0535 vZonPri(k) = 0. _d 0
e37ac28e89 Mart*0536 ENDDO
4e4ad91a39 Jean*0537 DO k=1,Nr
9f68a71aa4 Mart*0538 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0539 vZonBar = vZonBar + vVel(i,j+2,k,bi,bj)
9f68a71aa4 Mart*0540 #else
4e4ad91a39 Jean*0541 vZonBar = vZonBar + OBSvStevens(i,k,bi,bj)
9f68a71aa4 Mart*0542 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0543 & *drF(k)* _hFacS(i,j+1,k,bi,bj)
0544 drFBar = drFBar + drF(k)* _hFacS(i,j+1,k,bi,bj)
9f68a71aa4 Mart*0545 ENDDO
e37ac28e89 Mart*0546 IF ( drFBar .GT. 0. _d 0 ) vZonBar = vZonBar/drFBar
4e4ad91a39 Jean*0547 DO k=1,Nr
9f68a71aa4 Mart*0548 #ifdef OBCS_STEVENS_USE_INTERIOR_VELOCITY
4e4ad91a39 Jean*0549 vZonPri(k) = (vVel(i,j+2,k,bi,bj)-vZonBar)
9f68a71aa4 Mart*0550 #else
4e4ad91a39 Jean*0551 vZonPri(k) = (OBSvStevens(i,k,bi,bj)-vZonBar)
9f68a71aa4 Mart*0552 #endif /* OBCS_STEVENS_USE_INTERIOR_VELOCITY */
4e4ad91a39 Jean*0553 & * _maskS(i,j+1,k,bi,bj)
9f68a71aa4 Mart*0554 ENDDO
0555
0556 drFBar = 0. _d 0
e37ac28e89 Mart*0557 vZonBar = 0. _d 0
4e4ad91a39 Jean*0558 DO k=1,Nr
0559 vZonBar = vZonBar + OBSv(i,k,bi,bj)
0560 & *drF(k)* _hFacS(i,j+1,k,bi,bj)
0561 drFBar = drFBar + drF(k)* _hFacS(i,j+1,k,bi,bj)
9f68a71aa4 Mart*0562 ENDDO
e37ac28e89 Mart*0563 IF ( drFBar .GT. 0. _d 0 ) vZonBar = vZonBar/drFBar
9f68a71aa4 Mart*0564
e37ac28e89 Mart*0565
4e4ad91a39 Jean*0566 DO k=1,Nr
0567 OBSv(i,k,bi,bj) = (vZonBar + vZonPri(k))
0568 & * _maskS(i,j+1,k,bi,bj)
9f68a71aa4 Mart*0569
b2cb1ccb9a Mart*0570 #ifdef ALLOW_NONHYDROSTATIC
4e4ad91a39 Jean*0571 OBSw(i,k,bi,bj)=0.
b2cb1ccb9a Mart*0572 #endif
9f68a71aa4 Mart*0573 ENDDO
0574 ENDIF
0575 ENDDO
b2cb1ccb9a Mart*0576 #ifdef NONLIN_FRSURF
9f68a71aa4 Mart*0577
0578 IF ( nonlinFreeSurf.GT.0 ) THEN
4e4ad91a39 Jean*0579 DO i=1-OLx,sNx+OLx
0580 j = OB_Js(i,bi,bj)
0581 IF ( j.NE.OB_indexNone ) THEN
0582 OBSeta(i,bi,bj) = etaN(i,j+1,bi,bj)
9f68a71aa4 Mart*0583 ENDIF
0584 ENDDO
0585 ENDIF
0586 #endif /* NONLIN_FRSURF */
0587
74019f026d Jean*0588
4e4ad91a39 Jean*0589 DO k=1,Nr
0590 DO i=1-OLx,sNx+OLx
0591 j = OB_Js(i,bi,bj)
0592 IF ( j.NE.OB_indexNone ) THEN
0593 cflZon(i,k) = 0.5 _d 0 * _dyC(i,j+2,bi,bj)/dTtracerLev(k)
9f68a71aa4 Mart*0594
0595
4e4ad91a39 Jean*0596 gFacZ(i,k) = ABS(MAX(SIGN(1.D0,vVel(i,j+1,k,bi,bj)),0.D0))
9f68a71aa4 Mart*0597 ELSE
4e4ad91a39 Jean*0598 cflZon(i,k) = 0. _d 0
0599 gFacZ (i,k) = 0. _d 0
9f68a71aa4 Mart*0600 ENDIF
0601 ENDDO
0602 ENDDO
4e4ad91a39 Jean*0603 # ifdef ALLOW_AUTODIFF_TAMC
af61e5eb16 Mart*0604
4e4ad91a39 Jean*0605 # endif
0daa63ec35 Mart*0606
0607 CALL OBCS_STEVENS_CALC_TRACER_SOUTH(
4e4ad91a39 Jean*0608 U OBSt,
0daa63ec35 Mart*0609 I OBStStevens, theta, gammat,
4e4ad91a39 Jean*0610 I vVel, cflZon, gFacZ, pFac, aFac,
0daa63ec35 Mart*0611 I OB_Js, OB_indexNone, bi, bj,
0612 I futureTime, futureIter,
0613 I myThid )
0614
0615 CALL OBCS_STEVENS_CALC_TRACER_SOUTH(
4e4ad91a39 Jean*0616 U OBSs,
0daa63ec35 Mart*0617 I OBSsStevens, salt, gammas,
4e4ad91a39 Jean*0618 I vVel, cflZon, gFacZ, pFac, aFac,
0daa63ec35 Mart*0619 I OB_Js, OB_indexNone, bi, bj,
0620 I futureTime, futureIter,
0621 I myThid )
0622
9f68a71aa4 Mart*0623
eb8aff1784 Jean*0624 ENDIF
b2cb1ccb9a Mart*0625 #endif /* ALLOW_OBCS_SOUTH */
0626
0627
0628 ENDDO
0629 ENDDO
0630
b1353a35da Mart*0631
0632 CALL OBCS_STEVENS_SAVE_TRACERS(
0633 I futureTime, futureIter,
0634 I myThid )
b2cb1ccb9a Mart*0635
0636
0637 #ifdef CHECK_BALANCE
0638 DO bj=myByLo(myThid),myByHi(myThid)
0639 DO bi=myBxLo(myThid),myBxHi(myThid)
0640 uPhase=0.
0641 vPhase=0.
eb8aff1784 Jean*0642 uVelLoc = 0.
4e4ad91a39 Jean*0643 DO j=1-OLy,sNy+OLy
e37ac28e89 Mart*0644 uMerBar=0. _d 0
4e4ad91a39 Jean*0645 DO k=1,Nr
0646 i = OB_Ie(j,bi,bj)
0647 IF ( i.EQ.OB_indexNone ) i = 1
0648 uPhase = uPhase + OBEu(j,k,bi,bj)
0649 & *drF(k)* _hFacW(i,j,k,bi,bj)*dyG(i,j,bi,bj)
0650 i = OB_Iw(j,bi,bj)
0651 IF ( i.EQ.OB_indexNone ) i = 1
0652 vPhase = vPhase + OBWu(j,k,bi,bj)
0653 & *drF(k)* _hFacW(i+1,j,k,bi,bj)*dyG(i+1,j,bi,bj)
e37ac28e89 Mart*0654
0655
0656
0657
b2cb1ccb9a Mart*0658 ENDDO
e37ac28e89 Mart*0659
eb8aff1784 Jean*0660 ENDDO
b2cb1ccb9a Mart*0661
0662 ENDDO
0663 ENDDO
eb8aff1784 Jean*0664 _GLOBAL_SUM_RL( uPhase, myThid )
0665 _GLOBAL_SUM_RL( vPhase, myThid )
e37ac28e89 Mart*0666
eb8aff1784 Jean*0667 print *, 'ml-obcs: OBE = ', uPhase*1 _d -6, ' Sv'
0668 print *, 'ml-obcs: OBW = ', vPhase*1 _d -6, ' Sv'
e37ac28e89 Mart*0669
eb8aff1784 Jean*0670 #endif /* CHECK_BALANCE */
b2cb1ccb9a Mart*0671
0672 #ifdef ALLOW_DEBUG
eb8aff1784 Jean*0673 IF (debugMode) CALL DEBUG_LEAVE('OBCS_CALC_STEVENS',myThid)
b2cb1ccb9a Mart*0674 #endif
eb8aff1784 Jean*0675
b2cb1ccb9a Mart*0676 #endif /* ALLOW_OBCS_STEVENS */
0677 RETURN
0678 END
b1353a35da Mart*0679
0680
0daa63ec35 Mart*0681
0682
0683 SUBROUTINE OBCS_STEVENS_CALC_TRACER_EAST(
4e4ad91a39 Jean*0684 U OBEf,
0daa63ec35 Mart*0685 I OBE_Stevens, tracer, gammaf,
4e4ad91a39 Jean*0686 I uVel, cflMer, gFacM, pFac, aFac,
0daa63ec35 Mart*0687 I OB_I, OB_indexNone, bi, bj,
0688 I futureTime, futureIter,
0689 I myThid )
0690
0691
0692
0693
0694
0695
0696
0697
0698 IMPLICIT NONE
0699
0700 #include "SIZE.h"
0701 #include "GRID.h"
0702
0703
0704
0705
0706
0707 _RL futureTime
0708 INTEGER futureIter
0709 INTEGER myThid
0710 INTEGER bi, bj
0711 INTEGER OB_indexNone
0712 INTEGER OB_I (1-OLy:sNy+OLy,nSx,nSy)
0713 _RL cflMer (1-OLy:sNy+OLy,Nr)
0714 _RL gFacM (1-OLy:sNy+OLy,Nr)
0715 _RL gammaf, pFac, aFac
4e4ad91a39 Jean*0716 _RL OBEf (1-OLy:sNy+OLy,Nr,nSx,nSy)
0717 _RL OBE_Stevens (1-OLy:sNy+OLy,Nr,nSx,nSy)
0718 _RL tracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0719 _RL uVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0daa63ec35 Mart*0720
0721 #ifdef ALLOW_OBCS_STEVENS
0722
0723
0724
0725
0726
0727 INTEGER i,j,k
0728 _RL uPhase
0729 _RL dtracSpace
0730 _RL dTracTime
0731
4e4ad91a39 Jean*0732 DO k=1,Nr
0733 DO j=1-OLy,sNy+OLy
0734 i = OB_I(j,bi,bj)
0735 IF ( i.NE.OB_indexNone ) THEN
0736 dTracSpace = (tracer(i-1,j,k,bi,bj)-tracer(i-2,j,k,bi,bj))
0737 & * _maskW(i-1,j,k,bi,bj)
0738 dTracTime = (tracer(i-1,j,k,bi,bj)-OBE_Stevens(j,k,bi,bj))
0739 uPhase = cflMer(j,k) * pFac
0daa63ec35 Mart*0740 IF ( dTracSpace .NE. 0. _d 0 ) THEN
4e4ad91a39 Jean*0741 uPhase = MIN( cflMer(j,k),
0742 & MAX( 0.D0, -cflMer(j,k)*dTracTime/dTracSpace )
0daa63ec35 Mart*0743 & ) * pFac
0744 ENDIF
0745
0746
4e4ad91a39 Jean*0747 OBEf(j,k,bi,bj) = _maskW(i,j,k,bi,bj) * (
0748 & - ( aFac*MAX(0.D0,uVel(i,j,k,bi,bj)) + uPhase )
0749 & *(tracer(i,j,k,bi,bj)-tracer(i-1,j,k,bi,bj))
0750 & * _recip_dxC(i,j,bi,bj)
0751 & - gFacM(j,k) * gammaf
0752 & * (tracer(i,j,k,bi,bj)-OBEf(j,k,bi,bj)) )
0daa63ec35 Mart*0753 ENDIF
0754 ENDDO
0755 ENDDO
0756
0757 #endif /* ALLOW_OBCS_STEVENS */
0758 RETURN
0759 END
0760
0761
0762
0763
0764 SUBROUTINE OBCS_STEVENS_CALC_TRACER_WEST(
4e4ad91a39 Jean*0765 U OBWf,
0daa63ec35 Mart*0766 I OBW_Stevens, tracer, gammaf,
4e4ad91a39 Jean*0767 I uVel, cflMer, gFacM, pFac, aFac,
0daa63ec35 Mart*0768 I OB_I, OB_indexNone, bi, bj,
0769 I futureTime, futureIter,
0770 I myThid )
0771
0772
0773
0774
0775
0776
0777
0778
0779 IMPLICIT NONE
0780
0781 #include "SIZE.h"
0782 #include "GRID.h"
0783
0784
0785
0786
0787
0788 _RL futureTime
0789 INTEGER futureIter
0790 INTEGER myThid
0791 INTEGER bi, bj
0792 INTEGER OB_indexNone
0793 INTEGER OB_I (1-OLy:sNy+OLy,nSx,nSy)
0794 _RL cflMer (1-OLy:sNy+OLy,Nr)
0795 _RL gFacM (1-OLy:sNy+OLy,Nr)
0796 _RL gammaf, pFac, aFac
4e4ad91a39 Jean*0797 _RL OBWf (1-OLy:sNy+OLy,Nr,nSx,nSy)
0798 _RL OBW_Stevens (1-OLy:sNy+OLy,Nr,nSx,nSy)
0799 _RL tracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0800 _RL uVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0daa63ec35 Mart*0801
0802 #ifdef ALLOW_OBCS_STEVENS
0803
0804
0805
0806
0807
0808 INTEGER i,j,k
0809 _RL uPhase
0810 _RL dtracSpace
0811 _RL dTracTime
0812
0813
4e4ad91a39 Jean*0814 DO k=1,Nr
0815 DO j=1-OLy,sNy+OLy
0816 i = OB_I(j,bi,bj)
0817 IF ( i.NE.OB_indexNone ) THEN
0818 dTracSpace = (tracer(i+2,j,k,bi,bj)-tracer(i+1,j,k,bi,bj))
0819 & * _maskW(i+2,j,k,bi,bj)
0820 dTracTime = (tracer(i+1,j,k,bi,bj)-OBW_Stevens(j,k,bi,bj))
0821 uPhase = -cflMer(j,k) * pFac
0daa63ec35 Mart*0822 IF ( dTracSpace .NE. 0. _d 0 ) THEN
4e4ad91a39 Jean*0823 uPhase = MAX( -cflMer(j,k),
0824 & MIN( 0.D0, -cflMer(j,k)*dTracTime/dTracSpace )
0daa63ec35 Mart*0825 & ) * pFac
0826 ENDIF
0827
0828
4e4ad91a39 Jean*0829 OBWf(j,k,bi,bj) = _maskW(i+1,j,k,bi,bj) * (
0830 & - ( aFac*MIN(0.D0,uVel(i+1,j,k,bi,bj)) + uPhase )
0831 & *(tracer(i+1,j,k,bi,bj)-tracer(i,j,k,bi,bj))
0832 & * _recip_dxC(i+1,j,bi,bj)
0833 & - gFacM(j,k) * gammaf
0834 & * (tracer(i,j,k,bi,bj)-OBWf(j,k,bi,bj)) )
0daa63ec35 Mart*0835 ENDIF
0836 ENDDO
0837 ENDDO
0838
0839 #endif /* ALLOW_OBCS_STEVENS */
0840 RETURN
0841 END
0842
0843
0844
0845
0846 SUBROUTINE OBCS_STEVENS_CALC_TRACER_NORTH(
4e4ad91a39 Jean*0847 U OBNf,
0daa63ec35 Mart*0848 I OBN_Stevens, tracer, gammaf,
4e4ad91a39 Jean*0849 I vVel, cflZon, gFacZ, pFac, aFac,
0daa63ec35 Mart*0850 I OB_J, OB_indexNone, bi, bj,
0851 I futureTime, futureIter,
0852 I myThid )
0853
0854
0855
0856
0857
0858
0859
0860
0861 IMPLICIT NONE
0862
0863 #include "SIZE.h"
0864 #include "GRID.h"
0865
0866
0867
0868
0869
0870 _RL futureTime
0871 INTEGER futureIter
0872 INTEGER myThid
0873 INTEGER bi, bj
0874 INTEGER OB_indexNone
0875 INTEGER OB_J (1-OLx:sNx+OLx,nSx,nSy)
0876 _RL cflZon (1-OLx:sNx+OLx,Nr)
0877 _RL gFacZ (1-OLx:sNx+OLx,Nr)
0878 _RL gammaf, pFac, aFac
4e4ad91a39 Jean*0879 _RL OBNf (1-OLx:sNx+OLx,Nr,nSx,nSy)
0880 _RL OBN_Stevens (1-OLx:sNx+OLx,Nr,nSx,nSy)
0881 _RL tracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0882 _RL vVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0daa63ec35 Mart*0883
0884 #ifdef ALLOW_OBCS_STEVENS
0885
0886
0887
0888
0889
0890 INTEGER i,j,k
0891 _RL vPhase
0892 _RL dtracSpace
0893 _RL dTracTime
0894
4e4ad91a39 Jean*0895 DO k=1,Nr
0896 DO i=1-OLx,sNx+OLx
0897 j = OB_J(i,bi,bj)
0898 IF ( j.NE.OB_indexNone ) THEN
0daa63ec35 Mart*0899
4e4ad91a39 Jean*0900 dTracSpace = (tracer(i,j-1,k,bi,bj)-tracer(i,j-2,k,bi,bj))
0901 & * _maskS(i,j-1,k,bi,bj)
0902 dTracTime = (tracer(i,j-1,k,bi,bj)-OBN_Stevens(i,k,bi,bj))
0903 vPhase = cflZon(i,k) * pFac
0daa63ec35 Mart*0904 IF ( dTracSpace .NE. 0. _d 0 ) THEN
4e4ad91a39 Jean*0905 vPhase = MIN( cflZon(i,k),
0906 & MAX( 0.D0, -cflZon(i,k)*dTracTime/dTracSpace )
0daa63ec35 Mart*0907 & ) * pFac
0908 ENDIF
0909
0910
4e4ad91a39 Jean*0911 OBNf(i,k,bi,bj) = _maskS(i,j,k,bi,bj) * (
0912 & - ( aFac*MAX(0.D0,vVel(i,j,k,bi,bj)) + vPhase )
0913 & *(tracer(i,j,k,bi,bj)-tracer(i,j-1,k,bi,bj))
0914 & * _recip_dyC(i,j,bi,bj)
0915 & - gFacZ(i,k) * gammaf
0916 & * (tracer(i,j,k,bi,bj)-OBNf(i,k,bi,bj)) )
0daa63ec35 Mart*0917 ENDIF
0918 ENDDO
0919 ENDDO
0920
0921 #endif /* ALLOW_OBCS_STEVENS */
0922 RETURN
0923 END
0924
0925
0926
0927
0928 SUBROUTINE OBCS_STEVENS_CALC_TRACER_SOUTH(
4e4ad91a39 Jean*0929 U OBSf,
0daa63ec35 Mart*0930 I OBS_Stevens, tracer, gammaf,
4e4ad91a39 Jean*0931 I vVel, cflZon, gFacZ, pFac, aFac,
0daa63ec35 Mart*0932 I OB_J, OB_indexNone, bi, bj,
0933 I futureTime, futureIter,
0934 I myThid )
0935
0936
0937
0938
0939
0940
0941
0942
0943 IMPLICIT NONE
0944
0945 #include "SIZE.h"
0946 #include "GRID.h"
0947
0948
0949
0950
0951
0952 _RL futureTime
0953 INTEGER futureIter
0954 INTEGER myThid
0955 INTEGER bi, bj
0956 INTEGER OB_indexNone
0957 INTEGER OB_J (1-OLx:sNx+OLx,nSx,nSy)
0958 _RL cflZon (1-OLx:sNx+OLx,Nr)
0959 _RL gFacZ (1-OLx:sNx+OLx,Nr)
0960 _RL gammaf, pFac, aFac
4e4ad91a39 Jean*0961 _RL OBSf (1-OLx:sNx+OLx,Nr,nSx,nSy)
0962 _RL OBS_Stevens (1-OLx:sNx+OLx,Nr,nSx,nSy)
0963 _RL tracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0964 _RL vVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
0daa63ec35 Mart*0965
0966 #ifdef ALLOW_OBCS_STEVENS
0967
0968
0969
0970
0971
0972 INTEGER i,j,k
0973 _RL vPhase
0974 _RL dtracSpace
0975 _RL dTracTime
0976
4e4ad91a39 Jean*0977 DO k=1,Nr
0978 DO i=1-OLx,sNx+OLx
0979 j = OB_J(i,bi,bj)
0980 IF ( j.NE.OB_indexNone ) THEN
0981 dTracSpace = (tracer(i,j+2,k,bi,bj)-tracer(i,j+1,k,bi,bj))
0982 & * _maskS(i,j+2,k,bi,bj)
0983 dTracTime = (tracer(i,j+1,k,bi,bj)-OBS_Stevens(i,k,bi,bj))
0984 vPhase = -cflZon(i,k) * pFac
0daa63ec35 Mart*0985 IF ( dTracSpace .NE. 0. _d 0 ) THEN
4e4ad91a39 Jean*0986 vPhase = MAX( -cflZon(i,k),
0987 & MIN( 0.D0, -cflZon(i,k)*dTracTime/dTracSpace )
0daa63ec35 Mart*0988 & ) * pFac
0989 ENDIF
0990
0991
4e4ad91a39 Jean*0992 OBSf(i,k,bi,bj) = _maskS(i,j+1,k,bi,bj) * (
0993 & - ( aFac*MIN(0.D0,vVel(i,j+1,k,bi,bj)) + vPhase )
0994 & *(tracer(i,j+1,k,bi,bj)-tracer(i,j,k,bi,bj))
0995 & * _recip_dyC(i,j+1,bi,bj)
0996 & - gFacZ(i,k) * gammaf
0997 & * (tracer(i,j,k,bi,bj)-OBSf(i,k,bi,bj)) )
0daa63ec35 Mart*0998 ENDIF
0999 ENDDO
1000 ENDDO
1001
1002 #endif /* ALLOW_OBCS_STEVENS */
1003 RETURN
1004 END
1005
1006
b1353a35da Mart*1007
1008
1009 SUBROUTINE OBCS_STEVENS_SAVE_TRACERS(
1010 I futureTime, futureIter,
1011 I myThid )
1012
1013
1014
74019f026d Jean*1015
1016
b1353a35da Mart*1017
1018
1019
1020
1021 IMPLICIT NONE
1022
1023 #include "SIZE.h"
1024 #include "EEPARAMS.h"
1025 #include "GRID.h"
1026 #include "OBCS_PARAMS.h"
1027 #include "OBCS_GRID.h"
1028 #include "OBCS_FIELDS.h"
1029 #include "DYNVARS.h"
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040 _RL futureTime
1041 INTEGER futureIter
1042 INTEGER myThid
1043
397c34a218 Mart*1044 #ifdef ALLOW_OBCS_STEVENS
b1353a35da Mart*1045
4e4ad91a39 Jean*1046
1047
1048
b1353a35da Mart*1049 INTEGER bi,bj,i,j,k,Iobc,Jobc
1050
1051
1052 DO bj=myByLo(myThid),myByHi(myThid)
1053 DO bi=myBxLo(myThid),myBxHi(myThid)
1054 #ifdef ALLOW_OBCS_NORTH
1055 IF ( tileHasOBN(bi,bj) .AND. useStevensNorth ) THEN
1056
74019f026d Jean*1057 DO i=1-OLx,sNx+OLx
b1353a35da Mart*1058 Jobc = OB_Jn(i,bi,bj)
74019f026d Jean*1059 IF ( Jobc.NE.OB_indexNone ) THEN
b1353a35da Mart*1060 DO k = 1,Nr
1061 OBNtStevens(i,k,bi,bj) = theta(i,Jobc-1,k,bi,bj)
1062 & *maskC(i,Jobc+1,k,bi,bj)
1063 OBNsStevens(i,k,bi,bj) = salt(i,Jobc-1,k,bi,bj)
1064 & *maskC(i,Jobc+1,k,bi,bj)
1065 ENDDO
1066 ENDIF
1067 ENDDO
1068 ENDIF
1069 #endif /* ALLOW_OBCS_NORTH */
1070 #ifdef ALLOW_OBCS_SOUTH
1071 IF ( tileHasOBS(bi,bj) .AND. useStevensSouth ) THEN
1072
74019f026d Jean*1073 DO i=1-OLx,sNx+OLx
b1353a35da Mart*1074 Jobc = OB_Js(i,bi,bj)
74019f026d Jean*1075 IF ( Jobc.NE.OB_indexNone ) THEN
b1353a35da Mart*1076 DO k = 1,Nr
1077 OBStStevens(i,k,bi,bj) = theta(i,Jobc+1,k,bi,bj)
1078 & *maskC(i,Jobc+1,k,bi,bj)
1079 OBSsStevens(i,k,bi,bj) = salt(i,Jobc+1,k,bi,bj)
1080 & *maskC(i,Jobc+1,k,bi,bj)
1081 ENDDO
1082 ENDIF
1083 ENDDO
1084 ENDIF
1085 #endif /* ALLOW_OBCS_SOUTH */
1086 #ifdef ALLOW_OBCS_EAST
1087 IF ( tileHasOBE(bi,bj) .AND. useStevensEast ) THEN
1088
74019f026d Jean*1089 DO j=1-OLy,sNy+OLy
b1353a35da Mart*1090 Iobc = OB_Ie(j,bi,bj)
74019f026d Jean*1091 IF ( Iobc.NE.OB_indexNone ) THEN
b1353a35da Mart*1092 DO k = 1,Nr
1093 OBEtStevens(j,k,bi,bj) = theta(Iobc-1,j,k,bi,bj)
1094 & *maskC(Iobc-1,j,k,bi,bj)
1095 OBEsStevens(j,k,bi,bj) = salt(Iobc-1,j,k,bi,bj)
1096 & *maskC(Iobc-1,j,k,bi,bj)
1097 ENDDO
1098 ENDIF
1099 ENDDO
1100 ENDIF
1101 #endif /* ALLOW_OBCS_EAST */
1102 #ifdef ALLOW_OBCS_WEST
1103 IF ( tileHasOBW(bi,bj) .AND. useStevensWest ) THEN
1104
74019f026d Jean*1105 DO j=1-OLy,sNy+OLy
b1353a35da Mart*1106 Iobc = OB_Iw(j,bi,bj)
74019f026d Jean*1107 IF ( Iobc.NE.OB_indexNone ) THEN
b1353a35da Mart*1108 DO k = 1,Nr
1109 OBWtStevens(j,k,bi,bj) = theta(Iobc+1,j,k,bi,bj)
1110 & *maskC(Iobc+1,j,k,bi,bj)
1111 OBWsStevens(j,k,bi,bj) = salt(Iobc+1,j,k,bi,bj)
1112 & *maskC(Iobc+1,j,k,bi,bj)
1113 ENDDO
1114 ENDIF
1115 ENDDO
1116 ENDIF
1117 #endif /* ALLOW_OBCS_WEST */
1118 ENDDO
1119 ENDDO
1120 #endif /* ALLOW_OBCS_STEVENS */
1121 RETURN
1122 END