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

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

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

revision 1.3 by adcroft, Wed Apr 29 21:31:09 1998 UTC revision 1.10 by adcroft, Thu May 28 16:19:50 1998 UTC
# Line 2  C $Header$ Line 2  C $Header$
2    
3  #include "CPP_EEOPTIONS.h"  #include "CPP_EEOPTIONS.h"
4    
5        SUBROUTINE DYNAMICS(myThid)        SUBROUTINE DYNAMICS(myTime, myIter, myThid)
6  C     /==========================================================\  C     /==========================================================\
7  C     | SUBROUTINE DYNAMICS                                      |  C     | SUBROUTINE DYNAMICS                                      |
8  C     | o Controlling routine for the explicit part of the model |  C     | o Controlling routine for the explicit part of the model |
# Line 25  C     == Global variables === Line 25  C     == Global variables ===
25  #include "SIZE.h"  #include "SIZE.h"
26  #include "EEPARAMS.h"  #include "EEPARAMS.h"
27  #include "CG2D.h"  #include "CG2D.h"
28    #include "PARAMS.h"
29  #include "DYNVARS.h"  #include "DYNVARS.h"
30    
31  C     == Routine arguments ==  C     == Routine arguments ==
32    C     myTime - Current time in simulation
33    C     myIter - Current iteration number in simulation
34  C     myThid - Thread number for this instance of the routine.  C     myThid - Thread number for this instance of the routine.
35        INTEGER myThid        INTEGER myThid
36          _RL myTime
37          INTEGER myIter
38    
39  C     == Local variables  C     == Local variables
40  C     xA, yA                 - Per block temporaries holding face areas  C     xA, yA                 - Per block temporaries holding face areas
# Line 79  C                          into fVerTerm Line 84  C                          into fVerTerm
84        _RL pH    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)        _RL pH    (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
85        _RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
86        _RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
87          _RL rhotmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
88          _RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89          _RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
90          _RL K13   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
91          _RL K23   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
92          _RL K33   (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
93          _RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
94        INTEGER iMin, iMax        INTEGER iMin, iMax
95        INTEGER jMin, jMax        INTEGER jMin, jMax
96        INTEGER bi, bj        INTEGER bi, bj
# Line 92  C     point numbers. This prevents spuri Line 104  C     point numbers. This prevents spuri
104  C     uninitialised but inert locations.  C     uninitialised but inert locations.
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
107          xA(i,j)      = 0.*1. _d 37          xA(i,j)      = 0. _d 0
108          yA(i,j)      = 0.*1. _d 37          yA(i,j)      = 0. _d 0
109          uTrans(i,j)  = 0.*1. _d 37          uTrans(i,j)  = 0. _d 0
110          vTrans(i,j)  = 0.*1. _d 37          vTrans(i,j)  = 0. _d 0
111          aTerm(i,j)   = 0.*1. _d 37          aTerm(i,j)   = 0. _d 0
112          xTerm(i,j)   = 0.*1. _d 37          xTerm(i,j)   = 0. _d 0
113          cTerm(i,j)   = 0.*1. _d 37          cTerm(i,j)   = 0. _d 0
114          mTerm(i,j)   = 0.*1. _d 37          mTerm(i,j)   = 0. _d 0
115          pTerm(i,j)   = 0.*1. _d 37          pTerm(i,j)   = 0. _d 0
116          fZon(i,j)    = 0.*1. _d 37          fZon(i,j)    = 0. _d 0
117          fMer(i,j)    = 0.*1. _d 37          fMer(i,j)    = 0. _d 0
118          DO K=1,nZ          DO K=1,nZ
119           pH (i,j,k)  = 0.*1. _d 37           pH (i,j,k)  = 0. _d 0
120             K13(i,j,k) = 0. _d 0
121             K23(i,j,k) = 0. _d 0
122             K33(i,j,k) = 0. _d 0
123          ENDDO          ENDDO
124          rhokm1(i,j)    = 0. _d 0          rhokm1(i,j)  = 0. _d 0
125          rhokp1(i,j)    = 0. _d 0          rhokp1(i,j)  = 0. _d 0
126         ENDDO          rhotmp(i,j)  = 0. _d 0
       ENDDO  
 C--   Set up work arrays that need valid initial values  
       DO j=1-OLy,sNy+OLy  
        DO i=1-OLx,sNx+OLx  
         wTrans(i,j)  = 0. _d 0  
         fVerT(i,j,1) = 0. _d 0  
         fVerT(i,j,2) = 0. _d 0  
         fVerS(i,j,1) = 0. _d 0  
         fVerS(i,j,2) = 0. _d 0  
         fVerU(i,j,1) = 0. _d 0  
         fVerU(i,j,2) = 0. _d 0  
         fVerV(i,j,1) = 0. _d 0  
         fVerV(i,j,2) = 0. _d 0  
127         ENDDO         ENDDO
128        ENDDO        ENDDO
129    
130        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
131         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
132    
133  C--   Boundary condition on hydrostatic pressure is pH(z=0)=0  C--     Boundary condition on hydrostatic pressure is pH(z=0)=0
134          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
135           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
136            pH(i,j,1) = 0. _d 0            pH(i,j,1) = 0. _d 0
137              K13(i,j,1) = 0. _d 0
138              K23(i,j,1) = 0. _d 0
139              K33(i,j,1) = 0. _d 0
140              KapGM(i,j) = 0. _d 0
141             ENDDO
142            ENDDO
143    
144    C--     Set up work arrays that need valid initial values
145            DO j=1-OLy,sNy+OLy
146             DO i=1-OLx,sNx+OLx
147              wTrans(i,j)  = 0. _d 0
148              fVerT(i,j,1) = 0. _d 0
149              fVerT(i,j,2) = 0. _d 0
150              fVerS(i,j,1) = 0. _d 0
151              fVerS(i,j,2) = 0. _d 0
152              fVerU(i,j,1) = 0. _d 0
153              fVerU(i,j,2) = 0. _d 0
154              fVerV(i,j,1) = 0. _d 0
155              fVerV(i,j,2) = 0. _d 0
156           ENDDO           ENDDO
157          ENDDO          ENDDO
158    
# Line 140  C--   Boundary condition on hydrostatic Line 161  C--   Boundary condition on hydrostatic
161          jMin = 1-OLy+1          jMin = 1-OLy+1
162          jMax = sNy+OLy          jMax = sNy+OLy
163    
164  C--     Update fields according to tendency terms  C--     Calculate gradient of surface pressure
165            CALL GRAD_PSURF(
166         I       bi,bj,iMin,iMax,jMin,jMax,
167         O       pSurfX,pSurfY,
168         I       myThid)
169    
170    C--     Update fields in top level according to tendency terms
171          CALL TIMESTEP(          CALL TIMESTEP(
172       I       bi,bj,iMin,iMax,jMin,jMax,myThid)       I       bi,bj,iMin,iMax,jMin,jMax,1,pSurfX,pSurfY,myThid)
173    
174          DO K=2,Nz  C--     Density of 1st level (below W(1)) reference to level 1
175  C Density of K-1 level (above W(K)) reference to K level          CALL FIND_RHO(
176           CALL FIND_RHO(       I     bi, bj, iMin, iMax, jMin, jMax, 1, 1, eosType,
177       I      bi, bj, iMin, iMax, jMin, jMax,  K-1, K, 'LINEAR',       O     rhoKm1,
178       O      rhoKm1,       I     myThid )
179       I      myThid )  C--     Integrate hydrostatic balance for pH with BC of pH(z=0)=0
180  C Density of K level (below W(K)) reference to K level          CALL CALC_PH(
181           CALL FIND_RHO(       I      bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1,
182       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, 'LINEAR',       U      pH,
      O      rhoKp1,  
183       I      myThid )       I      myThid )
184            DO J=1-Oly,sNy+Oly
185             DO I=1-Olx,sNx+Olx
186              rhoKp1(I,J)=rhoKm1(I,J)
187             ENDDO
188            ENDDO
189    
190            DO K=2,Nz
191    C--     Update fields in Kth level according to tendency terms
192            CALL TIMESTEP(
193         I       bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid)
194    C--     Density of K-1 level (above W(K)) reference to K-1 level
195    copt    CALL FIND_RHO(
196    copt I     bi, bj, iMin, iMax, jMin, jMax,  K-1, K-1, eosType,
197    copt O     rhoKm1,
198    copt I     myThid )
199    C       rhoKm1=rhoKp1
200            DO J=1-Oly,sNy+Oly
201             DO I=1-Olx,sNx+Olx
202              rhoKm1(I,J)=rhoKp1(I,J)
203             ENDDO
204            ENDDO
205    C--     Density of K level (below W(K)) reference to K level
206            CALL FIND_RHO(
207         I     bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,
208         O     rhoKp1,
209         I     myThid )
210    C--     Density of K-1 level (above W(K)) reference to K level
211            CALL FIND_RHO(
212         I     bi, bj, iMin, iMax, jMin, jMax,  K-1, K, eosType,
213         O     rhotmp,
214         I     myThid )
215    C--     Calculate iso-neutral slopes for the GM/Redi parameterisation
216            CALL CALC_ISOSLOPES(
217         I            bi, bj, iMin, iMax, jMin, jMax, K,
218         I            rhoKm1, rhoKp1, rhotmp,
219         O            K13, K23, K33, KapGM,
220         I            myThid )
221  C--     Calculate static stability and mix where convectively unstable  C--     Calculate static stability and mix where convectively unstable
222           CALL CONVECT(          CALL CONVECT(
223       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,myThid)       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,
224  C Density of K-1 level (above W(K)) reference to K-1 level       I      myTime,myIter,myThid)
225           CALL FIND_RHO(  C--     Density of K-1 level (above W(K)) reference to K-1 level
226       I      bi, bj, iMin, iMax, jMin, jMax,  K-1, K-1, 'LINEAR',          CALL FIND_RHO(
227       O      rhoKm1,       I     bi, bj, iMin, iMax, jMin, jMax,  K-1, K-1, eosType,
228       I      myThid )       O     rhoKm1,
229         I     myThid )
230    C--     Density of K level (below W(K)) referenced to K level
231            CALL FIND_RHO(
232         I     bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,
233         O     rhoKp1,
234         I     myThid )
235  C--     Integrate hydrostatic balance for pH with BC of pH(z=0)=0  C--     Integrate hydrostatic balance for pH with BC of pH(z=0)=0
236           CALL CALC_PH(          CALL CALC_PH(
237       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,
238       U       pH,       U      pH,
      I       myThid )  
         ENDDO ! K  
   
 C Density of Nz level (bottom level) reference to Nz level  
          CALL FIND_RHO(  
      I      bi, bj, iMin, iMax, jMin, jMax,  Nz, Nz, 'LINEAR',  
      O      rhoKm1,  
239       I      myThid )       I      myThid )
240  C--     Integrate hydrostatic balance for pH with BC of pH(z=0)=0  
241           CALL CALC_PH(          ENDDO
      I       bi,bj,iMin,iMax,jMin,jMax,Nz+1,rhoKm1,  
      U       pH,  
      I       myThid )  
242    
243          DO K = Nz, 1, -1          DO K = Nz, 1, -1
244           kM1  =max(1,k-1)   ! Points to level above k (=k-1)           kM1  =max(1,k-1)   ! Points to level above k (=k-1)
# Line 197  C--      Get temporary terms used by ten Line 256  C--      Get temporary terms used by ten
256       I        myThid)       I        myThid)
257    
258  C--      Calculate accelerations in the momentum equations  C--      Calculate accelerations in the momentum equations
259           CALL CALC_MOM_RHS(           IF ( momStepping ) THEN
260       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,            CALL CALC_MOM_RHS(
261       I        xA,yA,uTrans,vTrans,wTrans,maskC,       I         bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
262       I        pH,       I         xA,yA,uTrans,vTrans,wTrans,maskC,
263       U        aTerm,xTerm,cTerm,mTerm,pTerm,       I         pH,
264       U        fZon, fMer, fVerU, fVerV,       U         aTerm,xTerm,cTerm,mTerm,pTerm,
265       I        myThid)       U         fZon, fMer, fVerU, fVerV,
266         I         myThid)
267             ENDIF
268    
269  C--      Calculate active tracer tendencies  C--      Calculate active tracer tendencies
270           CALL CALC_GT(           IF ( tempStepping ) THEN
271       I        bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,            CALL CALC_GT(
272       I        xA,yA,uTrans,vTrans,wTrans,maskUp,       I         bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
273       U        aTerm,xTerm,fZon,fMer,fVerT,       I         xA,yA,uTrans,vTrans,wTrans,maskUp,
274       I        myThid)       I         K13,K23,K33,KapGM,
275         U         aTerm,xTerm,fZon,fMer,fVerT,
276         I         myThid)
277             ENDIF
278  Cdbg     CALL CALC_GS(  Cdbg     CALL CALC_GS(
279  Cdbg I        bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,  Cdbg I        bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
280  Cdbg I        xA,yA,uTrans,vTrans,wTrans,maskUp,  Cdbg I        xA,yA,uTrans,vTrans,wTrans,maskUp,
281    Cdbg I        K13,K23,K33,KapGM,
282  Cdbg U        aTerm,xTerm,fZon,fMer,fVerS,  Cdbg U        aTerm,xTerm,fZon,fMer,fVerS,
283  Cdbg I        myThid)  Cdbg I        myThid)
284    
# Line 222  Cdbg I        myThid) Line 287  Cdbg I        myThid)
287         ENDDO         ENDDO
288        ENDDO        ENDDO
289    
290    !dbg  write(0,*) 'dynamics: pS',minval(cg2d_x),maxval(cg2d_x)
291    !dbg  write(0,*) 'dynamics: U',minval(uVel(1:sNx,1:sNy,:,:,:)),
292    !dbg &                         maxval(uVel(1:sNx,1:sNy,:,:,:))
293    !dbg  write(0,*) 'dynamics: V',minval(vVel(1:sNx,1:sNy,:,:,:)),
294    !dbg &                         maxval(vVel(1:sNx,1:sNy,:,:,:))
295    !dbg  write(0,*) 'dynamics: K13',minval(K13(1:sNx,1:sNy,:)),
296    !dbg &                         maxval(K13(1:sNx,1:sNy,:))
297    !dbg  write(0,*) 'dynamics: K23',minval(K23(1:sNx,1:sNy,:)),
298    !dbg &                         maxval(K23(1:sNx,1:sNy,:))
299    !dbg  write(0,*) 'dynamics: K33',minval(K33(1:sNx,1:sNy,:)),
300    !dbg &                         maxval(K33(1:sNx,1:sNy,:))
301    !dbg  write(0,*) 'dynamics: gT',minval(gT(1:sNx,1:sNy,:,:,:)),
302    !dbg &                         maxval(gT(1:sNx,1:sNy,:,:,:))
303    !dbg  write(0,*) 'dynamics: T',minval(Theta(1:sNx,1:sNy,:,:,:)),
304    !dbg &                         maxval(Theta(1:sNx,1:sNy,:,:,:))
305    !dbg  write(0,*) 'dynamics: pH',minval(pH/(Gravity*Rhonil)),
306    !dbg &                          maxval(pH/(Gravity*Rhonil))
307    
308        RETURN        RETURN
309        END        END

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.22