1 | ! |
---|
2 | ! $Header$ |
---|
3 | ! |
---|
4 | c |
---|
5 | c |
---|
6 | |
---|
7 | SUBROUTINE leapfrog_p(ucov,vcov,teta,ps,masse,phis,q,clesphy0, |
---|
8 | & time_0) |
---|
9 | |
---|
10 | USE misc_mod |
---|
11 | USE parallel |
---|
12 | USE times |
---|
13 | USE mod_hallo |
---|
14 | USE Bands |
---|
15 | USE Write_Field |
---|
16 | USE Write_Field_p |
---|
17 | USE vampir |
---|
18 | USE timer_filtre, ONLY : print_filtre_timer |
---|
19 | USE infotrac |
---|
20 | USE guide_p_mod, ONLY : guide_main |
---|
21 | |
---|
22 | IMPLICIT NONE |
---|
23 | |
---|
24 | c ...... Version du 10/01/98 .......... |
---|
25 | |
---|
26 | c avec coordonnees verticales hybrides |
---|
27 | c avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
28 | |
---|
29 | c======================================================================= |
---|
30 | c |
---|
31 | c Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
32 | c ------- |
---|
33 | c |
---|
34 | c Objet: |
---|
35 | c ------ |
---|
36 | c |
---|
37 | c GCM LMD nouvelle grille |
---|
38 | c |
---|
39 | c======================================================================= |
---|
40 | c |
---|
41 | c ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
42 | c et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
43 | c hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
44 | |
---|
45 | c ... Possibilite de choisir le shema pour l'advection de |
---|
46 | c q , en modifiant iadv dans traceur.def (10/02) . |
---|
47 | c |
---|
48 | c Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
49 | c Pour Van-Leer iadv=10 |
---|
50 | c |
---|
51 | c----------------------------------------------------------------------- |
---|
52 | c Declarations: |
---|
53 | c ------------- |
---|
54 | |
---|
55 | #include "dimensions.h" |
---|
56 | #include "paramet.h" |
---|
57 | #include "comconst.h" |
---|
58 | #include "comdissnew.h" |
---|
59 | #include "comvert.h" |
---|
60 | #include "comgeom.h" |
---|
61 | #include "logic.h" |
---|
62 | #include "temps.h" |
---|
63 | #include "control.h" |
---|
64 | #include "ener.h" |
---|
65 | #include "description.h" |
---|
66 | #include "serre.h" |
---|
67 | #include "com_io_dyn.h" |
---|
68 | #include "iniprint.h" |
---|
69 | #include "academic.h" |
---|
70 | |
---|
71 | INTEGER longcles |
---|
72 | PARAMETER ( longcles = 20 ) |
---|
73 | REAL clesphy0( longcles ) |
---|
74 | |
---|
75 | real zqmin,zqmax |
---|
76 | INTEGER nbetatmoy, nbetatdem,nbetat |
---|
77 | |
---|
78 | c variables dynamiques |
---|
79 | REAL :: vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants |
---|
80 | REAL :: teta(ip1jmp1,llm) ! temperature potentielle |
---|
81 | REAL :: q(ip1jmp1,llm,nqtot) ! champs advectes |
---|
82 | REAL :: ps(ip1jmp1) ! pression au sol |
---|
83 | REAL,SAVE :: p (ip1jmp1,llmp1 ) ! pression aux interfac.des couches |
---|
84 | REAL,SAVE :: pks(ip1jmp1) ! exner au sol |
---|
85 | REAL,SAVE :: pk(ip1jmp1,llm) ! exner au milieu des couches |
---|
86 | REAL,SAVE :: pkf(ip1jmp1,llm) ! exner filt.au milieu des couches |
---|
87 | REAL :: masse(ip1jmp1,llm) ! masse d'air |
---|
88 | REAL :: phis(ip1jmp1) ! geopotentiel au sol |
---|
89 | REAL,SAVE :: phi(ip1jmp1,llm) ! geopotentiel |
---|
90 | REAL,SAVE :: w(ip1jmp1,llm) ! vitesse verticale |
---|
91 | |
---|
92 | c variables dynamiques intermediaire pour le transport |
---|
93 | REAL,SAVE :: pbaru(ip1jmp1,llm),pbarv(ip1jm,llm) !flux de masse |
---|
94 | |
---|
95 | c variables dynamiques au pas -1 |
---|
96 | REAL,SAVE :: vcovm1(ip1jm,llm),ucovm1(ip1jmp1,llm) |
---|
97 | REAL,SAVE :: tetam1(ip1jmp1,llm),psm1(ip1jmp1) |
---|
98 | REAL,SAVE :: massem1(ip1jmp1,llm) |
---|
99 | |
---|
100 | c tendances dynamiques |
---|
101 | REAL,SAVE :: dv(ip1jm,llm),du(ip1jmp1,llm) |
---|
102 | REAL,SAVE :: dteta(ip1jmp1,llm),dp(ip1jmp1) |
---|
103 | REAL,DIMENSION(:,:,:), ALLOCATABLE, SAVE :: dq |
---|
104 | |
---|
105 | c tendances de la dissipation |
---|
106 | REAL,SAVE :: dvdis(ip1jm,llm),dudis(ip1jmp1,llm) |
---|
107 | REAL,SAVE :: dtetadis(ip1jmp1,llm) |
---|
108 | |
---|
109 | c tendances physiques |
---|
110 | REAL,SAVE :: dvfi(ip1jm,llm),dufi(ip1jmp1,llm) |
---|
111 | REAL,SAVE :: dtetafi(ip1jmp1,llm) |
---|
112 | REAL,SAVE :: dpfi(ip1jmp1) |
---|
113 | REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: dqfi |
---|
114 | |
---|
115 | c variables pour le fichier histoire |
---|
116 | REAL dtav ! intervalle de temps elementaire |
---|
117 | |
---|
118 | REAL tppn(iim),tpps(iim),tpn,tps |
---|
119 | c |
---|
120 | INTEGER itau,itaufinp1,iav |
---|
121 | INTEGER*4 iday ! jour julien |
---|
122 | REAL time ! Heure de la journee en fraction d'1 jour |
---|
123 | |
---|
124 | REAL SSUM |
---|
125 | REAL time_0 |
---|
126 | REAL,SAVE :: finvmaold(ip1jmp1,llm) |
---|
127 | |
---|
128 | cym LOGICAL lafin |
---|
129 | LOGICAL :: lafin |
---|
130 | INTEGER ij,iq,l |
---|
131 | INTEGER ik |
---|
132 | |
---|
133 | real time_step, t_wrt, t_ops |
---|
134 | |
---|
135 | REAL rdayvrai,rdaym_ini |
---|
136 | LOGICAL first,callinigrads |
---|
137 | |
---|
138 | data callinigrads/.true./ |
---|
139 | character*10 string10 |
---|
140 | |
---|
141 | REAL,SAVE :: alpha(ip1jmp1,llm),beta(ip1jmp1,llm) |
---|
142 | REAL,SAVE :: flxw(ip1jmp1,llm) ! flux de masse verticale |
---|
143 | |
---|
144 | c+jld variables test conservation energie |
---|
145 | REAL,SAVE :: ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm) |
---|
146 | C Tendance de la temp. potentiel d (theta)/ d t due a la |
---|
147 | C tansformation d'energie cinetique en energie thermique |
---|
148 | C cree par la dissipation |
---|
149 | REAL,SAVE :: dtetaecdt(ip1jmp1,llm) |
---|
150 | REAL,SAVE :: vcont(ip1jm,llm),ucont(ip1jmp1,llm) |
---|
151 | REAL,SAVE :: vnat(ip1jm,llm),unat(ip1jmp1,llm) |
---|
152 | REAL d_h_vcol, d_qt, d_qw, d_ql, d_ec |
---|
153 | CHARACTER*15 ztit |
---|
154 | ! INTEGER ip_ebil_dyn ! PRINT level for energy conserv. diag. |
---|
155 | ! SAVE ip_ebil_dyn |
---|
156 | ! DATA ip_ebil_dyn/0/ |
---|
157 | c-jld |
---|
158 | |
---|
159 | character*80 dynhist_file, dynhistave_file |
---|
160 | character*20 modname |
---|
161 | character*80 abort_message |
---|
162 | |
---|
163 | C Calendrier |
---|
164 | LOGICAL true_calendar |
---|
165 | PARAMETER (true_calendar = .false.) |
---|
166 | |
---|
167 | logical,PARAMETER :: dissip_conservative=.TRUE. |
---|
168 | |
---|
169 | INTEGER testita |
---|
170 | PARAMETER (testita = 9) |
---|
171 | |
---|
172 | c declaration liees au parallelisme |
---|
173 | INTEGER :: ierr |
---|
174 | LOGICAL :: FirstCaldyn |
---|
175 | LOGICAL :: FirstPhysic |
---|
176 | INTEGER :: ijb,ije,j,i |
---|
177 | type(Request) :: TestRequest |
---|
178 | type(Request) :: Request_Dissip |
---|
179 | type(Request) :: Request_physic |
---|
180 | REAL,SAVE :: dvfi_tmp(iip1,llm),dufi_tmp(iip1,llm) |
---|
181 | REAL,SAVE :: dtetafi_tmp(iip1,llm) |
---|
182 | REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: dqfi_tmp |
---|
183 | REAL,SAVE :: dpfi_tmp(iip1) |
---|
184 | |
---|
185 | INTEGER :: true_itau |
---|
186 | LOGICAL :: verbose=.true. |
---|
187 | INTEGER :: iapptrac |
---|
188 | INTEGER :: AdjustCount |
---|
189 | INTEGER :: var_time |
---|
190 | LOGICAL :: ok_start_timer=.FALSE. |
---|
191 | LOGICAL, SAVE :: firstcall=.TRUE. |
---|
192 | |
---|
193 | c$OMP MASTER |
---|
194 | ItCount=0 |
---|
195 | c$OMP END MASTER |
---|
196 | true_itau=0 |
---|
197 | FirstCaldyn=.TRUE. |
---|
198 | FirstPhysic=.TRUE. |
---|
199 | iapptrac=0 |
---|
200 | AdjustCount = 0 |
---|
201 | lafin=.false. |
---|
202 | |
---|
203 | itaufin = nday*day_step |
---|
204 | itaufinp1 = itaufin +1 |
---|
205 | modname="leapfrog_p" |
---|
206 | |
---|
207 | itau = 0 |
---|
208 | iday = day_ini+itau/day_step |
---|
209 | time = FLOAT(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
210 | IF(time.GT.1.) THEN |
---|
211 | time = time-1. |
---|
212 | iday = iday+1 |
---|
213 | ENDIF |
---|
214 | |
---|
215 | c Allocate variables depending on dynamic variable nqtot |
---|
216 | c$OMP MASTER |
---|
217 | IF (firstcall) THEN |
---|
218 | firstcall=.FALSE. |
---|
219 | ALLOCATE(dq(ip1jmp1,llm,nqtot)) |
---|
220 | ALLOCATE(dqfi(ip1jmp1,llm,nqtot)) |
---|
221 | ALLOCATE(dqfi_tmp(iip1,llm,nqtot)) |
---|
222 | END IF |
---|
223 | c$OMP END MASTER |
---|
224 | c$OMP BARRIER |
---|
225 | |
---|
226 | c----------------------------------------------------------------------- |
---|
227 | c On initialise la pression et la fonction d'Exner : |
---|
228 | c -------------------------------------------------- |
---|
229 | |
---|
230 | c$OMP MASTER |
---|
231 | dq=0. |
---|
232 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
233 | CALL exner_hyb( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf ) |
---|
234 | c$OMP END MASTER |
---|
235 | c----------------------------------------------------------------------- |
---|
236 | c Debut de l'integration temporelle: |
---|
237 | c ---------------------------------- |
---|
238 | c et du parallelisme !! |
---|
239 | |
---|
240 | 1 CONTINUE |
---|
241 | |
---|
242 | c$OMP MASTER |
---|
243 | |
---|
244 | CALL barrier |
---|
245 | |
---|
246 | c$OMP END MASTER |
---|
247 | c$OMP BARRIER |
---|
248 | |
---|
249 | |
---|
250 | #ifdef CPP_IOIPSL |
---|
251 | if (ok_guide) then |
---|
252 | !$OMP MASTER |
---|
253 | call guide_main(itau,ucov,vcov,teta,q,masse,ps) |
---|
254 | !$OMP END MASTER |
---|
255 | !$OMP BARRIER |
---|
256 | endif |
---|
257 | #endif |
---|
258 | |
---|
259 | c |
---|
260 | c IF( MOD( itau, 10* day_step ).EQ.0 ) THEN |
---|
261 | c CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
262 | c PRINT *,' ---- Test_period apres continue OK ! -----', itau |
---|
263 | c ENDIF |
---|
264 | c |
---|
265 | cym CALL SCOPY( ijmllm ,vcov , 1, vcovm1 , 1 ) |
---|
266 | cym CALL SCOPY( ijp1llm,ucov , 1, ucovm1 , 1 ) |
---|
267 | cym CALL SCOPY( ijp1llm,teta , 1, tetam1 , 1 ) |
---|
268 | cym CALL SCOPY( ijp1llm,masse, 1, massem1, 1 ) |
---|
269 | cym CALL SCOPY( ip1jmp1, ps , 1, psm1 , 1 ) |
---|
270 | |
---|
271 | if (FirstCaldyn) then |
---|
272 | c$OMP MASTER |
---|
273 | ucovm1=ucov |
---|
274 | vcovm1=vcov |
---|
275 | tetam1= teta |
---|
276 | massem1= masse |
---|
277 | psm1= ps |
---|
278 | |
---|
279 | finvmaold = masse |
---|
280 | CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
281 | c$OMP END MASTER |
---|
282 | c$OMP BARRIER |
---|
283 | else |
---|
284 | ! Save fields obtained at previous time step as '...m1' |
---|
285 | ijb=ij_begin |
---|
286 | ije=ij_end |
---|
287 | |
---|
288 | c$OMP MASTER |
---|
289 | psm1 (ijb:ije) = ps (ijb:ije) |
---|
290 | c$OMP END MASTER |
---|
291 | |
---|
292 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
293 | DO l=1,llm |
---|
294 | ije=ij_end |
---|
295 | ucovm1 (ijb:ije,l) = ucov (ijb:ije,l) |
---|
296 | tetam1 (ijb:ije,l) = teta (ijb:ije,l) |
---|
297 | massem1 (ijb:ije,l) = masse (ijb:ije,l) |
---|
298 | finvmaold(ijb:ije,l)=masse(ijb:ije,l) |
---|
299 | |
---|
300 | if (pole_sud) ije=ij_end-iip1 |
---|
301 | vcovm1(ijb:ije,l) = vcov (ijb:ije,l) |
---|
302 | |
---|
303 | |
---|
304 | ENDDO |
---|
305 | c$OMP ENDDO |
---|
306 | |
---|
307 | |
---|
308 | CALL filtreg_p ( finvmaold ,jj_begin,jj_end,jjp1, |
---|
309 | . llm, -2,2, .TRUE., 1 ) |
---|
310 | |
---|
311 | endif ! of if (FirstCaldyn) |
---|
312 | |
---|
313 | forward = .TRUE. |
---|
314 | leapf = .FALSE. |
---|
315 | dt = dtvr |
---|
316 | |
---|
317 | c ... P.Le Van .26/04/94 .... |
---|
318 | |
---|
319 | cym CALL SCOPY ( ijp1llm, masse, 1, finvmaold, 1 ) |
---|
320 | cym CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
321 | |
---|
322 | cym ne sert a rien |
---|
323 | cym call minmax(ijp1llm,q(:,:,3),zqmin,zqmax) |
---|
324 | |
---|
325 | 2 CONTINUE |
---|
326 | |
---|
327 | c$OMP MASTER |
---|
328 | ItCount=ItCount+1 |
---|
329 | if (MOD(ItCount,1)==1) then |
---|
330 | debug=.true. |
---|
331 | else |
---|
332 | debug=.false. |
---|
333 | endif |
---|
334 | c$OMP END MASTER |
---|
335 | c----------------------------------------------------------------------- |
---|
336 | |
---|
337 | c date: |
---|
338 | c ----- |
---|
339 | |
---|
340 | |
---|
341 | c gestion des appels de la physique et des dissipations: |
---|
342 | c ------------------------------------------------------ |
---|
343 | c |
---|
344 | c ... P.Le Van ( 6/02/95 ) .... |
---|
345 | |
---|
346 | apphys = .FALSE. |
---|
347 | statcl = .FALSE. |
---|
348 | conser = .FALSE. |
---|
349 | apdiss = .FALSE. |
---|
350 | c idissip=1 |
---|
351 | IF( purmats ) THEN |
---|
352 | IF( MOD(itau,iconser) .EQ.0.AND. forward ) conser = .TRUE. |
---|
353 | IF( MOD(itau,idissip ).EQ.0.AND..NOT.forward ) apdiss = .TRUE. |
---|
354 | IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward |
---|
355 | s .and. iflag_phys.EQ.1 ) apphys = .TRUE. |
---|
356 | ELSE |
---|
357 | IF( MOD(itau ,iconser) .EQ. 0 ) conser = .TRUE. |
---|
358 | IF( MOD(itau+1,idissip) .EQ. 0 ) apdiss = .TRUE. |
---|
359 | IF( MOD(itau+1,iphysiq).EQ.0.AND.iflag_phys.EQ.1) apphys=.TRUE. |
---|
360 | END IF |
---|
361 | |
---|
362 | cym ---> Pour le moment |
---|
363 | cym apphys = .FALSE. |
---|
364 | statcl = .FALSE. |
---|
365 | conser = .FALSE. |
---|
366 | |
---|
367 | if (firstCaldyn) then |
---|
368 | c$OMP MASTER |
---|
369 | call SetDistrib(jj_Nb_Caldyn) |
---|
370 | c$OMP END MASTER |
---|
371 | c$OMP BARRIER |
---|
372 | firstCaldyn=.FALSE. |
---|
373 | cym call InitTime |
---|
374 | c$OMP MASTER |
---|
375 | call Init_timer |
---|
376 | c$OMP END MASTER |
---|
377 | endif |
---|
378 | |
---|
379 | c$OMP MASTER |
---|
380 | IF (ok_start_timer) THEN |
---|
381 | CALL InitTime |
---|
382 | ok_start_timer=.FALSE. |
---|
383 | ENDIF |
---|
384 | c$OMP END MASTER |
---|
385 | |
---|
386 | if (Adjust) then |
---|
387 | c$OMP MASTER |
---|
388 | AdjustCount=AdjustCount+1 |
---|
389 | if (iapptrac==iapp_tracvl .and. (forward. OR . leapf) |
---|
390 | & .and. itau/iphysiq>2 .and. Adjustcount>30) then |
---|
391 | AdjustCount=0 |
---|
392 | call allgather_timer_average |
---|
393 | |
---|
394 | if (Verbose) then |
---|
395 | |
---|
396 | print *,'*********************************' |
---|
397 | print *,'****** TIMER CALDYN ******' |
---|
398 | do i=0,mpi_size-1 |
---|
399 | print *,'proc',i,' : Nb Bandes :',jj_nb_caldyn(i), |
---|
400 | & ' : temps moyen :', |
---|
401 | & timer_average(jj_nb_caldyn(i),timer_caldyn,i), |
---|
402 | & '+-',timer_delta(jj_nb_caldyn(i),timer_caldyn,i) |
---|
403 | enddo |
---|
404 | |
---|
405 | print *,'*********************************' |
---|
406 | print *,'****** TIMER VANLEER ******' |
---|
407 | do i=0,mpi_size-1 |
---|
408 | print *,'proc',i,' : Nb Bandes :',jj_nb_vanleer(i), |
---|
409 | & ' : temps moyen :', |
---|
410 | & timer_average(jj_nb_vanleer(i),timer_vanleer,i), |
---|
411 | & '+-',timer_delta(jj_nb_vanleer(i),timer_vanleer,i) |
---|
412 | enddo |
---|
413 | |
---|
414 | print *,'*********************************' |
---|
415 | print *,'****** TIMER DISSIP ******' |
---|
416 | do i=0,mpi_size-1 |
---|
417 | print *,'proc',i,' : Nb Bandes :',jj_nb_dissip(i), |
---|
418 | & ' : temps moyen :', |
---|
419 | & timer_average(jj_nb_dissip(i),timer_dissip,i), |
---|
420 | & '+-',timer_delta(jj_nb_dissip(i),timer_dissip,i) |
---|
421 | enddo |
---|
422 | |
---|
423 | if (mpi_rank==0) call WriteBands |
---|
424 | |
---|
425 | endif |
---|
426 | |
---|
427 | call AdjustBands_caldyn |
---|
428 | if (mpi_rank==0) call WriteBands |
---|
429 | |
---|
430 | call Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, |
---|
431 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
432 | call Register_SwapFieldHallo(ucovm1,ucovm1,ip1jmp1,llm, |
---|
433 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
434 | call Register_SwapFieldHallo(vcov,vcov,ip1jm,llm, |
---|
435 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
436 | call Register_SwapFieldHallo(vcovm1,vcovm1,ip1jm,llm, |
---|
437 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
438 | call Register_SwapFieldHallo(teta,teta,ip1jmp1,llm, |
---|
439 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
440 | call Register_SwapFieldHallo(tetam1,tetam1,ip1jmp1,llm, |
---|
441 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
442 | call Register_SwapFieldHallo(masse,masse,ip1jmp1,llm, |
---|
443 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
444 | call Register_SwapFieldHallo(massem1,massem1,ip1jmp1,llm, |
---|
445 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
446 | call Register_SwapFieldHallo(ps,ps,ip1jmp1,1, |
---|
447 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
448 | call Register_SwapFieldHallo(psm1,psm1,ip1jmp1,1, |
---|
449 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
450 | call Register_SwapFieldHallo(pkf,pkf,ip1jmp1,llm, |
---|
451 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
452 | call Register_SwapFieldHallo(pk,pk,ip1jmp1,llm, |
---|
453 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
454 | call Register_SwapFieldHallo(pks,pks,ip1jmp1,1, |
---|
455 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
456 | call Register_SwapFieldHallo(phis,phis,ip1jmp1,1, |
---|
457 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
458 | call Register_SwapFieldHallo(phi,phi,ip1jmp1,llm, |
---|
459 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
460 | call Register_SwapFieldHallo(finvmaold,finvmaold,ip1jmp1,llm, |
---|
461 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
462 | |
---|
463 | do j=1,nqtot |
---|
464 | call Register_SwapFieldHallo(q(1,1,j),q(1,1,j),ip1jmp1,llm, |
---|
465 | & jj_nb_caldyn,0,0,TestRequest) |
---|
466 | enddo |
---|
467 | |
---|
468 | call SetDistrib(jj_nb_caldyn) |
---|
469 | call SendRequest(TestRequest) |
---|
470 | call WaitRequest(TestRequest) |
---|
471 | |
---|
472 | call AdjustBands_dissip |
---|
473 | call AdjustBands_physic |
---|
474 | |
---|
475 | endif |
---|
476 | c$OMP END MASTER |
---|
477 | endif |
---|
478 | |
---|
479 | |
---|
480 | |
---|
481 | c----------------------------------------------------------------------- |
---|
482 | c calcul des tendances dynamiques: |
---|
483 | c -------------------------------- |
---|
484 | c$OMP BARRIER |
---|
485 | c$OMP MASTER |
---|
486 | call VTb(VThallo) |
---|
487 | c$OMP END MASTER |
---|
488 | |
---|
489 | call Register_Hallo(ucov,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
490 | call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,TestRequest) |
---|
491 | call Register_Hallo(teta,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
492 | call Register_Hallo(ps,ip1jmp1,1,1,2,2,1,TestRequest) |
---|
493 | call Register_Hallo(pkf,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
494 | call Register_Hallo(pk,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
495 | call Register_Hallo(pks,ip1jmp1,1,1,1,1,1,TestRequest) |
---|
496 | call Register_Hallo(p,ip1jmp1,llmp1,1,1,1,1,TestRequest) |
---|
497 | |
---|
498 | c do j=1,nqtot |
---|
499 | c call Register_Hallo(q(1,1,j),ip1jmp1,llm,1,1,1,1, |
---|
500 | c * TestRequest) |
---|
501 | c enddo |
---|
502 | |
---|
503 | call SendRequest(TestRequest) |
---|
504 | c$OMP BARRIER |
---|
505 | call WaitRequest(TestRequest) |
---|
506 | |
---|
507 | c$OMP MASTER |
---|
508 | call VTe(VThallo) |
---|
509 | c$OMP END MASTER |
---|
510 | c$OMP BARRIER |
---|
511 | |
---|
512 | if (debug) then |
---|
513 | !$OMP BARRIER |
---|
514 | !$OMP MASTER |
---|
515 | call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
516 | call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
517 | call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
518 | call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) |
---|
519 | call WriteField_p('masse',reshape(masse,(/iip1,jmp1,llm/))) |
---|
520 | call WriteField_p('pk',reshape(pk,(/iip1,jmp1,llm/))) |
---|
521 | call WriteField_p('pks',reshape(pks,(/iip1,jmp1/))) |
---|
522 | call WriteField_p('pkf',reshape(pkf,(/iip1,jmp1,llm/))) |
---|
523 | call WriteField_p('phis',reshape(phis,(/iip1,jmp1/))) |
---|
524 | do j=1,nqtot |
---|
525 | call WriteField_p('q'//trim(int2str(j)), |
---|
526 | . reshape(q(:,:,j),(/iip1,jmp1,llm/))) |
---|
527 | enddo |
---|
528 | !$OMP END MASTER |
---|
529 | c$OMP BARRIER |
---|
530 | endif |
---|
531 | |
---|
532 | |
---|
533 | True_itau=True_itau+1 |
---|
534 | |
---|
535 | c$OMP MASTER |
---|
536 | IF (prt_level>9) THEN |
---|
537 | WRITE(lunout,*)"leapfrog_p: Iteration No",True_itau |
---|
538 | ENDIF |
---|
539 | |
---|
540 | |
---|
541 | call start_timer(timer_caldyn) |
---|
542 | |
---|
543 | CALL geopot_p ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
544 | |
---|
545 | |
---|
546 | call VTb(VTcaldyn) |
---|
547 | c$OMP END MASTER |
---|
548 | var_time=time+iday-day_ini |
---|
549 | |
---|
550 | c$OMP BARRIER |
---|
551 | ! CALL FTRACE_REGION_BEGIN("caldyn") |
---|
552 | CALL caldyn_p |
---|
553 | $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , |
---|
554 | $ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, time+iday-day_ini ) |
---|
555 | |
---|
556 | ! CALL FTRACE_REGION_END("caldyn") |
---|
557 | |
---|
558 | c$OMP MASTER |
---|
559 | call VTe(VTcaldyn) |
---|
560 | c$OMP END MASTER |
---|
561 | |
---|
562 | cc$OMP BARRIER |
---|
563 | cc$OMP MASTER |
---|
564 | ! call WriteField_p('du',reshape(du,(/iip1,jmp1,llm/))) |
---|
565 | ! call WriteField_p('dv',reshape(dv,(/iip1,jjm,llm/))) |
---|
566 | ! call WriteField_p('dteta',reshape(dteta,(/iip1,jmp1,llm/))) |
---|
567 | ! call WriteField_p('dp',reshape(dp,(/iip1,jmp1/))) |
---|
568 | ! call WriteField_p('w',reshape(w,(/iip1,jmp1,llm/))) |
---|
569 | ! call WriteField_p('pbaru',reshape(pbaru,(/iip1,jmp1,llm/))) |
---|
570 | ! call WriteField_p('pbarv',reshape(pbarv,(/iip1,jjm,llm/))) |
---|
571 | ! call WriteField_p('p',reshape(p,(/iip1,jmp1,llmp1/))) |
---|
572 | ! call WriteField_p('masse',reshape(masse,(/iip1,jmp1,llm/))) |
---|
573 | ! call WriteField_p('pk',reshape(pk,(/iip1,jmp1,llm/))) |
---|
574 | cc$OMP END MASTER |
---|
575 | |
---|
576 | c----------------------------------------------------------------------- |
---|
577 | c calcul des tendances advection des traceurs (dont l'humidite) |
---|
578 | c ------------------------------------------------------------- |
---|
579 | |
---|
580 | IF( forward. OR . leapf ) THEN |
---|
581 | cc$OMP PARALLEL DEFAULT(SHARED) |
---|
582 | c |
---|
583 | CALL caladvtrac_p(q,pbaru,pbarv, |
---|
584 | * p, masse, dq, teta, |
---|
585 | . flxw,pk, iapptrac) |
---|
586 | |
---|
587 | IF (offline) THEN |
---|
588 | Cmaf stokage du flux de masse pour traceurs OFF-LINE |
---|
589 | |
---|
590 | #ifdef CPP_IOIPSL |
---|
591 | CALL fluxstokenc_p(pbaru,pbarv,masse,teta,phi,phis, |
---|
592 | . dtvr, itau) |
---|
593 | #endif |
---|
594 | |
---|
595 | |
---|
596 | ENDIF ! of IF (offline) |
---|
597 | c |
---|
598 | ENDIF ! of IF( forward. OR . leapf ) |
---|
599 | cc$OMP END PARALLEL |
---|
600 | |
---|
601 | c----------------------------------------------------------------------- |
---|
602 | c integrations dynamique et traceurs: |
---|
603 | c ---------------------------------- |
---|
604 | |
---|
605 | c$OMP MASTER |
---|
606 | call VTb(VTintegre) |
---|
607 | c$OMP END MASTER |
---|
608 | c call WriteField_p('ucovm1',reshape(ucovm1,(/iip1,jmp1,llm/))) |
---|
609 | c call WriteField_p('vcovm1',reshape(vcovm1,(/iip1,jjm,llm/))) |
---|
610 | c call WriteField_p('tetam1',reshape(tetam1,(/iip1,jmp1,llm/))) |
---|
611 | c call WriteField_p('psm1',reshape(psm1,(/iip1,jmp1/))) |
---|
612 | c call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
613 | c call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
614 | c call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
615 | c call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) |
---|
616 | cc$OMP PARALLEL DEFAULT(SHARED) |
---|
617 | c$OMP BARRIER |
---|
618 | ! CALL FTRACE_REGION_BEGIN("integrd") |
---|
619 | |
---|
620 | CALL integrd_p ( 2,vcovm1,ucovm1,tetam1,psm1,massem1 , |
---|
621 | $ dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps,masse,phis , |
---|
622 | $ finvmaold ) |
---|
623 | |
---|
624 | ! CALL FTRACE_REGION_END("integrd") |
---|
625 | c$OMP BARRIER |
---|
626 | cc$OMP MASTER |
---|
627 | c call WriteField_p('ucovm1',reshape(ucovm1,(/iip1,jmp1,llm/))) |
---|
628 | c call WriteField_p('vcovm1',reshape(vcovm1,(/iip1,jjm,llm/))) |
---|
629 | c call WriteField_p('tetam1',reshape(tetam1,(/iip1,jmp1,llm/))) |
---|
630 | c call WriteField_p('psm1',reshape(psm1,(/iip1,jmp1/))) |
---|
631 | c call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
632 | c call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
633 | c call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
634 | c call WriteField_p('dteta',reshape(dteta,(/iip1,jmp1,llm/))) |
---|
635 | c |
---|
636 | c call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) |
---|
637 | c do j=1,nqtot |
---|
638 | c call WriteField_p('q'//trim(int2str(j)), |
---|
639 | c . reshape(q(:,:,j),(/iip1,jmp1,llm/))) |
---|
640 | c call WriteField_p('dq'//trim(int2str(j)), |
---|
641 | c . reshape(dq(:,:,j),(/iip1,jmp1,llm/))) |
---|
642 | c enddo |
---|
643 | cc$OMP END MASTER |
---|
644 | |
---|
645 | |
---|
646 | c$OMP MASTER |
---|
647 | call VTe(VTintegre) |
---|
648 | c$OMP END MASTER |
---|
649 | c .P.Le Van (26/04/94 ajout de finvpold dans l'appel d'integrd) |
---|
650 | c |
---|
651 | c----------------------------------------------------------------------- |
---|
652 | c calcul des tendances physiques: |
---|
653 | c ------------------------------- |
---|
654 | c ######## P.Le Van ( Modif le 6/02/95 ) ########### |
---|
655 | c |
---|
656 | IF( purmats ) THEN |
---|
657 | IF( itau.EQ.itaufin.AND..NOT.forward ) lafin = .TRUE. |
---|
658 | ELSE |
---|
659 | IF( itau+1. EQ. itaufin ) lafin = .TRUE. |
---|
660 | ENDIF |
---|
661 | |
---|
662 | cc$OMP END PARALLEL |
---|
663 | |
---|
664 | c |
---|
665 | c |
---|
666 | IF( apphys ) THEN |
---|
667 | c |
---|
668 | c ....... Ajout P.Le Van ( 17/04/96 ) ........... |
---|
669 | c |
---|
670 | cc$OMP PARALLEL DEFAULT(SHARED) |
---|
671 | cc$OMP+ PRIVATE(rdaym_ini,rdayvrai,ijb,ije) |
---|
672 | |
---|
673 | c$OMP MASTER |
---|
674 | call suspend_timer(timer_caldyn) |
---|
675 | |
---|
676 | write(lunout,*) |
---|
677 | & 'leapfrog_p: Entree dans la physique : Iteration No ',true_itau |
---|
678 | c$OMP END MASTER |
---|
679 | |
---|
680 | CALL pression_p ( ip1jmp1, ap, bp, ps, p ) |
---|
681 | |
---|
682 | c$OMP BARRIER |
---|
683 | CALL exner_hyb_p( ip1jmp1, ps, p,alpha,beta,pks, pk, pkf ) |
---|
684 | c$OMP BARRIER |
---|
685 | rdaym_ini = itau * dtvr / daysec |
---|
686 | rdayvrai = rdaym_ini + day_ini |
---|
687 | |
---|
688 | |
---|
689 | c rajout debug |
---|
690 | c lafin = .true. |
---|
691 | |
---|
692 | |
---|
693 | c Inbterface avec les routines de phylmd (phymars ... ) |
---|
694 | c ----------------------------------------------------- |
---|
695 | |
---|
696 | c+jld |
---|
697 | |
---|
698 | c Diagnostique de conservation de l'energie : initialisation |
---|
699 | IF (ip_ebil_dyn.ge.1 ) THEN |
---|
700 | ztit='bil dyn' |
---|
701 | ! Ehouarn: be careful, diagedyn is Earth-specific (includes ../phylmd/..)! |
---|
702 | IF (planet_type.eq."earth") THEN |
---|
703 | CALL diagedyn(ztit,2,1,1,dtphys |
---|
704 | & , ucov , vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2)) |
---|
705 | ENDIF |
---|
706 | ENDIF |
---|
707 | c-jld |
---|
708 | c$OMP BARRIER |
---|
709 | c$OMP MASTER |
---|
710 | call VTb(VThallo) |
---|
711 | c$OMP END MASTER |
---|
712 | |
---|
713 | call SetTag(Request_physic,800) |
---|
714 | |
---|
715 | call Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, |
---|
716 | * jj_Nb_physic,2,2,Request_physic) |
---|
717 | |
---|
718 | call Register_SwapFieldHallo(vcov,vcov,ip1jm,llm, |
---|
719 | * jj_Nb_physic,2,2,Request_physic) |
---|
720 | |
---|
721 | call Register_SwapFieldHallo(teta,teta,ip1jmp1,llm, |
---|
722 | * jj_Nb_physic,2,2,Request_physic) |
---|
723 | |
---|
724 | call Register_SwapFieldHallo(p,p,ip1jmp1,llmp1, |
---|
725 | * jj_Nb_physic,2,2,Request_physic) |
---|
726 | |
---|
727 | call Register_SwapFieldHallo(pk,pk,ip1jmp1,llm, |
---|
728 | * jj_Nb_physic,2,2,Request_physic) |
---|
729 | |
---|
730 | call Register_SwapFieldHallo(phis,phis,ip1jmp1,1, |
---|
731 | * jj_Nb_physic,2,2,Request_physic) |
---|
732 | |
---|
733 | call Register_SwapFieldHallo(phi,phi,ip1jmp1,llm, |
---|
734 | * jj_Nb_physic,2,2,Request_physic) |
---|
735 | |
---|
736 | call Register_SwapFieldHallo(w,w,ip1jmp1,llm, |
---|
737 | * jj_Nb_physic,2,2,Request_physic) |
---|
738 | |
---|
739 | c call SetDistrib(jj_nb_vanleer) |
---|
740 | do j=1,nqtot |
---|
741 | |
---|
742 | call Register_SwapFieldHallo(q(1,1,j),q(1,1,j),ip1jmp1,llm, |
---|
743 | * jj_Nb_physic,2,2,Request_physic) |
---|
744 | enddo |
---|
745 | |
---|
746 | call Register_SwapFieldHallo(flxw,flxw,ip1jmp1,llm, |
---|
747 | * jj_Nb_physic,2,2,Request_physic) |
---|
748 | |
---|
749 | call SendRequest(Request_Physic) |
---|
750 | c$OMP BARRIER |
---|
751 | call WaitRequest(Request_Physic) |
---|
752 | |
---|
753 | c$OMP BARRIER |
---|
754 | c$OMP MASTER |
---|
755 | call SetDistrib(jj_nb_Physic) |
---|
756 | call VTe(VThallo) |
---|
757 | |
---|
758 | call VTb(VTphysiq) |
---|
759 | c$OMP END MASTER |
---|
760 | c$OMP BARRIER |
---|
761 | |
---|
762 | cc$OMP MASTER |
---|
763 | c call WriteField_p('ucovfi',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
764 | c call WriteField_p('vcovfi',reshape(vcov,(/iip1,jjm,llm/))) |
---|
765 | c call WriteField_p('tetafi',reshape(teta,(/iip1,jmp1,llm/))) |
---|
766 | c call WriteField_p('pfi',reshape(p,(/iip1,jmp1,llmp1/))) |
---|
767 | c call WriteField_p('pkfi',reshape(pk,(/iip1,jmp1,llm/))) |
---|
768 | cc$OMP END MASTER |
---|
769 | cc$OMP BARRIER |
---|
770 | ! CALL FTRACE_REGION_BEGIN("calfis") |
---|
771 | CALL calfis_p(lafin ,rdayvrai,time , |
---|
772 | $ ucov,vcov,teta,q,masse,ps,p,pk,phis,phi , |
---|
773 | $ du,dv,dteta,dq, |
---|
774 | $ flxw, |
---|
775 | $ clesphy0, dufi,dvfi,dtetafi,dqfi,dpfi ) |
---|
776 | ! CALL FTRACE_REGION_END("calfis") |
---|
777 | ijb=ij_begin |
---|
778 | ije=ij_end |
---|
779 | if ( .not. pole_nord) then |
---|
780 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
781 | DO l=1,llm |
---|
782 | dufi_tmp(1:iip1,l) = dufi(ijb:ijb+iim,l) |
---|
783 | dvfi_tmp(1:iip1,l) = dvfi(ijb:ijb+iim,l) |
---|
784 | dtetafi_tmp(1:iip1,l)= dtetafi(ijb:ijb+iim,l) |
---|
785 | dqfi_tmp(1:iip1,l,:) = dqfi(ijb:ijb+iim,l,:) |
---|
786 | ENDDO |
---|
787 | c$OMP END DO NOWAIT |
---|
788 | |
---|
789 | c$OMP MASTER |
---|
790 | dpfi_tmp(1:iip1) = dpfi(ijb:ijb+iim) |
---|
791 | c$OMP END MASTER |
---|
792 | endif ! of if ( .not. pole_nord) |
---|
793 | |
---|
794 | c$OMP BARRIER |
---|
795 | c$OMP MASTER |
---|
796 | call SetDistrib(jj_nb_Physic_bis) |
---|
797 | |
---|
798 | call VTb(VThallo) |
---|
799 | c$OMP END MASTER |
---|
800 | c$OMP BARRIER |
---|
801 | |
---|
802 | call Register_Hallo(dufi,ip1jmp1,llm, |
---|
803 | * 1,0,0,1,Request_physic) |
---|
804 | |
---|
805 | call Register_Hallo(dvfi,ip1jm,llm, |
---|
806 | * 1,0,0,1,Request_physic) |
---|
807 | |
---|
808 | call Register_Hallo(dtetafi,ip1jmp1,llm, |
---|
809 | * 1,0,0,1,Request_physic) |
---|
810 | |
---|
811 | call Register_Hallo(dpfi,ip1jmp1,1, |
---|
812 | * 1,0,0,1,Request_physic) |
---|
813 | |
---|
814 | do j=1,nqtot |
---|
815 | call Register_Hallo(dqfi(1,1,j),ip1jmp1,llm, |
---|
816 | * 1,0,0,1,Request_physic) |
---|
817 | enddo |
---|
818 | |
---|
819 | call SendRequest(Request_Physic) |
---|
820 | c$OMP BARRIER |
---|
821 | call WaitRequest(Request_Physic) |
---|
822 | |
---|
823 | c$OMP BARRIER |
---|
824 | c$OMP MASTER |
---|
825 | call VTe(VThallo) |
---|
826 | |
---|
827 | call SetDistrib(jj_nb_Physic) |
---|
828 | c$OMP END MASTER |
---|
829 | c$OMP BARRIER |
---|
830 | ijb=ij_begin |
---|
831 | if (.not. pole_nord) then |
---|
832 | |
---|
833 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
834 | DO l=1,llm |
---|
835 | dufi(ijb:ijb+iim,l) = dufi(ijb:ijb+iim,l)+dufi_tmp(1:iip1,l) |
---|
836 | dvfi(ijb:ijb+iim,l) = dvfi(ijb:ijb+iim,l)+dvfi_tmp(1:iip1,l) |
---|
837 | dtetafi(ijb:ijb+iim,l) = dtetafi(ijb:ijb+iim,l) |
---|
838 | & +dtetafi_tmp(1:iip1,l) |
---|
839 | dqfi(ijb:ijb+iim,l,:) = dqfi(ijb:ijb+iim,l,:) |
---|
840 | & + dqfi_tmp(1:iip1,l,:) |
---|
841 | ENDDO |
---|
842 | c$OMP END DO NOWAIT |
---|
843 | |
---|
844 | c$OMP MASTER |
---|
845 | dpfi(ijb:ijb+iim) = dpfi(ijb:ijb+iim)+ dpfi_tmp(1:iip1) |
---|
846 | c$OMP END MASTER |
---|
847 | |
---|
848 | endif ! of if (.not. pole_nord) |
---|
849 | c$OMP BARRIER |
---|
850 | cc$OMP MASTER |
---|
851 | c call WriteField_p('dufi',reshape(dufi,(/iip1,jmp1,llm/))) |
---|
852 | c call WriteField_p('dvfi',reshape(dvfi,(/iip1,jjm,llm/))) |
---|
853 | c call WriteField_p('dtetafi',reshape(dtetafi,(/iip1,jmp1,llm/))) |
---|
854 | c call WriteField_p('dpfi',reshape(dpfi,(/iip1,jmp1/))) |
---|
855 | cc$OMP END MASTER |
---|
856 | c |
---|
857 | c do j=1,nqtot |
---|
858 | c call WriteField_p('dqfi'//trim(int2str(j)), |
---|
859 | c . reshape(dqfi(:,:,j),(/iip1,jmp1,llm/))) |
---|
860 | c enddo |
---|
861 | |
---|
862 | c ajout des tendances physiques: |
---|
863 | c ------------------------------ |
---|
864 | IF (ok_strato) THEN |
---|
865 | CALL top_bound_p( vcov,ucov,teta, dufi,dvfi,dtetafi) |
---|
866 | ENDIF |
---|
867 | |
---|
868 | CALL addfi_p( dtphys, leapf, forward , |
---|
869 | $ ucov, vcov, teta , q ,ps , |
---|
870 | $ dufi, dvfi, dtetafi , dqfi ,dpfi ) |
---|
871 | |
---|
872 | c$OMP BARRIER |
---|
873 | c$OMP MASTER |
---|
874 | call VTe(VTphysiq) |
---|
875 | |
---|
876 | call VTb(VThallo) |
---|
877 | c$OMP END MASTER |
---|
878 | |
---|
879 | call SetTag(Request_physic,800) |
---|
880 | call Register_SwapField(ucov,ucov,ip1jmp1,llm, |
---|
881 | * jj_Nb_caldyn,Request_physic) |
---|
882 | |
---|
883 | call Register_SwapField(vcov,vcov,ip1jm,llm, |
---|
884 | * jj_Nb_caldyn,Request_physic) |
---|
885 | |
---|
886 | call Register_SwapField(teta,teta,ip1jmp1,llm, |
---|
887 | * jj_Nb_caldyn,Request_physic) |
---|
888 | |
---|
889 | call Register_SwapField(p,p,ip1jmp1,llmp1, |
---|
890 | * jj_Nb_caldyn,Request_physic) |
---|
891 | |
---|
892 | call Register_SwapField(pk,pk,ip1jmp1,llm, |
---|
893 | * jj_Nb_caldyn,Request_physic) |
---|
894 | |
---|
895 | call Register_SwapField(phis,phis,ip1jmp1,1, |
---|
896 | * jj_Nb_caldyn,Request_physic) |
---|
897 | |
---|
898 | call Register_SwapField(phi,phi,ip1jmp1,llm, |
---|
899 | * jj_Nb_caldyn,Request_physic) |
---|
900 | |
---|
901 | call Register_SwapField(w,w,ip1jmp1,llm, |
---|
902 | * jj_Nb_caldyn,Request_physic) |
---|
903 | |
---|
904 | do j=1,nqtot |
---|
905 | |
---|
906 | call Register_SwapField(q(1,1,j),q(1,1,j),ip1jmp1,llm, |
---|
907 | * jj_Nb_caldyn,Request_physic) |
---|
908 | |
---|
909 | enddo |
---|
910 | |
---|
911 | call SendRequest(Request_Physic) |
---|
912 | c$OMP BARRIER |
---|
913 | call WaitRequest(Request_Physic) |
---|
914 | |
---|
915 | c$OMP BARRIER |
---|
916 | c$OMP MASTER |
---|
917 | call VTe(VThallo) |
---|
918 | call SetDistrib(jj_Nb_caldyn) |
---|
919 | c$OMP END MASTER |
---|
920 | c$OMP BARRIER |
---|
921 | c |
---|
922 | c Diagnostique de conservation de l'energie : difference |
---|
923 | IF (ip_ebil_dyn.ge.1 ) THEN |
---|
924 | ztit='bil phys' |
---|
925 | CALL diagedyn(ztit,2,1,1,dtphys |
---|
926 | e , ucov , vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2)) |
---|
927 | ENDIF |
---|
928 | |
---|
929 | cc$OMP MASTER |
---|
930 | c if (debug) then |
---|
931 | c call WriteField_p('ucovfi',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
932 | c call WriteField_p('vcovfi',reshape(vcov,(/iip1,jjm,llm/))) |
---|
933 | c call WriteField_p('tetafi',reshape(teta,(/iip1,jmp1,llm/))) |
---|
934 | c endif |
---|
935 | cc$OMP END MASTER |
---|
936 | |
---|
937 | |
---|
938 | c-jld |
---|
939 | c$OMP MASTER |
---|
940 | call resume_timer(timer_caldyn) |
---|
941 | if (FirstPhysic) then |
---|
942 | ok_start_timer=.TRUE. |
---|
943 | FirstPhysic=.false. |
---|
944 | endif |
---|
945 | c$OMP END MASTER |
---|
946 | ENDIF ! of IF( apphys ) |
---|
947 | |
---|
948 | IF(iflag_phys.EQ.2) THEN ! "Newtonian" case |
---|
949 | c Calcul academique de la physique = Rappel Newtonien + fritcion |
---|
950 | c -------------------------------------------------------------- |
---|
951 | cym teta(:,:)=teta(:,:) |
---|
952 | cym s -iphysiq*dtvr*(teta(:,:)-tetarappel(:,:))/taurappel |
---|
953 | ijb=ij_begin |
---|
954 | ije=ij_end |
---|
955 | teta(ijb:ije,:)=teta(ijb:ije,:) |
---|
956 | s -iphysiq*dtvr*(teta(ijb:ije,:)-tetarappel(ijb:ije,:))/taurappel |
---|
957 | |
---|
958 | call Register_Hallo(ucov,ip1jmp1,llm,0,1,1,0,Request_Physic) |
---|
959 | call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,Request_Physic) |
---|
960 | call SendRequest(Request_Physic) |
---|
961 | call WaitRequest(Request_Physic) |
---|
962 | |
---|
963 | call friction_p(ucov,vcov,iphysiq*dtvr) |
---|
964 | ENDIF ! of IF(iflag_phys.EQ.2) |
---|
965 | |
---|
966 | |
---|
967 | CALL pression_p ( ip1jmp1, ap, bp, ps, p ) |
---|
968 | c$OMP BARRIER |
---|
969 | CALL exner_hyb_p( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf ) |
---|
970 | c$OMP BARRIER |
---|
971 | |
---|
972 | cc$OMP END PARALLEL |
---|
973 | |
---|
974 | c----------------------------------------------------------------------- |
---|
975 | c dissipation horizontale et verticale des petites echelles: |
---|
976 | c ---------------------------------------------------------- |
---|
977 | |
---|
978 | IF(apdiss) THEN |
---|
979 | cc$OMP PARALLEL DEFAULT(SHARED) |
---|
980 | cc$OMP+ PRIVATE(ijb,ije,tppn,tpn,tpps,tps) |
---|
981 | c$OMP MASTER |
---|
982 | call suspend_timer(timer_caldyn) |
---|
983 | |
---|
984 | c print*,'Entree dans la dissipation : Iteration No ',true_itau |
---|
985 | c calcul de l'energie cinetique avant dissipation |
---|
986 | c print *,'Passage dans la dissipation' |
---|
987 | |
---|
988 | call VTb(VThallo) |
---|
989 | c$OMP END MASTER |
---|
990 | |
---|
991 | c$OMP BARRIER |
---|
992 | |
---|
993 | call Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, |
---|
994 | * jj_Nb_dissip,1,1,Request_dissip) |
---|
995 | |
---|
996 | call Register_SwapFieldHallo(vcov,vcov,ip1jm,llm, |
---|
997 | * jj_Nb_dissip,1,1,Request_dissip) |
---|
998 | |
---|
999 | call Register_SwapField(teta,teta,ip1jmp1,llm, |
---|
1000 | * jj_Nb_dissip,Request_dissip) |
---|
1001 | |
---|
1002 | call Register_SwapField(p,p,ip1jmp1,llmp1, |
---|
1003 | * jj_Nb_dissip,Request_dissip) |
---|
1004 | |
---|
1005 | call Register_SwapField(pk,pk,ip1jmp1,llm, |
---|
1006 | * jj_Nb_dissip,Request_dissip) |
---|
1007 | |
---|
1008 | call SendRequest(Request_dissip) |
---|
1009 | c$OMP BARRIER |
---|
1010 | call WaitRequest(Request_dissip) |
---|
1011 | |
---|
1012 | c$OMP BARRIER |
---|
1013 | c$OMP MASTER |
---|
1014 | call SetDistrib(jj_Nb_dissip) |
---|
1015 | call VTe(VThallo) |
---|
1016 | call VTb(VTdissipation) |
---|
1017 | call start_timer(timer_dissip) |
---|
1018 | c$OMP END MASTER |
---|
1019 | c$OMP BARRIER |
---|
1020 | |
---|
1021 | call covcont_p(llm,ucov,vcov,ucont,vcont) |
---|
1022 | call enercin_p(vcov,ucov,vcont,ucont,ecin0) |
---|
1023 | |
---|
1024 | c dissipation |
---|
1025 | |
---|
1026 | ! CALL FTRACE_REGION_BEGIN("dissip") |
---|
1027 | CALL dissip_p(vcov,ucov,teta,p,dvdis,dudis,dtetadis) |
---|
1028 | ! CALL FTRACE_REGION_END("dissip") |
---|
1029 | |
---|
1030 | ijb=ij_begin |
---|
1031 | ije=ij_end |
---|
1032 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1033 | DO l=1,llm |
---|
1034 | ucov(ijb:ije,l)=ucov(ijb:ije,l)+dudis(ijb:ije,l) |
---|
1035 | ENDDO |
---|
1036 | c$OMP END DO NOWAIT |
---|
1037 | if (pole_sud) ije=ije-iip1 |
---|
1038 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1039 | DO l=1,llm |
---|
1040 | vcov(ijb:ije,l)=vcov(ijb:ije,l)+dvdis(ijb:ije,l) |
---|
1041 | ENDDO |
---|
1042 | c$OMP END DO NOWAIT |
---|
1043 | |
---|
1044 | c teta=teta+dtetadis |
---|
1045 | |
---|
1046 | |
---|
1047 | c------------------------------------------------------------------------ |
---|
1048 | if (dissip_conservative) then |
---|
1049 | C On rajoute la tendance due a la transform. Ec -> E therm. cree |
---|
1050 | C lors de la dissipation |
---|
1051 | c$OMP BARRIER |
---|
1052 | c$OMP MASTER |
---|
1053 | call suspend_timer(timer_dissip) |
---|
1054 | call VTb(VThallo) |
---|
1055 | c$OMP END MASTER |
---|
1056 | call Register_Hallo(ucov,ip1jmp1,llm,1,1,1,1,Request_Dissip) |
---|
1057 | call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,Request_Dissip) |
---|
1058 | call SendRequest(Request_Dissip) |
---|
1059 | c$OMP BARRIER |
---|
1060 | call WaitRequest(Request_Dissip) |
---|
1061 | c$OMP MASTER |
---|
1062 | call VTe(VThallo) |
---|
1063 | call resume_timer(timer_dissip) |
---|
1064 | c$OMP END MASTER |
---|
1065 | c$OMP BARRIER |
---|
1066 | call covcont_p(llm,ucov,vcov,ucont,vcont) |
---|
1067 | call enercin_p(vcov,ucov,vcont,ucont,ecin) |
---|
1068 | |
---|
1069 | ijb=ij_begin |
---|
1070 | ije=ij_end |
---|
1071 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1072 | do l=1,llm |
---|
1073 | do ij=ijb,ije |
---|
1074 | dtetaecdt(ij,l)= (ecin0(ij,l)-ecin(ij,l))/ pk(ij,l) |
---|
1075 | dtetadis(ij,l)=dtetadis(ij,l)+dtetaecdt(ij,l) |
---|
1076 | enddo |
---|
1077 | enddo |
---|
1078 | c$OMP END DO NOWAIT |
---|
1079 | endif |
---|
1080 | |
---|
1081 | ijb=ij_begin |
---|
1082 | ije=ij_end |
---|
1083 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1084 | do l=1,llm |
---|
1085 | do ij=ijb,ije |
---|
1086 | teta(ij,l)=teta(ij,l)+dtetadis(ij,l) |
---|
1087 | enddo |
---|
1088 | enddo |
---|
1089 | c$OMP END DO NOWAIT |
---|
1090 | c------------------------------------------------------------------------ |
---|
1091 | |
---|
1092 | |
---|
1093 | c ....... P. Le Van ( ajout le 17/04/96 ) ........... |
---|
1094 | c ... Calcul de la valeur moyenne, unique de h aux poles ..... |
---|
1095 | c |
---|
1096 | |
---|
1097 | ijb=ij_begin |
---|
1098 | ije=ij_end |
---|
1099 | |
---|
1100 | if (pole_nord) then |
---|
1101 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1102 | DO l = 1, llm |
---|
1103 | DO ij = 1,iim |
---|
1104 | tppn(ij) = aire( ij ) * teta( ij ,l) |
---|
1105 | ENDDO |
---|
1106 | tpn = SSUM(iim,tppn,1)/apoln |
---|
1107 | |
---|
1108 | DO ij = 1, iip1 |
---|
1109 | teta( ij ,l) = tpn |
---|
1110 | ENDDO |
---|
1111 | ENDDO |
---|
1112 | c$OMP END DO NOWAIT |
---|
1113 | |
---|
1114 | c$OMP MASTER |
---|
1115 | DO ij = 1,iim |
---|
1116 | tppn(ij) = aire( ij ) * ps ( ij ) |
---|
1117 | ENDDO |
---|
1118 | tpn = SSUM(iim,tppn,1)/apoln |
---|
1119 | |
---|
1120 | DO ij = 1, iip1 |
---|
1121 | ps( ij ) = tpn |
---|
1122 | ENDDO |
---|
1123 | c$OMP END MASTER |
---|
1124 | endif |
---|
1125 | |
---|
1126 | if (pole_sud) then |
---|
1127 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1128 | DO l = 1, llm |
---|
1129 | DO ij = 1,iim |
---|
1130 | tpps(ij) = aire(ij+ip1jm) * teta(ij+ip1jm,l) |
---|
1131 | ENDDO |
---|
1132 | tps = SSUM(iim,tpps,1)/apols |
---|
1133 | |
---|
1134 | DO ij = 1, iip1 |
---|
1135 | teta(ij+ip1jm,l) = tps |
---|
1136 | ENDDO |
---|
1137 | ENDDO |
---|
1138 | c$OMP END DO NOWAIT |
---|
1139 | |
---|
1140 | c$OMP MASTER |
---|
1141 | DO ij = 1,iim |
---|
1142 | tpps(ij) = aire(ij+ip1jm) * ps (ij+ip1jm) |
---|
1143 | ENDDO |
---|
1144 | tps = SSUM(iim,tpps,1)/apols |
---|
1145 | |
---|
1146 | DO ij = 1, iip1 |
---|
1147 | ps(ij+ip1jm) = tps |
---|
1148 | ENDDO |
---|
1149 | c$OMP END MASTER |
---|
1150 | endif |
---|
1151 | |
---|
1152 | |
---|
1153 | c$OMP BARRIER |
---|
1154 | c$OMP MASTER |
---|
1155 | call VTe(VTdissipation) |
---|
1156 | |
---|
1157 | call stop_timer(timer_dissip) |
---|
1158 | |
---|
1159 | call VTb(VThallo) |
---|
1160 | c$OMP END MASTER |
---|
1161 | call Register_SwapField(ucov,ucov,ip1jmp1,llm, |
---|
1162 | * jj_Nb_caldyn,Request_dissip) |
---|
1163 | |
---|
1164 | call Register_SwapField(vcov,vcov,ip1jm,llm, |
---|
1165 | * jj_Nb_caldyn,Request_dissip) |
---|
1166 | |
---|
1167 | call Register_SwapField(teta,teta,ip1jmp1,llm, |
---|
1168 | * jj_Nb_caldyn,Request_dissip) |
---|
1169 | |
---|
1170 | call Register_SwapField(p,p,ip1jmp1,llmp1, |
---|
1171 | * jj_Nb_caldyn,Request_dissip) |
---|
1172 | |
---|
1173 | call Register_SwapField(pk,pk,ip1jmp1,llm, |
---|
1174 | * jj_Nb_caldyn,Request_dissip) |
---|
1175 | |
---|
1176 | call SendRequest(Request_dissip) |
---|
1177 | c$OMP BARRIER |
---|
1178 | call WaitRequest(Request_dissip) |
---|
1179 | |
---|
1180 | c$OMP BARRIER |
---|
1181 | c$OMP MASTER |
---|
1182 | call SetDistrib(jj_Nb_caldyn) |
---|
1183 | call VTe(VThallo) |
---|
1184 | call resume_timer(timer_caldyn) |
---|
1185 | c print *,'fin dissipation' |
---|
1186 | c$OMP END MASTER |
---|
1187 | c$OMP BARRIER |
---|
1188 | END IF |
---|
1189 | |
---|
1190 | cc$OMP END PARALLEL |
---|
1191 | |
---|
1192 | c ajout debug |
---|
1193 | c IF( lafin ) then |
---|
1194 | c abort_message = 'Simulation finished' |
---|
1195 | c call abort_gcm(modname,abort_message,0) |
---|
1196 | c ENDIF |
---|
1197 | |
---|
1198 | c ******************************************************************** |
---|
1199 | c ******************************************************************** |
---|
1200 | c .... fin de l'integration dynamique et physique pour le pas itau .. |
---|
1201 | c ******************************************************************** |
---|
1202 | c ******************************************************************** |
---|
1203 | |
---|
1204 | c preparation du pas d'integration suivant ...... |
---|
1205 | cym call WriteField('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
1206 | cym call WriteField('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
1207 | c$OMP MASTER |
---|
1208 | call stop_timer(timer_caldyn) |
---|
1209 | c$OMP END MASTER |
---|
1210 | IF (itau==itaumax) then |
---|
1211 | c$OMP MASTER |
---|
1212 | call allgather_timer_average |
---|
1213 | |
---|
1214 | if (mpi_rank==0) then |
---|
1215 | |
---|
1216 | print *,'*********************************' |
---|
1217 | print *,'****** TIMER CALDYN ******' |
---|
1218 | do i=0,mpi_size-1 |
---|
1219 | print *,'proc',i,' : Nb Bandes :',jj_nb_caldyn(i), |
---|
1220 | & ' : temps moyen :', |
---|
1221 | & timer_average(jj_nb_caldyn(i),timer_caldyn,i) |
---|
1222 | enddo |
---|
1223 | |
---|
1224 | print *,'*********************************' |
---|
1225 | print *,'****** TIMER VANLEER ******' |
---|
1226 | do i=0,mpi_size-1 |
---|
1227 | print *,'proc',i,' : Nb Bandes :',jj_nb_vanleer(i), |
---|
1228 | & ' : temps moyen :', |
---|
1229 | & timer_average(jj_nb_vanleer(i),timer_vanleer,i) |
---|
1230 | enddo |
---|
1231 | |
---|
1232 | print *,'*********************************' |
---|
1233 | print *,'****** TIMER DISSIP ******' |
---|
1234 | do i=0,mpi_size-1 |
---|
1235 | print *,'proc',i,' : Nb Bandes :',jj_nb_dissip(i), |
---|
1236 | & ' : temps moyen :', |
---|
1237 | & timer_average(jj_nb_dissip(i),timer_dissip,i) |
---|
1238 | enddo |
---|
1239 | |
---|
1240 | print *,'*********************************' |
---|
1241 | print *,'****** TIMER PHYSIC ******' |
---|
1242 | do i=0,mpi_size-1 |
---|
1243 | print *,'proc',i,' : Nb Bandes :',jj_nb_physic(i), |
---|
1244 | & ' : temps moyen :', |
---|
1245 | & timer_average(jj_nb_physic(i),timer_physic,i) |
---|
1246 | enddo |
---|
1247 | |
---|
1248 | endif |
---|
1249 | |
---|
1250 | print *,'Taille du Buffer MPI (REAL*8)',MaxBufferSize |
---|
1251 | print *,'Taille du Buffer MPI utilise (REAL*8)',MaxBufferSize_Used |
---|
1252 | print *, 'Temps total ecoule sur la parallelisation :',DiffTime() |
---|
1253 | print *, 'Temps CPU ecoule sur la parallelisation :',DiffCpuTime() |
---|
1254 | CALL print_filtre_timer |
---|
1255 | call finalize_parallel |
---|
1256 | c$OMP END MASTER |
---|
1257 | c$OMP BARRIER |
---|
1258 | RETURN |
---|
1259 | ENDIF |
---|
1260 | |
---|
1261 | IF ( .NOT.purmats ) THEN |
---|
1262 | c ........................................................ |
---|
1263 | c .............. schema matsuno + leapfrog .............. |
---|
1264 | c ........................................................ |
---|
1265 | |
---|
1266 | IF(forward. OR. leapf) THEN |
---|
1267 | itau= itau + 1 |
---|
1268 | iday= day_ini+itau/day_step |
---|
1269 | time= FLOAT(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
1270 | IF(time.GT.1.) THEN |
---|
1271 | time = time-1. |
---|
1272 | iday = iday+1 |
---|
1273 | ENDIF |
---|
1274 | ENDIF |
---|
1275 | |
---|
1276 | |
---|
1277 | IF( itau. EQ. itaufinp1 ) then |
---|
1278 | |
---|
1279 | c$OMP MASTER |
---|
1280 | call finalize_parallel |
---|
1281 | c$OMP END MASTER |
---|
1282 | abort_message = 'Simulation finished' |
---|
1283 | call abort_gcm(modname,abort_message,0) |
---|
1284 | RETURN |
---|
1285 | ENDIF |
---|
1286 | c----------------------------------------------------------------------- |
---|
1287 | c ecriture du fichier histoire moyenne: |
---|
1288 | c ------------------------------------- |
---|
1289 | |
---|
1290 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
1291 | c$OMP BARRIER |
---|
1292 | IF(itau.EQ.itaufin) THEN |
---|
1293 | iav=1 |
---|
1294 | ELSE |
---|
1295 | iav=0 |
---|
1296 | ENDIF |
---|
1297 | #ifdef CPP_IOIPSL |
---|
1298 | IF (ok_dynzon) THEN |
---|
1299 | call Register_Hallo(vcov,ip1jm,llm,1,0,0,1,TestRequest) |
---|
1300 | call SendRequest(TestRequest) |
---|
1301 | c$OMP BARRIER |
---|
1302 | call WaitRequest(TestRequest) |
---|
1303 | c$OMP BARRIER |
---|
1304 | c$OMP MASTER |
---|
1305 | CALL writedynav_p(histaveid, itau,vcov , |
---|
1306 | , ucov,teta,pk,phi,q,masse,ps,phis) |
---|
1307 | |
---|
1308 | c ATTENTION!!! bilan_dyn_p ne marche probablement pas avec OpenMP |
---|
1309 | CALL bilan_dyn_p(2,dtvr*iperiod,dtvr*day_step*periodav, |
---|
1310 | , ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) |
---|
1311 | c$OMP END MASTER |
---|
1312 | ENDIF !ok_dynzon |
---|
1313 | #endif |
---|
1314 | ENDIF |
---|
1315 | |
---|
1316 | c----------------------------------------------------------------------- |
---|
1317 | c ecriture de la bande histoire: |
---|
1318 | c ------------------------------ |
---|
1319 | |
---|
1320 | c IF( MOD(itau,iecri ).EQ.0) THEN |
---|
1321 | |
---|
1322 | IF( MOD(itau,iecri*day_step).EQ.0) THEN |
---|
1323 | c$OMP BARRIER |
---|
1324 | c$OMP MASTER |
---|
1325 | nbetat = nbetatdem |
---|
1326 | CALL geopot_p(ip1jmp1,teta,pk,pks,phis,phi) |
---|
1327 | |
---|
1328 | cym unat=0. |
---|
1329 | |
---|
1330 | ijb=ij_begin |
---|
1331 | ije=ij_end |
---|
1332 | |
---|
1333 | if (pole_nord) then |
---|
1334 | ijb=ij_begin+iip1 |
---|
1335 | unat(1:iip1,:)=0. |
---|
1336 | endif |
---|
1337 | |
---|
1338 | if (pole_sud) then |
---|
1339 | ije=ij_end-iip1 |
---|
1340 | unat(ij_end-iip1+1:ij_end,:)=0. |
---|
1341 | endif |
---|
1342 | |
---|
1343 | do l=1,llm |
---|
1344 | unat(ijb:ije,l)=ucov(ijb:ije,l)/cu(ijb:ije) |
---|
1345 | enddo |
---|
1346 | |
---|
1347 | ijb=ij_begin |
---|
1348 | ije=ij_end |
---|
1349 | if (pole_sud) ije=ij_end-iip1 |
---|
1350 | |
---|
1351 | do l=1,llm |
---|
1352 | vnat(ijb:ije,l)=vcov(ijb:ije,l)/cv(ijb:ije) |
---|
1353 | enddo |
---|
1354 | |
---|
1355 | #ifdef CPP_IOIPSL |
---|
1356 | |
---|
1357 | CALL writehist_p(histid,histvid, itau,vcov, |
---|
1358 | & ucov,teta,phi,q,masse,ps,phis) |
---|
1359 | |
---|
1360 | #endif |
---|
1361 | ! For some Grads outputs of fields |
---|
1362 | if (output_grads_dyn) then |
---|
1363 | ! Ehouarn: hope this works the way I think it does: |
---|
1364 | call Gather_Field(unat,ip1jmp1,llm,0) |
---|
1365 | call Gather_Field(vnat,ip1jm,llm,0) |
---|
1366 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
1367 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
1368 | do iq=1,nqtot |
---|
1369 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
1370 | enddo |
---|
1371 | if (mpi_rank==0) then |
---|
1372 | #include "write_grads_dyn.h" |
---|
1373 | endif |
---|
1374 | endif ! of if (output_grads_dyn) |
---|
1375 | c$OMP END MASTER |
---|
1376 | ENDIF ! of IF(MOD(itau,iecri).EQ.0) |
---|
1377 | |
---|
1378 | IF(itau.EQ.itaufin) THEN |
---|
1379 | |
---|
1380 | c$OMP BARRIER |
---|
1381 | c$OMP MASTER |
---|
1382 | |
---|
1383 | if (planet_type.eq."earth") then |
---|
1384 | #ifdef CPP_EARTH |
---|
1385 | ! Write an Earth-format restart file |
---|
1386 | CALL dynredem1_p("restart.nc",0.0, |
---|
1387 | & vcov,ucov,teta,q,masse,ps) |
---|
1388 | |
---|
1389 | #endif |
---|
1390 | endif ! of if (planet_type.eq."earth") |
---|
1391 | |
---|
1392 | CLOSE(99) |
---|
1393 | c$OMP END MASTER |
---|
1394 | ENDIF ! of IF (itau.EQ.itaufin) |
---|
1395 | |
---|
1396 | c----------------------------------------------------------------------- |
---|
1397 | c gestion de l'integration temporelle: |
---|
1398 | c ------------------------------------ |
---|
1399 | |
---|
1400 | IF( MOD(itau,iperiod).EQ.0 ) THEN |
---|
1401 | GO TO 1 |
---|
1402 | ELSE IF ( MOD(itau-1,iperiod). EQ. 0 ) THEN |
---|
1403 | |
---|
1404 | IF( forward ) THEN |
---|
1405 | c fin du pas forward et debut du pas backward |
---|
1406 | |
---|
1407 | forward = .FALSE. |
---|
1408 | leapf = .FALSE. |
---|
1409 | GO TO 2 |
---|
1410 | |
---|
1411 | ELSE |
---|
1412 | c fin du pas backward et debut du premier pas leapfrog |
---|
1413 | |
---|
1414 | leapf = .TRUE. |
---|
1415 | dt = 2.*dtvr |
---|
1416 | GO TO 2 |
---|
1417 | END IF |
---|
1418 | ELSE |
---|
1419 | |
---|
1420 | c ...... pas leapfrog ..... |
---|
1421 | |
---|
1422 | leapf = .TRUE. |
---|
1423 | dt = 2.*dtvr |
---|
1424 | GO TO 2 |
---|
1425 | END IF ! of IF (MOD(itau,iperiod).EQ.0) |
---|
1426 | ! ELSEIF (MOD(itau-1,iperiod).EQ.0) |
---|
1427 | |
---|
1428 | |
---|
1429 | ELSE ! of IF (.not.purmats) |
---|
1430 | |
---|
1431 | c ........................................................ |
---|
1432 | c .............. schema matsuno ............... |
---|
1433 | c ........................................................ |
---|
1434 | IF( forward ) THEN |
---|
1435 | |
---|
1436 | itau = itau + 1 |
---|
1437 | iday = day_ini+itau/day_step |
---|
1438 | time = FLOAT(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
1439 | |
---|
1440 | IF(time.GT.1.) THEN |
---|
1441 | time = time-1. |
---|
1442 | iday = iday+1 |
---|
1443 | ENDIF |
---|
1444 | |
---|
1445 | forward = .FALSE. |
---|
1446 | IF( itau. EQ. itaufinp1 ) then |
---|
1447 | c$OMP MASTER |
---|
1448 | call finalize_parallel |
---|
1449 | c$OMP END MASTER |
---|
1450 | abort_message = 'Simulation finished' |
---|
1451 | call abort_gcm(modname,abort_message,0) |
---|
1452 | RETURN |
---|
1453 | ENDIF |
---|
1454 | GO TO 2 |
---|
1455 | |
---|
1456 | ELSE ! of IF(forward) |
---|
1457 | |
---|
1458 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
1459 | IF(itau.EQ.itaufin) THEN |
---|
1460 | iav=1 |
---|
1461 | ELSE |
---|
1462 | iav=0 |
---|
1463 | ENDIF |
---|
1464 | #ifdef CPP_IOIPSL |
---|
1465 | IF (ok_dynzon) THEN |
---|
1466 | c$OMP BARRIER |
---|
1467 | |
---|
1468 | call Register_Hallo(vcov,ip1jm,llm,1,0,0,1,TestRequest) |
---|
1469 | call SendRequest(TestRequest) |
---|
1470 | c$OMP BARRIER |
---|
1471 | call WaitRequest(TestRequest) |
---|
1472 | |
---|
1473 | c$OMP BARRIER |
---|
1474 | c$OMP MASTER |
---|
1475 | CALL writedynav_p(histaveid, itau,vcov , |
---|
1476 | , ucov,teta,pk,phi,q,masse,ps,phis) |
---|
1477 | CALL bilan_dyn_p(2,dtvr*iperiod,dtvr*day_step*periodav, |
---|
1478 | , ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) |
---|
1479 | c$OMP END MASTER |
---|
1480 | END IF !ok_dynzon |
---|
1481 | #endif |
---|
1482 | ENDIF ! of IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) |
---|
1483 | |
---|
1484 | |
---|
1485 | c IF(MOD(itau,iecri ).EQ.0) THEN |
---|
1486 | IF(MOD(itau,iecri*day_step).EQ.0) THEN |
---|
1487 | c$OMP BARRIER |
---|
1488 | c$OMP MASTER |
---|
1489 | nbetat = nbetatdem |
---|
1490 | CALL geopot_p(ip1jmp1,teta,pk,pks,phis,phi) |
---|
1491 | |
---|
1492 | cym unat=0. |
---|
1493 | ijb=ij_begin |
---|
1494 | ije=ij_end |
---|
1495 | |
---|
1496 | if (pole_nord) then |
---|
1497 | ijb=ij_begin+iip1 |
---|
1498 | unat(1:iip1,:)=0. |
---|
1499 | endif |
---|
1500 | |
---|
1501 | if (pole_sud) then |
---|
1502 | ije=ij_end-iip1 |
---|
1503 | unat(ij_end-iip1+1:ij_end,:)=0. |
---|
1504 | endif |
---|
1505 | |
---|
1506 | do l=1,llm |
---|
1507 | unat(ijb:ije,l)=ucov(ijb:ije,l)/cu(ijb:ije) |
---|
1508 | enddo |
---|
1509 | |
---|
1510 | ijb=ij_begin |
---|
1511 | ije=ij_end |
---|
1512 | if (pole_sud) ije=ij_end-iip1 |
---|
1513 | |
---|
1514 | do l=1,llm |
---|
1515 | vnat(ijb:ije,l)=vcov(ijb:ije,l)/cv(ijb:ije) |
---|
1516 | enddo |
---|
1517 | |
---|
1518 | #ifdef CPP_IOIPSL |
---|
1519 | |
---|
1520 | CALL writehist_p(histid, histvid, itau,vcov , |
---|
1521 | & ucov,teta,phi,q,masse,ps,phis) |
---|
1522 | #endif |
---|
1523 | ! For some Grads output (but does it work?) |
---|
1524 | if (output_grads_dyn) then |
---|
1525 | call Gather_Field(unat,ip1jmp1,llm,0) |
---|
1526 | call Gather_Field(vnat,ip1jm,llm,0) |
---|
1527 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
1528 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
1529 | do iq=1,nqtot |
---|
1530 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
1531 | enddo |
---|
1532 | c |
---|
1533 | if (mpi_rank==0) then |
---|
1534 | #include "write_grads_dyn.h" |
---|
1535 | endif |
---|
1536 | endif ! of if (output_grads_dyn) |
---|
1537 | |
---|
1538 | c$OMP END MASTER |
---|
1539 | ENDIF ! of IF(MOD(itau,iecri*day_step).EQ.0) |
---|
1540 | |
---|
1541 | IF(itau.EQ.itaufin) THEN |
---|
1542 | if (planet_type.eq."earth") then |
---|
1543 | #ifdef CPP_EARTH |
---|
1544 | c$OMP MASTER |
---|
1545 | CALL dynredem1_p("restart.nc",0.0, |
---|
1546 | . vcov,ucov,teta,q,masse,ps) |
---|
1547 | c$OMP END MASTER |
---|
1548 | #endif |
---|
1549 | endif ! of if (planet_type.eq."earth") |
---|
1550 | ENDIF ! of IF(itau.EQ.itaufin) |
---|
1551 | |
---|
1552 | forward = .TRUE. |
---|
1553 | GO TO 1 |
---|
1554 | |
---|
1555 | ENDIF ! of IF (forward) |
---|
1556 | |
---|
1557 | END IF ! of IF(.not.purmats) |
---|
1558 | c$OMP MASTER |
---|
1559 | call finalize_parallel |
---|
1560 | c$OMP END MASTER |
---|
1561 | RETURN |
---|
1562 | END |
---|