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

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

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


Revision 1.33 - (show annotations) (download)
Fri Feb 13 21:56:48 2009 UTC (15 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62c, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint63g, checkpoint64, checkpoint62, checkpoint63, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint62b, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint61n, checkpoint61q, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.32: +21 -11 lines
Add TAF option "kind" (or adjust "byte") to enable real*4 common blocks

1 C $Header: /u/gcmpack/MITgcm/model/src/convective_adjustment.F,v 1.32 2008/08/11 22:25:52 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: CONVECTIVE_ADJUSTMENT
9 C !INTERFACE:
10 SUBROUTINE CONVECTIVE_ADJUSTMENT(
11 I bi, bj, myTime, myIter, myThid )
12 C !DESCRIPTION: \bv
13 C *==========================================================*
14 C | SUBROUTINE CONVECTIVE_ADJUSTMENT
15 C | o Driver for vertical mixing or similar parameterization
16 C *==========================================================*
17 C \ev
18
19 C !USES:
20 IMPLICIT NONE
21 C == Global data ==
22 #include "SIZE.h"
23 #include "EEPARAMS.h"
24 #include "PARAMS.h"
25 #include "DYNVARS.h"
26 #include "GRID.h"
27 #ifdef ALLOW_TIMEAVE
28 #include "TIMEAVE_STATV.h"
29 #endif
30 #ifdef ALLOW_AUTODIFF_TAMC
31 #include "tamc.h"
32 #include "tamc_keys.h"
33 #endif /* ALLOW_AUTODIFF_TAMC */
34 EXTERNAL DIFFERENT_MULTIPLE
35 LOGICAL DIFFERENT_MULTIPLE
36
37 C !INPUT/OUTPUT PARAMETERS:
38 C == Routine arguments ==
39 C bi,bj :: tile indices
40 C myTime :: Current time in simulation
41 C myIter :: Current iteration in simulation
42 C myThid :: My Thread Id number
43 INTEGER bi,bj
44 _RL myTime
45 INTEGER myIter
46 INTEGER myThid
47
48 #ifdef INCLUDE_CONVECT_CALL
49
50 C !LOCAL VARIABLES:
51 C == Local variables ==
52 C iMin,iMax,jMin,jMax :: computation domain
53 C i,j,K :: Loop counters
54 C rhoKm1, rhoK :: Density at adjacent levels (common ref. level)
55 C ConvectCount :: Convection mixing freq. counter.
56 INTEGER iMin,iMax,jMin,jMax
57 INTEGER i, j, K, kTop, kBottom, kDir, deltaK
58 _RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
59 _RL rhoK (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
60 _RL ConvectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
61 _RL weightA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
62 _RL weightB(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
63 CEOP
64
65 C-- Check to see if should convect now
66 IF ( DIFFERENT_MULTIPLE(cAdjFreq,myTime,deltaTClock)
67 & ) THEN
68
69 C-- Define computation domain
70 c iMin = 1
71 c iMax = sNx
72 c jMin = 1
73 c jMax = sNy
74 iMin=1-Olx
75 iMax=sNx+Olx
76 jMin=1-Oly
77 jMax=sNy+Oly
78
79 C-- Initialise counters
80 kTop = 0
81 kBottom = 0
82 kDir = 0
83 deltaK = 0
84
85 C- Initialisation of Convection Counter
86 DO K=1,Nr
87 DO j=1-OLy,sNy+OLy
88 DO i=1-OLx,sNx+OLx
89 ConvectCount(i,j,K) = 0.
90 ENDDO
91 ENDDO
92 ENDDO
93
94 #ifdef ALLOW_AUTODIFF_TAMC
95 act1 = bi - myBxLo(myThid)
96 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
97 act2 = bj - myByLo(myThid)
98 max2 = myByHi(myThid) - myByLo(myThid) + 1
99 act3 = myThid - 1
100 max3 = nTx*nTy
101 act4 = ikey_dynamics - 1
102 ikey = (act1 + 1) + act2*max1
103 & + act3*max1*max2
104 & + act4*max1*max2*max3
105 #endif /* ALLOW_AUTODIFF_TAMC */
106
107 IF ( rkSign*gravitySign .GT. 0. ) THEN
108 C- <=> usingZCoords:
109 kTop = 2
110 kBottom = Nr
111 kDir = 1
112 deltaK = -1
113 ELSE
114 C- <=> usingPCoords:
115 kTop = Nr
116 kBottom = 2
117 kDir = -1
118 deltaK = 0
119 ENDIF
120
121 #ifdef ALLOW_AUTODIFF_TAMC
122 CADJ STORE theta(:,:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte,
123 CADJ & kind = isbyte
124 CADJ STORE salt (:,:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte,
125 CADJ & kind = isbyte
126 CADJ STORE convectcount(:,:,:) = comlev1_bibj, key=ikey, byte=isbyte,
127 CADJ & kind = isbyte
128 #endif
129
130 C-- Loop over all *interior* layers
131 DO K=kTop,kBottom,kDir
132
133 #ifdef ALLOW_AUTODIFF_TAMC
134 kkey = (ikey-1)*Nr + k
135 CADJ STORE theta(:,:,k-1,bi,bj) = comlev1_bibj_k,key=kkey,byte=isbyte,
136 CADJ & kind = isbyte
137 CADJ STORE salt (:,:,k-1,bi,bj) = comlev1_bibj_k,key=kkey,byte=isbyte,
138 CADJ & kind = isbyte
139 CADJ STORE convectcount(:,:,k-1) = comlev1_bibj_k,key=kkey,byte=isbyte,
140 CADJ & kind = isbyte
141 #endif /* ALLOW_AUTODIFF_TAMC */
142 C- Density of K-1 layer (above W(K)) reference to K-1 T-level
143 CALL FIND_RHO_2D(
144 I iMin, iMax, jMin, jMax, K+deltaK,
145 I theta(1-OLx,1-OLy,K-1,bi,bj),
146 I salt (1-OLx,1-OLy,K-1,bi,bj),
147 O rhoKm1,
148 I K-1, bi, bj, myThid )
149
150 C- Density of K layer (below W(K)) reference to K-1 T-level.
151 #ifdef ALLOW_AUTODIFF_TAMC
152 CADJ STORE theta(:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte,
153 CADJ & kind = isbyte
154 CADJ STORE salt (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte,
155 CADJ & kind = isbyte
156 #endif /* ALLOW_AUTODIFF_TAMC */
157 CALL FIND_RHO_2D(
158 I iMin, iMax, jMin, jMax, K+deltaK,
159 I theta(1-OLx,1-OLy,K,bi,bj),
160 I salt (1-OLx,1-OLy,K,bi,bj),
161 O rhoK,
162 I K, bi, bj, myThid )
163
164 #ifdef ALLOW_AUTODIFF_TAMC
165 CADJ STORE rhoKm1(:,:) = comlev1_bibj_k, key = kkey, byte = isbyte,
166 CADJ & kind = isbyte
167 CADJ STORE rhoK (:,:) = comlev1_bibj_k, key = kkey, byte = isbyte,
168 CADJ & kind = isbyte
169 #endif /* ALLOW_AUTODIFF_TAMC */
170 C- Check static stability with layer below and mix as needed.
171 c CALL CONVECT(
172 c I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoK,
173 c U ConvectCount,
174 c I myTime,myIter,myThid)
175
176 C- Pre-calculate mixing weights for interface K
177 CALL CONVECTIVE_WEIGHTS(
178 I bi,bj,K,rhoKm1,rhoK,
179 O weightA,weightB,ConvectCount,
180 I myThid)
181
182 C- Convectively mix heat across interface K
183 CALL CONVECTIVELY_MIXTRACER(
184 I bi,bj,k,weightA,weightB,
185 U theta,
186 I myThid)
187
188 C- Convectively mix salt across interface K
189 CALL CONVECTIVELY_MIXTRACER(
190 I bi,bj,k,weightA,weightB,
191 U salt,
192 I myThid)
193
194 #ifdef ALLOW_PTRACERS
195 C- Convectively mix passive tracers across interface K
196 IF ( usePTRACERS ) THEN
197 CALL PTRACERS_CONVECT(
198 I bi,bj,k,weightA,weightB,myThid)
199 ENDIF
200 #endif /* ALLOW_PTRACERS */
201
202 C-- End DO K=1,Nr
203 ENDDO
204
205 #ifdef ALLOW_TIMEAVE
206 IF (myIter.NE.nIter0 .AND. taveFreq.GT.0.) THEN
207 CALL TIMEAVE_CUMUL_1T(ConvectCountTave, ConvectCount,
208 I Nr, deltaTclock, bi, bj, myThid)
209 ENDIF
210 #endif /* ALLOW_TIMEAVE */
211
212 #ifdef ALLOW_DIAGNOSTICS
213 IF ( myIter.NE.nIter0 .AND. useDiagnostics ) THEN
214 CALL DIAGNOSTICS_FILL( ConvectCount, 'CONVADJ ',
215 I 0, Nr, 2, bi, bj, myThid )
216 ENDIF
217 #endif /* ALLOW_DIAGNOSTICS */
218
219 C-- End IF (DIFFERENT_MULTIPLE)
220 ENDIF
221
222 #endif /* INCLUDE_CONVECT_CALL */
223
224 RETURN
225 END

  ViewVC Help
Powered by ViewVC 1.1.22