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