1 | ! $Header$ |
---|
2 | |
---|
3 | SUBROUTINE vlspltgen_loc(q, pente_max, masse, w, pbaru, pbarv, & |
---|
4 | pdt, p, pk, teta) |
---|
5 | |
---|
6 | |
---|
7 | ! Auteurs: P.Le Van, F.Hourdin, F.Forget, F.Codron |
---|
8 | |
---|
9 | ! ******************************************************************** |
---|
10 | ! Schema d'advection " pseudo amont " . |
---|
11 | ! + test sur humidite specifique: Q advecte< Qsat aval |
---|
12 | ! (F. Codron, 10/99) |
---|
13 | ! ******************************************************************** |
---|
14 | ! q,pbaru,pbarv,w sont des arguments d'entree pour le s-pg .... |
---|
15 | |
---|
16 | ! pente_max facteur de limitation des pentes: 2 en general |
---|
17 | ! 0 pour un schema amont |
---|
18 | ! pbaru,pbarv,w flux de masse en u ,v ,w |
---|
19 | ! pdt pas de temps |
---|
20 | |
---|
21 | ! teta temperature potentielle, p pression aux interfaces, |
---|
22 | ! pk exner au milieu des couches necessaire pour calculer Qsat |
---|
23 | ! -------------------------------------------------------------------- |
---|
24 | USE parallel_lmdz |
---|
25 | USE mod_hallo |
---|
26 | USE lmdz_vampir |
---|
27 | ! CRisi: on rajoute variables utiles d'infotrac |
---|
28 | USE lmdz_infotrac, ONLY: nqtot, tracers, isoCheck |
---|
29 | USE vlspltgen_mod |
---|
30 | USE comconst_mod, ONLY: cpp |
---|
31 | USE logic_mod, ONLY: adv_qsat_liq |
---|
32 | |
---|
33 | |
---|
34 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
35 | USE lmdz_paramet |
---|
36 | IMPLICIT NONE |
---|
37 | |
---|
38 | ! |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | ! Arguments: |
---|
44 | ! ---------- |
---|
45 | REAL :: masse(ijb_u:ije_u, llm), pente_max |
---|
46 | REAL :: pbaru(ijb_u:ije_u, llm), pbarv(ijb_v:ije_v, llm) |
---|
47 | REAL :: q(ijb_u:ije_u, llm, nqtot) |
---|
48 | REAL :: w(ijb_u:ije_u, llm), pdt |
---|
49 | REAL :: p(ijb_u:ije_u, llmp1), teta(ijb_u:ije_u, llm) |
---|
50 | REAL :: pk(ijb_u:ije_u, llm) |
---|
51 | |
---|
52 | ! Local |
---|
53 | ! --------- |
---|
54 | |
---|
55 | INTEGER :: ij, l |
---|
56 | |
---|
57 | REAL :: zzpbar, zzw |
---|
58 | |
---|
59 | REAL :: qmin, qmax |
---|
60 | DATA qmin, qmax/0., 1.e33/ |
---|
61 | |
---|
62 | !--pour rapport de melange saturant-- |
---|
63 | |
---|
64 | REAL :: rtt, retv, r2es, r3les, r3ies, r4les, r4ies, play |
---|
65 | REAL :: ptarg, pdelarg, foeew, zdelta |
---|
66 | REAL :: tempe(ijb_u:ije_u) |
---|
67 | INTEGER :: ijb, ije, iq, iq2, ifils |
---|
68 | LOGICAL, SAVE :: firstcall = .TRUE. |
---|
69 | !$OMP THREADPRIVATE(firstcall) |
---|
70 | type(request), SAVE :: MyRequest1 |
---|
71 | !$OMP THREADPRIVATE(MyRequest1) |
---|
72 | type(request), SAVE :: MyRequest2 |
---|
73 | !$OMP THREADPRIVATE(MyRequest2) |
---|
74 | ! fonction psat(T) |
---|
75 | |
---|
76 | FOEEW (PTARG, PDELARG) = EXP (& |
---|
77 | (R3LES * (1. - PDELARG) + R3IES * PDELARG) * (PTARG - RTT) & |
---|
78 | / (PTARG - (R4LES * (1. - PDELARG) + R4IES * PDELARG))) |
---|
79 | |
---|
80 | r2es = 380.11733 |
---|
81 | r3les = 17.269 |
---|
82 | r3ies = 21.875 |
---|
83 | r4les = 35.86 |
---|
84 | r4ies = 7.66 |
---|
85 | retv = 0.6077667 |
---|
86 | rtt = 273.16 |
---|
87 | |
---|
88 | ! Allocate variables depending on dynamic variable nqtot |
---|
89 | |
---|
90 | IF (firstcall) THEN |
---|
91 | firstcall = .FALSE. |
---|
92 | END IF |
---|
93 | !-- Calcul de Qsat en chaque point |
---|
94 | !-- approximation: au milieu des couches play(l)=(p(l)+p(l+1))/2 |
---|
95 | ! pour eviter une exponentielle. |
---|
96 | |
---|
97 | CALL SetTag(MyRequest1, 100) |
---|
98 | CALL SetTag(MyRequest2, 101) |
---|
99 | |
---|
100 | ijb = ij_begin - iip1 |
---|
101 | ije = ij_end + iip1 |
---|
102 | IF (pole_nord) ijb = ij_begin |
---|
103 | IF (pole_sud) ije = ij_end |
---|
104 | |
---|
105 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
106 | DO l = 1, llm |
---|
107 | DO ij = ijb, ije |
---|
108 | tempe(ij) = teta(ij, l) * pk(ij, l) / cpp |
---|
109 | ENDDO |
---|
110 | DO ij = ijb, ije |
---|
111 | IF (adv_qsat_liq) THEN |
---|
112 | zdelta = 0. |
---|
113 | ELSE |
---|
114 | zdelta = MAX(0., SIGN(1., rtt - tempe(ij))) |
---|
115 | ENDIF |
---|
116 | play = 0.5 * (p(ij, l) + p(ij, l + 1)) |
---|
117 | qsat(ij, l) = MIN(0.5, r2es * FOEEW(tempe(ij), zdelta) / play) |
---|
118 | qsat(ij, l) = qsat(ij, l) / (1. - retv * qsat(ij, l)) |
---|
119 | ENDDO |
---|
120 | ENDDO |
---|
121 | !$OMP END DO NOWAIT |
---|
122 | ! PRINT*,'Debut vlsplt version debug sans vlyqs' |
---|
123 | |
---|
124 | zzpbar = 0.5 * pdt |
---|
125 | zzw = pdt |
---|
126 | |
---|
127 | ijb = ij_begin |
---|
128 | ije = ij_end |
---|
129 | IF (pole_nord) ijb = ijb + iip1 |
---|
130 | IF (pole_sud) ije = ije - iip1 |
---|
131 | |
---|
132 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
133 | DO l = 1, llm |
---|
134 | DO ij = ijb, ije |
---|
135 | mu(ij, l) = pbaru(ij, l) * zzpbar |
---|
136 | ENDDO |
---|
137 | ENDDO |
---|
138 | !$OMP END DO NOWAIT |
---|
139 | |
---|
140 | ijb = ij_begin - iip1 |
---|
141 | ije = ij_end |
---|
142 | IF (pole_nord) ijb = ij_begin |
---|
143 | IF (pole_sud) ije = ij_end - iip1 |
---|
144 | |
---|
145 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
146 | DO l = 1, llm |
---|
147 | DO ij = ijb, ije |
---|
148 | mv(ij, l) = pbarv(ij, l) * zzpbar |
---|
149 | ENDDO |
---|
150 | ENDDO |
---|
151 | !$OMP END DO NOWAIT |
---|
152 | |
---|
153 | ijb = ij_begin |
---|
154 | ije = ij_end |
---|
155 | |
---|
156 | DO iq = 1, nqtot |
---|
157 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
158 | DO l = 1, llm |
---|
159 | DO ij = ijb, ije |
---|
160 | mw(ij, l, iq) = w(ij, l) * zzw |
---|
161 | ENDDO |
---|
162 | ENDDO |
---|
163 | !$OMP END DO NOWAIT |
---|
164 | ENDDO |
---|
165 | |
---|
166 | DO iq = 1, nqtot |
---|
167 | !$OMP MASTER |
---|
168 | DO ij = ijb, ije |
---|
169 | mw(ij, llm + 1, iq) = 0. |
---|
170 | ENDDO |
---|
171 | !$OMP END MASTER |
---|
172 | ENDDO |
---|
173 | |
---|
174 | ijb = ij_begin |
---|
175 | ije = ij_end |
---|
176 | |
---|
177 | DO iq = 1, nqtot |
---|
178 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
179 | DO l = 1, llm |
---|
180 | zq(ijb:ije, l, iq) = q(ijb:ije, l, iq) |
---|
181 | zm(ijb:ije, l, iq) = masse(ijb:ije, l) |
---|
182 | ENDDO |
---|
183 | !$OMP END DO NOWAIT |
---|
184 | ENDDO |
---|
185 | |
---|
186 | ! verif temporaire |
---|
187 | ijb = ij_begin |
---|
188 | ije = ij_end |
---|
189 | CALL check_isotopes(zq, ijb, ije, 'vlspltgen_loc 191') |
---|
190 | |
---|
191 | !$OMP BARRIER |
---|
192 | DO iq = 1, nqtot |
---|
193 | ! CRisi: on ne boucle que sur les pères= ceux qui sont transportés directement par l'air |
---|
194 | IF(tracers(iq)%parent /= 'air') CYCLE |
---|
195 | !WRITE(*,*) 'vlspltgen 192: iq,iadv=',iq,tracers(iq)%iadv |
---|
196 | SELECT CASE(tracers(iq)%iadv) |
---|
197 | CASE(0); CYCLE |
---|
198 | CASE(10) |
---|
199 | CALL vlx_loc(zq, pente_max, zm, mu, & |
---|
200 | ij_begin, ij_end, iq) |
---|
201 | |
---|
202 | !$OMP MASTER |
---|
203 | CALL VTb(VTHallo) |
---|
204 | !$OMP END MASTER |
---|
205 | CALL Register_Hallo_u(zq(:, :, iq), llm, 2, 2, 2, 2, MyRequest1) |
---|
206 | CALL Register_Hallo_u(zm(:, :, iq), llm, 1, 1, 1, 1, MyRequest1) |
---|
207 | ! CRisi |
---|
208 | DO ifils = 1, tracers(iq)%nqDescen |
---|
209 | iq2 = tracers(iq)%iqDescen(ifils) |
---|
210 | CALL Register_Hallo_u(zq(:, :, iq2), llm, 2, 2, 2, 2, MyRequest1) |
---|
211 | CALL Register_Hallo_u(zm(:, :, iq2), llm, 1, 1, 1, 1, MyRequest1) |
---|
212 | enddo |
---|
213 | |
---|
214 | !$OMP MASTER |
---|
215 | CALL VTe(VTHallo) |
---|
216 | !$OMP END MASTER |
---|
217 | CASE(14) |
---|
218 | CALL vlxqs_loc(zq, pente_max, zm, mu, & |
---|
219 | qsat, ij_begin, ij_end, iq) |
---|
220 | |
---|
221 | !$OMP MASTER |
---|
222 | CALL VTb(VTHallo) |
---|
223 | !$OMP END MASTER |
---|
224 | |
---|
225 | CALL Register_Hallo_u(zq(:, :, iq), llm, 2, 2, 2, 2, MyRequest1) |
---|
226 | CALL Register_Hallo_u(zm(:, :, iq), llm, 1, 1, 1, 1, MyRequest1) |
---|
227 | DO ifils = 1, tracers(iq)%nqDescen |
---|
228 | iq2 = tracers(iq)%iqDescen(ifils) |
---|
229 | CALL Register_Hallo_u(zq(:, :, iq2), llm, 2, 2, 2, 2, MyRequest1) |
---|
230 | CALL Register_Hallo_u(zm(:, :, iq2), llm, 1, 1, 1, 1, MyRequest1) |
---|
231 | enddo |
---|
232 | |
---|
233 | !$OMP MASTER |
---|
234 | CALL VTe(VTHallo) |
---|
235 | !$OMP END MASTER |
---|
236 | CASE DEFAULT |
---|
237 | CALL abort_gcm("vlspltgen_loc", "schema non parallelise", 1) |
---|
238 | END SELECT |
---|
239 | |
---|
240 | enddo !DO iq=1,nqtot |
---|
241 | |
---|
242 | |
---|
243 | !$OMP BARRIER |
---|
244 | !$OMP MASTER |
---|
245 | CALL VTb(VTHallo) |
---|
246 | !$OMP END MASTER |
---|
247 | |
---|
248 | CALL SendRequest(MyRequest1) |
---|
249 | |
---|
250 | !$OMP MASTER |
---|
251 | CALL VTe(VTHallo) |
---|
252 | !$OMP END MASTER |
---|
253 | !$OMP BARRIER |
---|
254 | |
---|
255 | ! verif temporaire |
---|
256 | ijb = ij_begin - 2 * iip1 |
---|
257 | ije = ij_end + 2 * iip1 |
---|
258 | IF (pole_nord) ijb = ij_begin |
---|
259 | IF (pole_sud) ije = ij_end |
---|
260 | CALL check_isotopes(zq, ij_begin, ij_end, 'vlspltgen_loc 280') |
---|
261 | |
---|
262 | DO iq = 1, nqtot |
---|
263 | IF(tracers(iq)%parent /= 'air') CYCLE |
---|
264 | !WRITE(*,*) 'vlspltgen 279: iq=',iq |
---|
265 | |
---|
266 | SELECT CASE(tracers(iq)%iadv) |
---|
267 | CASE(0); CYCLE |
---|
268 | CASE(10) |
---|
269 | CASE(14) |
---|
270 | CASE DEFAULT |
---|
271 | CALL abort_gcm("vlspltgen_p", "schema non parallelise", 1) |
---|
272 | END SELECT |
---|
273 | |
---|
274 | enddo |
---|
275 | !$OMP BARRIER |
---|
276 | !$OMP MASTER |
---|
277 | CALL VTb(VTHallo) |
---|
278 | !$OMP END MASTER |
---|
279 | |
---|
280 | ! CALL WaitRecvRequest(MyRequest1) |
---|
281 | ! CALL WaitSendRequest(MyRequest1) |
---|
282 | !$OMP BARRIER |
---|
283 | CALL WaitRequest(MyRequest1) |
---|
284 | |
---|
285 | |
---|
286 | !$OMP MASTER |
---|
287 | CALL VTe(VTHallo) |
---|
288 | !$OMP END MASTER |
---|
289 | !$OMP BARRIER |
---|
290 | |
---|
291 | IF(isoCheck) THEN |
---|
292 | CALL check_isotopes(zq, ij_begin, ij_end, 'vlspltgen_loc 326') |
---|
293 | ijb = ij_begin - 2 * iip1 |
---|
294 | ije = ij_end + 2 * iip1 |
---|
295 | IF (pole_nord) ijb = ij_begin |
---|
296 | IF (pole_sud) ije = ij_end |
---|
297 | CALL check_isotopes(zq, ijb, ije, 'vlspltgen_loc 336') |
---|
298 | END IF |
---|
299 | |
---|
300 | DO iq = 1, nqtot |
---|
301 | IF(tracers(iq)%parent /= 'air') CYCLE |
---|
302 | |
---|
303 | SELECT CASE(tracers(iq)%iadv) |
---|
304 | CASE(0); CYCLE |
---|
305 | CASE(10); CALL vly_loc(zq, pente_max, zm, mv, iq) |
---|
306 | CASE(14); CALL vlyqs_loc(zq, pente_max, zm, mv, qsat, iq) |
---|
307 | CASE DEFAULT |
---|
308 | CALL abort_gcm("vlspltgen_p", "schema non parallelise", 1) |
---|
309 | END SELECT |
---|
310 | |
---|
311 | enddo |
---|
312 | |
---|
313 | CALL check_isotopes(zq, ij_begin, ij_end, 'vlspltgen_loc 357') |
---|
314 | |
---|
315 | DO iq = 1, nqtot |
---|
316 | IF(tracers(iq)%parent /= 'air') CYCLE |
---|
317 | SELECT CASE(tracers(iq)%iadv) |
---|
318 | CASE(0); CYCLE |
---|
319 | CASE(10, 14) |
---|
320 | !$OMP BARRIER |
---|
321 | CALL vlz_loc(zq, pente_max, zm, mw, & |
---|
322 | ij_begin, ij_end, iq) |
---|
323 | !$OMP BARRIER |
---|
324 | |
---|
325 | !$OMP MASTER |
---|
326 | CALL VTb(VTHallo) |
---|
327 | !$OMP END MASTER |
---|
328 | |
---|
329 | CALL Register_Hallo_u(zq(:, :, iq), llm, 2, 2, 2, 2, MyRequest2) |
---|
330 | CALL Register_Hallo_u(zm(:, :, iq), llm, 1, 1, 1, 1, MyRequest2) |
---|
331 | ! CRisi |
---|
332 | DO ifils = 1, tracers(iq)%nqDescen |
---|
333 | iq2 = tracers(iq)%iqDescen(ifils) |
---|
334 | CALL Register_Hallo_u(zq(:, :, iq2), llm, 2, 2, 2, 2, MyRequest2) |
---|
335 | CALL Register_Hallo_u(zm(:, :, iq2), llm, 1, 1, 1, 1, MyRequest2) |
---|
336 | enddo |
---|
337 | !$OMP MASTER |
---|
338 | CALL VTe(VTHallo) |
---|
339 | !$OMP END MASTER |
---|
340 | !$OMP BARRIER |
---|
341 | CASE DEFAULT |
---|
342 | |
---|
343 | CALL abort_gcm("vlspltgen_p", "schema non parallelise", 1) |
---|
344 | END SELECT |
---|
345 | |
---|
346 | enddo |
---|
347 | !$OMP BARRIER |
---|
348 | |
---|
349 | !$OMP MASTER |
---|
350 | CALL VTb(VTHallo) |
---|
351 | !$OMP END MASTER |
---|
352 | |
---|
353 | CALL SendRequest(MyRequest2) |
---|
354 | |
---|
355 | !$OMP MASTER |
---|
356 | CALL VTe(VTHallo) |
---|
357 | !$OMP END MASTER |
---|
358 | |
---|
359 | CALL check_isotopes(zq, ij_begin, ij_end, 'vlspltgen_loc 429') |
---|
360 | |
---|
361 | !$OMP BARRIER |
---|
362 | DO iq = 1, nqtot |
---|
363 | IF(tracers(iq)%parent /= 'air') CYCLE |
---|
364 | !WRITE(*,*) 'vlspltgen 409: iq=',iq |
---|
365 | |
---|
366 | SELECT CASE(tracers(iq)%iadv) |
---|
367 | CASE(0); CYCLE |
---|
368 | CASE(10, 14) |
---|
369 | !$OMP BARRIER |
---|
370 | CASE DEFAULT |
---|
371 | CALL abort_gcm("vlspltgen_p", "schema non parallelise", 1) |
---|
372 | END SELECT |
---|
373 | |
---|
374 | enddo |
---|
375 | !WRITE(*,*) 'vlspltgen_loc 476' |
---|
376 | |
---|
377 | !$OMP BARRIER |
---|
378 | !WRITE(*,*) 'vlspltgen_loc 477' |
---|
379 | !$OMP MASTER |
---|
380 | CALL VTb(VTHallo) |
---|
381 | !$OMP END MASTER |
---|
382 | |
---|
383 | ! CALL WaitRecvRequest(MyRequest2) |
---|
384 | ! CALL WaitSendRequest(MyRequest2) |
---|
385 | !$OMP BARRIER |
---|
386 | CALL WaitRequest(MyRequest2) |
---|
387 | |
---|
388 | !$OMP MASTER |
---|
389 | CALL VTe(VTHallo) |
---|
390 | !$OMP END MASTER |
---|
391 | !$OMP BARRIER |
---|
392 | |
---|
393 | |
---|
394 | !WRITE(*,*) 'vlspltgen_loc 494' |
---|
395 | CALL check_isotopes(zq, ij_begin, ij_end, 'vlspltgen_loc 461') |
---|
396 | |
---|
397 | DO iq = 1, nqtot |
---|
398 | IF(tracers(iq)%parent /= 'air') CYCLE |
---|
399 | SELECT CASE(tracers(iq)%iadv) |
---|
400 | CASE(0); CYCLE |
---|
401 | CASE(10); CALL vly_loc(zq, pente_max, zm, mv, iq) |
---|
402 | CASE(14); CALL vlyqs_loc(zq, pente_max, zm, mv, qsat, iq) |
---|
403 | CASE DEFAULT |
---|
404 | CALL abort_gcm("vlspltgen_p", "schema non parallelise", 1) |
---|
405 | END SELECT |
---|
406 | |
---|
407 | enddo !do iq=1,nqtot |
---|
408 | |
---|
409 | CALL check_isotopes(zq, ij_begin, ij_end, 'vlspltgen_loc 493') |
---|
410 | |
---|
411 | DO iq = 1, nqtot |
---|
412 | IF(tracers(iq)%parent /= 'air') CYCLE |
---|
413 | SELECT CASE(tracers(iq)%iadv) |
---|
414 | CASE(0); CYCLE |
---|
415 | CASE(10); CALL vlx_loc(zq, pente_max, zm, mu, & |
---|
416 | ij_begin, ij_end, iq) |
---|
417 | CASE(14); CALL vlxqs_loc(zq, pente_max, zm, mu, & |
---|
418 | qsat, ij_begin, ij_end, iq) |
---|
419 | CASE DEFAULT |
---|
420 | CALL abort_gcm("vlspltgen_p", "schema non parallelise", 1) |
---|
421 | END SELECT |
---|
422 | |
---|
423 | enddo !do iq=1,nqtot |
---|
424 | |
---|
425 | !WRITE(*,*) 'vlspltgen 550: apres derniere serie de CALL vlx' |
---|
426 | CALL check_isotopes(zq, ij_begin, ij_end, 'vlspltgen_loc 521') |
---|
427 | |
---|
428 | ijb = ij_begin |
---|
429 | ije = ij_end |
---|
430 | !$OMP BARRIER |
---|
431 | |
---|
432 | DO iq = 1, nqtot |
---|
433 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
434 | DO l = 1, llm |
---|
435 | DO ij = ijb, ije |
---|
436 | ! PRINT *,'zq-->',ij,l,iq,zq(ij,l,iq) |
---|
437 | ! PRINT *,'q-->',ij,l,iq,q(ij,l,iq) |
---|
438 | q(ij, l, iq) = zq(ij, l, iq) |
---|
439 | ENDDO |
---|
440 | ENDDO |
---|
441 | !$OMP END DO NOWAIT |
---|
442 | |
---|
443 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
444 | DO l = 1, llm |
---|
445 | DO ij = ijb, ije - iip1 + 1, iip1 |
---|
446 | q(ij + iim, l, iq) = q(ij, l, iq) |
---|
447 | ENDDO |
---|
448 | ENDDO |
---|
449 | !$OMP END DO NOWAIT |
---|
450 | ENDDO !DO iq=1,nqtot |
---|
451 | |
---|
452 | CALL check_isotopes(q, ij_begin, ij_end, 'vlspltgen_loc 557') |
---|
453 | |
---|
454 | !$OMP BARRIER |
---|
455 | |
---|
456 | !c$OMP MASTER |
---|
457 | ! CALL WaitSendRequest(MyRequest1) |
---|
458 | ! CALL WaitSendRequest(MyRequest2) |
---|
459 | !c$OMP END MASTER |
---|
460 | !c$OMP BARRIER |
---|
461 | |
---|
462 | !WRITE(*,*) 'vlspltgen 597: sortie' |
---|
463 | |
---|
464 | END SUBROUTINE vlspltgen_loc |
---|