/[MITgcm]/MITgcm/pkg/mom_fluxform/mom_fluxform.F
ViewVC logotype

Diff of /MITgcm/pkg/mom_fluxform/mom_fluxform.F

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

revision 1.30 by heimbach, Thu Nov 24 00:06:38 2005 UTC revision 1.42 by jmc, Tue Mar 16 00:16:50 2010 UTC
# Line 31  CBOP Line 31  CBOP
31  C !ROUTINE: MOM_FLUXFORM  C !ROUTINE: MOM_FLUXFORM
32    
33  C !INTERFACE: ==========================================================  C !INTERFACE: ==========================================================
34        SUBROUTINE MOM_FLUXFORM(        SUBROUTINE MOM_FLUXFORM(
35       I        bi,bj,iMin,iMax,jMin,jMax,k,kUp,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,kUp,kDown,
36       I        KappaRU, KappaRV,       I        KappaRU, KappaRV,
37       U        fVerU, fVerV,       U        fVerU, fVerV,
# Line 40  C !INTERFACE: ========================== Line 40  C !INTERFACE: ==========================
40    
41  C !DESCRIPTION:  C !DESCRIPTION:
42  C Calculates all the horizontal accelerations except for the implicit surface  C Calculates all the horizontal accelerations except for the implicit surface
43  C pressure gradient and implciit vertical viscosity.  C pressure gradient and implicit vertical viscosity.
44    
45  C !USES: ===============================================================  C !USES: ===============================================================
46  C     == Global variables ==  C     == Global variables ==
# Line 52  C     == Global variables == Line 52  C     == Global variables ==
52  #include "PARAMS.h"  #include "PARAMS.h"
53  #include "GRID.h"  #include "GRID.h"
54  #include "SURFACE.h"  #include "SURFACE.h"
55    #ifdef ALLOW_AUTODIFF_TAMC
56    # include "tamc.h"
57    # include "tamc_keys.h"
58    # include "MOM_FLUXFORM.h"
59    #endif
60    
61  C !INPUT PARAMETERS: ===================================================  C !INPUT PARAMETERS: ===================================================
62  C  bi,bj                :: tile indices  C  bi,bj                :: tile indices
# Line 93  C  fZon                 :: zonal fluxes Line 98  C  fZon                 :: zonal fluxes
98  C  fMer                 :: meridional fluxes  C  fMer                 :: meridional fluxes
99  C  fVrUp,fVrDw          :: vertical viscous fluxes at interface k-1 & k  C  fVrUp,fVrDw          :: vertical viscous fluxes at interface k-1 & k
100        INTEGER i,j        INTEGER i,j
101    #ifdef ALLOW_AUTODIFF_TAMC
102          INTEGER imomkey
103    #endif
104        _RL vF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
105        _RL v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
106        _RL cF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL cF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 101  C  fVrUp,fVrDw          :: vertical visc Line 109  C  fVrUp,fVrDw          :: vertical visc
109        _RL fMer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL fMer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
110        _RL fVrUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL fVrUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
111        _RL fVrDw(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL fVrDw(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
112  C     afFacMom      - Tracer parameters for turning terms  C     afFacMom     :: Tracer parameters for turning terms on and off.
113  C     vfFacMom        on and off.  C     vfFacMom
114  C     pfFacMom        afFacMom - Advective terms  C     pfFacMom        afFacMom - Advective terms
115  C     cfFacMom        vfFacMom - Eddy viscosity terms  C     cfFacMom        vfFacMom - Eddy viscosity terms
116  C     mTFacMom        pfFacMom - Pressure terms  C     mtFacMom        pfFacMom - Pressure terms
117  C                     cfFacMom - Coriolis terms  C                     cfFacMom - Coriolis terms
118  C                     foFacMom - Forcing  C                     foFacMom - Forcing
119  C                     mTFacMom - Metric term  C                     mtFacMom - Metric term
120  C     uDudxFac, AhDudxFac, etc ... individual term parameters for switching terms off  C     uDudxFac, AhDudxFac, etc ... individual term parameters for switching terms off
121        _RS    hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS    hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
122        _RS  r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS  r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 137  C     uDudxFac, AhDudxFac, etc ... indiv Line 145  C     uDudxFac, AhDudxFac, etc ... indiv
145        _RL  ArDudrFac        _RL  ArDudrFac
146        _RL  fuFac        _RL  fuFac
147        _RL  mtFacU        _RL  mtFacU
148          _RL  mtNHFacU
149        _RL  uDvdxFac        _RL  uDvdxFac
150        _RL  AhDvdxFac        _RL  AhDvdxFac
151        _RL  vDvdyFac        _RL  vDvdyFac
# Line 145  C     uDudxFac, AhDudxFac, etc ... indiv Line 154  C     uDudxFac, AhDudxFac, etc ... indiv
154        _RL  ArDvdrFac        _RL  ArDvdrFac
155        _RL  fvFac        _RL  fvFac
156        _RL  mtFacV        _RL  mtFacV
157          _RL  mtNHFacV
158        _RL  sideMaskFac        _RL  sideMaskFac
159        LOGICAL bottomDragTerms,harmonic,biharmonic,useVariableViscosity        LOGICAL bottomDragTerms,harmonic,biharmonic,useVariableViscosity
160  CEOP  CEOP
161    #ifdef MOM_BOUNDARY_CONSERVE
162          COMMON / MOM_FLUXFORM_LOCAL / uBnd, vBnd
163          _RL  uBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
164          _RL  vBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
165    #endif /* MOM_BOUNDARY_CONSERVE */
166    
167    #ifdef ALLOW_AUTODIFF_TAMC
168              act0 = k - 1
169              max0 = Nr
170              act1 = bi - myBxLo(myThid)
171              max1 = myBxHi(myThid) - myBxLo(myThid) + 1
172              act2 = bj - myByLo(myThid)
173              max2 = myByHi(myThid) - myByLo(myThid) + 1
174              act3 = myThid - 1
175              max3 = nTx*nTy
176              act4 = ikey_dynamics - 1
177              imomkey = (act0 + 1)
178         &                    + act1*max0
179         &                    + act2*max0*max1
180         &                    + act3*max0*max1*max2
181         &                    + act4*max0*max1*max2*max3
182    #endif /* ALLOW_AUTODIFF_TAMC */
183    
184  C     Initialise intermediate terms  C     Initialise intermediate terms
185        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
# Line 162  C     Initialise intermediate terms Line 194  C     Initialise intermediate terms
194          fVrDw(i,j)= 0.          fVrDw(i,j)= 0.
195          rTransU(i,j)= 0.          rTransU(i,j)= 0.
196          rTransV(i,j)= 0.          rTransV(i,j)= 0.
197    c       KE(i,j)     = 0.
198            hDiv(i,j)   = 0.
199            vort3(i,j)  = 0.
200          strain(i,j) = 0.          strain(i,j) = 0.
201          tension(i,j)= 0.          tension(i,j)= 0.
202          guDiss(i,j) = 0.          guDiss(i,j) = 0.
203          gvDiss(i,j) = 0.          gvDiss(i,j) = 0.
 #ifdef ALLOW_AUTODIFF_TAMC  
         vort3(i,j)   = 0. _d 0  
         strain(i,j)  = 0. _d 0  
         tension(i,j) = 0. _d 0  
 #endif  
204         ENDDO         ENDDO
205        ENDDO        ENDDO
206    
# Line 182  C     o U momentum equation Line 212  C     o U momentum equation
212        AhDudyFac    = vfFacMom*1.        AhDudyFac    = vfFacMom*1.
213        rVelDudrFac  = afFacMom*1.        rVelDudrFac  = afFacMom*1.
214        ArDudrFac    = vfFacMom*1.        ArDudrFac    = vfFacMom*1.
215        mTFacU       = mtFacMom*1.        mtFacU       = mtFacMom*1.
216          mtNHFacU     = 1.
217        fuFac        = cfFacMom*1.        fuFac        = cfFacMom*1.
218  C     o V momentum equation  C     o V momentum equation
219        uDvdxFac     = afFacMom*1.        uDvdxFac     = afFacMom*1.
# Line 191  C     o V momentum equation Line 222  C     o V momentum equation
222        AhDvdyFac    = vfFacMom*1.        AhDvdyFac    = vfFacMom*1.
223        rVelDvdrFac  = afFacMom*1.        rVelDvdrFac  = afFacMom*1.
224        ArDvdrFac    = vfFacMom*1.        ArDvdrFac    = vfFacMom*1.
225        mTFacV       = mtFacMom*1.        mtFacV       = mtFacMom*1.
226          mtNHFacV     = 1.
227        fvFac        = cfFacMom*1.        fvFac        = cfFacMom*1.
228    
229        IF (implicitViscosity) THEN        IF (implicitViscosity) THEN
# Line 222  C---- Calculate common quantities used i Line 254  C---- Calculate common quantities used i
254  C     Calculate tracer cell face open areas  C     Calculate tracer cell face open areas
255        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
256         DO i=1-OLx,sNx+OLx         DO i=1-OLx,sNx+OLx
257          xA(i,j) = _dyG(i,j,bi,bj)          xA(i,j) = _dyG(i,j,bi,bj)*deepFacC(k)
258       &   *drF(k)*_hFacW(i,j,k,bi,bj)       &          *drF(k)*_hFacW(i,j,k,bi,bj)
259          yA(i,j) = _dxG(i,j,bi,bj)          yA(i,j) = _dxG(i,j,bi,bj)*deepFacC(k)
260       &   *drF(k)*_hFacS(i,j,k,bi,bj)       &          *drF(k)*_hFacS(i,j,k,bi,bj)
261         ENDDO         ENDDO
262        ENDDO        ENDDO
263    
# Line 238  C     Make local copies of horizontal fl Line 270  C     Make local copies of horizontal fl
270        ENDDO        ENDDO
271    
272  C     Calculate velocity field "volume transports" through tracer cell faces.  C     Calculate velocity field "volume transports" through tracer cell faces.
273    C     anelastic: transports are scaled by rhoFacC (~ mass transport)
274        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
275         DO i=1-OLx,sNx+OLx         DO i=1-OLx,sNx+OLx
276          uTrans(i,j) = uFld(i,j)*xA(i,j)          uTrans(i,j) = uFld(i,j)*xA(i,j)*rhoFacC(k)
277          vTrans(i,j) = vFld(i,j)*yA(i,j)          vTrans(i,j) = vFld(i,j)*yA(i,j)*rhoFacC(k)
278         ENDDO         ENDDO
279        ENDDO        ENDDO
280    
# Line 272  C     Calculate velocity field "volume t Line 305  C     Calculate velocity field "volume t
305  C---  First call (k=1): compute vertical adv. flux fVerU(kUp) & fVerV(kUp)  C---  First call (k=1): compute vertical adv. flux fVerU(kUp) & fVerV(kUp)
306        IF (momAdvection.AND.k.EQ.1) THEN        IF (momAdvection.AND.k.EQ.1) THEN
307    
308    #ifdef MOM_BOUNDARY_CONSERVE
309            CALL MOM_UV_BOUNDARY( bi, bj, k,
310         I                        uVel, vVel,
311         O                        uBnd(1-OLx,1-OLy,k,bi,bj),
312         O                        vBnd(1-OLx,1-OLy,k,bi,bj),
313         I                        myTime, myIter, myThid )
314    #endif /* MOM_BOUNDARY_CONSERVE */
315    
316  C-    Calculate vertical transports above U & V points (West & South face):  C-    Calculate vertical transports above U & V points (West & South face):
317    
318    #ifdef ALLOW_AUTODIFF_TAMC
319    # ifdef NONLIN_FRSURF
320    #  ifndef DISABLE_RSTAR_CODE
321    CADJ STORE dwtransc(:,:,bi,bj) =
322    CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
323    CADJ STORE dwtransu(:,:,bi,bj) =
324    CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
325    CADJ STORE dwtransv(:,:,bi,bj) =
326    CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
327    #  endif
328    # endif /* NONLIN_FRSURF */
329    #endif /* ALLOW_AUTODIFF_TAMC */
330          CALL MOM_CALC_RTRANS( k, bi, bj,          CALL MOM_CALC_RTRANS( k, bi, bj,
331       O                        rTransU, rTransV,       O                        rTransU, rTransV,
332       I                        myTime, myIter, myThid)       I                        myTime, myIter, myThid)
# Line 295  C---  Calculate vertical transports (at Line 349  C---  Calculate vertical transports (at
349       I                        myTime, myIter, myThid)       I                        myTime, myIter, myThid)
350        ENDIF        ENDIF
351    
352    #ifdef MOM_BOUNDARY_CONSERVE
353          IF ( momAdvection .AND. k.LT.Nr ) THEN
354            CALL MOM_UV_BOUNDARY( bi, bj, k+1,
355         I                        uVel, vVel,
356         O                        uBnd(1-OLx,1-OLy,k+1,bi,bj),
357         O                        vBnd(1-OLx,1-OLy,k+1,bi,bj),
358         I                        myTime, myIter, myThid )
359          ENDIF
360    #endif /* MOM_BOUNDARY_CONSERVE */
361    
362        IF (momViscosity) THEN        IF (momViscosity) THEN
363         CALL MOM_CALC_VISC(         CALL MOM_CALC_VISC(
364       I        bi,bj,k,       I        bi,bj,k,
# Line 311  C---- Zonal momentum equation starts her Line 375  C---- Zonal momentum equation starts her
375        IF (momAdvection) THEN        IF (momAdvection) THEN
376  C---  Calculate mean fluxes (advection)   between cells for zonal flow.  C---  Calculate mean fluxes (advection)   between cells for zonal flow.
377    
378    #ifdef MOM_BOUNDARY_CONSERVE
379            CALL MOM_U_ADV_UU( bi,bj,k,uTrans,uBnd(1-OLx,1-OLy,k,bi,bj),
380         O                     fZon,myThid )
381            CALL MOM_U_ADV_VU( bi,bj,k,vTrans,uBnd(1-OLx,1-OLy,k,bi,bj),
382         O                     fMer,myThid )
383            CALL MOM_U_ADV_WU(
384         I                     bi,bj,k+1,uBnd,wVel,rTransU,
385         O                     fVerU(1-OLx,1-OLy,kDown), myThid )
386    #else /* MOM_BOUNDARY_CONSERVE */
387  C--   Zonal flux (fZon is at east face of "u" cell)  C--   Zonal flux (fZon is at east face of "u" cell)
388  C     Mean flow component of zonal flux -> fZon  C     Mean flow component of zonal flux -> fZon
389          CALL MOM_U_ADV_UU(bi,bj,k,uTrans,uFld,fZon,myThid)          CALL MOM_U_ADV_UU(bi,bj,k,uTrans,uFld,fZon,myThid)
# Line 324  C     Mean flow component of vertical fl Line 397  C     Mean flow component of vertical fl
397          CALL MOM_U_ADV_WU(          CALL MOM_U_ADV_WU(
398       I                     bi,bj,k+1,uVel,wVel,rTransU,       I                     bi,bj,k+1,uVel,wVel,rTransU,
399       O                     fVerU(1-OLx,1-OLy,kDown), myThid )       O                     fVerU(1-OLx,1-OLy,kDown), myThid )
400    #endif /* MOM_BOUNDARY_CONSERVE */
401    
402  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term
403          DO j=jMin,jMax          DO j=jMin,jMax
# Line 334  C--   Tendency is minus divergence of th Line 408  C--   Tendency is minus divergence of th
408       &      ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) )       &      ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) )
409  #else  #else
410       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
411       &     *recip_rAw(i,j,bi,bj)       &     *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k)
412  #endif  #endif
413       &    *( ( fZon(i,j  )     - fZon(i-1,j) )*uDudxFac       &     *( ( fZon(i,j  )     - fZon(i-1,j) )*uDudxFac
414       &      +( fMer(i,j+1)     - fMer(i,  j) )*vDudyFac       &       +( fMer(i,j+1)     - fMer(i,  j) )*vDudyFac
415       &      +(fVerU(i,j,kDown) - fVerU(i,j,kUp))*rkSign*rVelDudrFac       &       +(fVerU(i,j,kDown) - fVerU(i,j,kUp))*rkSign*rVelDudrFac
416       &     )       &     )
417           ENDDO           ENDDO
418          ENDDO          ENDDO
# Line 354  C--   Tendency is minus divergence of th Line 428  C--   Tendency is minus divergence of th
428    
429  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
430  C-- account for 3.D divergence of the flow in rStar coordinate:  C-- account for 3.D divergence of the flow in rStar coordinate:
431    # ifndef DISABLE_RSTAR_CODE
432          IF ( select_rStar.GT.0 ) THEN          IF ( select_rStar.GT.0 ) THEN
433           DO j=jMin,jMax           DO j=jMin,jMax
434            DO i=iMin,iMax            DO i=iMin,iMax
# Line 371  C-- account for 3.D divergence of the fl Line 446  C-- account for 3.D divergence of the fl
446            ENDDO            ENDDO
447           ENDDO           ENDDO
448          ENDIF          ENDIF
449    # endif /* DISABLE_RSTAR_CODE */
450  #endif /* NONLIN_FRSURF */  #endif /* NONLIN_FRSURF */
451    
452        ELSE        ELSE
# Line 388  C-    endif momAdvection. Line 464  C-    endif momAdvection.
464  C---  Calculate eddy fluxes (dissipation) between cells for zonal flow.  C---  Calculate eddy fluxes (dissipation) between cells for zonal flow.
465    
466  C     Bi-harmonic term del^2 U -> v4F  C     Bi-harmonic term del^2 U -> v4F
467          IF (biharmonic)          IF (biharmonic)
468       &  CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid)       &  CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid)
469    
470  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon
# Line 406  C     Eddy component of vertical flux (i Line 482  C     Eddy component of vertical flux (i
482         ENDIF         ENDIF
483    
484  C--   Tendency is minus divergence of the fluxes  C--   Tendency is minus divergence of the fluxes
485    C     anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is)
486          DO j=jMin,jMax          DO j=jMin,jMax
487           DO i=iMin,iMax           DO i=iMin,iMax
488            guDiss(i,j) =            guDiss(i,j) =
# Line 414  C--   Tendency is minus divergence of th Line 491  C--   Tendency is minus divergence of th
491       &      ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) )       &      ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) )
492  #else  #else
493       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
494       &     *recip_rAw(i,j,bi,bj)       &     *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)
495  #endif  #endif
496       &    *( ( fZon(i,j  ) - fZon(i-1,j) )*AhDudxFac       &     *( ( fZon(i,j  ) - fZon(i-1,j) )*AhDudxFac
497       &      +( fMer(i,j+1) - fMer(i,  j) )*AhDudyFac       &       +( fMer(i,j+1) - fMer(i,  j) )*AhDudyFac
498       &      +( fVrDw(i,j)  - fVrUp(i,j) )*rkSign*ArDudrFac       &       +( fVrDw(i,j)  - fVrUp(i,j)  )*rkSign*ArDudrFac
499         &                                     *recip_rhoFacC(k)
500       &     )       &     )
501           ENDDO           ENDDO
502          ENDDO          ENDDO
# Line 432  C--   Tendency is minus divergence of th Line 510  C--   Tendency is minus divergence of th
510          ENDIF          ENDIF
511  #endif  #endif
512    
513  C-- No-slip and drag BCs appear as body forces in cell abutting topography  C-- No-slip and drag BCs appear as body forces in cell abutting topography
514          IF (no_slip_sides) THEN          IF (no_slip_sides) THEN
515  C-     No-slip BCs impose a drag at walls...  C-     No-slip BCs impose a drag at walls...
516           CALL MOM_U_SIDEDRAG(           CALL MOM_U_SIDEDRAG(
# Line 458  C-    No-slip BCs impose a drag at botto Line 536  C-    No-slip BCs impose a drag at botto
536           ENDDO           ENDDO
537          ENDIF          ENDIF
538    
539    #ifdef ALLOW_SHELFICE
540            IF (useShelfIce) THEN
541             CALL SHELFICE_U_DRAG(bi,bj,k,uFld,KE,KappaRU,vF,myThid)
542             DO j=jMin,jMax
543              DO i=iMin,iMax
544               gUdiss(i,j) = gUdiss(i,j) + vF(i,j)
545              ENDDO
546             ENDDO
547            ENDIF
548    #endif /* ALLOW_SHELFICE */
549    
550  C-    endif momViscosity  C-    endif momViscosity
551        ENDIF        ENDIF
552    
# Line 469  c    I     myTime,myThid) Line 558  c    I     myTime,myThid)
558    
559  C--   Metric terms for curvilinear grid systems  C--   Metric terms for curvilinear grid systems
560        IF (useNHMTerms) THEN        IF (useNHMTerms) THEN
561  C      o Non-hydrosatic metric terms  C      o Non-Hydrostatic (spherical) metric terms
562         CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid)         CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid)
563         DO j=jMin,jMax         DO j=jMin,jMax
564          DO i=iMin,iMax          DO i=iMin,iMax
565           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j)           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtNHFacU*mT(i,j)
566          ENDDO          ENDDO
567         ENDDO         ENDDO
568        ENDIF        ENDIF
569        IF (usingSphericalPolarMTerms) THEN        IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN
570    C      o Spherical polar grid metric terms
571         CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid)         CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid)
572         DO j=jMin,jMax         DO j=jMin,jMax
573          DO i=iMin,iMax          DO i=iMin,iMax
574           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j)           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtFacU*mT(i,j)
575          ENDDO          ENDDO
576         ENDDO         ENDDO
577        ENDIF        ENDIF
578        IF (usingCylindricalGrid) THEN        IF ( usingCylindricalGrid .AND. metricTerms ) THEN
579           CALL MOM_U_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)  C      o Cylindrical grid metric terms
580           DO j=jMin,jMax         CALL MOM_U_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)
581            DO i=iMin,iMax         DO j=jMin,jMax
582               gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j)          DO i=iMin,iMax
583            ENDDO           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtFacU*mT(i,j)
584            ENDDO
585         ENDDO         ENDDO
586        ENDIF        ENDIF
587    
# Line 499  C---+----1----+----2----+----3----+----4 Line 590  C---+----1----+----2----+----3----+----4
590  C---- Meridional momentum equation starts here  C---- Meridional momentum equation starts here
591    
592        IF (momAdvection) THEN        IF (momAdvection) THEN
593    
594    #ifdef MOM_BOUNDARY_CONSERVE
595            CALL MOM_V_ADV_UV( bi,bj,k,uTrans,vBnd(1-OLx,1-OLy,k,bi,bj),
596         O                     fZon,myThid )
597            CALL MOM_V_ADV_VV( bi,bj,k,vTrans,vBnd(1-OLx,1-OLy,k,bi,bj),
598         O                     fMer,myThid )
599            CALL MOM_V_ADV_WV(
600         I                     bi,bj,k+1,vBnd,wVel,rTransV,
601         O                     fVerV(1-OLx,1-OLy,kDown), myThid )
602    #else /* MOM_BOUNDARY_CONSERVE */
603  C---  Calculate mean fluxes (advection)   between cells for meridional flow.  C---  Calculate mean fluxes (advection)   between cells for meridional flow.
604  C     Mean flow component of zonal flux -> fZon  C     Mean flow component of zonal flux -> fZon
605          CALL MOM_V_ADV_UV(bi,bj,k,uTrans,vFld,fZon,myThid)          CALL MOM_V_ADV_UV(bi,bj,k,uTrans,vFld,fZon,myThid)
# Line 512  C     Mean flow component of vertical fl Line 613  C     Mean flow component of vertical fl
613          CALL MOM_V_ADV_WV(          CALL MOM_V_ADV_WV(
614       I                     bi,bj,k+1,vVel,wVel,rTransV,       I                     bi,bj,k+1,vVel,wVel,rTransV,
615       O                     fVerV(1-OLx,1-OLy,kDown), myThid )       O                     fVerV(1-OLx,1-OLy,kDown), myThid )
616    #endif /* MOM_BOUNDARY_CONSERVE */
617    
618  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term
619          DO j=jMin,jMax          DO j=jMin,jMax
# Line 522  C--   Tendency is minus divergence of th Line 624  C--   Tendency is minus divergence of th
624       &      ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) )       &      ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) )
625  #else  #else
626       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
627       &      *recip_rAs(i,j,bi,bj)       &     *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k)
628  #endif  #endif
629       &    *( ( fZon(i+1,j)     - fZon(i,j  ) )*uDvdxFac       &     *( ( fZon(i+1,j)     - fZon(i,j  ) )*uDvdxFac
630       &      +( fMer(i,  j)     - fMer(i,j-1) )*vDvdyFac       &       +( fMer(i,  j)     - fMer(i,j-1) )*vDvdyFac
631       &      +(fVerV(i,j,kDown) - fVerV(i,j,kUp))*rkSign*rVelDvdrFac       &       +(fVerV(i,j,kDown) - fVerV(i,j,kUp))*rkSign*rVelDvdrFac
632       &     )       &     )
633           ENDDO           ENDDO
634          ENDDO          ENDDO
# Line 542  C--   Tendency is minus divergence of th Line 644  C--   Tendency is minus divergence of th
644    
645  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
646  C-- account for 3.D divergence of the flow in rStar coordinate:  C-- account for 3.D divergence of the flow in rStar coordinate:
647    # ifndef DISABLE_RSTAR_CODE
648          IF ( select_rStar.GT.0 ) THEN          IF ( select_rStar.GT.0 ) THEN
649           DO j=jMin,jMax           DO j=jMin,jMax
650            DO i=iMin,iMax            DO i=iMin,iMax
# Line 559  C-- account for 3.D divergence of the fl Line 662  C-- account for 3.D divergence of the fl
662            ENDDO            ENDDO
663           ENDDO           ENDDO
664          ENDIF          ENDIF
665    # endif /* DISABLE_RSTAR_CODE */
666  #endif /* NONLIN_FRSURF */  #endif /* NONLIN_FRSURF */
667    
668        ELSE        ELSE
# Line 575  C-    endif momAdvection. Line 679  C-    endif momAdvection.
679        IF (momViscosity) THEN        IF (momViscosity) THEN
680  C---  Calculate eddy fluxes (dissipation) between cells for meridional flow.  C---  Calculate eddy fluxes (dissipation) between cells for meridional flow.
681  C     Bi-harmonic term del^2 V -> v4F  C     Bi-harmonic term del^2 V -> v4F
682          IF (biharmonic)          IF (biharmonic)
683       &  CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid)       &  CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid)
684    
685  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon
# Line 593  C     Eddy component of vertical flux (i Line 697  C     Eddy component of vertical flux (i
697         ENDIF         ENDIF
698    
699  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term
700    C     anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is)
701          DO j=jMin,jMax          DO j=jMin,jMax
702           DO i=iMin,iMax           DO i=iMin,iMax
703            gvDiss(i,j) =            gvDiss(i,j) =
# Line 601  C--   Tendency is minus divergence of th Line 706  C--   Tendency is minus divergence of th
706       &      ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) )       &      ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) )
707  #else  #else
708       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
709       &      *recip_rAs(i,j,bi,bj)       &      *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)
710  #endif  #endif
711       &    *( ( fZon(i+1,j)  - fZon(i,j  ) )*AhDvdxFac       &     *( ( fZon(i+1,j)  - fZon(i,j  ) )*AhDvdxFac
712       &      +( fMer(i,  j)  - fMer(i,j-1) )*AhDvdyFac       &       +( fMer(i,  j)  - fMer(i,j-1) )*AhDvdyFac
713       &      +( fVrDw(i,j)   - fVrUp(i,j) )*rkSign*ArDvdrFac       &       +( fVrDw(i,j)   - fVrUp(i,j) )*rkSign*ArDvdrFac
714         &                                     *recip_rhoFacC(k)
715       &     )       &     )
716           ENDDO           ENDDO
717          ENDDO          ENDDO
# Line 619  C--   Tendency is minus divergence of th Line 725  C--   Tendency is minus divergence of th
725          ENDIF          ENDIF
726  #endif  #endif
727    
728  C-- No-slip and drag BCs appear as body forces in cell abutting topography  C-- No-slip and drag BCs appear as body forces in cell abutting topography
729        IF (no_slip_sides) THEN          IF (no_slip_sides) THEN
730  C-     No-slip BCs impose a drag at walls...  C-     No-slip BCs impose a drag at walls...
731           CALL MOM_V_SIDEDRAG(           CALL MOM_V_SIDEDRAG(
732       I        bi,bj,k,       I        bi,bj,k,
# Line 645  C-    No-slip BCs impose a drag at botto Line 751  C-    No-slip BCs impose a drag at botto
751           ENDDO           ENDDO
752          ENDIF          ENDIF
753    
754    #ifdef ALLOW_SHELFICE
755            IF (useShelfIce) THEN
756             CALL SHELFICE_V_DRAG(bi,bj,k,vFld,KE,KappaRU,vF,myThid)
757             DO j=jMin,jMax
758              DO i=iMin,iMax
759               gvDiss(i,j) = gvDiss(i,j) + vF(i,j)
760              ENDDO
761             ENDDO
762            ENDIF
763    #endif /* ALLOW_SHELFICE */
764    
765  C-    endif momViscosity  C-    endif momViscosity
766        ENDIF        ENDIF
767    
# Line 656  c    I     myTime,myThid) Line 773  c    I     myTime,myThid)
773    
774  C--   Metric terms for curvilinear grid systems  C--   Metric terms for curvilinear grid systems
775        IF (useNHMTerms) THEN        IF (useNHMTerms) THEN
776  C      o Spherical polar grid metric terms  C      o Non-Hydrostatic (spherical) metric terms
777         CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid)         CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid)
778         DO j=jMin,jMax         DO j=jMin,jMax
779          DO i=iMin,iMax          DO i=iMin,iMax
780           gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j)           gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtNHFacV*mT(i,j)
781          ENDDO          ENDDO
782         ENDDO         ENDDO
783        ENDIF        ENDIF
784        IF (usingSphericalPolarMTerms) THEN        IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN
785    C      o Spherical polar grid metric terms
786         CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid)         CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid)
787         DO j=jMin,jMax         DO j=jMin,jMax
788          DO i=iMin,iMax          DO i=iMin,iMax
789           gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j)           gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtFacV*mT(i,j)
790          ENDDO          ENDDO
791         ENDDO         ENDDO
792        ENDIF        ENDIF
793        IF (usingCylindricalGrid) THEN        IF ( usingCylindricalGrid .AND. metricTerms ) THEN
794           CALL MOM_V_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)  C      o Cylindrical grid metric terms
795           DO j=jMin,jMax         CALL MOM_V_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)
796              DO i=iMin,iMax         DO j=jMin,jMax
797                 gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j)          DO i=iMin,iMax
798              ENDDO           gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtFacV*mT(i,j)
799           ENDDO          ENDDO
800           ENDDO
801        ENDIF        ENDIF
802    
803  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
# Line 711  c     ELSE Line 830  c     ELSE
830  #endif  #endif
831        ENDIF        ENDIF
832    
833        IF (nonHydrostatic.OR.quasiHydrostatic) THEN  C--   3.D Coriolis term (horizontal momentum, Eastward component: -fprime*w)
834         CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)        IF ( use3dCoriolis ) THEN
835         DO j=jMin,jMax          CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)
836          DO i=iMin,iMax          DO j=jMin,jMax
837           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j)           DO i=iMin,iMax
838              gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j)
839             ENDDO
840          ENDDO          ENDDO
841         ENDDO         IF ( usingCurvilinearGrid ) THEN
842    C-     presently, non zero angleSinC array only supported with Curvilinear-Grid
843            CALL MOM_V_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)
844            DO j=jMin,jMax
845             DO i=iMin,iMax
846              gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j)
847             ENDDO
848            ENDDO
849           ENDIF
850        ENDIF        ENDIF
851    
852  C--   Set du/dt & dv/dt on boundaries to zero  C--   Set du/dt & dv/dt on boundaries to zero

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.22