/[MITgcm]/MITgcm/model/src/dynamics.F
ViewVC logotype

Diff of /MITgcm/model/src/dynamics.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.168 by jmc, Fri Jan 3 16:19:04 2014 UTC revision 1.174 by jmc, Fri Aug 15 20:41:50 2014 UTC
# Line 3  C $Name$ Line 3  C $Name$
3    
4  #include "PACKAGES_CONFIG.h"  #include "PACKAGES_CONFIG.h"
5  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
6    #ifdef ALLOW_AUTODIFF
7    # include "AUTODIFF_OPTIONS.h"
8    #endif
9  #ifdef ALLOW_MOM_COMMON  #ifdef ALLOW_MOM_COMMON
10  # include "MOM_COMMON_OPTIONS.h"  # include "MOM_COMMON_OPTIONS.h"
11  #endif  #endif
# Line 22  C     | SUBROUTINE DYNAMICS Line 25  C     | SUBROUTINE DYNAMICS
25  C     | o Controlling routine for the explicit part of the model  C     | o Controlling routine for the explicit part of the model
26  C     |   dynamics.  C     |   dynamics.
27  C     *==========================================================*  C     *==========================================================*
 C     | This routine evaluates the "dynamics" terms for each  
 C     | block of ocean in turn. Because the blocks of ocean have  
 C     | overlap regions they are independent of one another.  
 C     | If terms involving lateral integrals are needed in this  
 C     | routine care will be needed. Similarly finite-difference  
 C     | operations with stencils wider than the overlap region  
 C     | require special consideration.  
 C     | The algorithm...  
 C     |  
 C     | "Correction Step"  
 C     | =================  
 C     | Here we update the horizontal velocities with the surface  
 C     | pressure such that the resulting flow is either consistent  
 C     | with the free-surface evolution or the rigid-lid:  
 C     |   U[n] = U* + dt x d/dx P  
 C     |   V[n] = V* + dt x d/dy P  
 C     |   W[n] = W* + dt x d/dz P  (NH mode)  
 C     |  
 C     | "Calculation of Gs"  
 C     | ===================  
 C     | This is where all the accelerations and tendencies (ie.  
 C     | physics, parameterizations etc...) are calculated  
 C     |   rho = rho ( theta[n], salt[n] )  
 C     |   b   = b(rho, theta)  
 C     |   K31 = K31 ( rho )  
 C     |   Gu[n] = Gu( u[n], v[n], wVel, b, ... )  
 C     |   Gv[n] = Gv( u[n], v[n], wVel, b, ... )  
 C     |   Gt[n] = Gt( theta[n], u[n], v[n], wVel, K31, ... )  
 C     |   Gs[n] = Gs( salt[n], u[n], v[n], wVel, K31, ... )  
 C     |  
 C     | "Time-stepping" or "Prediction"  
 C     | ================================  
 C     | The models variables are stepped forward with the appropriate  
 C     | time-stepping scheme (currently we use Adams-Bashforth II)  
 C     | - For momentum, the result is always *only* a "prediction"  
 C     | in that the flow may be divergent and will be "corrected"  
 C     | later with a surface pressure gradient.  
 C     | - Normally for tracers the result is the new field at time  
 C     | level [n+1} *BUT* in the case of implicit diffusion the result  
 C     | is also *only* a prediction.  
 C     | - We denote "predictors" with an asterisk (*).  
 C     |   U* = U[n] + dt x ( 3/2 Gu[n] - 1/2 Gu[n-1] )  
 C     |   V* = V[n] + dt x ( 3/2 Gv[n] - 1/2 Gv[n-1] )  
 C     |   theta[n+1] = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )  
 C     |   salt[n+1] = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )  
 C     | With implicit diffusion:  
 C     |   theta* = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )  
 C     |   salt* = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )  
 C     |   (1 + dt * K * d_zz) theta[n] = theta*  
 C     |   (1 + dt * K * d_zz) salt[n] = salt*  
 C     |  
 C     *==========================================================*  
28  C     \ev  C     \ev
29  C     !USES:  C     !USES:
30        IMPLICIT NONE        IMPLICIT NONE
# Line 89  C     == Global variables === Line 40  C     == Global variables ===
40  #ifdef ALLOW_CD_CODE  #ifdef ALLOW_CD_CODE
41  # include "CD_CODE_VARS.h"  # include "CD_CODE_VARS.h"
42  #endif  #endif
43  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF
44  # include "tamc.h"  # include "tamc.h"
45  # include "tamc_keys.h"  # include "tamc_keys.h"
46  # include "FFIELDS.h"  # include "FFIELDS.h"
# Line 111  C     == Global variables === Line 62  C     == Global variables ===
62  # ifdef ALLOW_MOM_FLUXFORM  # ifdef ALLOW_MOM_FLUXFORM
63  #  include "MOM_FLUXFORM.h"  #  include "MOM_FLUXFORM.h"
64  # endif  # endif
65  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF */
66    
67  C     !CALLING SEQUENCE:  C     !CALLING SEQUENCE:
68  C     DYNAMICS()  C     DYNAMICS()
# Line 482  C--       kDown  Cycles through 2,1 to p Line 433  C--       kDown  Cycles through 2,1 to p
433           kkey = (idynkey-1)*Nr + k           kkey = (idynkey-1)*Nr + k
434  CADJ STORE totPhiHyd (:,:,k,bi,bj)  CADJ STORE totPhiHyd (:,:,k,bi,bj)
435  CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
436    CADJ STORE phiHydLow (:,:,bi,bj)
437    CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
438  CADJ STORE theta (:,:,k,bi,bj)  CADJ STORE theta (:,:,k,bi,bj)
439  CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
440  CADJ STORE salt  (:,:,k,bi,bj)  CADJ STORE salt  (:,:,k,bi,bj)
441  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  
442  # ifdef NONLIN_FRSURF  # ifdef NONLIN_FRSURF
443  cph-test  cph-test
444  CADJ STORE  phiHydC (:,:)  CADJ STORE  phiHydC (:,:)
# Line 529  CADJ &     = comlev1_bibj_k, key=kkey, b Line 478  CADJ &     = comlev1_bibj_k, key=kkey, b
478  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
479    
480  C--      Integrate hydrostatic balance for phiHyd with BC of phiHyd(z=0)=0  C--      Integrate hydrostatic balance for phiHyd with BC of phiHyd(z=0)=0
481           IF ( implicitIntGravWave ) THEN           CALL CALC_PHI_HYD(
            CALL CALC_PHI_HYD(  
      I        bi,bj,iMin,iMax,jMin,jMax,k,  
      I        gT, gS,  
      U        phiHydF,  
      O        phiHydC, dPhiHydX, dPhiHydY,  
      I        myTime, myIter, myThid )  
          ELSE  
            CALL CALC_PHI_HYD(  
482       I        bi,bj,iMin,iMax,jMin,jMax,k,       I        bi,bj,iMin,iMax,jMin,jMax,k,
483       I        theta, salt,       I        theta, salt,
484       U        phiHydF,       U        phiHydF,
485       O        phiHydC, dPhiHydX, dPhiHydY,       O        phiHydC, dPhiHydX, dPhiHydY,
486       I        myTime, myIter, myThid )       I        myTime, myIter, myThid )
          ENDIF  
487  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
488           IF ( dPhiHydDiagIsOn ) THEN           IF ( dPhiHydDiagIsOn ) THEN
489             tmpFac = -1. _d 0             tmpFac = -1. _d 0
# Line 653  CADJ STORE gU(:,:,:,bi,bj) = comlev1_bib Line 593  CADJ STORE gU(:,:,:,bi,bj) = comlev1_bib
593            CALL IMPLDIFF(            CALL IMPLDIFF(
594       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
595       I         -1, KappaRU, recip_hFacW(1-OLx,1-OLy,1,bi,bj),       I         -1, KappaRU, recip_hFacW(1-OLx,1-OLy,1,bi,bj),
596       U         gU,       U         gU(1-OLx,1-OLy,1,bi,bj),
597       I         myThid )       I         myThid )
598  #ifdef    ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
599  CADJ STORE gV(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte  CADJ STORE gV(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte
# Line 661  CADJ STORE gV(:,:,:,bi,bj) = comlev1_bib Line 601  CADJ STORE gV(:,:,:,bi,bj) = comlev1_bib
601            CALL IMPLDIFF(            CALL IMPLDIFF(
602       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
603       I         -2, KappaRV, recip_hFacS(1-OLx,1-OLy,1,bi,bj),       I         -2, KappaRV, recip_hFacS(1-OLx,1-OLy,1,bi,bj),
604       U         gV,       U         gV(1-OLx,1-OLy,1,bi,bj),
605       I         myThid )       I         myThid )
606          ENDIF          ENDIF
607    
# Line 685  CADJ STORE vVelD(:,:,:,bi,bj) = comlev1_ Line 625  CADJ STORE vVelD(:,:,:,bi,bj) = comlev1_
625            CALL IMPLDIFF(            CALL IMPLDIFF(
626       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
627       I         0, KappaRU, recip_hFacW(1-OLx,1-OLy,1,bi,bj),       I         0, KappaRU, recip_hFacW(1-OLx,1-OLy,1,bi,bj),
628       U         vVelD,       U         vVelD(1-OLx,1-OLy,1,bi,bj),
629       I         myThid )       I         myThid )
630  #ifdef    ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
631  CADJ STORE uVelD(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte  CADJ STORE uVelD(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte
# Line 693  CADJ STORE uVelD(:,:,:,bi,bj) = comlev1_ Line 633  CADJ STORE uVelD(:,:,:,bi,bj) = comlev1_
633            CALL IMPLDIFF(            CALL IMPLDIFF(
634       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
635       I         0, KappaRV, recip_hFacS(1-OLx,1-OLy,1,bi,bj),       I         0, KappaRV, recip_hFacS(1-OLx,1-OLy,1,bi,bj),
636       U         uVelD,       U         uVelD(1-OLx,1-OLy,1,bi,bj),
637       I         myThid )       I         myThid )
638          ENDIF          ENDIF
639  #endif    /* ALLOW_CD_CODE */  #endif    /* ALLOW_CD_CODE */
# Line 766  Cml) Line 706  Cml)
706         CALL DEBUG_STATS_RL(Nr,salt,'Salt (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(Nr,salt,'Salt (DYNAMICS)',myThid)
707         CALL DEBUG_STATS_RL(Nr,gU,'Gu (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(Nr,gU,'Gu (DYNAMICS)',myThid)
708         CALL DEBUG_STATS_RL(Nr,gV,'Gv (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(Nr,gV,'Gv (DYNAMICS)',myThid)
        CALL DEBUG_STATS_RL(Nr,gT,'Gt (DYNAMICS)',myThid)  
        CALL DEBUG_STATS_RL(Nr,gS,'Gs (DYNAMICS)',myThid)  
709  #ifndef ALLOW_ADAMSBASHFORTH_3  #ifndef ALLOW_ADAMSBASHFORTH_3
710         CALL DEBUG_STATS_RL(Nr,guNm1,'GuNm1 (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(Nr,guNm1,'GuNm1 (DYNAMICS)',myThid)
711         CALL DEBUG_STATS_RL(Nr,gvNm1,'GvNm1 (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(Nr,gvNm1,'GvNm1 (DYNAMICS)',myThid)

Legend:
Removed from v.1.168  
changed lines
  Added in v.1.174

  ViewVC Help
Powered by ViewVC 1.1.22