3 |
|
|
4 |
#include "PACKAGES_CONFIG.h" |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
6 |
|
#undef DYNAMICS_GUGV_EXCH_CHECK |
7 |
|
|
8 |
CBOP |
CBOP |
9 |
C !ROUTINE: DYNAMICS |
C !ROUTINE: DYNAMICS |
31 |
C | with the free-surface evolution or the rigid-lid: |
C | with the free-surface evolution or the rigid-lid: |
32 |
C | U[n] = U* + dt x d/dx P |
C | U[n] = U* + dt x d/dx P |
33 |
C | V[n] = V* + dt x d/dy P |
C | V[n] = V* + dt x d/dy P |
34 |
|
C | W[n] = W* + dt x d/dz P (NH mode) |
35 |
C | |
C | |
36 |
C | "Calculation of Gs" |
C | "Calculation of Gs" |
37 |
C | =================== |
C | =================== |
92 |
C !CALLING SEQUENCE: |
C !CALLING SEQUENCE: |
93 |
C DYNAMICS() |
C DYNAMICS() |
94 |
C | |
C | |
95 |
|
C |-- CALC_EP_FORCING |
96 |
|
C | |
97 |
C |-- CALC_GRAD_PHI_SURF |
C |-- CALC_GRAD_PHI_SURF |
98 |
C | |
C | |
99 |
C |-- CALC_VISCOSITY |
C |-- CALC_VISCOSITY |
108 |
C | |
C | |
109 |
C |-- OBCS_APPLY_UV |
C |-- OBCS_APPLY_UV |
110 |
C | |
C | |
111 |
|
C |-- MOM_U_IMPLICIT_R |
112 |
|
C |-- MOM_V_IMPLICIT_R |
113 |
|
C | |
114 |
C |-- IMPLDIFF |
C |-- IMPLDIFF |
115 |
C | |
C | |
116 |
C |-- OBCS_APPLY_UV |
C |-- OBCS_APPLY_UV |
117 |
C | |
C | |
118 |
C |-- CALL TIMEAVE_CUMUL_1T |
C |-- CALC_GW |
119 |
C |-- CALL DEBUG_STATS_RL |
C | |
120 |
|
C |-- DIAGNOSTICS_FILL |
121 |
|
C |-- DEBUG_STATS_RL |
122 |
|
|
123 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
124 |
C == Routine arguments == |
C == Routine arguments == |
131 |
|
|
132 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
133 |
C == Local variables |
C == Local variables |
134 |
C fVer[STUV] o fVer: Vertical flux term - note fVer |
C fVer[UV] o fVer: Vertical flux term - note fVer |
135 |
C is "pipelined" in the vertical |
C is "pipelined" in the vertical |
136 |
C so we need an fVer for each |
C so we need an fVer for each |
137 |
C variable. |
C variable. |
138 |
C phiHydC :: hydrostatic potential anomaly at cell center |
C phiHydC :: hydrostatic potential anomaly at cell center |
139 |
C In z coords phiHyd is the hydrostatic potential |
C In z coords phiHyd is the hydrostatic potential |
140 |
C (=pressure/rho0) anomaly |
C (=pressure/rho0) anomaly |
170 |
INTEGER i, j |
INTEGER i, j |
171 |
INTEGER k, km1, kp1, kup, kDown |
INTEGER k, km1, kp1, kup, kDown |
172 |
|
|
173 |
LOGICAL DIFFERENT_MULTIPLE |
#ifdef ALLOW_DIAGNOSTICS |
174 |
EXTERNAL DIFFERENT_MULTIPLE |
_RL tmpFac |
175 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
176 |
|
|
177 |
|
|
178 |
C--- The algorithm... |
C--- The algorithm... |
179 |
C |
C |
220 |
C--- |
C--- |
221 |
CEOP |
CEOP |
222 |
|
|
223 |
|
#ifdef ALLOW_DEBUG |
224 |
|
IF ( debugLevel .GE. debLevB ) |
225 |
|
& CALL DEBUG_ENTER( 'DYNAMICS', myThid ) |
226 |
|
#endif |
227 |
|
|
228 |
C-- Call to routine for calculation of |
C-- Call to routine for calculation of |
229 |
C Eliassen-Palm-flux-forced U-tendency, |
C Eliassen-Palm-flux-forced U-tendency, |
230 |
C if desired: |
C if desired: |
277 |
cph( |
cph( |
278 |
c-- need some re-initialisation here to break dependencies |
c-- need some re-initialisation here to break dependencies |
279 |
cph) |
cph) |
280 |
gu(i,j,k,bi,bj) = 0. _d 0 |
gU(i,j,k,bi,bj) = 0. _d 0 |
281 |
gv(i,j,k,bi,bj) = 0. _d 0 |
gV(i,j,k,bi,bj) = 0. _d 0 |
282 |
#endif |
#endif |
283 |
ENDDO |
ENDDO |
284 |
ENDDO |
ENDDO |
385 |
#ifdef ALLOW_MOM_FLUXFORM |
#ifdef ALLOW_MOM_FLUXFORM |
386 |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
387 |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
388 |
I dPhiHydX,dPhiHydY,KappaRU,KappaRV, |
I KappaRU, KappaRV, |
389 |
U fVerU, fVerV, |
U fVerU, fVerV, |
390 |
|
O guDissip, gvDissip, |
391 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
392 |
#endif |
#endif |
393 |
#ifdef ALLOW_MOM_VECINV |
#ifdef ALLOW_MOM_VECINV |
394 |
IF (vectorInvariantMomentum) CALL MOM_VECINV( |
IF (vectorInvariantMomentum) CALL MOM_VECINV( |
395 |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
396 |
I dPhiHydX,dPhiHydY,KappaRU,KappaRV, |
I KappaRU, KappaRV, |
397 |
U fVerU, fVerV, |
U fVerU, fVerV, |
398 |
O guDissip, gvDissip, |
O guDissip, gvDissip, |
399 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
434 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
435 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
436 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
437 |
I 0, KappaRU,recip_HFacW, |
I -1, KappaRU,recip_HFacW, |
438 |
U gU, |
U gU, |
439 |
I myThid ) |
I myThid ) |
440 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
443 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
444 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
445 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
446 |
I 0, KappaRV,recip_HFacS, |
I -2, KappaRV,recip_HFacS, |
447 |
U gV, |
U gV, |
448 |
I myThid ) |
I myThid ) |
449 |
ENDIF |
ENDIF |
488 |
ENDIF |
ENDIF |
489 |
#endif |
#endif |
490 |
|
|
491 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
492 |
|
|
493 |
|
#ifdef ALLOW_NONHYDROSTATIC |
494 |
|
C-- Step forward W field in N-H algorithm |
495 |
|
IF ( momStepping .AND. nonHydrostatic ) THEN |
496 |
|
#ifdef ALLOW_DEBUG |
497 |
|
IF ( debugLevel .GE. debLevB ) |
498 |
|
& CALL DEBUG_CALL('CALC_GW', myThid ) |
499 |
|
#endif |
500 |
|
CALL TIMER_START('CALC_GW [DYNAMICS]',myThid) |
501 |
|
CALL CALC_GW( myTime, myIter, myThid ) |
502 |
|
CALL TIMER_STOP ('CALC_GW [DYNAMICS]',myThid) |
503 |
|
ENDIF |
504 |
|
#endif |
505 |
|
|
506 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
507 |
|
|
508 |
Cml( |
Cml( |
509 |
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 |
510 |
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 |
513 |
C & 'phiHydLow', myThid ) |
C & 'phiHydLow', myThid ) |
514 |
Cml) |
Cml) |
515 |
|
|
516 |
|
#ifdef ALLOW_DIAGNOSTICS |
517 |
|
IF ( usediagnostics ) THEN |
518 |
|
|
519 |
|
CALL DIAGNOSTICS_FILL(totPhihyd,'PHIHYD ',0,Nr,0,1,1,myThid) |
520 |
|
CALL DIAGNOSTICS_FILL(phiHydLow,'PHIBOT ',0, 1,0,1,1,myThid) |
521 |
|
|
522 |
|
tmpFac = 1. _d 0 |
523 |
|
CALL DIAGNOSTICS_SCALE_FILL(totPhihyd,tmpFac,2, |
524 |
|
& 'PHIHYDSQ',0,Nr,0,1,1,myThid) |
525 |
|
|
526 |
|
CALL DIAGNOSTICS_SCALE_FILL(phiHydLow,tmpFac,2, |
527 |
|
& 'PHIBOTSQ',0, 1,0,1,1,myThid) |
528 |
|
|
529 |
|
ENDIF |
530 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
531 |
|
|
532 |
#ifdef ALLOW_DEBUG |
#ifdef ALLOW_DEBUG |
533 |
If ( debugLevel .GE. debLevB ) THEN |
If ( debugLevel .GE. debLevB ) THEN |
534 |
CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid) |
537 |
CALL DEBUG_STATS_RL(Nr,wVel,'Wvel (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,wVel,'Wvel (DYNAMICS)',myThid) |
538 |
CALL DEBUG_STATS_RL(Nr,theta,'Theta (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,theta,'Theta (DYNAMICS)',myThid) |
539 |
CALL DEBUG_STATS_RL(Nr,salt,'Salt (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,salt,'Salt (DYNAMICS)',myThid) |
540 |
CALL DEBUG_STATS_RL(Nr,Gu,'Gu (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gU,'Gu (DYNAMICS)',myThid) |
541 |
CALL DEBUG_STATS_RL(Nr,Gv,'Gv (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gV,'Gv (DYNAMICS)',myThid) |
542 |
CALL DEBUG_STATS_RL(Nr,Gt,'Gt (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gT,'Gt (DYNAMICS)',myThid) |
543 |
CALL DEBUG_STATS_RL(Nr,Gs,'Gs (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gS,'Gs (DYNAMICS)',myThid) |
544 |
CALL DEBUG_STATS_RL(Nr,GuNm1,'GuNm1 (DYNAMICS)',myThid) |
#ifndef ALLOW_ADAMSBASHFORTH_3 |
545 |
CALL DEBUG_STATS_RL(Nr,GvNm1,'GvNm1 (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,guNm1,'GuNm1 (DYNAMICS)',myThid) |
546 |
CALL DEBUG_STATS_RL(Nr,GtNm1,'GtNm1 (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gvNm1,'GvNm1 (DYNAMICS)',myThid) |
547 |
CALL DEBUG_STATS_RL(Nr,GsNm1,'GsNm1 (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,gtNm1,'GtNm1 (DYNAMICS)',myThid) |
548 |
|
CALL DEBUG_STATS_RL(Nr,gsNm1,'GsNm1 (DYNAMICS)',myThid) |
549 |
|
#endif |
550 |
|
ENDIF |
551 |
|
#endif |
552 |
|
|
553 |
|
#ifdef DYNAMICS_GUGV_EXCH_CHECK |
554 |
|
C- jmc: For safety checking only: This Exchange here should not change |
555 |
|
C the solution. If solution changes, it means something is wrong, |
556 |
|
C but it does not mean that it is less wrong with this exchange. |
557 |
|
IF ( debugLevel .GT. debLevB ) THEN |
558 |
|
CALL EXCH_UV_XYZ_RL(gU,gV,.TRUE.,myThid) |
559 |
ENDIF |
ENDIF |
560 |
#endif |
#endif |
561 |
|
|
562 |
|
#ifdef ALLOW_DEBUG |
563 |
|
IF ( debugLevel .GE. debLevB ) |
564 |
|
& CALL DEBUG_LEAVE( 'DYNAMICS', myThid ) |
565 |
|
#endif |
566 |
|
|
567 |
RETURN |
RETURN |
568 |
END |
END |