62 |
C is "pipelined" in the vertical |
C is "pipelined" in the vertical |
63 |
C so we need an fVer for each |
C so we need an fVer for each |
64 |
C variable. |
C variable. |
65 |
C rhoK, rhoKM1 - Density at current level, level above and level |
C rhoK, rhoKM1 - Density at current level, and level above |
|
C below. |
|
|
C rhoKP1 |
|
|
C buoyK, buoyKM1 - Buoyancy at current level and level above. |
|
66 |
C phiHyd - Hydrostatic part of the potential phiHydi. |
C phiHyd - Hydrostatic part of the potential phiHydi. |
67 |
C In z coords phiHydiHyd is the hydrostatic |
C In z coords phiHydiHyd is the hydrostatic |
68 |
C pressure anomaly |
C pressure anomaly |
92 |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
93 |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
94 |
_RL phiHyd (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL phiHyd (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
95 |
|
_RL phiHydInterface(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
96 |
_RL rhokm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhokm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
_RL rhokp1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
97 |
_RL rhok (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhok (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
_RL buoyKM1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
|
_RL buoyK (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
|
_RL rhotmp (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
98 |
_RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
99 |
_RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
100 |
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
186 |
uTrans(i,j) = 0. _d 0 |
uTrans(i,j) = 0. _d 0 |
187 |
vTrans(i,j) = 0. _d 0 |
vTrans(i,j) = 0. _d 0 |
188 |
DO k=1,Nr |
DO k=1,Nr |
|
phiHyd (i,j,k) = 0. _d 0 |
|
189 |
KappaRU(i,j,k) = 0. _d 0 |
KappaRU(i,j,k) = 0. _d 0 |
190 |
KappaRV(i,j,k) = 0. _d 0 |
KappaRV(i,j,k) = 0. _d 0 |
191 |
sigmaX(i,j,k) = 0. _d 0 |
sigmaX(i,j,k) = 0. _d 0 |
194 |
ENDDO |
ENDDO |
195 |
rhoKM1 (i,j) = 0. _d 0 |
rhoKM1 (i,j) = 0. _d 0 |
196 |
rhok (i,j) = 0. _d 0 |
rhok (i,j) = 0. _d 0 |
|
rhoKP1 (i,j) = 0. _d 0 |
|
|
rhoTMP (i,j) = 0. _d 0 |
|
|
buoyKM1(i,j) = 0. _d 0 |
|
|
buoyK (i,j) = 0. _d 0 |
|
197 |
maskC (i,j) = 0. _d 0 |
maskC (i,j) = 0. _d 0 |
198 |
ENDDO |
ENDDO |
199 |
ENDDO |
ENDDO |
247 |
fVerU (i,j,2) = 0. _d 0 |
fVerU (i,j,2) = 0. _d 0 |
248 |
fVerV (i,j,1) = 0. _d 0 |
fVerV (i,j,1) = 0. _d 0 |
249 |
fVerV (i,j,2) = 0. _d 0 |
fVerV (i,j,2) = 0. _d 0 |
|
phiHyd(i,j,1) = 0. _d 0 |
|
250 |
ENDDO |
ENDDO |
251 |
ENDDO |
ENDDO |
252 |
|
|
277 |
kkey = (ikey-1)*(Nr-2+1) + (k-2) + 1 |
kkey = (ikey-1)*(Nr-2+1) + (k-2) + 1 |
278 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
279 |
|
|
|
#ifdef ALLOW_OBCS |
|
|
C-- Calculate future values on open boundaries |
|
|
IF (openBoundaries) THEN |
|
|
Caja CALL CYCLE_OBCS( k, bi, bj, myThid ) |
|
|
c new args! CALL SET_OBCS( k, bi, bj, myTime, myThid ) |
|
|
c +deltaT? |
|
|
ENDIF |
|
|
#endif |
|
|
|
|
280 |
C-- Integrate continuity vertically for vertical velocity |
C-- Integrate continuity vertically for vertical velocity |
281 |
CALL INTEGRATE_FOR_W( |
CALL INTEGRATE_FOR_W( |
282 |
I bi, bj, k, uVel, vVel, |
I bi, bj, k, uVel, vVel, |
283 |
O wVel, |
O wVel, |
284 |
I myThid ) |
I myThid ) |
285 |
#ifdef ALLOW_OBCS |
|
286 |
|
#ifdef ALLOW_OBCS |
287 |
|
C-- Calculate future values on open boundaries |
288 |
IF (openBoundaries) THEN |
IF (openBoundaries) THEN |
289 |
c new subr CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid ) |
#ifdef ALLOW_NONHYDROSTATIC |
290 |
|
IF (nonHydrostatic) THEN |
291 |
|
CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid ) |
292 |
|
ENDIF |
293 |
|
#endif /* ALLOW_NONHYDROSTATIC */ |
294 |
|
CALL OBCS_CALC( bi, bj, k, myTime+deltaT, myThid ) |
295 |
ENDIF |
ENDIF |
296 |
#endif |
#endif /* ALLOW_OBCS */ |
297 |
|
|
298 |
C-- Calculate gradients of potential density for isoneutral |
C-- Calculate gradients of potential density for isoneutral |
299 |
C slope terms (e.g. GM/Redi tensor or IVDC diffusivity) |
C slope terms (e.g. GM/Redi tensor or IVDC diffusivity) |
300 |
IF ( k.GT.1 .AND. (useGMRedi.OR.ivdc_kappa.NE.0.) ) THEN |
c IF ( k.GT.1 .AND. (useGMRedi.OR.ivdc_kappa.NE.0.) ) THEN |
301 |
|
IF ( useGMRedi .OR. (k.GT.1 .AND. ivdc_kappa.NE.0.) ) THEN |
302 |
CALL FIND_RHO( |
CALL FIND_RHO( |
303 |
I bi, bj, iMin, iMax, jMin, jMax, k, k, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, k, k, eosType, |
304 |
|
I theta, salt, |
305 |
O rhoK, |
O rhoK, |
306 |
I myThid ) |
I myThid ) |
307 |
CALL FIND_RHO( |
IF (k.GT.1) CALL FIND_RHO( |
308 |
I bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType, |
309 |
|
I theta, salt, |
310 |
O rhoKm1, |
O rhoKm1, |
311 |
I myThid ) |
I myThid ) |
312 |
CALL GRAD_SIGMA( |
CALL GRAD_SIGMA( |
317 |
ENDIF |
ENDIF |
318 |
|
|
319 |
C-- Implicit Vertical Diffusion for Convection |
C-- Implicit Vertical Diffusion for Convection |
320 |
|
c ==> should use sigmaR !!! |
321 |
IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN |
IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN |
322 |
CALL CALC_IVDC( |
CALL CALC_IVDC( |
323 |
I bi, bj, iMin, iMax, jMin, jMax, k, |
I bi, bj, iMin, iMax, jMin, jMax, k, |
324 |
I rhoKm1, rhoK, |
I rhoKm1, rhoK, |
|
c should use sigmaR !!! |
|
325 |
U ConvectCount, KappaRT, KappaRS, |
U ConvectCount, KappaRT, KappaRS, |
326 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
327 |
END IF |
END IF |
329 |
C-- end of diagnostic k loop (Nr:1) |
C-- end of diagnostic k loop (Nr:1) |
330 |
ENDDO |
ENDDO |
331 |
|
|
332 |
|
C-- Determines forcing terms based on external fields |
333 |
|
C relaxation terms, etc. |
334 |
|
CALL EXTERNAL_FORCING_SURF( |
335 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
336 |
|
I myThid ) |
337 |
|
|
338 |
#ifdef ALLOW_GMREDI |
#ifdef ALLOW_GMREDI |
339 |
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
340 |
IF (useGMRedi) THEN |
IF (useGMRedi) THEN |
355 |
ENDIF |
ENDIF |
356 |
#endif /* ALLOW_KPP */ |
#endif /* ALLOW_KPP */ |
357 |
|
|
|
C-- Determines forcing terms based on external fields |
|
|
C relaxation terms, etc. |
|
|
CALL EXTERNAL_FORCING_SURF( |
|
|
I bi, bj, iMin, iMax, jMin, jMax, |
|
|
I myThid ) |
|
|
|
|
358 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
359 |
CADJ STORE KappaRT(:,:,:) = comlev1_bibj, key = ikey, byte = isbyte |
CADJ STORE KappaRT(:,:,:) = comlev1_bibj, key = ikey, byte = isbyte |
360 |
CADJ STORE KappaRS(:,:,:) = comlev1_bibj, key = ikey, byte = isbyte |
CADJ STORE KappaRS(:,:,:) = comlev1_bibj, key = ikey, byte = isbyte |
434 |
U gSnm1, |
U gSnm1, |
435 |
I myIter, myThid) |
I myIter, myThid) |
436 |
ENDIF |
ENDIF |
437 |
#ifdef ALLOW_OBCS |
|
438 |
|
#ifdef ALLOW_OBCS |
439 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
440 |
IF (openBoundaries) THEN |
IF (openBoundaries) THEN |
441 |
#ifdef ALLOW_AUTODIFF_TAMC |
CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid ) |
|
CADJ STORE gwnm1(:,:,k,bi,bj) = comlev1_bibj_k |
|
|
CADJ & , key = kkey, byte = isbyte |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
|
|
c new subr CALL OBCS_APPLY_TS( bi, bj, k, myThid ) |
|
442 |
END IF |
END IF |
443 |
#endif |
#endif /* ALLOW_OBCS */ |
444 |
|
|
445 |
C-- Freeze water |
C-- Freeze water |
446 |
IF (allowFreezing) THEN |
IF (allowFreezing) THEN |
447 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
486 |
I myThid ) |
I myThid ) |
487 |
ENDIF |
ENDIF |
488 |
|
|
489 |
|
#ifdef ALLOW_OBCS |
490 |
|
C-- Apply open boundary conditions |
491 |
|
IF (openBoundaries) THEN |
492 |
|
DO K=1,Nr |
493 |
|
CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid ) |
494 |
|
ENDDO |
495 |
|
END IF |
496 |
|
#endif /* ALLOW_OBCS */ |
497 |
|
|
498 |
C-- End If implicitDiffusion |
C-- End If implicitDiffusion |
499 |
ENDIF |
ENDIF |
500 |
|
|
516 |
jMin = 1-OLy+2 |
jMin = 1-OLy+2 |
517 |
jMax = sNy+OLy-1 |
jMax = sNy+OLy-1 |
518 |
|
|
|
C-- Calculate buoyancy |
|
|
CALL FIND_RHO( |
|
|
I bi, bj, iMin, iMax, jMin, jMax, km1, km1, eosType, |
|
|
O rhoKm1, |
|
|
I myThid ) |
|
|
CALL CALC_BUOYANCY( |
|
|
I bi,bj,iMin,iMax,jMin,jMax,k,rhoKm1, |
|
|
O buoyKm1, |
|
|
I myThid ) |
|
|
CALL FIND_RHO( |
|
|
I bi, bj, iMin, iMax, jMin, jMax, k, k, eosType, |
|
|
O rhoK, |
|
|
I myThid ) |
|
|
CALL CALC_BUOYANCY( |
|
|
I bi,bj,iMin,iMax,jMin,jMax,k,rhoK, |
|
|
O buoyK, |
|
|
I myThid ) |
|
|
|
|
519 |
C-- Integrate hydrostatic balance for phiHyd with BC of |
C-- Integrate hydrostatic balance for phiHyd with BC of |
520 |
C-- phiHyd(z=0)=0 |
C-- phiHyd(z=0)=0 |
521 |
CALL CALC_PHI_HYD( |
CALL CALC_PHI_HYD( |
522 |
I bi,bj,iMin,iMax,jMin,jMax,k,buoyKm1,buoyK, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
523 |
U phiHyd, |
I theta, salt, |
524 |
|
U phiHyd, phiHydInterface, |
525 |
I myThid ) |
I myThid ) |
526 |
|
|
527 |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
535 |
CALL TIMESTEP( |
CALL TIMESTEP( |
536 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
537 |
I myIter, myThid) |
I myIter, myThid) |
538 |
|
|
539 |
|
#ifdef ALLOW_OBCS |
540 |
|
C-- Apply open boundary conditions |
541 |
|
IF (openBoundaries) THEN |
542 |
|
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
543 |
|
END IF |
544 |
|
#endif /* ALLOW_OBCS */ |
545 |
|
|
546 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
547 |
#ifdef INCLUDE_CD_CODE |
#ifdef INCLUDE_CD_CODE |
548 |
ELSE |
ELSE |
581 |
U gVNm1, |
U gVNm1, |
582 |
I myThid ) |
I myThid ) |
583 |
|
|
584 |
|
#ifdef ALLOW_OBCS |
585 |
|
C-- Apply open boundary conditions |
586 |
|
IF (openBoundaries) THEN |
587 |
|
DO K=1,Nr |
588 |
|
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
589 |
|
ENDDO |
590 |
|
END IF |
591 |
|
#endif /* ALLOW_OBCS */ |
592 |
|
|
593 |
#ifdef INCLUDE_CD_CODE |
#ifdef INCLUDE_CD_CODE |
594 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
595 |
idkey = iikey + 5 |
idkey = iikey + 5 |