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

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

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

revision 1.12 by heimbach, Sun Mar 24 02:08:21 2002 UTC revision 1.26 by jmc, Sun May 15 03:02:08 2005 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4    #include "PACKAGES_CONFIG.h"
5  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
6    
7  CBOP  CBOP
# Line 24  C     == Global data == Line 25  C     == Global data ==
25  #include "PARAMS.h"  #include "PARAMS.h"
26  #include "DYNVARS.h"  #include "DYNVARS.h"
27  #include "GRID.h"  #include "GRID.h"
 #ifdef ALLOW_PASSIVE_TRACER  
 #include "TR1.h"  
 #endif  
28  #ifdef ALLOW_TIMEAVE  #ifdef ALLOW_TIMEAVE
29  #include "TIMEAVE_STATV.h"  #include "TIMEAVE_STATV.h"
30  #endif  #endif
# Line 54  C     !LOCAL VARIABLES: Line 52  C     !LOCAL VARIABLES:
52  C     == Local variables ==  C     == Local variables ==
53  C     rhoKm1, rhoK :: Density at adjacent levels (common ref. level)  C     rhoKm1, rhoK :: Density at adjacent levels (common ref. level)
54  C     ConvectCount :: Convection mixing freq. counter.  C     ConvectCount :: Convection mixing freq. counter.
55        INTEGER i, j, K        INTEGER i, j, K, kTop, kBottom, kDir, deltaK
56        _RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
57        _RL rhoK  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhoK  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
58        _RL ConvectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL ConvectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
# Line 63  C     ConvectCount :: Convection mixing Line 61  C     ConvectCount :: Convection mixing
61  CEOP  CEOP
62    
63  C--   Check to see if should convect now  C--   Check to see if should convect now
64        IF ( DIFFERENT_MULTIPLE(cAdjFreq,myTime,myTime-deltaTClock) ) THEN        IF ( DIFFERENT_MULTIPLE(cAdjFreq,myTime,deltaTClock)
65         &   ) THEN
66    
67    C--   Initialise counters
68            kTop    = 0
69            kBottom = 0
70            kDir    = 0
71            deltaK  = 0
72    
73  C-      Initialisation of Convection Counter  C-      Initialisation of Convection Counter
74          DO K=1,Nr          DO K=1,Nr
# Line 87  C-      Initialisation of Convection Cou Line 92  C-      Initialisation of Convection Cou
92       &                      + act4*max1*max2*max3       &                      + act4*max1*max2*max3
93  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
94    
95  #ifdef  ALLOW_KPP           IF ( rkFac*gravitySign .LT. 0. ) THEN
96          IF (  C-          <=> usingZCoords:
97       &      (.NOT.useKPP) ! CONVECT not needed with KPP mixing            kTop    =  2
98       &     ) THEN            kBottom = Nr
99  #endif  /* ALLOW_KPP */            kDir    =  1
100              deltaK  = -1
101             ELSE
102    C-          <=> usingPCoords:
103              kTop    = Nr
104              kBottom =  2
105              kDir    = -1
106              deltaK  =  0
107             ENDIF
108    
109  C--       Loop over all *interior* layers  C--       Loop over all *interior* layers
110            DO K=2,Nr            DO K=kTop,kBottom,kDir
111    
112  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
113              kkey = (ikey-1)*Nr + k              kkey = (ikey-1)*Nr + k
# Line 103  CADJ STORE salt (:,:,k-1,bi,bj) = comlev Line 116  CADJ STORE salt (:,:,k-1,bi,bj) = comlev
116  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
117  C-          Density of K-1 layer (above W(K)) reference to K-1 T-level  C-          Density of K-1 layer (above W(K)) reference to K-1 T-level
118              CALL FIND_RHO(              CALL FIND_RHO(
119       I           bi,bj,iMin,iMax,jMin,jMax,K-1,K-1,eosType,       I           bi,bj,iMin,iMax,jMin,jMax,K-1,K+deltaK,
120       I           theta,salt,       I           theta,salt,
121       O           rhoKm1,       O           rhoKm1,
122       I           myThid )       I           myThid )
# Line 114  CADJ STORE theta(:,:,k,bi,bj) = comlev1_ Line 127  CADJ STORE theta(:,:,k,bi,bj) = comlev1_
127  CADJ STORE salt (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ STORE salt (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte
128  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
129              CALL FIND_RHO(              CALL FIND_RHO(
130       I           bi,bj,iMin,iMax,jMin,jMax,K,K-1,eosType,       I           bi,bj,iMin,iMax,jMin,jMax,K,K+deltaK,
131       I           theta,salt,       I           theta,salt,
132       O           rhoK,       O           rhoK,
133       I           myThid )       I           myThid )
# Line 147  C-          Convectively mix salt across Line 160  C-          Convectively mix salt across
160       U                              salt,       U                              salt,
161       I                              myThid)       I                              myThid)
162    
 #ifdef ALLOW_PASSIVE_TRACER  
 C-          Convectively mix passive tracer across interface K  
             CALL CONVECTIVELY_MIXTRACER(  
      I                              bi,bj,k,weightA,weightB,  
      U                              Tr1,  
      I                              myThid)  
 #endif /* ALLOW_PASSIVE_TRACER */  
   
163  #ifdef ALLOW_PTRACERS  #ifdef ALLOW_PTRACERS
164  C-          Convectively mix passive tracers across interface K  C-          Convectively mix passive tracers across interface K
165              IF ( usePTRACERS ) THEN              IF ( usePTRACERS ) THEN
# Line 167  C--       End DO K=1,Nr Line 172  C--       End DO K=1,Nr
172            ENDDO            ENDDO
173                
174  #ifdef ALLOW_TIMEAVE  #ifdef ALLOW_TIMEAVE
175    #ifndef MINIMAL_TAVE_OUTPUT
176    ceh3 needs an IF ( useTIMEAVE ) THEN
177            IF (myIter.ne.nIter0 .AND. taveFreq.GT.0.) THEN            IF (myIter.ne.nIter0 .AND. taveFreq.GT.0.) THEN
178              CALL TIMEAVE_CUMULATE(ConvectCountTave, ConvectCount, Nr,              CALL TIMEAVE_CUMUL_1T(ConvectCountTave, ConvectCount,
179       I                               deltaTclock, bi, bj, myThid)       I                            Nr, deltaTclock, bi, bj, myThid)
180            ENDIF            ENDIF
181    #endif /* ndef MINIMAL_TAVE_OUTPUT */
182  #endif /* ALLOW_TIMEAVE */  #endif /* ALLOW_TIMEAVE */
183    
 #ifdef  ALLOW_KPP  
 C--     End IF (.NOT.useKPP)  
         ENDIF  
 #endif  /* ALLOW_KPP */  
   
184  C--   End IF (DIFFERENT_MULTIPLE)  C--   End IF (DIFFERENT_MULTIPLE)
185        ENDIF        ENDIF
186    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.22