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

Diff of /MITgcm/pkg/mom_vecinv/mom_vecinv.F

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

revision 1.65 by jmc, Tue Jun 7 22:22:34 2011 UTC revision 1.66 by jmc, Sun Mar 18 22:24:01 2012 UTC
# Line 4  C $Name$ Line 4  C $Name$
4  #include "MOM_VECINV_OPTIONS.h"  #include "MOM_VECINV_OPTIONS.h"
5    
6        SUBROUTINE MOM_VECINV(        SUBROUTINE MOM_VECINV(
7       I        bi,bj,iMin,iMax,jMin,jMax,k,kUp,kDown,       I        bi,bj,k,iMin,iMax,jMin,jMax,
8       I        KappaRU, KappaRV,       I        KappaRU, KappaRV,
9       U        fVerU, fVerV,       I        fVerUkm, fVerVkm,
10         O        fVerUkp, fVerVkp,
11       O        guDiss, gvDiss,       O        guDiss, gvDiss,
12       I        myTime, myIter, myThid)       I        myTime, myIter, myThid )
13  C     /==========================================================\  C     *==========================================================*
14  C     | S/R MOM_VECINV                                           |  C     | S/R MOM_VECINV                                           |
15  C     | o Form the right hand-side of the momentum equation.     |  C     | o Form the right hand-side of the momentum equation.     |
16  C     |==========================================================|  C     *==========================================================*
17  C     | Terms are evaluated one layer at a time working from     |  C     | Terms are evaluated one layer at a time working from     |
18  C     | the bottom to the top. The vertically integrated         |  C     | the bottom to the top. The vertically integrated         |
19  C     | barotropic flow tendency term is evluated by summing the |  C     | barotropic flow tendency term is evluated by summing the |
# Line 23  C     | for the diffusion equation bc wi Line 24  C     | for the diffusion equation bc wi
24  C     | form produces a diffusive flux that does not scale with  |  C     | form produces a diffusive flux that does not scale with  |
25  C     | open-area. Need to do something to solidfy this and to   |  C     | open-area. Need to do something to solidfy this and to   |
26  C     | deal "properly" with thin walls.                         |  C     | deal "properly" with thin walls.                         |
27  C     \==========================================================/  C     *==========================================================*
28        IMPLICIT NONE        IMPLICIT NONE
29    
30  C     == Global variables ==  C     == Global variables ==
# Line 44  C     == Global variables == Line 45  C     == Global variables ==
45  #endif  #endif
46    
47  C     == Routine arguments ==  C     == Routine arguments ==
48  C     fVerU  :: Flux of momentum in the vertical direction, out of the upper  C     bi,bj   :: current tile indices
49  C     fVerV  :: face of a cell K ( flux into the cell above ).  C     k       :: current vertical level
50  C     guDiss :: dissipation tendency (all explicit terms), u component  C     iMin,iMax,jMin,jMax :: loop ranges
51  C     gvDiss :: dissipation tendency (all explicit terms), v component  C     fVerU   :: Flux of momentum in the vertical direction, out of the upper
52  C     bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation  C     fVerV   :: face of a cell K ( flux into the cell above ).
53  C                                      results will be set.  C     fVerUkm :: vertical viscous flux of U, interface above (k-1/2)
54  C     kUp, kDown                     - Index for upper and lower layers.  C     fVerVkm :: vertical viscous flux of V, interface above (k-1/2)
55  C     myThid :: my Thread Id number  C     fVerUkp :: vertical viscous flux of U, interface below (k+1/2)
56    C     fVerVkp :: vertical viscous flux of V, interface below (k+1/2)
57    
58    C     guDiss  :: dissipation tendency (all explicit terms), u component
59    C     gvDiss  :: dissipation tendency (all explicit terms), v component
60    C     myTime  :: current time
61    C     myIter  :: current time-step number
62    C     myThid  :: my Thread Id number
63          INTEGER bi,bj,k
64          INTEGER iMin,iMax,jMin,jMax
65        _RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
66        _RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
67        _RL fVerU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerUkm(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
68        _RL fVerV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerVkm(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
69          _RL fVerUkp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
70          _RL fVerVkp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71        _RL guDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL guDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72        _RL gvDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL gvDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
       INTEGER kUp,kDown  
73        _RL     myTime        _RL     myTime
74        INTEGER myIter        INTEGER myIter
75        INTEGER myThid        INTEGER myThid
       INTEGER bi,bj,iMin,iMax,jMin,jMax  
76    
77  #ifdef ALLOW_MOM_VECINV  #ifdef ALLOW_MOM_VECINV
78    
# Line 93  C     == Local variables == Line 103  C     == Local variables ==
103        _RL viscAh_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL viscAh_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
104        _RL viscA4_Z(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL viscA4_Z(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
105        _RL viscA4_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL viscA4_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
106  C     i,j,k  :: Loop counters  C     i,j    :: Loop counters
107        INTEGER i,j,k        INTEGER i,j
108  C     xxxFac - On-off tracer parameters used for switching terms off.  C     xxxFac :: On-off tracer parameters used for switching terms off.
109        _RL  ArDudrFac        _RL  ArDudrFac
110        _RL  ArDvdrFac        _RL  ArDvdrFac
111        _RL  sideMaskFac        _RL  sideMaskFac
# Line 116  C--   only the kDown part of fverU/V is Line 126  C--   only the kDown part of fverU/V is
126  C--   the kUp is still required  C--   the kUp is still required
127  C--   In the case of mom_fluxform Kup is set as well  C--   In the case of mom_fluxform Kup is set as well
128  C--   (at least in part)  C--   (at least in part)
129        fVerU(1,1,kUp) = fVerU(1,1,kUp)        fVerUkm(1,1) = fVerUkm(1,1)
130        fVerV(1,1,kUp) = fVerV(1,1,kUp)        fVerVkm(1,1) = fVerVkm(1,1)
131  #endif  #endif
132    
133  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
# Line 248  CADJ &     comlev1_bibj_k, key = imomkey Line 258  CADJ &     comlev1_bibj_k, key = imomkey
258         CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,myThid)         CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,myThid)
259    
260  C-     account for no-slip / free-slip BC:  C-     account for no-slip / free-slip BC:
261         DO j=1-Oly,sNy+Oly         DO j=1-OLy,sNy+OLy
262          DO i=1-Olx,sNx+Olx          DO i=1-OLx,sNx+OLx
263            IF ( hFacZ(i,j).EQ.0. ) THEN            IF ( hFacZ(i,j).EQ.0. ) THEN
264              vort3(i,j)  = sideMaskFac*vort3(i,j)              vort3(i,j)  = sideMaskFac*vort3(i,j)
265              strain(i,j) = sideMaskFac*strain(i,j)              strain(i,j) = sideMaskFac*strain(i,j)
# Line 308  C---   Calculate dissipation terms for U Line 318  C---   Calculate dissipation terms for U
318  C      in terms of tension and strain  C      in terms of tension and strain
319         IF (useStrainTensionVisc) THEN         IF (useStrainTensionVisc) THEN
320  C        mask strain as if free-slip since side-drag is computed separately  C        mask strain as if free-slip since side-drag is computed separately
321           DO j=1-Oly,sNy+Oly           DO j=1-OLy,sNy+OLy
322            DO i=1-Olx,sNx+Olx            DO i=1-OLx,sNx+OLx
323              IF ( hFacZ(i,j).EQ.0. ) strain(i,j) = 0. _d 0              IF ( hFacZ(i,j).EQ.0. ) strain(i,j) = 0. _d 0
324            ENDDO            ENDDO
325           ENDDO           ENDDO
# Line 345  C     Eddy component of vertical flux (i Line 355  C     Eddy component of vertical flux (i
355  C     Combine fluxes  C     Combine fluxes
356         DO j=jMin,jMax         DO j=jMin,jMax
357          DO i=iMin,iMax          DO i=iMin,iMax
358           fVerU(i,j,kDown) = ArDudrFac*vrF(i,j)           fVerUkp(i,j) = ArDudrFac*vrF(i,j)
359          ENDDO          ENDDO
360         ENDDO         ENDDO
361    
362  C--   Tendency is minus divergence of the fluxes  C--   Tendency is minus divergence of the fluxes
363         DO j=2-Oly,sNy+Oly-1         DO j=2-OLy,sNy+OLy-1
364          DO i=2-Olx,sNx+Olx-1          DO i=2-OLx,sNx+OLx-1
365           guDiss(i,j) = guDiss(i,j)           guDiss(i,j) = guDiss(i,j)
366       &   -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)       &   -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
367       &   *recip_rAw(i,j,bi,bj)       &   *recip_rAw(i,j,bi,bj)
368       &  *(       &   *( fVerUkp(i,j) - fVerUkm(i,j) )*rkSign
      &    fVerU(i,j,kDown) - fVerU(i,j,kUp)  
      &   )*rkSign  
369          ENDDO          ENDDO
370         ENDDO         ENDDO
371        ENDIF        ENDIF
# Line 410  C     Eddy component of vertical flux (i Line 418  C     Eddy component of vertical flux (i
418  C     Combine fluxes -> fVerV  C     Combine fluxes -> fVerV
419         DO j=jMin,jMax         DO j=jMin,jMax
420          DO i=iMin,iMax          DO i=iMin,iMax
421           fVerV(i,j,kDown) = ArDvdrFac*vrF(i,j)           fVerVkp(i,j) = ArDvdrFac*vrF(i,j)
422          ENDDO          ENDDO
423         ENDDO         ENDDO
424    
# Line 419  C--   Tendency is minus divergence of th Line 427  C--   Tendency is minus divergence of th
427          DO i=iMin,iMax          DO i=iMin,iMax
428           gvDiss(i,j) = gvDiss(i,j)           gvDiss(i,j) = gvDiss(i,j)
429       &   -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)       &   -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
430       &    *recip_rAs(i,j,bi,bj)       &   *recip_rAs(i,j,bi,bj)
431       &  *(       &   *( fVerVkp(i,j) - fVerVkm(i,j) )*rkSign
      &    fVerV(i,j,kDown) - fVerV(i,j,kUp)  
      &   )*rkSign  
432          ENDDO          ENDDO
433         ENDDO         ENDDO
434        ENDIF        ENDIF
# Line 486  C---+----1----+----2----+----3----+----4 Line 492  C---+----1----+----2----+----3----+----4
492    
493  C---  Prepare for Advection & Coriolis terms:  C---  Prepare for Advection & Coriolis terms:
494  C-    Mask relative vorticity and calculate absolute vorticity  C-    Mask relative vorticity and calculate absolute vorticity
495        DO j=1-Oly,sNy+Oly        DO j=1-OLy,sNy+OLy
496         DO i=1-Olx,sNx+Olx         DO i=1-OLx,sNx+OLx
497           IF ( hFacZ(i,j).EQ.0. ) vort3(i,j) = 0.           IF ( hFacZ(i,j).EQ.0. ) vort3(i,j) = 0.
498         ENDDO         ENDDO
499        ENDDO        ENDDO
# Line 758  C--   Set du/dt & dv/dt on boundaries to Line 764  C--   Set du/dt & dv/dt on boundaries to
764          CALL DIAGNOSTICS_FILL(guDiss, 'Um_Diss ',k,1,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(guDiss, 'Um_Diss ',k,1,2,bi,bj,myThid)
765          CALL DIAGNOSTICS_FILL(gvDiss, 'Vm_Diss ',k,1,2,bi,bj,myThid)          CALL DIAGNOSTICS_FILL(gvDiss, 'Vm_Diss ',k,1,2,bi,bj,myThid)
766         ENDIF         ENDIF
767          CALL DIAGNOSTICS_FILL(gU(1-Olx,1-Oly,k,bi,bj),          CALL DIAGNOSTICS_FILL(gU(1-OLx,1-OLy,k,bi,bj),
768       &                                'Um_Advec',k,1,2,bi,bj,myThid)       &                                'Um_Advec',k,1,2,bi,bj,myThid)
769          CALL DIAGNOSTICS_FILL(gV(1-Olx,1-Oly,k,bi,bj),          CALL DIAGNOSTICS_FILL(gV(1-OLx,1-OLy,k,bi,bj),
770       &                                'Vm_Advec',k,1,2,bi,bj,myThid)       &                                'Vm_Advec',k,1,2,bi,bj,myThid)
771        ENDIF        ENDIF
772  #endif /* ALLOW_DIAGNOSTICS */  #endif /* ALLOW_DIAGNOSTICS */

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

  ViewVC Help
Powered by ViewVC 1.1.22