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 |
258 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
259 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
260 |
I etaSurfX,etaSurfY,myTime,myThid) |
I etaSurfX,etaSurfY,myTime,myThid) |
261 |
|
#ifdef ALLOW_OBCS |
262 |
|
IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K, myThid ) |
263 |
|
#endif |
264 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( .NOT. BOTTOM_LAYER ) THEN |
265 |
C-- Update fields in layer below according to tendency terms |
C-- Update fields in layer below according to tendency terms |
266 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
267 |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
268 |
I etaSurfX,etaSurfY,myTime,myThid) |
I etaSurfX,etaSurfY,myTime,myThid) |
269 |
|
#ifdef ALLOW_OBCS |
270 |
|
IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid ) |
271 |
|
#endif |
272 |
ENDIF |
ENDIF |
273 |
#endif |
#endif |
274 |
C-- Density of 1st level (below W(1)) reference to level 1 |
C-- Density of 1st level (below W(1)) reference to level 1 |
279 |
I myThid ) |
I myThid ) |
280 |
#endif |
#endif |
281 |
|
|
282 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( (.NOT. BOTTOM_LAYER) |
283 |
|
#ifdef ALLOW_KPP |
284 |
|
& .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing |
285 |
|
#endif |
286 |
|
& ) THEN |
287 |
C-- Check static stability with layer below |
C-- Check static stability with layer below |
288 |
C-- and mix as needed. |
C-- and mix as needed. |
289 |
#ifdef INCLUDE_FIND_RHO_CALL |
#ifdef INCLUDE_FIND_RHO_CALL |
325 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
326 |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
327 |
I etaSurfX,etaSurfY,myTime,myThid) |
I etaSurfX,etaSurfY,myTime,myThid) |
328 |
|
#ifdef ALLOW_OBCS |
329 |
|
IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid ) |
330 |
|
#endif |
331 |
ENDIF |
ENDIF |
332 |
#endif |
#endif |
333 |
C-- Density of K level (below W(K)) reference to K level |
C-- Density of K level (below W(K)) reference to K level |
337 |
O rhoK, |
O rhoK, |
338 |
I myThid ) |
I myThid ) |
339 |
#endif |
#endif |
340 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( (.NOT. BOTTOM_LAYER) |
341 |
|
#ifdef ALLOW_KPP |
342 |
|
& .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing |
343 |
|
#endif |
344 |
|
& ) THEN |
345 |
C-- Check static stability with layer below and mix as needed. |
C-- Check static stability with layer below and mix as needed. |
346 |
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. |
347 |
#ifdef INCLUDE_FIND_RHO_CALL |
#ifdef INCLUDE_FIND_RHO_CALL |
398 |
ENDDO |
ENDDO |
399 |
ENDDO ! K |
ENDDO ! K |
400 |
|
|
401 |
|
#ifdef ALLOW_KPP |
402 |
|
C-- Compute KPP mixing coefficients |
403 |
|
IF (usingKPPmixing) THEN |
404 |
|
CALL TIMER_START('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]' |
405 |
|
I , myThid) |
406 |
|
CALL KVMIX( |
407 |
|
I bi, bj, myTime, myThid ) |
408 |
|
CALL TIMER_STOP ('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]' |
409 |
|
I , myThid) |
410 |
|
ENDIF |
411 |
|
#endif |
412 |
|
|
413 |
DO K = Nr, 1, -1 |
DO K = Nr, 1, -1 |
414 |
|
|
415 |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
430 |
CALL CALC_DIFFUSIVITY( |
CALL CALC_DIFFUSIVITY( |
431 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
432 |
I maskC,maskUp,KapGM,K33, |
I maskC,maskUp,KapGM,K33, |
433 |
O KappaRT,KappaRS, |
O KappaRT,KappaRS,KappaRU,KappaRV, |
434 |
I myThid) |
I myThid) |
435 |
#endif |
#endif |
436 |
C-- Calculate accelerations in the momentum equations |
C-- Calculate accelerations in the momentum equations |
438 |
CALL CALC_MOM_RHS( |
CALL CALC_MOM_RHS( |
439 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
440 |
I xA,yA,uTrans,vTrans,rTrans,rVel,maskC, |
I xA,yA,uTrans,vTrans,rTrans,rVel,maskC, |
441 |
I phiHyd, |
I phiHyd,KappaRU,KappaRV, |
442 |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
443 |
U fZon, fMer, fVerU, fVerV, |
U fZon, fMer, fVerU, fVerV, |
444 |
I myTime, myThid) |
I myTime, myThid) |
464 |
CALL TIMESTEP( |
CALL TIMESTEP( |
465 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
466 |
I myThid) |
I myThid) |
467 |
|
#ifdef ALLOW_OBCS |
468 |
|
C-- Apply open boundary conditions |
469 |
|
IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid ) |
470 |
|
#endif |
471 |
|
C-- Freeze water |
472 |
|
IF (allowFreezing) |
473 |
|
& CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid ) |
474 |
C-- Diagnose barotropic divergence of predicted fields |
C-- Diagnose barotropic divergence of predicted fields |
475 |
CALL CALC_DIV_GHAT( |
CALL CALC_DIV_GHAT( |
476 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
491 |
|
|
492 |
C-- Implicit diffusion |
C-- Implicit diffusion |
493 |
IF (implicitDiffusion) THEN |
IF (implicitDiffusion) THEN |
494 |
CALL IMPLDIFF( bi, bj, iMin, iMax, jMin, jMax, |
IF (tempStepping) CALL IMPLDIFF( |
495 |
I KappaRT,KappaRS, |
I bi, bj, iMin, iMax, jMin, jMax, |
496 |
I myThid ) |
I deltaTtracer, KappaRT,recip_HFacC, |
497 |
ENDIF |
U gTNm1, |
498 |
|
I myThid ) |
499 |
|
IF (saltStepping) CALL IMPLDIFF( |
500 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
501 |
|
I deltaTtracer, KappaRS,recip_HFacC, |
502 |
|
U gSNm1, |
503 |
|
I myThid ) |
504 |
|
IF (momStepping) THEN |
505 |
|
CALL IMPLDIFF( |
506 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
507 |
|
I deltaTmom, KappaRU,recip_HFacW, |
508 |
|
U gUNm1, |
509 |
|
I myThid ) |
510 |
|
CALL IMPLDIFF( |
511 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
512 |
|
I deltaTmom, KappaRV,recip_HFacS, |
513 |
|
U gVNm1, |
514 |
|
I myThid ) |
515 |
|
#ifdef INCLUDE_CD_CODE |
516 |
|
CALL IMPLDIFF( |
517 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
518 |
|
I deltaTmom, KappaRU,recip_HFacW, |
519 |
|
U vVelD, |
520 |
|
I myThid ) |
521 |
|
CALL IMPLDIFF( |
522 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
523 |
|
I deltaTmom, KappaRV,recip_HFacS, |
524 |
|
U uVelD, |
525 |
|
I myThid ) |
526 |
|
#endif |
527 |
|
ENDIF ! momStepping |
528 |
|
ENDIF ! implicitDiffusion |
529 |
|
|
530 |
ENDDO |
ENDDO |
531 |
ENDDO |
ENDDO |