1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
5 |
|
|
63 |
C is "pipelined" in the vertical |
C is "pipelined" in the vertical |
64 |
C so we need an fVer for each |
C so we need an fVer for each |
65 |
C variable. |
C variable. |
66 |
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. |
|
67 |
C phiHyd - Hydrostatic part of the potential phiHydi. |
C phiHyd - Hydrostatic part of the potential phiHydi. |
68 |
C In z coords phiHydiHyd is the hydrostatic |
C In z coords phiHydiHyd is the hydrostatic |
69 |
C pressure anomaly |
C pressure anomaly |
94 |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
95 |
_RL phiHyd (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL phiHyd (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
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 |
189 |
phiHyd (i,j,k) = 0. _d 0 |
phiHyd(i,j,k) = 0. _d 0 |
190 |
KappaRU(i,j,k) = 0. _d 0 |
KappaRU(i,j,k) = 0. _d 0 |
191 |
KappaRV(i,j,k) = 0. _d 0 |
KappaRV(i,j,k) = 0. _d 0 |
192 |
sigmaX(i,j,k) = 0. _d 0 |
sigmaX(i,j,k) = 0. _d 0 |
195 |
ENDDO |
ENDDO |
196 |
rhoKM1 (i,j) = 0. _d 0 |
rhoKM1 (i,j) = 0. _d 0 |
197 |
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 |
|
198 |
maskC (i,j) = 0. _d 0 |
maskC (i,j) = 0. _d 0 |
199 |
ENDDO |
ENDDO |
200 |
ENDDO |
ENDDO |
248 |
fVerU (i,j,2) = 0. _d 0 |
fVerU (i,j,2) = 0. _d 0 |
249 |
fVerV (i,j,1) = 0. _d 0 |
fVerV (i,j,1) = 0. _d 0 |
250 |
fVerV (i,j,2) = 0. _d 0 |
fVerV (i,j,2) = 0. _d 0 |
|
phiHyd(i,j,1) = 0. _d 0 |
|
251 |
ENDDO |
ENDDO |
252 |
ENDDO |
ENDDO |
253 |
|
|
285 |
I myThid ) |
I myThid ) |
286 |
|
|
287 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
288 |
C-- Calculate future values on open boundaries |
#ifdef ALLOW_NONHYDROSTATIC |
289 |
IF (openBoundaries) THEN |
C-- Apply OBC to W if in N-H mode |
290 |
#ifdef ALLOW_NONHYDROSTATIC |
IF (useOBCS.AND.nonHydrostatic) THEN |
291 |
IF (nonHydrostatic) THEN |
CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid ) |
|
CALL OBCS_APPLY_W( bi, bj, k, wVel, myThid ) |
|
|
ENDIF |
|
|
#endif /* ALLOW_NONHYDROSTATIC */ |
|
|
CALL OBCS_CALC( bi, bj, k, myTime+deltaT, myThid ) |
|
292 |
ENDIF |
ENDIF |
293 |
|
#endif /* ALLOW_NONHYDROSTATIC */ |
294 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
295 |
|
|
296 |
C-- Calculate gradients of potential density for isoneutral |
C-- Calculate gradients of potential density for isoneutral |
297 |
C slope terms (e.g. GM/Redi tensor or IVDC diffusivity) |
C slope terms (e.g. GM/Redi tensor or IVDC diffusivity) |
298 |
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 |
299 |
|
IF ( useGMRedi .OR. (k.GT.1 .AND. ivdc_kappa.NE.0.) ) THEN |
300 |
CALL FIND_RHO( |
CALL FIND_RHO( |
301 |
I bi, bj, iMin, iMax, jMin, jMax, k, k, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, k, k, eosType, |
302 |
|
I theta, salt, |
303 |
O rhoK, |
O rhoK, |
304 |
I myThid ) |
I myThid ) |
305 |
CALL FIND_RHO( |
IF (k.GT.1) CALL FIND_RHO( |
306 |
I bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, k-1, k, eosType, |
307 |
|
I theta, salt, |
308 |
O rhoKm1, |
O rhoKm1, |
309 |
I myThid ) |
I myThid ) |
310 |
CALL GRAD_SIGMA( |
CALL GRAD_SIGMA( |
315 |
ENDIF |
ENDIF |
316 |
|
|
317 |
C-- Implicit Vertical Diffusion for Convection |
C-- Implicit Vertical Diffusion for Convection |
318 |
|
c ==> should use sigmaR !!! |
319 |
IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN |
IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN |
320 |
CALL CALC_IVDC( |
CALL CALC_IVDC( |
321 |
I bi, bj, iMin, iMax, jMin, jMax, k, |
I bi, bj, iMin, iMax, jMin, jMax, k, |
322 |
I rhoKm1, rhoK, |
I rhoKm1, rhoK, |
|
c should use sigmaR !!! |
|
323 |
U ConvectCount, KappaRT, KappaRS, |
U ConvectCount, KappaRT, KappaRS, |
324 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
325 |
END IF |
END IF |
327 |
C-- end of diagnostic k loop (Nr:1) |
C-- end of diagnostic k loop (Nr:1) |
328 |
ENDDO |
ENDDO |
329 |
|
|
330 |
|
#ifdef ALLOW_OBCS |
331 |
|
C-- Calculate future values on open boundaries |
332 |
|
IF (useOBCS) THEN |
333 |
|
CALL OBCS_CALC( bi, bj, myTime+deltaT, |
334 |
|
I uVel, vVel, wVel, theta, salt, |
335 |
|
I myThid ) |
336 |
|
ENDIF |
337 |
|
#endif /* ALLOW_OBCS */ |
338 |
|
|
339 |
C-- Determines forcing terms based on external fields |
C-- Determines forcing terms based on external fields |
340 |
C relaxation terms, etc. |
C relaxation terms, etc. |
341 |
CALL EXTERNAL_FORCING_SURF( |
CALL EXTERNAL_FORCING_SURF( |
351 |
I sigmaX, sigmaY, sigmaR, |
I sigmaX, sigmaY, sigmaR, |
352 |
I myThid ) |
I myThid ) |
353 |
ENDDO |
ENDDO |
354 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
355 |
|
ELSE |
356 |
|
DO k=1, Nr |
357 |
|
CALL GMREDI_CALC_TENSOR_DUMMY( |
358 |
|
I bi, bj, iMin, iMax, jMin, jMax, k, |
359 |
|
I sigmaX, sigmaY, sigmaR, |
360 |
|
I myThid ) |
361 |
|
ENDDO |
362 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
363 |
ENDIF |
ENDIF |
364 |
#endif /* ALLOW_GMREDI */ |
#endif /* ALLOW_GMREDI */ |
365 |
|
|
380 |
CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte |
CADJ STORE vvel (:,:,:,bi,bj) = comlev1_bibj, key = ikey, byte = isbyte |
381 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
382 |
|
|
383 |
|
#ifdef ALLOW_AIM |
384 |
|
C AIM - atmospheric intermediate model, physics package code. |
385 |
|
C note(jmc) : phiHyd=0 at this point but is not really used in Molteni Physics |
386 |
|
IF ( useAIM ) THEN |
387 |
|
CALL TIMER_START('AIM_DO_ATMOS_PHYS [DYNAMICS]', myThid) |
388 |
|
CALL AIM_DO_ATMOS_PHYSICS( phiHyd, myTime, myThid ) |
389 |
|
CALL TIMER_STOP ('AIM_DO_ATMOS_PHYS [DYNAMICS]', myThid) |
390 |
|
ENDIF |
391 |
|
#endif /* ALLOW_AIM */ |
392 |
|
|
393 |
|
|
394 |
C-- Start of thermodynamics loop |
C-- Start of thermodynamics loop |
462 |
|
|
463 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
464 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
465 |
IF (openBoundaries) THEN |
IF (useOBCS) THEN |
466 |
CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid ) |
CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid ) |
467 |
END IF |
END IF |
468 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
513 |
|
|
514 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
515 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
516 |
IF (openBoundaries) THEN |
IF (useOBCS) THEN |
517 |
DO K=1,Nr |
DO K=1,Nr |
518 |
CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid ) |
CALL OBCS_APPLY_TS( bi, bj, k, gTnm1, gSnm1, myThid ) |
519 |
ENDDO |
ENDDO |
541 |
jMin = 1-OLy+2 |
jMin = 1-OLy+2 |
542 |
jMax = sNy+OLy-1 |
jMax = sNy+OLy-1 |
543 |
|
|
|
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 ) |
|
|
|
|
544 |
C-- Integrate hydrostatic balance for phiHyd with BC of |
C-- Integrate hydrostatic balance for phiHyd with BC of |
545 |
C-- phiHyd(z=0)=0 |
C phiHyd(z=0)=0 |
546 |
CALL CALC_PHI_HYD( |
C distinguishe between Stagger and Non Stagger time stepping |
547 |
I bi,bj,iMin,iMax,jMin,jMax,k,buoyKm1,buoyK, |
IF (staggerTimeStep) THEN |
548 |
|
CALL CALC_PHI_HYD( |
549 |
|
I bi,bj,iMin,iMax,jMin,jMax,k, |
550 |
|
I gTnm1, gSnm1, |
551 |
|
U phiHyd, |
552 |
|
I myThid ) |
553 |
|
ELSE |
554 |
|
CALL CALC_PHI_HYD( |
555 |
|
I bi,bj,iMin,iMax,jMin,jMax,k, |
556 |
|
I theta, salt, |
557 |
U phiHyd, |
U phiHyd, |
558 |
I myThid ) |
I myThid ) |
559 |
|
ENDIF |
560 |
|
|
561 |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
562 |
C and step forward storing the result in gUnm1, gVnm1, etc... |
C and step forward storing the result in gUnm1, gVnm1, etc... |
567 |
U fVerU, fVerV, |
U fVerU, fVerV, |
568 |
I myTime, myThid) |
I myTime, myThid) |
569 |
CALL TIMESTEP( |
CALL TIMESTEP( |
570 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
I bi,bj,iMin,iMax,jMin,jMax,k,phiHyd, |
571 |
I myIter, myThid) |
I myIter, myThid) |
572 |
|
|
573 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
574 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
575 |
IF (openBoundaries) THEN |
IF (useOBCS) THEN |
576 |
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
577 |
END IF |
END IF |
578 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
617 |
|
|
618 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
619 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
620 |
IF (openBoundaries) THEN |
IF (useOBCS) THEN |
621 |
DO K=1,Nr |
DO K=1,Nr |
622 |
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
623 |
ENDDO |
ENDDO |
650 |
|
|
651 |
RETURN |
RETURN |
652 |
END |
END |
|
|
|
|
|
|
|
C-- Cumulative diagnostic calculations (ie. time-averaging) |
|
|
#ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE |
|
|
c IF (taveFreq.GT.0.) THEN |
|
|
c CALL DO_TIME_AVERAGES( |
|
|
c I myTime, myIter, bi, bj, k, kup, kDown, |
|
|
c I ConvectCount, |
|
|
c I myThid ) |
|
|
c ENDIF |
|
|
#endif |
|
|
|
|