1 | ! |
---|
2 | ! $Id$ |
---|
3 | ! |
---|
4 | c |
---|
5 | c |
---|
6 | #define DEBUG_IO |
---|
7 | #undef DEBUG_IO |
---|
8 | SUBROUTINE advtrac_loc(pbarug,pbarvg ,wg, |
---|
9 | * p, massem,q,teta, |
---|
10 | * pk ) |
---|
11 | |
---|
12 | c Auteur : F. Hourdin |
---|
13 | c |
---|
14 | c Modif. P. Le Van (20/12/97) |
---|
15 | c F. Codron (10/99) |
---|
16 | c D. Le Croller (07/2001) |
---|
17 | c M.A Filiberti (04/2002) |
---|
18 | c |
---|
19 | USE parallel_lmdz |
---|
20 | USE Write_Field_loc |
---|
21 | USE Write_Field |
---|
22 | USE Bands |
---|
23 | USE mod_hallo |
---|
24 | USE Vampir |
---|
25 | USE times |
---|
26 | USE infotrac, ONLY: nqtot, iadv, ok_iso_verif |
---|
27 | USE control_mod, ONLY: iapp_tracvl, day_step, planet_type |
---|
28 | USE advtrac_mod, ONLY: finmasse |
---|
29 | USE comconst_mod, ONLY: dtvr |
---|
30 | IMPLICIT NONE |
---|
31 | c |
---|
32 | include "dimensions.h" |
---|
33 | include "paramet.h" |
---|
34 | include "comdissip.h" |
---|
35 | include "comgeom2.h" |
---|
36 | include "ener.h" |
---|
37 | include "description.h" |
---|
38 | |
---|
39 | c------------------------------------------------------------------- |
---|
40 | c Arguments |
---|
41 | c------------------------------------------------------------------- |
---|
42 | c Ajout PPM |
---|
43 | c-------------------------------------------------------- |
---|
44 | REAL massebx(ijb_u:ije_u,llm),masseby(ijb_v:ije_v,llm) |
---|
45 | c-------------------------------------------------------- |
---|
46 | INTEGER iapptrac |
---|
47 | REAL pbarug(ijb_u:ije_u,llm),pbarvg(ijb_v:ije_v,llm) |
---|
48 | REAL wg(ijb_u:ije_u,llm) |
---|
49 | REAL q(ijb_u:ije_u,llm,nqtot),massem(ijb_u:ije_u,llm) |
---|
50 | REAL p( ijb_u:ije_u,llmp1 ),teta(ijb_u:ije_u,llm) |
---|
51 | REAL pk(ijb_u:ije_u,llm) |
---|
52 | |
---|
53 | c------------------------------------------------------------- |
---|
54 | c Variables locales |
---|
55 | c------------------------------------------------------------- |
---|
56 | |
---|
57 | REAL zdp(ijb_u:ije_u) |
---|
58 | REAL (kind=kind(1.d0)) :: t_initial, t_final, tps_cpu |
---|
59 | INTEGER,SAVE :: iadvtr=0 |
---|
60 | c$OMP THREADPRIVATE(iadvtr) |
---|
61 | INTEGER ij,l,iq,iiq |
---|
62 | REAL zdpmin, zdpmax |
---|
63 | c---------------------------------------------------------- |
---|
64 | c Rajouts pour PPM |
---|
65 | c---------------------------------------------------------- |
---|
66 | INTEGER indice,n |
---|
67 | REAL dtbon ! Pas de temps adaptatif pour que CFL<1 |
---|
68 | REAL CFLmaxz,aaa,bbb ! CFL maximum |
---|
69 | REAL psppm(iim,jjb_u:jje_u) ! pression au sol |
---|
70 | REAL unatppm(iim,jjb_u:jje_u,llm),vnatppm(iim,jjb_u:jje_u,llm) |
---|
71 | REAL qppm(iim*jjnb_u,llm,nqtot) |
---|
72 | REAL fluxwppm(iim,jjb_u:jje_u,llm) |
---|
73 | REAL apppm(llmp1), bpppm(llmp1) |
---|
74 | LOGICAL dum,fill |
---|
75 | DATA fill/.true./ |
---|
76 | DATA dum/.true./ |
---|
77 | integer ijb,ije,ijbu,ijbv,ijeu,ijev,j |
---|
78 | type(Request),SAVE :: testRequest |
---|
79 | !$OMP THREADPRIVATE(testRequest) |
---|
80 | |
---|
81 | c test sur l''eventuelle creation de valeurs negatives de la masse |
---|
82 | ijb=ij_begin |
---|
83 | ije=ij_end |
---|
84 | if (pole_nord) ijb=ij_begin+iip1 |
---|
85 | if (pole_sud) ije=ij_end-iip1 |
---|
86 | |
---|
87 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
88 | DO l=1,llm-1 |
---|
89 | DO ij = ijb+1,ije |
---|
90 | zdp(ij) = pbarug(ij-1,l) - pbarug(ij,l) |
---|
91 | s - pbarvg(ij-iip1,l) + pbarvg(ij,l) |
---|
92 | s + wg(ij,l+1) - wg(ij,l) |
---|
93 | ENDDO |
---|
94 | |
---|
95 | c CALL SCOPY( jjm -1 ,zdp(iip1+iip1),iip1,zdp(iip2),iip1 ) |
---|
96 | c ym ---> pourquoi jjm-1 et non jjm ? a cause du pole ? |
---|
97 | |
---|
98 | do ij=ijb,ije-iip1+1,iip1 |
---|
99 | zdp(ij)=zdp(ij+iip1-1) |
---|
100 | enddo |
---|
101 | |
---|
102 | DO ij = ijb,ije |
---|
103 | zdp(ij)= zdp(ij)*dtvr/ massem(ij,l) |
---|
104 | ENDDO |
---|
105 | |
---|
106 | |
---|
107 | c CALL minmax ( ip1jm-iip1, zdp(iip2), zdpmin,zdpmax ) |
---|
108 | c ym ---> eventuellement a revoir |
---|
109 | CALL minmax ( ije-ijb+1, zdp(ijb), zdpmin,zdpmax ) |
---|
110 | |
---|
111 | IF(MAX(ABS(zdpmin),ABS(zdpmax)).GT.0.5) THEN |
---|
112 | PRINT*,'WARNING DP/P l=',l,' MIN:',zdpmin, |
---|
113 | s ' MAX:', zdpmax |
---|
114 | ENDIF |
---|
115 | |
---|
116 | ENDDO |
---|
117 | c$OMP END DO NOWAIT |
---|
118 | |
---|
119 | c------------------------------------------------------------------- |
---|
120 | c Advection proprement dite (Modification Le Croller (07/2001) |
---|
121 | c------------------------------------------------------------------- |
---|
122 | |
---|
123 | c---------------------------------------------------- |
---|
124 | c Calcul des moyennes basées sur la masse |
---|
125 | c---------------------------------------------------- |
---|
126 | |
---|
127 | cym ----> Normalement, inutile pour les schémas classiques |
---|
128 | cym ----> Revérifier lors de la parallélisation des autres schemas |
---|
129 | |
---|
130 | cym call massbar_p(massem,massebx,masseby) |
---|
131 | |
---|
132 | #ifdef DEBUG_IO |
---|
133 | CALL WriteField_u('massem',massem) |
---|
134 | CALL WriteField_u('wg',wg) |
---|
135 | CALL WriteField_u('pbarug',pbarug) |
---|
136 | CALL WriteField_v('pbarvg',pbarvg) |
---|
137 | CALL WriteField_u('p_tmp',p) |
---|
138 | CALL WriteField_u('pk_tmp',pk) |
---|
139 | CALL WriteField_u('teta_tmp',teta) |
---|
140 | do j=1,nqtot |
---|
141 | call WriteField_u('q_adv'//trim(int2str(j)), |
---|
142 | . q(:,:,j)) |
---|
143 | enddo |
---|
144 | #endif |
---|
145 | |
---|
146 | ! |
---|
147 | ! call Register_Hallo_v(pbarvg,llm,1,1,1,1,TestRequest) |
---|
148 | ! |
---|
149 | ! call SendRequest(TestRequest) |
---|
150 | !c$OMP BARRIER |
---|
151 | ! call WaitRequest(TestRequest) |
---|
152 | c$OMP BARRIER |
---|
153 | |
---|
154 | !write(*,*) 'advtrac 157: appel de vlspltgen_loc' |
---|
155 | call vlspltgen_loc( q,iadv, 2., massem, wg , |
---|
156 | * pbarug,pbarvg,dtvr,p, |
---|
157 | * pk,teta ) |
---|
158 | |
---|
159 | !write(*,*) 'advtrac 162: apres appel vlspltgen_loc' |
---|
160 | if (ok_iso_verif) then |
---|
161 | call check_isotopes(q,ijb_u,ije_u,'advtrac 162') |
---|
162 | endif !if (ok_iso_verif) then |
---|
163 | |
---|
164 | #ifdef DEBUG_IO |
---|
165 | do j=1,nqtot |
---|
166 | call WriteField_u('q_adv'//trim(int2str(j)), |
---|
167 | . q(:,:,j)) |
---|
168 | enddo |
---|
169 | #endif |
---|
170 | |
---|
171 | GOTO 1234 |
---|
172 | c----------------------------------------------------------- |
---|
173 | c Appel des sous programmes d'advection |
---|
174 | c----------------------------------------------------------- |
---|
175 | do iq=1,nqtot |
---|
176 | c call clock(t_initial) |
---|
177 | if(iadv(iq) == 0) cycle |
---|
178 | c ---------------------------------------------------------------- |
---|
179 | c Schema de Van Leer I MUSCL |
---|
180 | c ---------------------------------------------------------------- |
---|
181 | if(iadv(iq).eq.10) THEN |
---|
182 | |
---|
183 | !LF call vlsplt_p(q(1,1,iq),2.,massem,wg,pbarug,pbarvg,dtvr) |
---|
184 | |
---|
185 | c ---------------------------------------------------------------- |
---|
186 | c Schema "pseudo amont" + test sur humidite specifique |
---|
187 | C pour la vapeur d'eau. F. Codron |
---|
188 | c ---------------------------------------------------------------- |
---|
189 | else if(iadv(iq).eq.14) then |
---|
190 | c |
---|
191 | cym stop 'advtrac : appel à vlspltqs :schema non parallelise' |
---|
192 | !LF CALL vlspltqs_p( q(1,1,1), 2., massem, wg , |
---|
193 | !LF * pbarug,pbarvg,dtvr,p,pk,teta ) |
---|
194 | c ---------------------------------------------------------------- |
---|
195 | c Schema de Frederic Hourdin |
---|
196 | c ---------------------------------------------------------------- |
---|
197 | else if(iadv(iq).eq.12) then |
---|
198 | stop 'advtrac : schema non parallelise' |
---|
199 | c Pas de temps adaptatif |
---|
200 | call adaptdt(iadv(iq),dtbon,n,pbarug,massem) |
---|
201 | if (n.GT.1) then |
---|
202 | write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', |
---|
203 | s dtvr,'n=',n |
---|
204 | endif |
---|
205 | do indice=1,n |
---|
206 | call advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,1) |
---|
207 | end do |
---|
208 | else if(iadv(iq).eq.13) then |
---|
209 | stop 'advtrac : schema non parallelise' |
---|
210 | c Pas de temps adaptatif |
---|
211 | call adaptdt(iadv(iq),dtbon,n,pbarug,massem) |
---|
212 | if (n.GT.1) then |
---|
213 | write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', |
---|
214 | s dtvr,'n=',n |
---|
215 | endif |
---|
216 | do indice=1,n |
---|
217 | call advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,2) |
---|
218 | end do |
---|
219 | c ---------------------------------------------------------------- |
---|
220 | c Schema de pente SLOPES |
---|
221 | c ---------------------------------------------------------------- |
---|
222 | else if (iadv(iq).eq.20) then |
---|
223 | stop 'advtrac : schema non parallelise' |
---|
224 | |
---|
225 | call pentes_ini (q(1,1,iq),wg,massem,pbarug,pbarvg,0) |
---|
226 | |
---|
227 | c ---------------------------------------------------------------- |
---|
228 | c Schema de Prather |
---|
229 | c ---------------------------------------------------------------- |
---|
230 | else if (iadv(iq).eq.30) then |
---|
231 | stop 'advtrac : schema non parallelise' |
---|
232 | c Pas de temps adaptatif |
---|
233 | call adaptdt(iadv(iq),dtbon,n,pbarug,massem) |
---|
234 | if (n.GT.1) then |
---|
235 | write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', |
---|
236 | s dtvr,'n=',n |
---|
237 | endif |
---|
238 | call prather(q(1,1,iq),wg,massem,pbarug,pbarvg, |
---|
239 | s n,dtbon) |
---|
240 | c ---------------------------------------------------------------- |
---|
241 | c Schemas PPM Lin et Rood |
---|
242 | c ---------------------------------------------------------------- |
---|
243 | else if (iadv(iq).eq.11.OR.(iadv(iq).GE.16.AND. |
---|
244 | s iadv(iq).LE.18)) then |
---|
245 | |
---|
246 | stop 'advtrac : schema non parallelise' |
---|
247 | |
---|
248 | c Test sur le flux horizontal |
---|
249 | c Pas de temps adaptatif |
---|
250 | call adaptdt(iadv(iq),dtbon,n,pbarug,massem) |
---|
251 | if (n.GT.1) then |
---|
252 | write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', |
---|
253 | s dtvr,'n=',n |
---|
254 | endif |
---|
255 | c Test sur le flux vertical |
---|
256 | CFLmaxz=0. |
---|
257 | do l=2,llm |
---|
258 | do ij=iip2,ip1jm |
---|
259 | aaa=wg(ij,l)*dtvr/massem(ij,l) |
---|
260 | CFLmaxz=max(CFLmaxz,aaa) |
---|
261 | bbb=-wg(ij,l)*dtvr/massem(ij,l-1) |
---|
262 | CFLmaxz=max(CFLmaxz,bbb) |
---|
263 | enddo |
---|
264 | enddo |
---|
265 | if (CFLmaxz.GE.1) then |
---|
266 | write(*,*) 'WARNING vertical','CFLmaxz=', CFLmaxz |
---|
267 | endif |
---|
268 | |
---|
269 | c----------------------------------------------------------- |
---|
270 | c Ss-prg interface LMDZ.4->PPM3d |
---|
271 | c----------------------------------------------------------- |
---|
272 | |
---|
273 | call interpre(q(1,1,iq),qppm(1,1,iq),wg,fluxwppm,massem, |
---|
274 | s apppm,bpppm,massebx,masseby,pbarug,pbarvg, |
---|
275 | s unatppm,vnatppm,psppm) |
---|
276 | |
---|
277 | do indice=1,n |
---|
278 | c--------------------------------------------------------------------- |
---|
279 | c VL (version PPM) horiz. et PPM vert. |
---|
280 | c--------------------------------------------------------------------- |
---|
281 | if (iadv(iq).eq.11) then |
---|
282 | c Ss-prg PPM3d de Lin |
---|
283 | call ppm3d(1,qppm(1,1,iq), |
---|
284 | s psppm,psppm, |
---|
285 | s unatppm,vnatppm,fluxwppm,dtbon,2,2,2,1, |
---|
286 | s iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, |
---|
287 | s fill,dum,220.) |
---|
288 | |
---|
289 | c---------------------------------------------------------------------- |
---|
290 | c Monotonic PPM |
---|
291 | c---------------------------------------------------------------------- |
---|
292 | else if (iadv(iq).eq.16) then |
---|
293 | c Ss-prg PPM3d de Lin |
---|
294 | call ppm3d(1,qppm(1,1,iq), |
---|
295 | s psppm,psppm, |
---|
296 | s unatppm,vnatppm,fluxwppm,dtbon,3,3,3,1, |
---|
297 | s iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, |
---|
298 | s fill,dum,220.) |
---|
299 | c--------------------------------------------------------------------- |
---|
300 | |
---|
301 | c--------------------------------------------------------------------- |
---|
302 | c Semi Monotonic PPM |
---|
303 | c--------------------------------------------------------------------- |
---|
304 | else if (iadv(iq).eq.17) then |
---|
305 | c Ss-prg PPM3d de Lin |
---|
306 | call ppm3d(1,qppm(1,1,iq), |
---|
307 | s psppm,psppm, |
---|
308 | s unatppm,vnatppm,fluxwppm,dtbon,4,4,4,1, |
---|
309 | s iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, |
---|
310 | s fill,dum,220.) |
---|
311 | c--------------------------------------------------------------------- |
---|
312 | |
---|
313 | c--------------------------------------------------------------------- |
---|
314 | c Positive Definite PPM |
---|
315 | c--------------------------------------------------------------------- |
---|
316 | else if (iadv(iq).eq.18) then |
---|
317 | c Ss-prg PPM3d de Lin |
---|
318 | call ppm3d(1,qppm(1,1,iq), |
---|
319 | s psppm,psppm, |
---|
320 | s unatppm,vnatppm,fluxwppm,dtbon,5,5,5,1, |
---|
321 | s iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, |
---|
322 | s fill,dum,220.) |
---|
323 | c--------------------------------------------------------------------- |
---|
324 | endif |
---|
325 | enddo |
---|
326 | c----------------------------------------------------------------- |
---|
327 | c Ss-prg interface PPM3d-LMDZ.4 |
---|
328 | c----------------------------------------------------------------- |
---|
329 | call interpost(q(1,1,iq),qppm(1,1,iq)) |
---|
330 | endif |
---|
331 | c---------------------------------------------------------------------- |
---|
332 | |
---|
333 | c----------------------------------------------------------------- |
---|
334 | c On impose une seule valeur du traceur au pôle Sud j=jjm+1=jjp1 |
---|
335 | c et Nord j=1 |
---|
336 | c----------------------------------------------------------------- |
---|
337 | |
---|
338 | c call traceurpole(q(1,1,iq),massem) |
---|
339 | |
---|
340 | c calcul du temps cpu pour un schema donne |
---|
341 | |
---|
342 | |
---|
343 | end DO |
---|
344 | |
---|
345 | 1234 CONTINUE |
---|
346 | c$OMP BARRIER |
---|
347 | |
---|
348 | if (planet_type=="earth") then |
---|
349 | |
---|
350 | ijb=ij_begin |
---|
351 | ije=ij_end |
---|
352 | |
---|
353 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
354 | DO l = 1, llm |
---|
355 | DO ij = ijb, ije |
---|
356 | finmasse(ij,l) = p(ij,l) - p(ij,l+1) |
---|
357 | ENDDO |
---|
358 | ENDDO |
---|
359 | c$OMP END DO |
---|
360 | |
---|
361 | ! CRisi: on passe nqtot et non nq |
---|
362 | CALL qminimum_loc( q, nqtot, finmasse ) |
---|
363 | |
---|
364 | endif ! of if (planet_type=="earth") |
---|
365 | |
---|
366 | RETURN |
---|
367 | END |
---|
368 | |
---|