20 |
C | C*P* comments indicating place holders for which code is | |
C | C*P* comments indicating place holders for which code is | |
21 |
C | presently being developed. | |
C | presently being developed. | |
22 |
C \==========================================================/ |
C \==========================================================/ |
23 |
|
IMPLICIT NONE |
24 |
|
|
25 |
C == Global variables === |
C == Global variables === |
26 |
#include "SIZE.h" |
#include "SIZE.h" |
28 |
#include "CG2D.h" |
#include "CG2D.h" |
29 |
#include "PARAMS.h" |
#include "PARAMS.h" |
30 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
31 |
|
#include "GRID.h" |
32 |
|
#ifdef ALLOW_KPP |
33 |
|
#include "KPPMIX.h" |
34 |
|
#endif |
35 |
|
|
36 |
C == Routine arguments == |
C == Routine arguments == |
37 |
C myTime - Current time in simulation |
C myTime - Current time in simulation |
122 |
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
123 |
_RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
124 |
_RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
125 |
|
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
126 |
|
_RL KappaRV (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
127 |
|
|
128 |
INTEGER iMin, iMax |
INTEGER iMin, iMax |
129 |
INTEGER jMin, jMax |
INTEGER jMin, jMax |
275 |
I myThid ) |
I myThid ) |
276 |
#endif |
#endif |
277 |
|
|
278 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( (.NOT. BOTTOM_LAYER) |
279 |
|
#ifdef ALLOW_KPP |
280 |
|
& .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing |
281 |
|
#endif |
282 |
|
& ) THEN |
283 |
C-- Check static stability with layer below |
C-- Check static stability with layer below |
284 |
C-- and mix as needed. |
C-- and mix as needed. |
285 |
#ifdef INCLUDE_FIND_RHO_CALL |
#ifdef INCLUDE_FIND_RHO_CALL |
331 |
O rhoK, |
O rhoK, |
332 |
I myThid ) |
I myThid ) |
333 |
#endif |
#endif |
334 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( (.NOT. BOTTOM_LAYER) |
335 |
|
#ifdef ALLOW_KPP |
336 |
|
& .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing |
337 |
|
#endif |
338 |
|
& ) THEN |
339 |
C-- Check static stability with layer below and mix as needed. |
C-- Check static stability with layer below and mix as needed. |
340 |
C-- Density of K+1 level (below W(K+1)) reference to K level. |
C-- Density of K+1 level (below W(K+1)) reference to K level. |
341 |
#ifdef INCLUDE_FIND_RHO_CALL |
#ifdef INCLUDE_FIND_RHO_CALL |
392 |
ENDDO |
ENDDO |
393 |
ENDDO ! K |
ENDDO ! K |
394 |
|
|
395 |
|
#ifdef ALLOW_KPP |
396 |
|
C-- Compute KPP mixing coefficients |
397 |
|
IF (usingKPPmixing) THEN |
398 |
|
CALL TIMER_START('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]' |
399 |
|
I , myThid) |
400 |
|
CALL KVMIX( |
401 |
|
I bi, bj, myTime, myThid ) |
402 |
|
CALL TIMER_STOP ('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]' |
403 |
|
I , myThid) |
404 |
|
ENDIF |
405 |
|
#endif |
406 |
|
|
407 |
DO K = Nr, 1, -1 |
DO K = Nr, 1, -1 |
408 |
|
|
409 |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
424 |
CALL CALC_DIFFUSIVITY( |
CALL CALC_DIFFUSIVITY( |
425 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
426 |
I maskC,maskUp,KapGM,K33, |
I maskC,maskUp,KapGM,K33, |
427 |
O KappaRT,KappaRS, |
O KappaRT,KappaRS,KappaRU,KappaRV, |
428 |
I myThid) |
I myThid) |
429 |
#endif |
#endif |
430 |
C-- Calculate accelerations in the momentum equations |
C-- Calculate accelerations in the momentum equations |
432 |
CALL CALC_MOM_RHS( |
CALL CALC_MOM_RHS( |
433 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
434 |
I xA,yA,uTrans,vTrans,rTrans,rVel,maskC, |
I xA,yA,uTrans,vTrans,rTrans,rVel,maskC, |
435 |
I phiHyd, |
I phiHyd,KappaRU,KappaRV, |
436 |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
437 |
U fZon, fMer, fVerU, fVerV, |
U fZon, fMer, fVerU, fVerV, |
438 |
I myTime, myThid) |
I myTime, myThid) |
458 |
CALL TIMESTEP( |
CALL TIMESTEP( |
459 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
460 |
I myThid) |
I myThid) |
461 |
|
C-- Apply open boundary conditions |
462 |
IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid ) |
IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid ) |
463 |
|
C-- Freeze water |
464 |
|
IF (allowFreezing) |
465 |
|
& CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid ) |
466 |
C-- Diagnose barotropic divergence of predicted fields |
C-- Diagnose barotropic divergence of predicted fields |
467 |
CALL CALC_DIV_GHAT( |
CALL CALC_DIV_GHAT( |
468 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
483 |
|
|
484 |
C-- Implicit diffusion |
C-- Implicit diffusion |
485 |
IF (implicitDiffusion) THEN |
IF (implicitDiffusion) THEN |
486 |
CALL IMPLDIFF( bi, bj, iMin, iMax, jMin, jMax, |
IF (tempStepping) CALL IMPLDIFF( |
487 |
I KappaRT,KappaRS, |
I bi, bj, iMin, iMax, jMin, jMax, |
488 |
I myThid ) |
I deltaTtracer, KappaRT,recip_HFacC, |
489 |
ENDIF |
U gTNm1, |
490 |
|
I myThid ) |
491 |
|
IF (saltStepping) CALL IMPLDIFF( |
492 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
493 |
|
I deltaTtracer, KappaRS,recip_HFacC, |
494 |
|
U gSNm1, |
495 |
|
I myThid ) |
496 |
|
IF (momStepping) THEN |
497 |
|
CALL IMPLDIFF( |
498 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
499 |
|
I deltaTmom, KappaRU,recip_HFacW, |
500 |
|
U gUNm1, |
501 |
|
I myThid ) |
502 |
|
CALL IMPLDIFF( |
503 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
504 |
|
I deltaTmom, KappaRV,recip_HFacS, |
505 |
|
U gVNm1, |
506 |
|
I myThid ) |
507 |
|
#ifdef INCLUDE_CD_CODE |
508 |
|
CALL IMPLDIFF( |
509 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
510 |
|
I deltaTmom, KappaRU,recip_HFacW, |
511 |
|
U vVelD, |
512 |
|
I myThid ) |
513 |
|
CALL IMPLDIFF( |
514 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
515 |
|
I deltaTmom, KappaRV,recip_HFacS, |
516 |
|
U uVelD, |
517 |
|
I myThid ) |
518 |
|
#endif |
519 |
|
ENDIF ! momStepping |
520 |
|
ENDIF ! implicitDiffusion |
521 |
|
|
522 |
ENDDO |
ENDDO |
523 |
ENDDO |
ENDDO |