30 |
C | with the free-surface evolution or the rigid-lid: |
C | with the free-surface evolution or the rigid-lid: |
31 |
C | U[n] = U* + dt x d/dx P |
C | U[n] = U* + dt x d/dx P |
32 |
C | V[n] = V* + dt x d/dy P |
C | V[n] = V* + dt x d/dy P |
33 |
|
C | W[n] = W* + dt x d/dz P (NH mode) |
34 |
C | |
C | |
35 |
C | "Calculation of Gs" |
C | "Calculation of Gs" |
36 |
C | =================== |
C | =================== |
78 |
#include "CD_CODE_VARS.h" |
#include "CD_CODE_VARS.h" |
79 |
#endif |
#endif |
80 |
#include "GRID.h" |
#include "GRID.h" |
|
#ifdef ALLOW_PASSIVE_TRACER |
|
|
#include "TR1.h" |
|
|
#endif |
|
81 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
82 |
# include "tamc.h" |
# include "tamc.h" |
83 |
# include "tamc_keys.h" |
# include "tamc_keys.h" |
91 |
C !CALLING SEQUENCE: |
C !CALLING SEQUENCE: |
92 |
C DYNAMICS() |
C DYNAMICS() |
93 |
C | |
C | |
94 |
|
C |-- CALC_EP_FORCING |
95 |
|
C | |
96 |
C |-- CALC_GRAD_PHI_SURF |
C |-- CALC_GRAD_PHI_SURF |
97 |
C | |
C | |
98 |
C |-- CALC_VISCOSITY |
C |-- CALC_VISCOSITY |
107 |
C | |
C | |
108 |
C |-- OBCS_APPLY_UV |
C |-- OBCS_APPLY_UV |
109 |
C | |
C | |
110 |
|
C |-- MOM_U_IMPLICIT_R |
111 |
|
C |-- MOM_V_IMPLICIT_R |
112 |
|
C | |
113 |
C |-- IMPLDIFF |
C |-- IMPLDIFF |
114 |
C | |
C | |
115 |
C |-- OBCS_APPLY_UV |
C |-- OBCS_APPLY_UV |
116 |
C | |
C | |
117 |
C |-- CALL TIMEAVE_CUMUL_1T |
C |-- CALC_GW |
118 |
C |-- CALL DEBUG_STATS_RL |
C | |
119 |
|
C |-- DIAGNOSTICS_FILL |
120 |
|
C |-- DEBUG_STATS_RL |
121 |
|
|
122 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
123 |
C == Routine arguments == |
C == Routine arguments == |
130 |
|
|
131 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
132 |
C == Local variables |
C == Local variables |
133 |
C fVer[STUV] o fVer: Vertical flux term - note fVer |
C fVer[UV] o fVer: Vertical flux term - note fVer |
134 |
C is "pipelined" in the vertical |
C is "pipelined" in the vertical |
135 |
C so we need an fVer for each |
C so we need an fVer for each |
136 |
C variable. |
C variable. |
137 |
C phiHydC :: hydrostatic potential anomaly at cell center |
C phiHydC :: hydrostatic potential anomaly at cell center |
138 |
C In z coords phiHyd is the hydrostatic potential |
C In z coords phiHyd is the hydrostatic potential |
139 |
C (=pressure/rho0) anomaly |
C (=pressure/rho0) anomaly |
142 |
C dPhiHydX,Y :: Gradient (X & Y directions) of hydrostatic potential anom. |
C dPhiHydX,Y :: Gradient (X & Y directions) of hydrostatic potential anom. |
143 |
C phiSurfX, :: gradient of Surface potential (Pressure/rho, ocean) |
C phiSurfX, :: gradient of Surface potential (Pressure/rho, ocean) |
144 |
C phiSurfY or geopotential (atmos) in X and Y direction |
C phiSurfY or geopotential (atmos) in X and Y direction |
145 |
|
C guDissip :: dissipation tendency (all explicit terms), u component |
146 |
|
C gvDissip :: dissipation tendency (all explicit terms), v component |
147 |
C iMin, iMax - Ranges and sub-block indices on which calculations |
C iMin, iMax - Ranges and sub-block indices on which calculations |
148 |
C jMin, jMax are applied. |
C jMin, jMax are applied. |
149 |
C bi, bj |
C bi, bj |
158 |
_RL dPhiHydY(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
_RL dPhiHydY(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
159 |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
160 |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
161 |
|
_RL guDissip(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
162 |
|
_RL gvDissip(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
163 |
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
164 |
_RL KappaRV (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRV (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
165 |
|
|
169 |
INTEGER i, j |
INTEGER i, j |
170 |
INTEGER k, km1, kp1, kup, kDown |
INTEGER k, km1, kp1, kup, kDown |
171 |
|
|
172 |
LOGICAL DIFFERENT_MULTIPLE |
#ifdef ALLOW_DIAGNOSTICS |
173 |
EXTERNAL DIFFERENT_MULTIPLE |
_RL tmpFac |
174 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
175 |
|
|
176 |
|
|
177 |
C--- The algorithm... |
C--- The algorithm... |
178 |
C |
C |
219 |
C--- |
C--- |
220 |
CEOP |
CEOP |
221 |
|
|
222 |
|
#ifdef ALLOW_DEBUG |
223 |
|
IF ( debugLevel .GE. debLevB ) |
224 |
|
& CALL DEBUG_ENTER( 'DYNAMICS', myThid ) |
225 |
|
#endif |
226 |
|
|
227 |
C-- Call to routine for calculation of |
C-- Call to routine for calculation of |
228 |
C Eliassen-Palm-flux-forced U-tendency, |
C Eliassen-Palm-flux-forced U-tendency, |
229 |
C if desired: |
C if desired: |
275 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
276 |
cph( |
cph( |
277 |
c-- need some re-initialisation here to break dependencies |
c-- need some re-initialisation here to break dependencies |
|
c-- totphihyd is assumed zero from ini_pressure, i.e. |
|
|
c-- avoiding iterate pressure p = integral of (g*rho(p)*dz) |
|
278 |
cph) |
cph) |
279 |
totPhiHyd(i,j,k,bi,bj) = 0. _d 0 |
gU(i,j,k,bi,bj) = 0. _d 0 |
280 |
gu(i,j,k,bi,bj) = 0. _d 0 |
gV(i,j,k,bi,bj) = 0. _d 0 |
|
gv(i,j,k,bi,bj) = 0. _d 0 |
|
281 |
#endif |
#endif |
282 |
ENDDO |
ENDDO |
283 |
ENDDO |
ENDDO |
294 |
dPhiHydY(i,j) = 0. _d 0 |
dPhiHydY(i,j) = 0. _d 0 |
295 |
phiSurfX(i,j) = 0. _d 0 |
phiSurfX(i,j) = 0. _d 0 |
296 |
phiSurfY(i,j) = 0. _d 0 |
phiSurfY(i,j) = 0. _d 0 |
297 |
|
guDissip(i,j) = 0. _d 0 |
298 |
|
gvDissip(i,j) = 0. _d 0 |
299 |
ENDDO |
ENDDO |
300 |
ENDDO |
ENDDO |
301 |
|
|
363 |
c |
c |
364 |
CADJ STORE totphihyd (:,:,k,bi,bj) |
CADJ STORE totphihyd (:,:,k,bi,bj) |
365 |
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
|
CADJ STORE gt (:,:,k,bi,bj) |
|
|
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
|
|
CADJ STORE gs (:,:,k,bi,bj) |
|
|
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
|
366 |
CADJ STORE theta (:,:,k,bi,bj) |
CADJ STORE theta (:,:,k,bi,bj) |
367 |
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
368 |
CADJ STORE salt (:,:,k,bi,bj) |
CADJ STORE salt (:,:,k,bi,bj) |
384 |
#ifdef ALLOW_MOM_FLUXFORM |
#ifdef ALLOW_MOM_FLUXFORM |
385 |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
386 |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
387 |
I dPhiHydX,dPhiHydY,KappaRU,KappaRV, |
I KappaRU, KappaRV, |
388 |
U fVerU, fVerV, |
U fVerU, fVerV, |
389 |
|
O guDissip, gvDissip, |
390 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
391 |
#endif |
#endif |
392 |
#ifdef ALLOW_MOM_VECINV |
#ifdef ALLOW_MOM_VECINV |
393 |
IF (vectorInvariantMomentum) CALL MOM_VECINV( |
IF (vectorInvariantMomentum) CALL MOM_VECINV( |
394 |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
395 |
I dPhiHydX,dPhiHydY,KappaRU,KappaRV, |
I KappaRU, KappaRV, |
396 |
U fVerU, fVerV, |
U fVerU, fVerV, |
397 |
|
O guDissip, gvDissip, |
398 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
399 |
#endif |
#endif |
400 |
CALL TIMESTEP( |
CALL TIMESTEP( |
401 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
402 |
I dPhiHydX,dPhiHydY, phiSurfX, phiSurfY, |
I dPhiHydX,dPhiHydY, phiSurfX, phiSurfY, |
403 |
|
I guDissip, gvDissip, |
404 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
405 |
|
|
406 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
433 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
434 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
435 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
436 |
I deltaTmom, KappaRU,recip_HFacW, |
I -1, KappaRU,recip_HFacW, |
437 |
U gU, |
U gU, |
438 |
I myThid ) |
I myThid ) |
439 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
442 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
443 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
444 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
445 |
I deltaTmom, KappaRV,recip_HFacS, |
I -2, KappaRV,recip_HFacS, |
446 |
U gV, |
U gV, |
447 |
I myThid ) |
I myThid ) |
448 |
ENDIF |
ENDIF |
463 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
464 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
465 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
466 |
I deltaTmom, KappaRU,recip_HFacW, |
I 0, KappaRU,recip_HFacW, |
467 |
U vVelD, |
U vVelD, |
468 |
I myThid ) |
I myThid ) |
469 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
471 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
472 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
473 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
474 |
I deltaTmom, KappaRV,recip_HFacS, |
I 0, KappaRV,recip_HFacS, |
475 |
U uVelD, |
U uVelD, |
476 |
I myThid ) |
I myThid ) |
477 |
ENDIF |
ENDIF |
481 |
ENDDO |
ENDDO |
482 |
ENDDO |
ENDDO |
483 |
|
|
484 |
|
#ifdef ALLOW_OBCS |
485 |
|
IF (useOBCS) THEN |
486 |
|
CALL OBCS_PRESCRIBE_EXCHANGES(myThid) |
487 |
|
ENDIF |
488 |
|
#endif |
489 |
|
|
490 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
491 |
|
|
492 |
|
#ifdef ALLOW_NONHYDROSTATIC |
493 |
|
C-- Step forward W field in N-H algorithm |
494 |
|
IF ( momStepping .AND. nonHydrostatic ) THEN |
495 |
|
#ifdef ALLOW_DEBUG |
496 |
|
IF ( debugLevel .GE. debLevB ) |
497 |
|
& CALL DEBUG_CALL('CALC_GW', myThid ) |
498 |
|
#endif |
499 |
|
CALL TIMER_START('CALC_GW [DYNAMICS]',myThid) |
500 |
|
CALL CALC_GW( myTime, myIter, myThid ) |
501 |
|
CALL TIMER_STOP ('CALC_GW [DYNAMICS]',myThid) |
502 |
|
ENDIF |
503 |
|
#endif |
504 |
|
|
505 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
506 |
|
|
507 |
Cml( |
Cml( |
508 |
C In order to compare the variance of phiHydLow of a p/z-coordinate |
C In order to compare the variance of phiHydLow of a p/z-coordinate |
509 |
C run with etaH of a z/p-coordinate run the drift of phiHydLow |
C run with etaH of a z/p-coordinate run the drift of phiHydLow |
512 |
C & 'phiHydLow', myThid ) |
C & 'phiHydLow', myThid ) |
513 |
Cml) |
Cml) |
514 |
|
|
515 |
|
#ifdef ALLOW_DIAGNOSTICS |
516 |
|
IF ( usediagnostics ) THEN |
517 |
|
|
518 |
|
CALL DIAGNOSTICS_FILL(totPhihyd,'PHIHYD ',0,Nr,0,1,1,myThid) |
519 |
|
CALL DIAGNOSTICS_FILL(phiHydLow,'PHIBOT ',0, 1,0,1,1,myThid) |
520 |
|
|
521 |
|
tmpFac = 1. _d 0 |
522 |
|
CALL DIAGNOSTICS_SCALE_FILL(totPhihyd,tmpFac,2, |
523 |
|
& 'PHIHYDSQ',0,Nr,0,1,1,myThid) |
524 |
|
|
525 |
|
CALL DIAGNOSTICS_SCALE_FILL(phiHydLow,tmpFac,2, |
526 |
|
& 'PHIBOTSQ',0, 1,0,1,1,myThid) |
527 |
|
|
528 |
|
ENDIF |
529 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
530 |
|
|
531 |
#ifdef ALLOW_DEBUG |
#ifdef ALLOW_DEBUG |
532 |
If ( debugLevel .GE. debLevB ) THEN |
If ( debugLevel .GE. debLevB ) THEN |
533 |
CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid) |
536 |
CALL DEBUG_STATS_RL(Nr,wVel,'Wvel (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,wVel,'Wvel (DYNAMICS)',myThid) |
537 |
CALL DEBUG_STATS_RL(Nr,theta,'Theta (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,theta,'Theta (DYNAMICS)',myThid) |
538 |
CALL DEBUG_STATS_RL(Nr,salt,'Salt (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,salt,'Salt (DYNAMICS)',myThid) |
539 |
CALL DEBUG_STATS_RL(Nr,Gu,'Gu (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gU,'Gu (DYNAMICS)',myThid) |
540 |
CALL DEBUG_STATS_RL(Nr,Gv,'Gv (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gV,'Gv (DYNAMICS)',myThid) |
541 |
CALL DEBUG_STATS_RL(Nr,Gt,'Gt (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gT,'Gt (DYNAMICS)',myThid) |
542 |
CALL DEBUG_STATS_RL(Nr,Gs,'Gs (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gS,'Gs (DYNAMICS)',myThid) |
543 |
CALL DEBUG_STATS_RL(Nr,GuNm1,'GuNm1 (DYNAMICS)',myThid) |
#ifndef ALLOW_ADAMSBASHFORTH_3 |
544 |
CALL DEBUG_STATS_RL(Nr,GvNm1,'GvNm1 (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,guNm1,'GuNm1 (DYNAMICS)',myThid) |
545 |
CALL DEBUG_STATS_RL(Nr,GtNm1,'GtNm1 (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gvNm1,'GvNm1 (DYNAMICS)',myThid) |
546 |
CALL DEBUG_STATS_RL(Nr,GsNm1,'GsNm1 (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gtNm1,'GtNm1 (DYNAMICS)',myThid) |
547 |
|
CALL DEBUG_STATS_RL(Nr,gsNm1,'GsNm1 (DYNAMICS)',myThid) |
548 |
|
#endif |
549 |
ENDIF |
ENDIF |
550 |
#endif |
#endif |
551 |
|
|
552 |
|
#ifdef ALLOW_DEBUG |
553 |
|
IF ( debugLevel .GE. debLevB ) |
554 |
|
& CALL DEBUG_LEAVE( 'DYNAMICS', myThid ) |
555 |
|
#endif |
556 |
|
|
557 |
RETURN |
RETURN |
558 |
END |
END |