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

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

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


Revision 1.22 - (show annotations) (download)
Mon Aug 11 22:25:52 2008 UTC (15 years, 9 months ago) by jmc
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, checkpoint61f, checkpoint61n, checkpoint61q, checkpoint61e, checkpoint61g, checkpoint61d, checkpoint61c, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.21: +14 -12 lines
replace calls to "FIND_RHO" with recent version "FIND_RHO_2D"

1 C $Header: /u/gcmpack/MITgcm/model/src/convective_adjustment_ini.F,v 1.21 2008/06/19 17:21:24 heimbach Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: CONVECTIVE_ADJUSTMENT_INI
9 C !INTERFACE:
10 SUBROUTINE CONVECTIVE_ADJUSTMENT_INI(
11 I bi, bj, myTime, myIter, myThid )
12 C !DESCRIPTION: \bv
13 C *==========================================================*
14 C | SUBROUTINE CONVECTIVE_ADJUSTMENT_INI
15 C | o Driver for vertical mixing or similar parameterization
16 C *==========================================================*
17 C | Same prognostic code logic as S/R CONVECTIVE_ADJUSTMENT,
18 C | but different time history behavior in forward-reverse
19 C | adjoint operation.
20 C *==========================================================*
21 C \ev
22
23 C !USES:
24 IMPLICIT NONE
25 C == Global data ==
26 #include "SIZE.h"
27 #include "EEPARAMS.h"
28 #include "PARAMS.h"
29 #include "DYNVARS.h"
30 #include "GRID.h"
31 #ifdef ALLOW_TIMEAVE
32 #include "TIMEAVE_STATV.h"
33 #endif
34 #ifdef ALLOW_AUTODIFF_TAMC
35 #include "tamc.h"
36 #include "tamc_keys.h"
37 #endif /* ALLOW_AUTODIFF_TAMC */
38 EXTERNAL DIFFERENT_MULTIPLE
39 LOGICAL DIFFERENT_MULTIPLE
40
41 C !INPUT/OUTPUT PARAMETERS:
42 C == Routine arguments ==
43 C bi,bj :: tile indices
44 C myTime :: Current time in simulation
45 C myIter :: Current iteration in simulation
46 C myThid :: Thread number of this instance of S/R CONVECT
47 INTEGER bi,bj
48 _RL myTime
49 INTEGER myIter
50 INTEGER myThid
51
52 #ifdef INCLUDE_CONVECT_CALL
53
54 C !LOCAL VARIABLES:
55 C == Local variables ==
56 C iMin,iMax,jMin,jMax :: computation domain
57 C i,j,k :: Loop counters
58 C rhoKm1, rhoK :: Density at adjacent levels (ref. to same level)
59 C ConvectCount :: Convection freq. counter
60 INTEGER iMin,iMax,jMin,jMax
61 INTEGER i, j, K, kTop, kBottom, kDir, deltaK
62 _RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
63 _RL rhoK (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
64 _RL ConvectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
65 _RL weightA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
66 _RL weightB(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
67 CEOP
68
69 C-- Check to see if should convect now
70 IF ( DIFFERENT_MULTIPLE(cAdjFreq,myTime,deltaTClock)
71 & ) THEN
72
73 C-- Define computation domain
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 = 0
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) = tapelev_ini_bibj,
123 CADJ & key=ikey, byte=isbyte
124 CADJ STORE salt (:,:,:,bi,bj) = tapelev_ini_bibj,
125 CADJ & key=ikey, byte=isbyte
126 CADJ STORE convectcount(:,:,:) = tapelev_ini_bibj,
127 CADJ & key=ikey, byte=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) = tapelev_ini_bibj_k,
136 CADJ & key=kkey, byte=isbyte
137 CADJ STORE salt (:,:,k-1,bi,bj) = tapelev_ini_bibj_k,
138 CADJ & key=kkey, byte=isbyte
139 CADJ STORE convectcount(:,:,k-1) = tapelev_ini_bibj_k,
140 CADJ & key=kkey, byte=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) = tapelev_ini_bibj_k,
153 CADJ & key = kkey, byte = isbyte
154 CADJ STORE salt (:,:,k,bi,bj) = tapelev_ini_bibj_k,
155 CADJ & key = kkey, byte = 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(:,:) = tapelev_ini_bibj_k, key=kkey, byte=isbyte
166 CADJ STORE rhoK (:,:) = tapelev_ini_bibj_k, key=kkey, byte=isbyte
167 #endif /* ALLOW_AUTODIFF_TAMC */
168 C- Check static stability with layer below and mix as needed.
169 c CALL CONVECT(
170 c I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoK,
171 c U ConvectCount,
172 c I myTime,myIter,myThid)
173
174 C- Pre-calculate mixing weights for interface K
175 CALL CONVECTIVE_WEIGHTS(
176 I bi,bj,K,rhoKm1,rhoK,
177 O weightA,weightB,ConvectCount,
178 I myThid)
179
180 C- Convectively mix heat across interface K
181 CALL CONVECTIVELY_MIXTRACER(
182 I bi,bj,k,weightA,weightB,
183 U theta,
184 I myThid)
185
186 C- Convectively mix salt across interface K
187 CALL CONVECTIVELY_MIXTRACER(
188 I bi,bj,k,weightA,weightB,
189 U salt,
190 I myThid)
191
192 #ifdef ALLOW_PTRACERS
193 C- Convectively mix passive tracers across interface K
194 IF ( usePTRACERS ) THEN
195 CALL PTRACERS_CONVECT(
196 I bi,bj,k,weightA,weightB,myThid)
197 ENDIF
198 #endif /* ALLOW_PTRACERS */
199
200 C-- End DO K=1,Nr
201 ENDDO
202
203 C-- End IF (DIFFERENT_MULTIPLE)
204 ENDIF
205
206 #endif /* INCLUDE_CONVECT_CALL */
207
208 RETURN
209 END

  ViewVC Help
Powered by ViewVC 1.1.22