/[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.1 by adcroft, Thu Aug 16 17:16:03 2001 UTC revision 1.5 by adcroft, Tue Nov 5 18:49:02 2002 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4    CBOI
5    C !TITLE: pkg/mom\_advdiff
6    C !AUTHORS: adcroft@mit.edu
7    C !INTRODUCTION: Flux-form Momentum Equations Package
8    C
9    C Package "mom\_fluxform" provides methods for calculating explicit terms
10    C in the momentum equation cast in flux-form:
11    C \begin{eqnarray*}
12    C G^u & = & -\frac{1}{\rho} \partial_x \phi_h
13    C           -\nabla \cdot {\bf v} u
14    C           -fv
15    C           +\frac{1}{\rho} \nabla \cdot {\bf \tau}^x
16    C           + \mbox{metrics}
17    C \\
18    C G^v & = & -\frac{1}{\rho} \partial_y \phi_h
19    C           -\nabla \cdot {\bf v} v
20    C           +fu
21    C           +\frac{1}{\rho} \nabla \cdot {\bf \tau}^y
22    C           + \mbox{metrics}
23    C \end{eqnarray*}
24    C where ${\bf v}=(u,v,w)$ and $\tau$, the stress tensor, includes surface
25    C stresses as well as internal viscous stresses.
26    CEOI
27    
28  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
29    
30    CBOP
31    C !ROUTINE: MOM_FLUXFORM
32    
33    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        phi_hyd,KappaRU,KappaRV,       I        phi_hyd,KappaRU,KappaRV,
37       U        fVerU, fVerV,       U        fVerU, fVerV,
38       I        myCurrentTime, myThid)       I        myCurrentTime,myIter,myThid)
 C     /==========================================================\  
 C     | S/R MOM_FLUXFORM                                         |  
 C     | o Form the right hand-side of the momentum equation.     |  
 C     |==========================================================|  
 C     | Terms are evaluated one layer at a time working from     |  
 C     | the bottom to the top. The vertically integrated         |  
 C     | barotropic flow tendency term is evluated by summing the |  
 C     | tendencies.                                              |  
 C     | Notes:                                                   |  
 C     | We have not sorted out an entirely satisfactory formula  |  
 C     | for the diffusion equation bc with lopping. The present  |  
 C     | form produces a diffusive flux that does not scale with  |  
 C     | open-area. Need to do something to solidfy this and to   |  
 C     | deal "properly" with thin walls.                         |  
 C     \==========================================================/  
       IMPLICIT NONE  
39    
40    C !DESCRIPTION:
41    C Calculates all the horizontal accelerations except for the implicit surface
42    C pressure gradient and implciit vertical viscosity.
43    
44    C !USES: ===============================================================
45  C     == Global variables ==  C     == Global variables ==
46          IMPLICIT NONE
47  #include "SIZE.h"  #include "SIZE.h"
48  #include "DYNVARS.h"  #include "DYNVARS.h"
49  #include "FFIELDS.h"  #include "FFIELDS.h"
# Line 34  C     == Global variables == Line 52  C     == Global variables ==
52  #include "GRID.h"  #include "GRID.h"
53  #include "SURFACE.h"  #include "SURFACE.h"
54    
55  C     == Routine arguments ==  C !INPUT PARAMETERS: ===================================================
56  C     fZon    - Work array for flux of momentum in the east-west  C  bi,bj                :: tile indices
57  C               direction at the west face of a cell.  C  iMin,iMax,jMin,jMAx  :: loop ranges
58  C     fMer    - Work array for flux of momentum in the north-south  C  k                    :: vertical level
59  C               direction at the south face of a cell.  C  kUp                  :: =1 or 2 for consecutive k
60  C     fVerU   - Flux of momentum in the vertical  C  kDown                :: =2 or 1 for consecutive k
61  C     fVerV     direction out of the upper face of a cell K  C  phi_hyd              :: hydrostatic pressure (perturbation)
62  C               ( flux into the cell above ).  C  KappaRU              :: vertical viscosity
63  C     phi_hyd - Hydrostatic pressure  C  KappaRV              :: vertical viscosity
64  C     bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation  C  fVerU                :: vertical flux of U, 2 1/2 dim for pipe-lining
65  C                                      results will be set.  C  fVerV                :: vertical flux of V, 2 1/2 dim for pipe-lining
66  C     kUp, kDown                     - Index for upper and lower layers.  C  myCurrentTime        :: current time
67  C     myThid - Instance number for this innvocation of CALC_MOM_RHS  C  myIter               :: current time-step number
68    C  myThid               :: thread number
69          INTEGER bi,bj,iMin,iMax,jMin,jMax
70          INTEGER k,kUp,kDown
71        _RL phi_hyd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL phi_hyd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
72        _RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
73        _RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
74        _RL fVerU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
75        _RL fVerV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)        _RL fVerV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
       INTEGER kUp,kDown  
       INTEGER myThid  
76        _RL     myCurrentTime        _RL     myCurrentTime
77        INTEGER bi,bj,iMin,iMax,jMin,jMax        INTEGER myIter
78          INTEGER myThid
79    
80  C     == Local variables ==  C !OUTPUT PARAMETERS: ==================================================
81  C     ab15, ab05    - Weights for Adams-Bashforth time stepping scheme.  C None - updates gU() and gV() in common blocks
82  C     i,j,k         - Loop counters  
83    C !LOCAL VARIABLES: ====================================================
84    C  i,j                  :: loop indices
85    C  aF                   :: advective flux
86    C  vF                   :: viscous flux
87    C  v4F                  :: bi-harmonic viscous flux
88    C  vrF                  :: vertical viscous flux
89    C  cF                   :: Coriolis acceleration
90    C  mT                   :: Metric terms
91    C  pF                   :: Pressure gradient
92    C  fZon                 :: zonal fluxes
93    C  fMer                 :: meridional fluxes
94          INTEGER i,j
95          _RL aF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
96          _RL vF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
97          _RL v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
98          _RL vrF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99          _RL cF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
100          _RL mT(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
101          _RL pF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
102          _RL fZon(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
103          _RL fMer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
104  C     wMaskOverride - Land sea flag override for top layer.  C     wMaskOverride - Land sea flag override for top layer.
105  C     afFacMom      - Tracer parameters for turning terms  C     afFacMom      - Tracer parameters for turning terms
106  C     vfFacMom        on and off.  C     vfFacMom        on and off.
# Line 69  C     mTFacMom        pfFacMom - Pressur Line 110  C     mTFacMom        pfFacMom - Pressur
110  C                     cfFacMom - Coriolis terms  C                     cfFacMom - Coriolis terms
111  C                     foFacMom - Forcing  C                     foFacMom - Forcing
112  C                     mTFacMom - Metric term  C                     mTFacMom - Metric term
 C     vF            - Temporary holding viscous term (Laplacian)  
 C     v4F           - Temporary holding viscous term (Biharmonic)  
 C     cF            - Temporary holding coriolis term.  
 C     mT            - Temporary holding metric terms(s).  
 C     pF            - Temporary holding pressure|potential gradient terms.  
113  C     uDudxFac, AhDudxFac, etc ... individual term tracer parameters  C     uDudxFac, AhDudxFac, etc ... individual term tracer parameters
       _RL      aF (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL      vF (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL      v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL      vrF (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL      cF (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL      mT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL      pF (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL    fZon (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
       _RL    fMer (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
114        _RS    hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS    hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
115        _RS  r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS  r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
116        _RS      xA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS      xA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 93  C     uDudxFac, AhDudxFac, etc ... indiv Line 120  C     uDudxFac, AhDudxFac, etc ... indiv
120        _RL  uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL  uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
121        _RL  vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL  vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
122  C     I,J,K - Loop counters  C     I,J,K - Loop counters
       INTEGER i,j,k  
123  C     rVelMaskOverride - Factor for imposing special surface boundary conditions  C     rVelMaskOverride - Factor for imposing special surface boundary conditions
124  C                        ( set according to free-surface condition ).  C                        ( set according to free-surface condition ).
125  C     hFacROpen        - Lopped cell factos used tohold fraction of open  C     hFacROpen        - Lopped cell factos used tohold fraction of open
# Line 123  C     xxxFac - On-off tracer parameters Line 149  C     xxxFac - On-off tracer parameters
149        _RL  phyFac        _RL  phyFac
150        _RL  vForcFac        _RL  vForcFac
151        _RL  mtFacV        _RL  mtFacV
 C     ab05, ab15 - Adams-Bashforth time-stepping weights.  
       _RL  ab05, ab15  
152        INTEGER km1,kp1        INTEGER km1,kp1
153        _RL wVelBottomOverride        _RL wVelBottomOverride
154        LOGICAL bottomDragTerms        LOGICAL bottomDragTerms
155        _RL KE(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL KE(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
156    CEOP
157    
158        km1=MAX(1,k-1)        km1=MAX(1,k-1)
159        kp1=MIN(Nr,k+1)        kp1=MIN(Nr,k+1)
# Line 193  C-- with stagger time stepping, grad Phi Line 218  C-- with stagger time stepping, grad Phi
218          phyFac = 0.          phyFac = 0.
219        ENDIF        ENDIF
220    
 C--   Adams-Bashforth weighting factors  
       ab15   =  1.5 _d 0 + abEps  
       ab05   = -0.5 _d 0 - abEps  
     
221  C--   Calculate open water fraction at vorticity points  C--   Calculate open water fraction at vorticity points
222        CALL MOM_CALC_HFACZ(bi,bj,k,hFacZ,r_hFacZ,myThid)        CALL MOM_CALC_HFACZ(bi,bj,k,hFacZ,r_hFacZ,myThid)
223    
# Line 353  C--   Forcing term Line 374  C--   Forcing term
374       I     myCurrentTime,myThid)       I     myCurrentTime,myThid)
375    
376  C--   Metric terms for curvilinear grid systems  C--   Metric terms for curvilinear grid systems
377        IF (usingSphericalPolarMTerms) THEN        IF (useNHMTerms) THEN
378  C      o Spherical polar grid metric terms  C      o Non-hydrosatic metric terms
379         CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid)         CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid)
380         DO j=jMin,jMax         DO j=jMin,jMax
381          DO i=iMin,iMax          DO i=iMin,iMax
382           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)
383          ENDDO          ENDDO
384         ENDDO         ENDDO
385          ENDIF
386          IF (usingSphericalPolarMTerms) THEN
387         CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid)         CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid)
388         DO j=jMin,jMax         DO j=jMin,jMax
389          DO i=iMin,iMax          DO i=iMin,iMax
# Line 501  C--   Forcing term Line 524  C--   Forcing term
524       I     myCurrentTime,myThid)       I     myCurrentTime,myThid)
525    
526  C--   Metric terms for curvilinear grid systems  C--   Metric terms for curvilinear grid systems
527        IF (usingSphericalPolarMTerms) THEN        IF (useNHMTerms) THEN
528  C      o Spherical polar grid metric terms  C      o Spherical polar grid metric terms
529         CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid)         CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid)
530         DO j=jMin,jMax         DO j=jMin,jMax
# Line 509  C      o Spherical polar grid metric ter Line 532  C      o Spherical polar grid metric ter
532           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)
533          ENDDO          ENDDO
534         ENDDO         ENDDO
535          ENDIF
536          IF (usingSphericalPolarMTerms) THEN
537         CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid)         CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid)
538         DO j=jMin,jMax         DO j=jMin,jMax
539          DO i=iMin,iMax          DO i=iMin,iMax

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22