/[MITgcm]/MITgcm/model/src/calc_gw.F
ViewVC logotype

Diff of /MITgcm/model/src/calc_gw.F

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

revision 1.17 by mlosch, Fri Oct 1 16:15:29 2004 UTC revision 1.24 by jmc, Thu Dec 15 02:06:06 2005 UTC
# Line 9  CBOP Line 9  CBOP
9  C     !ROUTINE: CALC_GW  C     !ROUTINE: CALC_GW
10  C     !INTERFACE:  C     !INTERFACE:
11        SUBROUTINE CALC_GW(            SUBROUTINE CALC_GW(    
12       I        myThid)       I           myTime, myIter, myThid )
13  C     !DESCRIPTION: \bv  C     !DESCRIPTION: \bv
14  C     *==========================================================*  C     *==========================================================*
15  C     | S/R CALC_GW                                                C     | S/R CALC_GW                                              
# Line 26  C     !USES: Line 26  C     !USES:
26        IMPLICIT NONE        IMPLICIT NONE
27  C     == Global variables ==  C     == Global variables ==
28  #include "SIZE.h"  #include "SIZE.h"
 #include "DYNVARS.h"  
29  #include "EEPARAMS.h"  #include "EEPARAMS.h"
30  #include "PARAMS.h"  #include "PARAMS.h"
31  #include "GRID.h"  #include "GRID.h"
32  #include "GW.h"  #include "DYNVARS.h"
33  #include "CG3D.h"  #include "NH_VARS.h"
34    
35  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
36  C     == Routine arguments ==  C     == Routine arguments ==
37  C     myThid - Instance number for this innvocation of CALC_GW  C     myTime :: Current time in simulation
38    C     myIter :: Current iteration number in simulation
39    C     myThid :: Thread number for this instance of the routine.
40          _RL     myTime
41          INTEGER myIter
42        INTEGER myThid        INTEGER myThid
43    
44  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
# Line 54  C     flx_Dn       :: Temp. used for fVo Line 57  C     flx_Dn       :: Temp. used for fVo
57        _RL    flx_EW(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL    flx_EW(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
58        _RL    flx_Dn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL    flx_Dn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
59        _RL    flx_Up(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL    flx_Up(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
60  C     I,J,K - Loop counters        _RL    fZon(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
61        INTEGER i,j,k, kP1, kUp        _RL    fMer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
62          _RL    del2w(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
63    C     i,j,k - Loop counters
64          INTEGER i,j,k, kP1
65        _RL  wOverride        _RL  wOverride
66        _RS  hFacWtmp        _RS  hFacWtmp
67        _RS  hFacStmp        _RS  hFacStmp
68          _RS  hFacCtmp
69          _RS  recip_hFacCtmp
70        _RL ab15,ab05        _RL ab15,ab05
71        _RL slipSideFac        _RL slipSideFac
72        _RL tmp_VbarZ, tmp_UbarZ, tmp_WbarZ        _RL tmp_VbarZ, tmp_UbarZ, tmp_WbarZ
# Line 67  C     I,J,K - Loop counters Line 75  C     I,J,K - Loop counters
75        PARAMETER(Half=0.5D0)        PARAMETER(Half=0.5D0)
76  CEOP  CEOP
77    
 ceh3 needs an IF ( useNONHYDROSTATIC ) THEN  
   
78        iMin = 1        iMin = 1
79        iMax = sNx        iMax = sNx
80        jMin = 1        jMin = 1
81        jMax = sNy        jMax = sNy
82    
83  C     Adams-Bashforth timestepping weights  C     Adams-Bashforth timestepping weights
84        ab15 =  1.5 _d 0 + abeps        IF (myIter .EQ. 0) THEN
85        ab05 = -0.5 _d 0 - abeps         ab15 =  1.0 _d 0
86           ab05 =  0.0 _d 0
87          ELSE
88           ab15 =  1.5 _d 0 + abeps
89           ab05 = -0.5 _d 0 - abeps
90          ENDIF
91    
92  C     Lateral friction (no-slip, free slip, or half slip):  C     Lateral friction (no-slip, free slip, or half slip):
93        IF ( no_slip_sides ) THEN        IF ( no_slip_sides ) THEN
# Line 84  C     Lateral friction (no-slip, free sl Line 95  C     Lateral friction (no-slip, free sl
95        ELSE        ELSE
96          slipSideFac =  1. _d 0          slipSideFac =  1. _d 0
97        ENDIF        ENDIF
98  CML   half slip was used before ; keep it for now, but half slip is  CML   half slip was used before ; keep the line for now, but half slip is
99  CML   not used anywhere in the code as far as I can see  CML   not used anywhere in the code as far as I can see.
100  C        slipSideFac = 0. _d 0  C        slipSideFac = 0. _d 0
101    
102        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
# Line 93  C        slipSideFac = 0. _d 0 Line 104  C        slipSideFac = 0. _d 0
104          DO K=1,Nr          DO K=1,Nr
105           DO j=1-OLy,sNy+OLy           DO j=1-OLy,sNy+OLy
106            DO i=1-OLx,sNx+OLx            DO i=1-OLx,sNx+OLx
            gWNM1(i,j,k,bi,bj) = gW(i,j,k,bi,bj)  
107             gW(i,j,k,bi,bj) = 0.             gW(i,j,k,bi,bj) = 0.
108            ENDDO            ENDDO
109           ENDDO           ENDDO
# Line 123  C Sweep down column Line 133  C Sweep down column
133            Kp1=Nr            Kp1=Nr
134            wOverRide=0.            wOverRide=0.
135           endif           endif
136    C     horizontal bi-harmonic dissipation
137             IF (momViscosity .AND. viscA4W.NE.0. ) THEN
138    C     calculate the horizontal Laplacian of vertical flow
139    C     Zonal flux d/dx W
140              DO j=1-Oly,sNy+Oly
141               fZon(1-Olx,j)=0.
142               DO i=1-Olx+1,sNx+Olx
143                fZon(i,j) = drF(k)*_hFacC(i,j,k,bi,bj)
144         &           *_dyG(i,j,bi,bj)
145         &           *_recip_dxC(i,j,bi,bj)
146         &           *(wVel(i,j,k,bi,bj)-wVel(i-1,j,k,bi,bj))
147    #ifdef COSINEMETH_III
148         &           *sqcosFacU(J,bi,bj)
149    #endif
150               ENDDO
151              ENDDO
152    C     Meridional flux d/dy W
153              DO i=1-Olx,sNx+Olx
154               fMer(I,1-Oly)=0.
155              ENDDO
156              DO j=1-Oly+1,sNy+Oly
157               DO i=1-Olx,sNx+Olx
158                fMer(i,j) = drF(k)*_hFacC(i,j,k,bi,bj)
159         &           *_dxG(i,j,bi,bj)
160         &           *_recip_dyC(i,j,bi,bj)
161         &           *(wVel(i,j,k,bi,bj)-wVel(i,j-1,k,bi,bj))
162    #ifdef ISOTROPIC_COS_SCALING
163    #ifdef COSINEMETH_III
164         &           *sqCosFacV(j,bi,bj)
165    #endif
166    #endif
167               ENDDO
168              ENDDO
169              
170    C     del^2 W
171    C     Difference of zonal fluxes ...
172              DO j=1-Oly,sNy+Oly
173               DO i=1-Olx,sNx+Olx-1
174                del2w(i,j)=fZon(i+1,j)-fZon(i,j)
175               ENDDO
176               del2w(sNx+Olx,j)=0.
177              ENDDO
178    
179    C     ... add difference of meridional fluxes and divide by volume
180              DO j=1-Oly,sNy+Oly-1
181               DO i=1-Olx,sNx+Olx
182    C     First compute the fraction of open water for the w-control volume
183    C     at the southern face
184                hFacCtmp=max(hFacC(I,J,K-1,bi,bj)-Half,0. _d 0)
185         &           +   min(hFacC(I,J,K  ,bi,bj),Half)
186                IF (hFacCtmp .GT. 0.) THEN
187                 recip_hFacCtmp = 1./hFacCtmp
188                ELSE
189                 recip_hFacCtmp = 0. _d 0
190                ENDIF
191                del2w(i,j)=recip_rA(i,j,bi,bj)
192         &           *recip_drC(k)*recip_hFacCtmp
193         &           *(
194         &           del2w(i,j)
195         &           +( fMer(i,j+1)-fMer(i,j) )
196         &           )
197               ENDDO
198              ENDDO
199    C-- No-slip BCs impose a drag at walls...
200    CML ************************************************************
201    CML   No-slip Boundary conditions for bi-harmonic dissipation
202    CML   need to be implemented here!
203    CML ************************************************************
204             ELSE
205    C-    Initialize del2w to zero:
206              DO j=1-Oly,sNy+Oly
207               DO i=1-Olx,sNx+Olx
208                del2w(i,j) = 0. _d 0
209               ENDDO
210              ENDDO
211             ENDIF
212    
213  C Flux on Southern face  C Flux on Southern face
214           DO J=jMin,jMax+1           DO J=jMin,jMax+1
215            DO I=iMin,iMax            DO I=iMin,iMax
# Line 139  C     at the southern face Line 226  C     at the southern face
226       &       *(hFacStmp*(wVel(I,J,K,bi,bj)-wVel(I,J-1,K,bi,bj))       &       *(hFacStmp*(wVel(I,J,K,bi,bj)-wVel(I,J-1,K,bi,bj))
227       &        +(1. _d 0 - hFacStmp)*(1. _d 0 - slipSideFac)       &        +(1. _d 0 - hFacStmp)*(1. _d 0 - slipSideFac)
228       &         *wVel(I,J,K,bi,bj))       &         *wVel(I,J,K,bi,bj))
229         &    +viscA4W*_recip_dyC(I,J,bi,bj)*(del2w(I,J)-del2w(I,J-1))
230    #ifdef ISOTROPIC_COS_SCALING
231    #ifdef COSINEMETH_III
232         &    *sqCosFacV(j,bi,bj)
233    #else
234         &    *CosFacV(j,bi,bj)
235    #endif
236    #endif
237  C     The last term is the weighted average of the viscous stress at the open  C     The last term is the weighted average of the viscous stress at the open
238  C     fraction of the w control volume and at the closed fraction of the  C     fraction of the w control volume and at the closed fraction of the
239  C     the control volume. A more compact but less intelligible version  C     the control volume. A more compact but less intelligible version
# Line 154  C     First compute the fraction of open Line 249  C     First compute the fraction of open
249  C     at the western face  C     at the western face
250             hFacWtmp=max(hFacW(I,J,K-1,bi,bj)-Half,0. _d 0)             hFacWtmp=max(hFacW(I,J,K-1,bi,bj)-Half,0. _d 0)
251       &         +    min(hFacW(I,J,K  ,bi,bj),Half)       &         +    min(hFacW(I,J,K  ,bi,bj),Half)
252                   tmp_UbarZ=Half*(             tmp_UbarZ=Half*(
253       &         _hFacW(I,J,K-1,bi,bj)*uVel( I ,J,K-1,bi,bj)       &         _hFacW(I,J,K-1,bi,bj)*uVel( I ,J,K-1,bi,bj)
254       &        +_hFacW(I,J, K ,bi,bj)*uVel( I ,J, K ,bi,bj))       &        +_hFacW(I,J, K ,bi,bj)*uVel( I ,J, K ,bi,bj))
255             Flx_EW(I,J,bi,bj)=             Flx_EW(I,J,bi,bj)=
# Line 163  C     at the western face Line 258  C     at the western face
258       &      *(hFacWtmp*(wVel(I,J,K,bi,bj)-wVel(I-1,J,K,bi,bj))       &      *(hFacWtmp*(wVel(I,J,K,bi,bj)-wVel(I-1,J,K,bi,bj))
259       &       +(1 _d 0 - hFacWtmp)*(1 _d 0 - slipSideFac)       &       +(1 _d 0 - hFacWtmp)*(1 _d 0 - slipSideFac)
260       &        *wVel(I,J,K,bi,bj) )       &        *wVel(I,J,K,bi,bj) )
261         &    +viscA4W*_recip_dxC(I,J,bi,bj)*(del2w(I,J)-del2w(I-1,J))
262    #ifdef COSINEMETH_III
263         &                *sqCosFacU(j,bi,bj)
264    #else
265         &                *CosFacU(j,bi,bj)
266    #endif
267  C     The last term is the weighted average of the viscous stress at the open  C     The last term is the weighted average of the viscous stress at the open
268  C     fraction of the w control volume and at the closed fraction of the  C     fraction of the w control volume and at the closed fraction of the
269  C     the control volume. A more compact but less intelligible version  C     the control volume. A more compact but less intelligible version
# Line 205  caja           and an hFacUS (above V po Line 306  caja           and an hFacUS (above V po
306         ENDDO         ENDDO
307        ENDDO        ENDDO
308    
309        
310        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
311         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
312          DO K=2,Nr          DO K=2,Nr
313           DO j=jMin,jMax           DO j=jMin,jMax
314            DO i=iMin,iMax            DO i=iMin,iMax
315             wVel(i,j,k,bi,bj) = wVel(i,j,k,bi,bj)             wVel(i,j,k,bi,bj) = wVel(i,j,k,bi,bj)
316       &     +deltatMom*( ab15*gW(i,j,k,bi,bj)       &     +deltatMom*nh_Am2*( ab15*gW(i,j,k,bi,bj)
317       &                 +ab05*gWNM1(i,j,k,bi,bj) )       &                 +ab05*gwNm1(i,j,k,bi,bj) )
318             IF (hFacC(I,J,K,bi,bj).EQ.0.) wVel(i,j,k,bi,bj)=0.             IF (hFacC(I,J,K,bi,bj).EQ.0.) wVel(i,j,k,bi,bj)=0.
319               gwNm1(i,j,k,bi,bj) = gW(i,j,k,bi,bj)
320            ENDDO            ENDDO
321           ENDDO           ENDDO
322          ENDDO          ENDDO

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.22