/[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.28 by baylor, Tue Sep 27 13:38:21 2005 UTC revision 1.39 by jmc, Tue Dec 5 05:30:38 2006 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
159        LOGICAL bottomDragTerms,harmonic,biharmonic,useVariableViscosity        LOGICAL bottomDragTerms,harmonic,biharmonic,useVariableViscosity
160  CEOP  CEOP
161    
162    #ifdef ALLOW_AUTODIFF_TAMC
163              act0 = k - 1
164              max0 = Nr
165              act1 = bi - myBxLo(myThid)
166              max1 = myBxHi(myThid) - myBxLo(myThid) + 1
167              act2 = bj - myByLo(myThid)
168              max2 = myByHi(myThid) - myByLo(myThid) + 1
169              act3 = myThid - 1
170              max3 = nTx*nTy
171              act4 = ikey_dynamics - 1
172              imomkey = (act0 + 1)
173         &                    + act1*max0
174         &                    + act2*max0*max1
175         &                    + act3*max0*max1*max2
176         &                    + act4*max0*max1*max2*max3
177    #endif /* ALLOW_AUTODIFF_TAMC */
178    
179  C     Initialise intermediate terms  C     Initialise intermediate terms
180        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
181         DO i=1-OLx,sNx+OLx         DO i=1-OLx,sNx+OLx
# Line 161  C     Initialise intermediate terms Line 189  C     Initialise intermediate terms
189          fVrDw(i,j)= 0.          fVrDw(i,j)= 0.
190          rTransU(i,j)= 0.          rTransU(i,j)= 0.
191          rTransV(i,j)= 0.          rTransV(i,j)= 0.
192    c       KE(i,j)     = 0.
193    c       hDiv(i,j)   = 0.
194            vort3(i,j)  = 0.
195          strain(i,j) = 0.          strain(i,j) = 0.
196          tension(i,j)= 0.          tension(i,j)= 0.
197          guDiss(i,j) = 0.          guDiss(i,j) = 0.
# Line 176  C     o U momentum equation Line 207  C     o U momentum equation
207        AhDudyFac    = vfFacMom*1.        AhDudyFac    = vfFacMom*1.
208        rVelDudrFac  = afFacMom*1.        rVelDudrFac  = afFacMom*1.
209        ArDudrFac    = vfFacMom*1.        ArDudrFac    = vfFacMom*1.
210        mTFacU       = mtFacMom*1.        mtFacU       = mtFacMom*1.
211          mtNHFacU     = 1.
212        fuFac        = cfFacMom*1.        fuFac        = cfFacMom*1.
213  C     o V momentum equation  C     o V momentum equation
214        uDvdxFac     = afFacMom*1.        uDvdxFac     = afFacMom*1.
# Line 185  C     o V momentum equation Line 217  C     o V momentum equation
217        AhDvdyFac    = vfFacMom*1.        AhDvdyFac    = vfFacMom*1.
218        rVelDvdrFac  = afFacMom*1.        rVelDvdrFac  = afFacMom*1.
219        ArDvdrFac    = vfFacMom*1.        ArDvdrFac    = vfFacMom*1.
220        mTFacV       = mtFacMom*1.        mtFacV       = mtFacMom*1.
221          mtNHFacV     = 1.
222        fvFac        = cfFacMom*1.        fvFac        = cfFacMom*1.
223    
224        IF (implicitViscosity) THEN        IF (implicitViscosity) THEN
# Line 193  C     o V momentum equation Line 226  C     o V momentum equation
226          ArDvdrFac  = 0.          ArDvdrFac  = 0.
227        ENDIF        ENDIF
228    
229    C note: using standard stencil (no mask) results in under-estimating
230    C       vorticity at a no-slip boundary by a factor of 2 = sideDragFactor
231          IF ( no_slip_sides ) THEN
232            sideMaskFac = sideDragFactor
233          ELSE
234            sideMaskFac = 0. _d 0
235          ENDIF
236    
237        IF (     no_slip_bottom        IF (     no_slip_bottom
238       &    .OR. bottomDragQuadratic.NE.0.       &    .OR. bottomDragQuadratic.NE.0.
239       &    .OR. bottomDragLinear.NE.0.) THEN       &    .OR. bottomDragLinear.NE.0.) THEN
# Line 208  C---- Calculate common quantities used i Line 249  C---- Calculate common quantities used i
249  C     Calculate tracer cell face open areas  C     Calculate tracer cell face open areas
250        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
251         DO i=1-OLx,sNx+OLx         DO i=1-OLx,sNx+OLx
252          xA(i,j) = _dyG(i,j,bi,bj)          xA(i,j) = _dyG(i,j,bi,bj)*deepFacC(k)
253       &   *drF(k)*_hFacW(i,j,k,bi,bj)       &          *drF(k)*_hFacW(i,j,k,bi,bj)
254          yA(i,j) = _dxG(i,j,bi,bj)          yA(i,j) = _dxG(i,j,bi,bj)*deepFacC(k)
255       &   *drF(k)*_hFacS(i,j,k,bi,bj)       &          *drF(k)*_hFacS(i,j,k,bi,bj)
256         ENDDO         ENDDO
257        ENDDO        ENDDO
258    
# Line 224  C     Make local copies of horizontal fl Line 265  C     Make local copies of horizontal fl
265        ENDDO        ENDDO
266    
267  C     Calculate velocity field "volume transports" through tracer cell faces.  C     Calculate velocity field "volume transports" through tracer cell faces.
268    C     anelastic: transports are scaled by rhoFacC (~ mass transport)
269        DO j=1-OLy,sNy+OLy        DO j=1-OLy,sNy+OLy
270         DO i=1-OLx,sNx+OLx         DO i=1-OLx,sNx+OLx
271          uTrans(i,j) = uFld(i,j)*xA(i,j)          uTrans(i,j) = uFld(i,j)*xA(i,j)*rhoFacC(k)
272          vTrans(i,j) = vFld(i,j)*yA(i,j)          vTrans(i,j) = vFld(i,j)*yA(i,j)*rhoFacC(k)
273         ENDDO         ENDDO
274        ENDDO        ENDDO
275    
276        CALL MOM_CALC_KE(bi,bj,k,2,uFld,vFld,KE,myThid)        CALL MOM_CALC_KE(bi,bj,k,2,uFld,vFld,KE,myThid)
277        CALL MOM_CALC_HDIV(bi,bj,k,2,uFld,vFld,hDiv,myThid)        IF ( momViscosity) THEN
278        CALL MOM_CALC_RELVORT3(bi,bj,k,uFld,vFld,hFacZ,vort3,myThid)          CALL MOM_CALC_HDIV(bi,bj,k,2,uFld,vFld,hDiv,myThid)
279        CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid)          CALL MOM_CALC_RELVORT3(bi,bj,k,uFld,vFld,hFacZ,vort3,myThid)
280        CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,myThid)          CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid)
281            CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,myThid)
282            DO j=1-Oly,sNy+Oly
283             DO i=1-Olx,sNx+Olx
284               IF ( hFacZ(i,j).EQ.0. ) THEN
285                 vort3(i,j)  = sideMaskFac*vort3(i,j)
286                 strain(i,j) = sideMaskFac*strain(i,j)
287               ENDIF
288             ENDDO
289            ENDDO
290    #ifdef ALLOW_DIAGNOSTICS
291            IF ( useDiagnostics ) THEN
292              CALL DIAGNOSTICS_FILL(hDiv,   'momHDiv ',k,1,2,bi,bj,myThid)
293              CALL DIAGNOSTICS_FILL(vort3,  'momVort3',k,1,2,bi,bj,myThid)
294              CALL DIAGNOSTICS_FILL(tension,'Tension ',k,1,2,bi,bj,myThid)
295              CALL DIAGNOSTICS_FILL(strain, 'Strain  ',k,1,2,bi,bj,myThid)
296            ENDIF
297    #endif
298          ENDIF
299    
300  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)
301        IF (momAdvection.AND.k.EQ.1) THEN        IF (momAdvection.AND.k.EQ.1) THEN
302    
303  C-    Calculate vertical transports above U & V points (West & South face):  C-    Calculate vertical transports above U & V points (West & South face):
304    
305    #ifdef ALLOW_AUTODIFF_TAMC
306    # ifdef NONLIN_FRSURF
307    #  ifndef DISABLE_RSTAR_CODE
308    CADJ STORE dwtransc(:,:,bi,bj) =
309    CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
310    CADJ STORE dwtransu(:,:,bi,bj) =
311    CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
312    CADJ STORE dwtransv(:,:,bi,bj) =
313    CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
314    #  endif
315    # endif /* NONLIN_FRSURF */
316    #endif /* ALLOW_AUTODIFF_TAMC */
317          CALL MOM_CALC_RTRANS( k, bi, bj,          CALL MOM_CALC_RTRANS( k, bi, bj,
318       O                        rTransU, rTransV,       O                        rTransU, rTransV,
319       I                        myTime, myIter, myThid)       I                        myTime, myIter, myThid)
# Line 302  C--   Tendency is minus divergence of th Line 375  C--   Tendency is minus divergence of th
375       &      ( 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)) )
376  #else  #else
377       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
378       &     *recip_rAw(i,j,bi,bj)       &     *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k)
379  #endif  #endif
380       &    *( ( fZon(i,j  )     - fZon(i-1,j) )*uDudxFac       &     *( ( fZon(i,j  )     - fZon(i-1,j) )*uDudxFac
381       &      +( fMer(i,j+1)     - fMer(i,  j) )*vDudyFac       &       +( fMer(i,j+1)     - fMer(i,  j) )*vDudyFac
382       &      +(fVerU(i,j,kDown) - fVerU(i,j,kUp))*rkSign*rVelDudrFac       &       +(fVerU(i,j,kDown) - fVerU(i,j,kUp))*rkSign*rVelDudrFac
383       &     )       &     )
384           ENDDO           ENDDO
385          ENDDO          ENDDO
# Line 322  C--   Tendency is minus divergence of th Line 395  C--   Tendency is minus divergence of th
395    
396  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
397  C-- account for 3.D divergence of the flow in rStar coordinate:  C-- account for 3.D divergence of the flow in rStar coordinate:
398    # ifndef DISABLE_RSTAR_CODE
399          IF ( select_rStar.GT.0 ) THEN          IF ( select_rStar.GT.0 ) THEN
400           DO j=jMin,jMax           DO j=jMin,jMax
401            DO i=iMin,iMax            DO i=iMin,iMax
# Line 339  C-- account for 3.D divergence of the fl Line 413  C-- account for 3.D divergence of the fl
413            ENDDO            ENDDO
414           ENDDO           ENDDO
415          ENDIF          ENDIF
416    # endif /* DISABLE_RSTAR_CODE */
417  #endif /* NONLIN_FRSURF */  #endif /* NONLIN_FRSURF */
418    
419        ELSE        ELSE
# Line 356  C-    endif momAdvection. Line 431  C-    endif momAdvection.
431  C---  Calculate eddy fluxes (dissipation) between cells for zonal flow.  C---  Calculate eddy fluxes (dissipation) between cells for zonal flow.
432    
433  C     Bi-harmonic term del^2 U -> v4F  C     Bi-harmonic term del^2 U -> v4F
434          IF (biharmonic)          IF (biharmonic)
435       &  CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid)       &  CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid)
436    
437  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon
# Line 374  C     Eddy component of vertical flux (i Line 449  C     Eddy component of vertical flux (i
449         ENDIF         ENDIF
450    
451  C--   Tendency is minus divergence of the fluxes  C--   Tendency is minus divergence of the fluxes
452    C     anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is)
453          DO j=jMin,jMax          DO j=jMin,jMax
454           DO i=iMin,iMax           DO i=iMin,iMax
455            guDiss(i,j) =            guDiss(i,j) =
# Line 382  C--   Tendency is minus divergence of th Line 458  C--   Tendency is minus divergence of th
458       &      ( 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)) )
459  #else  #else
460       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
461       &     *recip_rAw(i,j,bi,bj)       &     *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)
462  #endif  #endif
463       &    *( ( fZon(i,j  ) - fZon(i-1,j) )*AhDudxFac       &     *( ( fZon(i,j  ) - fZon(i-1,j) )*AhDudxFac
464       &      +( fMer(i,j+1) - fMer(i,  j) )*AhDudyFac       &       +( fMer(i,j+1) - fMer(i,  j) )*AhDudyFac
465       &      +( fVrDw(i,j)  - fVrUp(i,j) )*rkSign*ArDudrFac       &       +( fVrDw(i,j)  - fVrUp(i,j)  )*rkSign*ArDudrFac
466         &                                     *recip_rhoFacC(k)
467       &     )       &     )
468           ENDDO           ENDDO
469          ENDDO          ENDDO
# Line 400  C--   Tendency is minus divergence of th Line 477  C--   Tendency is minus divergence of th
477          ENDIF          ENDIF
478  #endif  #endif
479    
480  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
481          IF (no_slip_sides) THEN          IF (no_slip_sides) THEN
482  C-     No-slip BCs impose a drag at walls...  C-     No-slip BCs impose a drag at walls...
483           CALL MOM_U_SIDEDRAG(           CALL MOM_U_SIDEDRAG(
# Line 426  C-    No-slip BCs impose a drag at botto Line 503  C-    No-slip BCs impose a drag at botto
503           ENDDO           ENDDO
504          ENDIF          ENDIF
505    
506    #ifdef ALLOW_SHELFICE
507            IF (useShelfIce) THEN
508             CALL SHELFICE_U_DRAG(bi,bj,k,uFld,KE,KappaRU,vF,myThid)
509             DO j=jMin,jMax
510              DO i=iMin,iMax
511               gUdiss(i,j) = gUdiss(i,j) + vF(i,j)
512              ENDDO
513             ENDDO
514            ENDIF
515    #endif /* ALLOW_SHELFICE */
516    
517  C-    endif momViscosity  C-    endif momViscosity
518        ENDIF        ENDIF
519    
# Line 437  c    I     myTime,myThid) Line 525  c    I     myTime,myThid)
525    
526  C--   Metric terms for curvilinear grid systems  C--   Metric terms for curvilinear grid systems
527        IF (useNHMTerms) THEN        IF (useNHMTerms) THEN
528  C      o Non-hydrosatic metric terms  C      o Non-Hydrostatic (spherical) metric terms
529         CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid)         CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid)
530         DO j=jMin,jMax         DO j=jMin,jMax
531          DO i=iMin,iMax          DO i=iMin,iMax
532           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)
533          ENDDO          ENDDO
534         ENDDO         ENDDO
535        ENDIF        ENDIF
536        IF (usingSphericalPolarMTerms) THEN        IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN
537    C      o Spherical polar grid metric terms
538         CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid)         CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid)
539         DO j=jMin,jMax         DO j=jMin,jMax
540          DO i=iMin,iMax          DO i=iMin,iMax
541           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)
542          ENDDO          ENDDO
543         ENDDO         ENDDO
544        ENDIF        ENDIF
545        IF (usingCylindricalGrid) THEN        IF ( usingCylindricalGrid .AND. metricTerms ) THEN
546           CALL MOM_U_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)  C      o Cylindrical grid metric terms
547           DO j=jMin,jMax         CALL MOM_U_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)
548            DO i=iMin,iMax         DO j=jMin,jMax
549               gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j)          DO i=iMin,iMax
550            ENDDO           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtFacU*mT(i,j)
551            ENDDO
552         ENDDO         ENDDO
553        ENDIF        ENDIF
554    
# Line 490  C--   Tendency is minus divergence of th Line 580  C--   Tendency is minus divergence of th
580       &      ( 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)) )
581  #else  #else
582       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
583       &      *recip_rAs(i,j,bi,bj)       &     *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k)
584  #endif  #endif
585       &    *( ( fZon(i+1,j)     - fZon(i,j  ) )*uDvdxFac       &     *( ( fZon(i+1,j)     - fZon(i,j  ) )*uDvdxFac
586       &      +( fMer(i,  j)     - fMer(i,j-1) )*vDvdyFac       &       +( fMer(i,  j)     - fMer(i,j-1) )*vDvdyFac
587       &      +(fVerV(i,j,kDown) - fVerV(i,j,kUp))*rkSign*rVelDvdrFac       &       +(fVerV(i,j,kDown) - fVerV(i,j,kUp))*rkSign*rVelDvdrFac
588       &     )       &     )
589           ENDDO           ENDDO
590          ENDDO          ENDDO
# Line 510  C--   Tendency is minus divergence of th Line 600  C--   Tendency is minus divergence of th
600    
601  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
602  C-- account for 3.D divergence of the flow in rStar coordinate:  C-- account for 3.D divergence of the flow in rStar coordinate:
603    # ifndef DISABLE_RSTAR_CODE
604          IF ( select_rStar.GT.0 ) THEN          IF ( select_rStar.GT.0 ) THEN
605           DO j=jMin,jMax           DO j=jMin,jMax
606            DO i=iMin,iMax            DO i=iMin,iMax
# Line 527  C-- account for 3.D divergence of the fl Line 618  C-- account for 3.D divergence of the fl
618            ENDDO            ENDDO
619           ENDDO           ENDDO
620          ENDIF          ENDIF
621    # endif /* DISABLE_RSTAR_CODE */
622  #endif /* NONLIN_FRSURF */  #endif /* NONLIN_FRSURF */
623    
624        ELSE        ELSE
# Line 543  C-    endif momAdvection. Line 635  C-    endif momAdvection.
635        IF (momViscosity) THEN        IF (momViscosity) THEN
636  C---  Calculate eddy fluxes (dissipation) between cells for meridional flow.  C---  Calculate eddy fluxes (dissipation) between cells for meridional flow.
637  C     Bi-harmonic term del^2 V -> v4F  C     Bi-harmonic term del^2 V -> v4F
638          IF (biharmonic)          IF (biharmonic)
639       &  CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid)       &  CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid)
640    
641  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon  C     Laplacian and bi-harmonic terms, Zonal  Fluxes -> fZon
# Line 561  C     Eddy component of vertical flux (i Line 653  C     Eddy component of vertical flux (i
653         ENDIF         ENDIF
654    
655  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term  C--   Tendency is minus divergence of the fluxes + coriolis + pressure term
656    C     anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is)
657          DO j=jMin,jMax          DO j=jMin,jMax
658           DO i=iMin,iMax           DO i=iMin,iMax
659            gvDiss(i,j) =            gvDiss(i,j) =
# Line 569  C--   Tendency is minus divergence of th Line 662  C--   Tendency is minus divergence of th
662       &      ( 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)) )
663  #else  #else
664       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)       &     -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
665       &      *recip_rAs(i,j,bi,bj)       &      *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)
666  #endif  #endif
667       &    *( ( fZon(i+1,j)  - fZon(i,j  ) )*AhDvdxFac       &     *( ( fZon(i+1,j)  - fZon(i,j  ) )*AhDvdxFac
668       &      +( fMer(i,  j)  - fMer(i,j-1) )*AhDvdyFac       &       +( fMer(i,  j)  - fMer(i,j-1) )*AhDvdyFac
669       &      +( fVrDw(i,j)   - fVrUp(i,j) )*rkSign*ArDvdrFac       &       +( fVrDw(i,j)   - fVrUp(i,j) )*rkSign*ArDvdrFac
670         &                                     *recip_rhoFacC(k)
671       &     )       &     )
672           ENDDO           ENDDO
673          ENDDO          ENDDO
# Line 587  C--   Tendency is minus divergence of th Line 681  C--   Tendency is minus divergence of th
681          ENDIF          ENDIF
682  #endif  #endif
683    
684  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
685        IF (no_slip_sides) THEN          IF (no_slip_sides) THEN
686  C-     No-slip BCs impose a drag at walls...  C-     No-slip BCs impose a drag at walls...
687           CALL MOM_V_SIDEDRAG(           CALL MOM_V_SIDEDRAG(
688       I        bi,bj,k,       I        bi,bj,k,
# Line 613  C-    No-slip BCs impose a drag at botto Line 707  C-    No-slip BCs impose a drag at botto
707           ENDDO           ENDDO
708          ENDIF          ENDIF
709    
710    #ifdef ALLOW_SHELFICE
711            IF (useShelfIce) THEN
712             CALL SHELFICE_V_DRAG(bi,bj,k,vFld,KE,KappaRU,vF,myThid)
713             DO j=jMin,jMax
714              DO i=iMin,iMax
715               gvDiss(i,j) = gvDiss(i,j) + vF(i,j)
716              ENDDO
717             ENDDO
718            ENDIF
719    #endif /* ALLOW_SHELFICE */
720    
721  C-    endif momViscosity  C-    endif momViscosity
722        ENDIF        ENDIF
723    
# Line 624  c    I     myTime,myThid) Line 729  c    I     myTime,myThid)
729    
730  C--   Metric terms for curvilinear grid systems  C--   Metric terms for curvilinear grid systems
731        IF (useNHMTerms) THEN        IF (useNHMTerms) THEN
732  C      o Spherical polar grid metric terms  C      o Non-Hydrostatic (spherical) metric terms
733         CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid)         CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid)
734         DO j=jMin,jMax         DO j=jMin,jMax
735          DO i=iMin,iMax          DO i=iMin,iMax
736           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)
737          ENDDO          ENDDO
738         ENDDO         ENDDO
739        ENDIF        ENDIF
740        IF (usingSphericalPolarMTerms) THEN        IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN
741    C      o Spherical polar grid metric terms
742         CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid)         CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid)
743         DO j=jMin,jMax         DO j=jMin,jMax
744          DO i=iMin,iMax          DO i=iMin,iMax
745           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)
746          ENDDO          ENDDO
747         ENDDO         ENDDO
748        ENDIF        ENDIF
749        IF (usingCylindricalGrid) THEN        IF ( usingCylindricalGrid .AND. metricTerms ) THEN
750           CALL MOM_V_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)  C      o Cylindrical grid metric terms
751           DO j=jMin,jMax         CALL MOM_V_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid)
752              DO i=iMin,iMax         DO j=jMin,jMax
753                 gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j)          DO i=iMin,iMax
754              ENDDO           gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtFacV*mT(i,j)
755           ENDDO          ENDDO
756           ENDDO
757        ENDIF        ENDIF
758    
759  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
# Line 679  c     ELSE Line 786  c     ELSE
786  #endif  #endif
787        ENDIF        ENDIF
788    
789        IF (nonHydrostatic.OR.quasiHydrostatic) THEN  C--   3.D Coriolis term (horizontal momentum, Eastward component: -f'*w)
790         CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)        IF ( use3dCoriolis ) THEN
791         DO j=jMin,jMax          CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)
792          DO i=iMin,iMax          DO j=jMin,jMax
793           gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j)           DO i=iMin,iMax
794              gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j)
795             ENDDO
796          ENDDO          ENDDO
797         ENDDO         IF ( usingCurvilinearGrid ) THEN
798    C-     presently, non zero angleSinC array only supported with Curvilinear-Grid
799            CALL MOM_V_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)
800            DO j=jMin,jMax
801             DO i=iMin,iMax
802              gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j)
803             ENDDO
804            ENDDO
805           ENDIF
806        ENDIF        ENDIF
807    
808  C--   Set du/dt & dv/dt on boundaries to zero  C--   Set du/dt & dv/dt on boundaries to zero
# Line 701  C--   Set du/dt & dv/dt on boundaries to Line 818  C--   Set du/dt & dv/dt on boundaries to
818  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
819        IF ( useDiagnostics ) THEN        IF ( useDiagnostics ) THEN
820          CALL DIAGNOSTICS_FILL(KE,    'momKE   ',k,1,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(KE,    'momKE   ',k,1,2,bi,bj,myThid)
         CALL DIAGNOSTICS_FILL(hDiv,  'momHDiv ',k,1,2,bi,bj,myThid)  
         CALL DIAGNOSTICS_FILL(vort3, 'momVort3',k,1,2,bi,bj,myThid)  
         CALL DIAGNOSTICS_FILL(strain,'Strain  ',k,1,2,bi,bj,myThid)  
         CALL DIAGNOSTICS_FILL(tension,'Tension ',k,1,2,bi,bj,myThid)  
821          CALL DIAGNOSTICS_FILL(gU(1-Olx,1-Oly,k,bi,bj),          CALL DIAGNOSTICS_FILL(gU(1-Olx,1-Oly,k,bi,bj),
822       &                               'Um_Advec',k,1,2,bi,bj,myThid)       &                               'Um_Advec',k,1,2,bi,bj,myThid)
823          CALL DIAGNOSTICS_FILL(gV(1-Olx,1-Oly,k,bi,bj),          CALL DIAGNOSTICS_FILL(gV(1-Olx,1-Oly,k,bi,bj),

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.22