/[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.34 by cnh, Mon Sep 7 16:23:11 1998 UTC revision 1.40 by adcroft, Wed Dec 9 16:11:51 1998 UTC
# Line 20  C     | ===== Line 20  C     | =====
20  C     | C*P* comments indicating place holders for which code is |  C     | C*P* comments indicating place holders for which code is |
21  C     |      presently being developed.                          |  C     |      presently being developed.                          |
22  C     \==========================================================/  C     \==========================================================/
23          IMPLICIT NONE
24    
25  C     == Global variables ===  C     == Global variables ===
26  #include "SIZE.h"  #include "SIZE.h"
# Line 38  C     myThid - Thread number for this in Line 39  C     myThid - Thread number for this in
39    
40  C     == Local variables  C     == Local variables
41  C     xA, yA                 - Per block temporaries holding face areas  C     xA, yA                 - Per block temporaries holding face areas
42  C     uTrans, vTrans, rTrans - Per block temporaries holding flow transport  C     uTrans, vTrans, rTrans - Per block temporaries holding flow
43    C                              transport
44  C     rVel                     o uTrans: Zonal transport  C     rVel                     o uTrans: Zonal transport
45  C                              o vTrans: Meridional transport  C                              o vTrans: Meridional transport
46  C                              o rTrans: Vertical transport  C                              o rTrans: Vertical transport
47  C                              o rVel:   Vertical velocity at upper and lower  C                              o rVel:   Vertical velocity at upper and
48  C                                        cell faces.  C                                        lower cell faces.
49  C     maskC,maskUp             o maskC: land/water mask for tracer cells  C     maskC,maskUp             o maskC: land/water mask for tracer cells
50  C                              o maskUp: land/water mask for W points  C                              o maskUp: land/water mask for W points
51  C     aTerm, xTerm, cTerm    - Work arrays for holding separate terms in  C     aTerm, xTerm, cTerm    - Work arrays for holding separate terms in
# Line 59  C                              o fVer: V Line 61  C                              o fVer: V
61  C                                      is "pipelined" in the vertical  C                                      is "pipelined" in the vertical
62  C                                      so we need an fVer for each  C                                      so we need an fVer for each
63  C                                      variable.  C                                      variable.
64  C     rhoK, rhoKM1   - Density at current level, level above and level below.  C     rhoK, rhoKM1   - Density at current level, level above and level
65    C                      below.
66  C     rhoKP1                                                                    C     rhoKP1                                                                  
67  C     buoyK, buoyKM1 - Buoyancy at current level and level above.  C     buoyK, buoyKM1 - Buoyancy at current level and level above.
68  C     phiHyd         - Hydrostatic part of the potential phiHydi.  C     phiHyd         - Hydrostatic part of the potential phiHydi.
69  C                      In z coords phiHydiHyd is the hydrostatic pressure anomaly  C                      In z coords phiHydiHyd is the hydrostatic
70  C                      In p coords phiHydiHyd is the geopotential surface height  C                      pressure anomaly
71    C                      In p coords phiHydiHyd is the geopotential
72    C                      surface height
73  C                      anomaly.  C                      anomaly.
74  C     etaSurfX,      - Holds surface elevation gradient in X and Y.  C     etaSurfX,      - Holds surface elevation gradient in X and Y.
75  C     etaSurfY  C     etaSurfY
# Line 72  C     K13, K23, K33  - Non-zero elements Line 77  C     K13, K23, K33  - Non-zero elements
77  C                      diffusion tensor.  C                      diffusion tensor.
78  C     KapGM          - Spatially varying Visbeck et. al mixing coeff.  C     KapGM          - Spatially varying Visbeck et. al mixing coeff.
79  C     KappaRT,       - Total diffusion in vertical for T and S.  C     KappaRT,       - Total diffusion in vertical for T and S.
80  C     KappaRS          ( background + spatially varying, isopycnal term).  C     KappaRS          (background + spatially varying, isopycnal term).
81  C     iMin, iMax     - Ranges and sub-block indices on which calculations  C     iMin, iMax     - Ranges and sub-block indices on which calculations
82  C     jMin, jMax       are applied.  C     jMin, jMax       are applied.
83  C     bi, bj  C     bi, bj
84  C     k, kUp,        - Index for layer above and below. kUp and kDown  C     k, kUp,        - Index for layer above and below. kUp and kDown
85  C     kDown, kM1       are switched with layer to be the appropriate index  C     kDown, kM1       are switched with layer to be the appropriate
86  C                      into fVerTerm  C                      index into fVerTerm.
87        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS xA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
88        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RS yA      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 202  C     uninitialised but inert locations. Line 207  C     uninitialised but inert locations.
207         ENDDO         ENDDO
208        ENDDO        ENDDO
209    
210    
211        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
212         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
213    
# Line 232  C--     Set up work arrays that need val Line 238  C--     Set up work arrays that need val
238          jMin = 1-OLy+1          jMin = 1-OLy+1
239          jMax = sNy+OLy          jMax = sNy+OLy
240    
241    
242          K = 1          K = 1
243          BOTTOM_LAYER = K .EQ. Nr          BOTTOM_LAYER = K .EQ. Nr
244    
245    #ifdef DO_PIPELINED_CORRECTION_STEP
246  C--     Calculate gradient of surface pressure  C--     Calculate gradient of surface pressure
247          CALL CALC_GRAD_ETA_SURF(          CALL CALC_GRAD_ETA_SURF(
248       I       bi,bj,iMin,iMax,jMin,jMax,       I       bi,bj,iMin,iMax,jMin,jMax,
# Line 244  C--     Update fields in top level accor Line 252  C--     Update fields in top level accor
252          CALL CORRECTION_STEP(          CALL CORRECTION_STEP(
253       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
254       I       etaSurfX,etaSurfY,myTime,myThid)       I       etaSurfX,etaSurfY,myTime,myThid)
255            IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K, myThid )
256          IF ( .NOT. BOTTOM_LAYER ) THEN          IF ( .NOT. BOTTOM_LAYER ) THEN
257  C--      Update fields in layer below according to tendency terms  C--      Update fields in layer below according to tendency terms
258           CALL CORRECTION_STEP(           CALL CORRECTION_STEP(
259       I        bi,bj,iMin,iMax,jMin,jMax,K+1,       I        bi,bj,iMin,iMax,jMin,jMax,K+1,
260       I        etaSurfX,etaSurfY,myTime,myThid)       I        etaSurfX,etaSurfY,myTime,myThid)
261             IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )
262          ENDIF          ENDIF
263    #endif
264  C--     Density of 1st level (below W(1)) reference to level 1  C--     Density of 1st level (below W(1)) reference to level 1
265    #ifdef  INCLUDE_FIND_RHO_CALL
266          CALL FIND_RHO(          CALL FIND_RHO(
267       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
268       O     rhoKm1,       O     rhoKm1,
269       I     myThid )       I     myThid )
270    #endif
271    
272          IF ( .NOT. BOTTOM_LAYER ) THEN          IF ( .NOT. BOTTOM_LAYER ) THEN
273  C--      Check static stability with layer below  C--      Check static stability with layer below
274  C--      and mix as needed.  C--      and mix as needed.
275    #ifdef  INCLUDE_FIND_RHO_CALL
276           CALL FIND_RHO(           CALL FIND_RHO(
277       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,
278       O      rhoKp1,       O      rhoKp1,
279       I      myThid )       I      myThid )
280    #endif
281    #ifdef  INCLUDE_CONVECT_CALL
282           CALL CONVECT(           CALL CONVECT(
283       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
284       I       myTime,myIter,myThid)       I       myTime,myIter,myThid)
285    #endif
286  C--      Recompute density after mixing  C--      Recompute density after mixing
287    #ifdef  INCLUDE_FIND_RHO_CALL
288           CALL FIND_RHO(           CALL FIND_RHO(
289       I      bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
290       O      rhoKm1,       O      rhoKm1,
291       I      myThid )       I      myThid )
292    #endif
293          ENDIF          ENDIF
294  C--     Calculate buoyancy  C--     Calculate buoyancy
295          CALL CALC_BUOYANCY(          CALL CALC_BUOYANCY(
296       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,       I      bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,
297       O      buoyKm1,       O      buoyKm1,
298       I      myThid )       I      myThid )
299  C--     Integrate hydrostatic balance for phiHyd with BC of phiHyd(z=0)=0  C--     Integrate hydrostatic balance for phiHyd with BC of
300    C--     phiHyd(z=0)=0
301          CALL CALC_PHI_HYD(          CALL CALC_PHI_HYD(
302       I      bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1,       I      bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1,
303       U      phiHyd,       U      phiHyd,
# Line 285  C--     Integrate hydrostatic balance fo Line 305  C--     Integrate hydrostatic balance fo
305    
306          DO K=2,Nr          DO K=2,Nr
307           BOTTOM_LAYER = K .EQ. Nr           BOTTOM_LAYER = K .EQ. Nr
308    #ifdef DO_PIPELINED_CORRECTION_STEP
309           IF ( .NOT. BOTTOM_LAYER ) THEN           IF ( .NOT. BOTTOM_LAYER ) THEN
310  C--       Update fields in layer below according to tendency terms  C--       Update fields in layer below according to tendency terms
311            CALL CORRECTION_STEP(            CALL CORRECTION_STEP(
312       I         bi,bj,iMin,iMax,jMin,jMax,K+1,       I         bi,bj,iMin,iMax,jMin,jMax,K+1,
313       I         etaSurfX,etaSurfY,myTime,myThid)       I         etaSurfX,etaSurfY,myTime,myThid)
314              IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )
315           ENDIF           ENDIF
316    #endif
317  C--      Density of K level (below W(K)) reference to K level  C--      Density of K level (below W(K)) reference to K level
318    #ifdef  INCLUDE_FIND_RHO_CALL
319           CALL FIND_RHO(           CALL FIND_RHO(
320       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,
321       O      rhoK,       O      rhoK,
322       I      myThid )       I      myThid )
323    #endif
324           IF ( .NOT. BOTTOM_LAYER ) THEN           IF ( .NOT. BOTTOM_LAYER ) THEN
325  C--       Check static stability with layer below and mix as needed.  C--       Check static stability with layer below and mix as needed.
326  C--       Density of K+1 level (below W(K+1)) reference to K level.  C--       Density of K+1 level (below W(K+1)) reference to K level.
327    #ifdef  INCLUDE_FIND_RHO_CALL
328            CALL FIND_RHO(            CALL FIND_RHO(
329       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,
330       O       rhoKp1,       O       rhoKp1,
331       I       myThid )       I       myThid )
332    #endif
333    #ifdef  INCLUDE_CONVECT_CALL
334            CALL CONVECT(            CALL CONVECT(
335       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,
336       I        myTime,myIter,myThid)       I        myTime,myIter,myThid)
337    #endif
338  C--       Recompute density after mixing  C--       Recompute density after mixing
339    #ifdef  INCLUDE_FIND_RHO_CALL
340            CALL FIND_RHO(            CALL FIND_RHO(
341       I       bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I       bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
342       O       rhoK,       O       rhoK,
343       I       myThid )       I       myThid )
344    #endif
345           ENDIF           ENDIF
346  C--      Calculate buoyancy  C--      Calculate buoyancy
347           CALL CALC_BUOYANCY(           CALL CALC_BUOYANCY(
348       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoK,       I       bi,bj,iMin,iMax,jMin,jMax,K,rhoK,
349       O       buoyK,       O       buoyK,
350       I       myThid )       I       myThid )
351  C--      Integrate hydrostatic balance for phiHyd with BC of phiHyd(z=0)=0  C--      Integrate hydrostatic balance for phiHyd with BC of
352    C--      phiHyd(z=0)=0
353           CALL CALC_PHI_HYD(           CALL CALC_PHI_HYD(
354       I        bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK,       I        bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK,
355       U        phiHyd,       U        phiHyd,
356       I        myThid )       I        myThid )
357  C--      Calculate iso-neutral slopes for the GM/Redi parameterisation  C--      Calculate iso-neutral slopes for the GM/Redi parameterisation
358    #ifdef  INCLUDE_FIND_RHO_CALL
359           CALL FIND_RHO(           CALL FIND_RHO(
360       I        bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,       I        bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,
361       O        rhoTmp,       O        rhoTmp,
362       I        myThid )       I        myThid )
363    #endif
364    #ifdef  INCLUDE_CALC_ISOSLOPES_CALL
365           CALL CALC_ISOSLOPES(           CALL CALC_ISOSLOPES(
366       I        bi, bj, iMin, iMax, jMin, jMax, K,       I        bi, bj, iMin, iMax, jMin, jMax, K,
367       I        rhoKm1, rhoK, rhotmp,       I        rhoKm1, rhoK, rhotmp,
368       O        K13, K23, K33, KapGM,       O        K13, K23, K33, KapGM,
369       I        myThid )       I        myThid )
370    #endif
371           DO J=jMin,jMax           DO J=jMin,jMax
372            DO I=iMin,iMax            DO I=iMin,iMax
373    #ifdef  INCLUDE_FIND_RHO_CALL
374             rhoKm1 (I,J) = rhoK(I,J)             rhoKm1 (I,J) = rhoK(I,J)
375    #endif
376             buoyKm1(I,J) = buoyK(I,J)             buoyKm1(I,J) = buoyK(I,J)
377            ENDDO            ENDDO
378           ENDDO           ENDDO
# Line 355  C--      Get temporary terms used by ten Line 393  C--      Get temporary terms used by ten
393       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
394       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,
395       I        myThid)       I        myThid)
396  CcnhDebugStarts  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
 C        IF ( K .EQ. 1 ) THEN  
 C          CALL PLOT_FIELD_XYRL( rVel(1,1,1), 'K=1 Current rVel.1 ' , myIter, myThid )  
 C          CALL PLOT_FIELD_XYRL( rVel(1,1,2), 'K=1 Current rVel.2 ' , myIter, myThid )  
 C        ENDIF  
 CcnhDebugEnds  
397  C--      Calculate the total vertical diffusivity  C--      Calculate the total vertical diffusivity
398           CALL CALC_DIFFUSIVITY(           CALL CALC_DIFFUSIVITY(
399       I        bi,bj,iMin,iMax,jMin,jMax,K,       I        bi,bj,iMin,iMax,jMin,jMax,K,
400       I        maskC,maskUp,KapGM,K33,       I        maskC,maskUp,KapGM,K33,
401       O        KappaRT,KappaRS,       O        KappaRT,KappaRS,
402       I        myThid)       I        myThid)
403    #endif
404  C--      Calculate accelerations in the momentum equations  C--      Calculate accelerations in the momentum equations
405           IF ( momStepping ) THEN           IF ( momStepping ) THEN
406            CALL CALC_MOM_RHS(            CALL CALC_MOM_RHS(
# Line 375  C--      Calculate accelerations in the Line 409  C--      Calculate accelerations in the
409       I         phiHyd,       I         phiHyd,
410       U         aTerm,xTerm,cTerm,mTerm,pTerm,       U         aTerm,xTerm,cTerm,mTerm,pTerm,
411       U         fZon, fMer, fVerU, fVerV,       U         fZon, fMer, fVerU, fVerV,
412       I         myThid)       I         myTime, myThid)
413           ENDIF           ENDIF
414  C--      Calculate active tracer tendencies  C--      Calculate active tracer tendencies
415           IF ( tempStepping ) THEN           IF ( tempStepping ) THEN
# Line 384  C--      Calculate active tracer tendenc Line 418  C--      Calculate active tracer tendenc
418       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
419       I         K13,K23,KappaRT,KapGM,       I         K13,K23,KappaRT,KapGM,
420       U         aTerm,xTerm,fZon,fMer,fVerT,       U         aTerm,xTerm,fZon,fMer,fVerT,
421       I         myThid)       I         myTime, myThid)
422           ENDIF           ENDIF
423           IF ( saltStepping ) THEN           IF ( saltStepping ) THEN
424            CALL CALC_GS(            CALL CALC_GS(
# Line 392  C--      Calculate active tracer tendenc Line 426  C--      Calculate active tracer tendenc
426       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,       I         xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
427       I         K13,K23,KappaRS,KapGM,       I         K13,K23,KappaRS,KapGM,
428       U         aTerm,xTerm,fZon,fMer,fVerS,       U         aTerm,xTerm,fZon,fMer,fVerS,
429       I         myThid)       I         myTime, myThid)
430           ENDIF           ENDIF
431  C--      Prediction step (step forward all model variables)  C--      Prediction step (step forward all model variables)
432           CALL TIMESTEP(           CALL TIMESTEP(
433       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
434       I       myThid)       I       myThid)
435             IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid )
436  C--      Diagnose barotropic divergence of predicted fields  C--      Diagnose barotropic divergence of predicted fields
437           CALL CALC_DIV_GHAT(           CALL CALC_DIV_GHAT(
438       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
# Line 405  C--      Diagnose barotropic divergence Line 440  C--      Diagnose barotropic divergence
440       I       myThid)       I       myThid)
441    
442  C--      Cumulative diagnostic calculations (ie. time-averaging)  C--      Cumulative diagnostic calculations (ie. time-averaging)
443  #ifdef ALLOW_DIAGNOSTICS  #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE
444           IF (taveFreq.GT.0.) THEN           IF (taveFreq.GT.0.) THEN
445            CALL DO_TIME_AVERAGES(            CALL DO_TIME_AVERAGES(
446       I                           myTime, myIter, bi, bj, K, kUp, kDown,       I                           myTime, myIter, bi, bj, K, kUp, kDown,
# Line 454  C     write(0,*) 'dynamics: S  ',minval( Line 489  C     write(0,*) 'dynamics: S  ',minval(
489  C    &                           maxval(salt(1:sNx,1:sNy,:,:,:))  C    &                           maxval(salt(1:sNx,1:sNy,:,:,:))
490  C     write(0,*) 'dynamics: phiHyd ',minval(phiHyd/(Gravity*Rhonil),mask=phiHyd.NE.0.),  C     write(0,*) 'dynamics: phiHyd ',minval(phiHyd/(Gravity*Rhonil),mask=phiHyd.NE.0.),
491  C    &                           maxval(phiHyd/(Gravity*Rhonil))  C    &                           maxval(phiHyd/(Gravity*Rhonil))
492    C     CALL PLOT_FIELD_XYZRL( gU, ' GU exiting dyanmics ' ,
493    C    &Nr, 1, myThid )
494    C     CALL PLOT_FIELD_XYZRL( gV, ' GV exiting dyanmics ' ,
495    C    &Nr, 1, myThid )
496    C     CALL PLOT_FIELD_XYZRL( gS, ' GS exiting dyanmics ' ,
497    C    &Nr, 1, myThid )
498    C     CALL PLOT_FIELD_XYZRL( gT, ' GT exiting dyanmics ' ,
499    C    &Nr, 1, myThid )
500    C     CALL PLOT_FIELD_XYZRL( phiHyd, ' phiHyd exiting dyanmics ' ,
501    C    &Nr, 1, myThid )
502    
503    
504        RETURN        RETURN
505        END        END

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.22