1 | |
---|
2 | ! $Id: calwake.F90 2671 2016-10-16 16:10:59Z fairhead $ |
---|
3 | |
---|
4 | SUBROUTINE calwake(iflag_wake_tend, paprs, pplay, dtime, & |
---|
5 | t, q, omgb, & |
---|
6 | dt_dwn, dq_dwn, m_dwn, m_up, dt_a, dq_a, & |
---|
7 | sigd, & |
---|
8 | wake_deltat, wake_deltaq, wake_s, wake_dens, & |
---|
9 | wake_dth, wake_h, & |
---|
10 | wake_pe, wake_fip, wake_gfl, & |
---|
11 | dt_wake, dq_wake, wake_k, t_x, q_x, wake_omgbdth, & |
---|
12 | wake_dp_omgb, & |
---|
13 | wake_dtke, wake_dqke, & |
---|
14 | wake_omg, wake_dp_deltomg, & |
---|
15 | wake_spread, wake_cstar, wake_d_deltat_gw, & |
---|
16 | wake_ddeltat, wake_ddeltaq, wake_ds, wake_ddens) |
---|
17 | ! ************************************************************** |
---|
18 | ! * |
---|
19 | ! CALWAKE * |
---|
20 | ! interface avec le schema de calcul de la poche * |
---|
21 | ! froide * |
---|
22 | ! * |
---|
23 | ! written by : CHERUY Frederique, 13/03/2000, 10.31.05 * |
---|
24 | ! modified by : ROEHRIG Romain, 01/30/2007 * |
---|
25 | ! ************************************************************** |
---|
26 | |
---|
27 | USE dimphy |
---|
28 | IMPLICIT NONE |
---|
29 | ! ====================================================================== |
---|
30 | include "YOMCST.h" |
---|
31 | |
---|
32 | ! Arguments |
---|
33 | ! ---------- |
---|
34 | ! Input |
---|
35 | ! ---- |
---|
36 | INTEGER, INTENT (IN) :: iflag_wake_tend |
---|
37 | REAL, INTENT (IN) :: dtime |
---|
38 | REAL, DIMENSION(klon, klev), INTENT (IN) :: pplay |
---|
39 | REAL, DIMENSION(klon, klev+1), INTENT (IN) :: paprs |
---|
40 | REAL, DIMENSION(klon, klev), INTENT (IN) :: t, q, omgb |
---|
41 | REAL, DIMENSION(klon, klev), INTENT (IN) :: dt_dwn, dq_dwn |
---|
42 | REAL, DIMENSION(klon, klev), INTENT (IN) :: m_up, m_dwn |
---|
43 | REAL, DIMENSION(klon, klev), INTENT (IN) :: dt_a, dq_a |
---|
44 | REAL, DIMENSION(klon), INTENT (IN) :: sigd |
---|
45 | ! Input/Output |
---|
46 | ! ------------ |
---|
47 | REAL, DIMENSION(klon, klev), INTENT (INOUT) :: wake_deltat, wake_deltaq |
---|
48 | REAL, DIMENSION(klon), INTENT (INOUT) :: wake_s |
---|
49 | REAL, DIMENSION(klon), INTENT (INOUT) :: wake_dens |
---|
50 | ! Output |
---|
51 | ! ------ |
---|
52 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: dt_wake, dq_wake |
---|
53 | INTEGER, DIMENSION(klon), INTENT (OUT) :: wake_k |
---|
54 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_d_deltat_gw |
---|
55 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_h |
---|
56 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_dth |
---|
57 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_pe, wake_fip, wake_gfl |
---|
58 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: t_x, q_x |
---|
59 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_omgbdth, wake_dp_omgb |
---|
60 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_dtke, wake_dqke |
---|
61 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_omg, wake_dp_deltomg |
---|
62 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_spread |
---|
63 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_cstar |
---|
64 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_ddeltat, wake_ddeltaq |
---|
65 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_ds, wake_ddens |
---|
66 | |
---|
67 | |
---|
68 | ! Variable internes |
---|
69 | ! ----------------- |
---|
70 | INTEGER :: i, l |
---|
71 | REAL :: aire |
---|
72 | REAL, DIMENSION(klon, klev) :: p, pi |
---|
73 | REAL, DIMENSION(klon, klev+1) :: ph |
---|
74 | REAL, DIMENSION(klon, klev) :: omgbe |
---|
75 | REAL, DIMENSION(klon, klev) :: te, qe |
---|
76 | REAL, DIMENSION(klon, klev) :: dtdwn, dqdwn |
---|
77 | REAL, DIMENSION(klon, klev) :: dta, dqa |
---|
78 | REAL, DIMENSION(klon, klev) :: amdwn, amup |
---|
79 | REAL, DIMENSION(klon, klev) :: dtw, dqw, dth |
---|
80 | REAL, DIMENSION(klon, klev) :: dtls, dqls |
---|
81 | REAL, DIMENSION(klon, klev) :: tx, qx |
---|
82 | REAL, DIMENSION(klon) :: hw, wape, fip, gfl |
---|
83 | REAL, DIMENSION(klon) :: sigmaw, wdens |
---|
84 | REAL, DIMENSION(klon, klev) :: omgbdth |
---|
85 | REAL, DIMENSION(klon, klev) :: dp_omgb |
---|
86 | REAL, DIMENSION(klon, klev) :: dtke, dqke |
---|
87 | REAL, DIMENSION(klon, klev) :: omg |
---|
88 | REAL, DIMENSION(klon, klev) :: dp_deltomg, spread |
---|
89 | REAL, DIMENSION(klon) :: cstar |
---|
90 | REAL, DIMENSION(klon) :: sigd0 |
---|
91 | INTEGER, DIMENSION(klon) :: ktopw |
---|
92 | REAL, DIMENSION(klon, klev) :: d_deltat_gw |
---|
93 | REAL, DIMENSION(klon, klev) :: d_deltatw, d_deltaqw |
---|
94 | REAL, DIMENSION(klon) :: d_sigmaw, d_wdens |
---|
95 | |
---|
96 | REAL :: rdcp |
---|
97 | |
---|
98 | |
---|
99 | ! print *, '-> calwake, wake_s ', wake_s(1) |
---|
100 | |
---|
101 | rdcp = 1./3.5 |
---|
102 | |
---|
103 | |
---|
104 | ! ----------------------------------------------------------- |
---|
105 | ! IM 290108 DO 999 i=1,klon ! a vectoriser |
---|
106 | ! ---------------------------------------------------------- |
---|
107 | |
---|
108 | |
---|
109 | DO l = 1, klev |
---|
110 | DO i = 1, klon |
---|
111 | p(i, l) = pplay(i, l) |
---|
112 | ph(i, l) = paprs(i, l) |
---|
113 | pi(i, l) = (pplay(i,l)/100000.)**rdcp |
---|
114 | |
---|
115 | te(i, l) = t(i, l) |
---|
116 | qe(i, l) = q(i, l) |
---|
117 | omgbe(i, l) = omgb(i, l) |
---|
118 | |
---|
119 | dtdwn(i, l) = dt_dwn(i, l) |
---|
120 | dqdwn(i, l) = dq_dwn(i, l) |
---|
121 | dta(i, l) = dt_a(i, l) |
---|
122 | dqa(i, l) = dq_a(i, l) |
---|
123 | END DO |
---|
124 | END DO |
---|
125 | |
---|
126 | DO i = 1, klon |
---|
127 | sigd0(i) = sigd(i) |
---|
128 | END DO |
---|
129 | ! print*, 'sigd0,sigd', sigd0, sigd(i) |
---|
130 | DO i = 1, klon |
---|
131 | ph(i, klev+1) = 0. |
---|
132 | END DO |
---|
133 | |
---|
134 | DO i = 1, klon |
---|
135 | ktopw(i) = wake_k(i) |
---|
136 | END DO |
---|
137 | |
---|
138 | DO i = 1, klon |
---|
139 | hw(i) = wake_h(i) |
---|
140 | END DO |
---|
141 | ! |
---|
142 | ! Make a copy of state variables |
---|
143 | DO l = 1, klev |
---|
144 | DO i = 1, klon |
---|
145 | dtw(i, l) = wake_deltat(i, l) |
---|
146 | dqw(i, l) = wake_deltaq(i, l) |
---|
147 | END DO |
---|
148 | END DO |
---|
149 | |
---|
150 | DO i = 1, klon |
---|
151 | sigmaw(i) = wake_s(i) |
---|
152 | END DO |
---|
153 | |
---|
154 | DO i = 1, klon |
---|
155 | wdens(i) = wake_dens(i) |
---|
156 | END DO |
---|
157 | |
---|
158 | ! fkc les flux de masses sont evalues aux niveaux et valent 0 a la surface |
---|
159 | ! fkc on veut le flux de masse au milieu des couches |
---|
160 | |
---|
161 | DO l = 1, klev - 1 |
---|
162 | DO i = 1, klon |
---|
163 | amdwn(i, l) = 0.5*(m_dwn(i,l)+m_dwn(i,l+1)) |
---|
164 | amdwn(i, l) = (m_dwn(i,l+1)) |
---|
165 | END DO |
---|
166 | END DO |
---|
167 | |
---|
168 | ! au sommet le flux de masse est nul |
---|
169 | |
---|
170 | DO i = 1, klon |
---|
171 | amdwn(i, klev) = 0.5*m_dwn(i, klev) |
---|
172 | END DO |
---|
173 | |
---|
174 | DO l = 1, klev |
---|
175 | DO i = 1, klon |
---|
176 | amup(i, l) = m_up(i, l) |
---|
177 | END DO |
---|
178 | END DO |
---|
179 | |
---|
180 | CALL wake(p, ph, pi, dtime, & |
---|
181 | te, qe, omgbe, & |
---|
182 | dtdwn, dqdwn, amdwn, amup, dta, dqa, & |
---|
183 | sigd0, & |
---|
184 | dtw, dqw, sigmaw, wdens, & ! state variables |
---|
185 | dth, hw, wape, fip, gfl, & |
---|
186 | dtls, dqls, ktopw, omgbdth, dp_omgb, tx, qx, & |
---|
187 | dtke, dqke, omg, dp_deltomg, spread, cstar, & |
---|
188 | d_deltat_gw, & |
---|
189 | d_deltatw, d_deltaqw, d_sigmaw, d_wdens) ! tendencies |
---|
190 | |
---|
191 | ! |
---|
192 | DO l = 1, klev |
---|
193 | DO i = 1, klon |
---|
194 | IF (ktopw(i)>0) THEN |
---|
195 | wake_d_deltat_gw(i, l) = d_deltat_gw(i, l) |
---|
196 | wake_omgbdth(i, l) = omgbdth(i, l) |
---|
197 | wake_dp_omgb(i, l) = dp_omgb(i, l) |
---|
198 | wake_dtke(i, l) = dtke(i, l) |
---|
199 | wake_dqke(i, l) = dqke(i, l) |
---|
200 | wake_omg(i, l) = omg(i, l) |
---|
201 | wake_dp_deltomg(i, l) = dp_deltomg(i, l) |
---|
202 | wake_spread(i, l) = spread(i, l) |
---|
203 | wake_dth(i, l) = dth(i, l) |
---|
204 | dt_wake(i, l) = dtls(i, l)*dtime ! derivative -> tendency |
---|
205 | dq_wake(i, l) = dqls(i, l)*dtime ! derivative -> tendency |
---|
206 | t_x(i, l) = tx(i, l) |
---|
207 | q_x(i, l) = qx(i, l) |
---|
208 | ELSE |
---|
209 | wake_d_deltat_gw(i, l) = 0. |
---|
210 | wake_omgbdth(i, l) = 0. |
---|
211 | wake_dp_omgb(i, l) = 0. |
---|
212 | wake_dtke(i, l) = 0. |
---|
213 | wake_dqke(i, l) = 0. |
---|
214 | wake_omg(i, l) = 0. |
---|
215 | wake_dp_deltomg(i, l) = 0. |
---|
216 | wake_spread(i, l) = 0. |
---|
217 | wake_dth(i, l) = 0. |
---|
218 | dt_wake(i, l) = 0. |
---|
219 | dq_wake(i, l) = 0. |
---|
220 | t_x(i, l) = te(i, l) |
---|
221 | q_x(i, l) = qe(i, l) |
---|
222 | END IF |
---|
223 | END DO |
---|
224 | END DO |
---|
225 | |
---|
226 | DO i = 1, klon |
---|
227 | wake_h(i) = hw(i) |
---|
228 | wake_pe(i) = wape(i) |
---|
229 | wake_fip(i) = fip(i) |
---|
230 | wake_gfl(i) = gfl(i) |
---|
231 | wake_k(i) = ktopw(i) |
---|
232 | wake_cstar(i) = cstar(i) |
---|
233 | END DO |
---|
234 | |
---|
235 | ! Tendencies of state variables |
---|
236 | DO l = 1, klev |
---|
237 | DO i = 1, klon |
---|
238 | IF (ktopw(i)>0) THEN |
---|
239 | wake_ddeltat(i, l) = d_deltatw(i, l)*dtime |
---|
240 | wake_ddeltaq(i, l) = d_deltaqw(i, l)*dtime |
---|
241 | ELSE |
---|
242 | wake_ddeltat(i, l) = -wake_deltat(i, l) |
---|
243 | wake_ddeltaq(i, l) = -wake_deltaq(i, l) |
---|
244 | END IF |
---|
245 | END DO |
---|
246 | END DO |
---|
247 | DO i = 1, klon |
---|
248 | IF (ktopw(i)>0) THEN |
---|
249 | wake_ds(i) = d_sigmaw(i)*dtime |
---|
250 | wake_ddens(i) = d_wdens(i)*dtime |
---|
251 | ELSE |
---|
252 | wake_ds(i) = -wake_s(i) |
---|
253 | wake_ddens(i)= -wake_dens(i) |
---|
254 | END IF |
---|
255 | END DO |
---|
256 | |
---|
257 | !jyg< |
---|
258 | IF (iflag_wake_tend .EQ. 0) THEN |
---|
259 | ! Update State variables |
---|
260 | DO l = 1, klev |
---|
261 | DO i = 1, klon |
---|
262 | IF (ktopw(i)>0) THEN |
---|
263 | wake_deltat(i, l) = dtw(i, l) |
---|
264 | wake_deltaq(i, l) = dqw(i, l) |
---|
265 | ELSE |
---|
266 | wake_deltat(i, l) = 0. |
---|
267 | wake_deltaq(i, l) = 0. |
---|
268 | END IF |
---|
269 | END DO |
---|
270 | END DO |
---|
271 | DO i = 1, klon |
---|
272 | wake_s(i) = sigmaw(i) |
---|
273 | wake_dens(i) = wdens(i) |
---|
274 | END DO |
---|
275 | ENDIF |
---|
276 | !>jyg |
---|
277 | |
---|
278 | RETURN |
---|
279 | END SUBROUTINE calwake |
---|
280 | |
---|