/[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.38 by jmc, Thu Nov 23 00:45:18 2006 UTC revision 1.42 by jmc, Tue Mar 16 00:16:50 2010 UTC
# 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 158  C     uDudxFac, AhDudxFac, etc ... indiv Line 158  C     uDudxFac, AhDudxFac, etc ... indiv
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  #ifdef ALLOW_AUTODIFF_TAMC
168            act0 = k - 1            act0 = k - 1
# Line 190  C     Initialise intermediate terms Line 195  C     Initialise intermediate terms
195          rTransU(i,j)= 0.          rTransU(i,j)= 0.
196          rTransV(i,j)= 0.          rTransV(i,j)= 0.
197  c       KE(i,j)     = 0.  c       KE(i,j)     = 0.
198  c       hDiv(i,j)   = 0.          hDiv(i,j)   = 0.
199          vort3(i,j)  = 0.          vort3(i,j)  = 0.
200          strain(i,j) = 0.          strain(i,j) = 0.
201          tension(i,j)= 0.          tension(i,j)= 0.
# Line 249  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 265  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 299  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  #ifdef ALLOW_AUTODIFF_TAMC
319  # ifdef NONLIN_FRSURF  # ifdef NONLIN_FRSURF
320  #  ifndef DISABLE_RSTAR_CODE  #  ifndef DISABLE_RSTAR_CODE
321  CADJ STORE dwtransc(:,:,bi,bj) =  CADJ STORE dwtransc(:,:,bi,bj) =
322  CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte  CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
323  CADJ STORE dwtransu(:,:,bi,bj) =  CADJ STORE dwtransu(:,:,bi,bj) =
324  CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte  CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
325  CADJ STORE dwtransv(:,:,bi,bj) =  CADJ STORE dwtransv(:,:,bi,bj) =
326  CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte  CADJ &     comlev1_bibj_k, key = imomkey, byte = isbyte
327  #  endif  #  endif
328  # endif /* NONLIN_FRSURF */  # endif /* NONLIN_FRSURF */
# Line 335  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 351  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 364  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 374  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 448  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 456  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 554  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 567  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 577  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 650  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 658  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 781  c     ELSE Line 830  c     ELSE
830  #endif  #endif
831        ENDIF        ENDIF
832    
833  C--   3.D Coriolis term (horizontal momentum, Eastward component: -f'*w)  C--   3.D Coriolis term (horizontal momentum, Eastward component: -fprime*w)
834        IF ( use3dCoriolis ) THEN        IF ( use3dCoriolis ) THEN
835          CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)          CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid)
836          DO j=jMin,jMax          DO j=jMin,jMax

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

  ViewVC Help
Powered by ViewVC 1.1.22