1 | ! |
---|
2 | ! $Id: leapfrog_p.F 1446 2010-10-22 09:27:25Z emillour $ |
---|
3 | ! |
---|
4 | c |
---|
5 | c |
---|
6 | |
---|
7 | SUBROUTINE leapfrog_p(ucov,vcov,teta,ps,masse,phis,q, |
---|
8 | & time_0) |
---|
9 | |
---|
10 | use exner_hyb_m, only: exner_hyb |
---|
11 | use exner_milieu_m, only: exner_milieu |
---|
12 | use exner_hyb_p_m, only: exner_hyb_p |
---|
13 | use exner_milieu_p_m, only: exner_milieu_p |
---|
14 | USE misc_mod |
---|
15 | USE parallel_lmdz |
---|
16 | USE times |
---|
17 | USE mod_hallo |
---|
18 | USE Bands |
---|
19 | USE Write_Field |
---|
20 | USE Write_Field_p |
---|
21 | USE vampir |
---|
22 | USE timer_filtre, ONLY : print_filtre_timer |
---|
23 | USE infotrac, ONLY: nqtot |
---|
24 | USE guide_p_mod, ONLY : guide_main |
---|
25 | USE getparam |
---|
26 | USE control_mod, only: planet_type,nday,day_step,iperiod,iphysiq, |
---|
27 | & less1day,fractday,ndynstep,iconser, |
---|
28 | & dissip_period,offline,ip_ebil_dyn, |
---|
29 | & ok_dynzon,periodav,ok_dyn_ave,iecri, |
---|
30 | & ok_dyn_ins,output_grads_dyn, |
---|
31 | & iapp_tracvl,ecritstart |
---|
32 | use cpdet_mod, only: cpdet,tpot2t_glo_p,t2tpot_glo_p |
---|
33 | use sponge_mod_p, only: callsponge,mode_sponge,sponge_p |
---|
34 | use comuforc_h |
---|
35 | USE comvert_mod, ONLY: ap,bp,pressure_exner,presnivs |
---|
36 | USE comconst_mod, ONLY: jmp1,daysec,dtvr,dtphys,dtdiss, |
---|
37 | . cpp,ihf,iflag_top_bound,pi |
---|
38 | USE logic_mod, ONLY: iflag_phys,ok_guide,forward,leapf,apphys, |
---|
39 | . statcl,conser,apdiss,purmats,tidal,ok_strato |
---|
40 | USE temps_mod, ONLY: itaufin,jD_ref,jH_ref,day_ini, |
---|
41 | . day_ref,start_time,dt,hour_ini,day_end |
---|
42 | |
---|
43 | |
---|
44 | IMPLICIT NONE |
---|
45 | |
---|
46 | c ...... Version du 10/01/98 .......... |
---|
47 | |
---|
48 | c avec coordonnees verticales hybrides |
---|
49 | c avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
50 | |
---|
51 | c======================================================================= |
---|
52 | c |
---|
53 | c Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
54 | c ------- |
---|
55 | c |
---|
56 | c Objet: |
---|
57 | c ------ |
---|
58 | c |
---|
59 | c GCM LMD nouvelle grille |
---|
60 | c |
---|
61 | c======================================================================= |
---|
62 | c |
---|
63 | c ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
64 | c et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
65 | c hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
66 | |
---|
67 | c ... Possibilite de choisir le shema pour l'advection de |
---|
68 | c q , en modifiant iadv dans traceur.def (10/02) . |
---|
69 | c |
---|
70 | c Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
71 | c Pour Van-Leer iadv=10 |
---|
72 | c |
---|
73 | c----------------------------------------------------------------------- |
---|
74 | c Declarations: |
---|
75 | c ------------- |
---|
76 | |
---|
77 | #include "dimensions.h" |
---|
78 | #include "paramet.h" |
---|
79 | #include "comdissnew.h" |
---|
80 | #include "comgeom.h" |
---|
81 | !#include "com_io_dyn.h" |
---|
82 | #include "iniprint.h" |
---|
83 | #include "academic.h" |
---|
84 | |
---|
85 | REAL,INTENT(IN) :: time_0 ! not used |
---|
86 | |
---|
87 | c dynamical variables: |
---|
88 | REAL,INTENT(INOUT) :: ucov(ip1jmp1,llm) ! zonal covariant wind |
---|
89 | REAL,INTENT(INOUT) :: vcov(ip1jm,llm) ! meridional covariant wind |
---|
90 | REAL,INTENT(INOUT) :: teta(ip1jmp1,llm) ! potential temperature |
---|
91 | REAL,INTENT(INOUT) :: ps(ip1jmp1) ! surface pressure (Pa) |
---|
92 | REAL,INTENT(INOUT) :: masse(ip1jmp1,llm) ! air mass |
---|
93 | REAL,INTENT(INOUT) :: phis(ip1jmp1) ! geopotentiat at the surface |
---|
94 | REAL,INTENT(INOUT) :: q(ip1jmp1,llm,nqtot) ! advected tracers |
---|
95 | |
---|
96 | REAL,SAVE :: p (ip1jmp1,llmp1 ) ! interlayer pressure |
---|
97 | REAL,SAVE :: pks(ip1jmp1) ! exner at the surface |
---|
98 | REAL,SAVE :: pk(ip1jmp1,llm) ! exner at mid-layer |
---|
99 | REAL,SAVE :: pkf(ip1jmp1,llm) ! filtered exner at mid-layer |
---|
100 | REAL,SAVE :: phi(ip1jmp1,llm) ! geopotential |
---|
101 | REAL,SAVE :: w(ip1jmp1,llm) ! vertical velocity |
---|
102 | ! ADAPTATION GCM POUR CP(T) |
---|
103 | REAL,SAVE :: temp(ip1jmp1,llm) ! temperature |
---|
104 | REAL,SAVE :: tsurpk(ip1jmp1,llm) ! cpp*T/pk |
---|
105 | |
---|
106 | real zqmin,zqmax |
---|
107 | |
---|
108 | c variables dynamiques intermediaire pour le transport |
---|
109 | REAL,SAVE :: pbaru(ip1jmp1,llm),pbarv(ip1jm,llm) !flux de masse |
---|
110 | |
---|
111 | c variables dynamiques au pas -1 |
---|
112 | REAL,SAVE :: vcovm1(ip1jm,llm),ucovm1(ip1jmp1,llm) |
---|
113 | REAL,SAVE :: tetam1(ip1jmp1,llm),psm1(ip1jmp1) |
---|
114 | REAL,SAVE :: massem1(ip1jmp1,llm) |
---|
115 | |
---|
116 | c tendances dynamiques |
---|
117 | REAL,SAVE :: dv(ip1jm,llm),du(ip1jmp1,llm) |
---|
118 | REAL,SAVE :: dteta(ip1jmp1,llm),dp(ip1jmp1) |
---|
119 | REAL,DIMENSION(:,:,:), ALLOCATABLE, SAVE :: dq |
---|
120 | |
---|
121 | c tendances de la dissipation |
---|
122 | REAL,SAVE :: dvdis(ip1jm,llm),dudis(ip1jmp1,llm) |
---|
123 | REAL,SAVE :: dtetadis(ip1jmp1,llm) |
---|
124 | |
---|
125 | c tendances physiques |
---|
126 | REAL,SAVE :: dvfi(ip1jm,llm),dufi(ip1jmp1,llm) |
---|
127 | REAL,SAVE :: dtetafi(ip1jmp1,llm) |
---|
128 | REAL,SAVE :: dpfi(ip1jmp1) |
---|
129 | REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: dqfi |
---|
130 | |
---|
131 | c tendances top_bound (sponge layer) |
---|
132 | c REAL,SAVE :: dvtop(ip1jm,llm) |
---|
133 | REAL,SAVE :: dutop(ip1jmp1,llm) |
---|
134 | c REAL,SAVE :: dtetatop(ip1jmp1,llm) |
---|
135 | c REAL,SAVE :: dptop(ip1jmp1) |
---|
136 | c REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: dqtop |
---|
137 | |
---|
138 | c TITAN : tendances due au forces de marees */s |
---|
139 | REAL,SAVE :: dvtidal(ip1jm,llm),dutidal(ip1jmp1,llm) |
---|
140 | |
---|
141 | c variables pour le fichier histoire |
---|
142 | REAL dtav ! intervalle de temps elementaire |
---|
143 | LOGICAL lrestart |
---|
144 | |
---|
145 | REAL tppn(iim),tpps(iim),tpn,tps |
---|
146 | c |
---|
147 | INTEGER itau,itaufinp1,iav |
---|
148 | ! INTEGER iday ! jour julien |
---|
149 | REAL time |
---|
150 | |
---|
151 | REAL SSUM |
---|
152 | ! REAL,SAVE :: finvmaold(ip1jmp1,llm) |
---|
153 | |
---|
154 | cym LOGICAL lafin |
---|
155 | LOGICAL :: lafin |
---|
156 | INTEGER ij,iq,l |
---|
157 | INTEGER ik |
---|
158 | |
---|
159 | real time_step, t_wrt, t_ops |
---|
160 | |
---|
161 | ! jD_cur: jour julien courant |
---|
162 | ! jH_cur: heure julienne courante |
---|
163 | REAL :: jD_cur, jH_cur |
---|
164 | INTEGER :: an, mois, jour |
---|
165 | REAL :: secondes |
---|
166 | real :: rdaym_ini |
---|
167 | logical :: physics |
---|
168 | LOGICAL first,callinigrads |
---|
169 | |
---|
170 | data callinigrads/.true./ |
---|
171 | character*10 string10 |
---|
172 | |
---|
173 | REAL,SAVE :: flxw(ip1jmp1,llm) ! flux de masse verticale |
---|
174 | |
---|
175 | c+jld variables test conservation energie |
---|
176 | REAL,SAVE :: ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm) |
---|
177 | C Tendance de la temp. potentiel d (theta)/ d t due a la |
---|
178 | C tansformation d'energie cinetique en energie thermique |
---|
179 | C cree par la dissipation |
---|
180 | REAL,SAVE :: dtetaecdt(ip1jmp1,llm) |
---|
181 | REAL,SAVE :: vcont(ip1jm,llm),ucont(ip1jmp1,llm) |
---|
182 | REAL,SAVE :: vnat(ip1jm,llm),unat(ip1jmp1,llm) |
---|
183 | REAL d_h_vcol, d_qt, d_qw, d_ql, d_ec |
---|
184 | CHARACTER*15 ztit |
---|
185 | ! INTEGER ip_ebil_dyn ! PRINT level for energy conserv. diag. |
---|
186 | ! SAVE ip_ebil_dyn |
---|
187 | ! DATA ip_ebil_dyn/0/ |
---|
188 | c-jld |
---|
189 | |
---|
190 | character*80 dynhist_file, dynhistave_file |
---|
191 | character(len=*),parameter :: modname="leapfrog" |
---|
192 | character*80 abort_message |
---|
193 | |
---|
194 | |
---|
195 | logical,PARAMETER :: dissip_conservative=.TRUE. |
---|
196 | |
---|
197 | INTEGER testita |
---|
198 | PARAMETER (testita = 9) |
---|
199 | |
---|
200 | logical , parameter :: flag_verif = .false. |
---|
201 | |
---|
202 | ! for CP(T) -- Aymeric |
---|
203 | real :: dtec |
---|
204 | real,save :: ztetaec(ip1jmp1,llm) !!SAVE ??? |
---|
205 | |
---|
206 | c declaration liees au parallelisme |
---|
207 | INTEGER :: ierr |
---|
208 | LOGICAL :: FirstCaldyn |
---|
209 | LOGICAL :: FirstPhysic |
---|
210 | INTEGER :: ijb,ije,j,i |
---|
211 | type(Request) :: TestRequest |
---|
212 | type(Request) :: Request_Dissip |
---|
213 | type(Request) :: Request_physic |
---|
214 | REAL,SAVE :: dvfi_tmp(iip1,llm),dufi_tmp(iip1,llm) |
---|
215 | REAL,SAVE :: dtetafi_tmp(iip1,llm) |
---|
216 | REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: dqfi_tmp |
---|
217 | REAL,SAVE :: dpfi_tmp(iip1) |
---|
218 | |
---|
219 | INTEGER :: true_itau |
---|
220 | INTEGER :: iapptrac |
---|
221 | INTEGER :: AdjustCount |
---|
222 | ! INTEGER :: var_time |
---|
223 | LOGICAL :: ok_start_timer=.FALSE. |
---|
224 | LOGICAL, SAVE :: firstcall=.TRUE. |
---|
225 | |
---|
226 | c$OMP MASTER |
---|
227 | ItCount=0 |
---|
228 | c$OMP END MASTER |
---|
229 | true_itau=0 |
---|
230 | FirstCaldyn=.TRUE. |
---|
231 | FirstPhysic=.TRUE. |
---|
232 | iapptrac=0 |
---|
233 | AdjustCount = 0 |
---|
234 | lafin=.false. |
---|
235 | |
---|
236 | if (nday>=0) then |
---|
237 | itaufin = nday*day_step |
---|
238 | else |
---|
239 | ! to run a given (-nday) number of dynamical steps |
---|
240 | itaufin = -nday |
---|
241 | endif |
---|
242 | if (less1day) then |
---|
243 | c MODIF VENUS: to run less than one day: |
---|
244 | itaufin = int(fractday*day_step) |
---|
245 | endif |
---|
246 | if (ndynstep.gt.0) then |
---|
247 | ! running a given number of dynamical steps |
---|
248 | itaufin=ndynstep |
---|
249 | endif |
---|
250 | itaufinp1 = itaufin +1 |
---|
251 | |
---|
252 | itau = 0 |
---|
253 | physics=.true. |
---|
254 | if (iflag_phys==0.or.iflag_phys==2) physics=.false. |
---|
255 | ! iday = day_ini+itau/day_step |
---|
256 | ! time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
257 | ! IF(time.GT.1.) THEN |
---|
258 | ! time = time-1. |
---|
259 | ! iday = iday+1 |
---|
260 | ! ENDIF |
---|
261 | |
---|
262 | c Allocate variables depending on dynamic variable nqtot |
---|
263 | c$OMP MASTER |
---|
264 | IF (firstcall) THEN |
---|
265 | firstcall=.FALSE. |
---|
266 | ALLOCATE(dq(ip1jmp1,llm,nqtot)) |
---|
267 | ALLOCATE(dqfi(ip1jmp1,llm,nqtot)) |
---|
268 | ALLOCATE(dqfi_tmp(iip1,llm,nqtot)) |
---|
269 | c ALLOCATE(dqtop(ip1jmp1,llm,nqtot)) |
---|
270 | END IF |
---|
271 | c$OMP END MASTER |
---|
272 | c$OMP BARRIER |
---|
273 | |
---|
274 | c----------------------------------------------------------------------- |
---|
275 | c On initialise la pression et la fonction d'Exner : |
---|
276 | c -------------------------------------------------- |
---|
277 | |
---|
278 | c$OMP MASTER |
---|
279 | c INITIALISATIONS |
---|
280 | dudis(:,:) =0. |
---|
281 | dvdis(:,:) =0. |
---|
282 | dtetadis(:,:)=0. |
---|
283 | dutop(:,:) =0. |
---|
284 | c dvtop(:,:) =0. |
---|
285 | c dtetatop(:,:)=0. |
---|
286 | c dqtop(:,:,:) =0. |
---|
287 | c dptop(:) =0. |
---|
288 | dufi(:,:) =0. |
---|
289 | dvfi(:,:) =0. |
---|
290 | dtetafi(:,:)=0. |
---|
291 | dqfi(:,:,:) =0. |
---|
292 | dpfi(:) =0. |
---|
293 | dq(:,:,:) =0. |
---|
294 | dp(:)=0 |
---|
295 | pbaru(:,:)=0 |
---|
296 | pbarv(:,:)=0 |
---|
297 | |
---|
298 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
299 | if (pressure_exner) then |
---|
300 | CALL exner_hyb( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
301 | else |
---|
302 | CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
303 | endif |
---|
304 | c$OMP END MASTER |
---|
305 | c----------------------------------------------------------------------- |
---|
306 | c Debut de l'integration temporelle: |
---|
307 | c ---------------------------------- |
---|
308 | c et du parallelisme !! |
---|
309 | |
---|
310 | c RMBY: check that hour_ini and start_time are not both non-zero |
---|
311 | if ((hour_ini.ne.0.0).and.(start_time.ne.0.0)) then |
---|
312 | write(*,*) "ERROR: hour_ini = ", hour_ini, |
---|
313 | & "start_time = ", start_time |
---|
314 | abort_message = 'hour_ini and start_time both nonzero' |
---|
315 | call abort_gcm(modname,abort_message,1) |
---|
316 | endif |
---|
317 | |
---|
318 | 1 CONTINUE ! Matsuno Forward step begins here |
---|
319 | |
---|
320 | c date: (NB: date remains unchanged for Backward step) |
---|
321 | c ----- |
---|
322 | |
---|
323 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
324 | & (itau+1)/day_step |
---|
325 | IF (planet_type .eq. "mars") THEN |
---|
326 | jH_cur = jH_ref + hour_ini + & |
---|
327 | & mod(itau+1,day_step)/float(day_step) |
---|
328 | ELSE |
---|
329 | jH_cur = jH_ref + start_time + & |
---|
330 | & mod(itau+1,day_step)/float(day_step) |
---|
331 | ENDIF |
---|
332 | if (jH_cur > 1.0 ) then |
---|
333 | jD_cur = jD_cur +1. |
---|
334 | jH_cur = jH_cur -1. |
---|
335 | endif |
---|
336 | |
---|
337 | |
---|
338 | #ifdef CPP_IOIPSL |
---|
339 | IF (planet_type.eq."earth") THEN |
---|
340 | if (ok_guide) then |
---|
341 | !$OMP MASTER |
---|
342 | call guide_main(itau,ucov,vcov,teta,q,masse,ps) |
---|
343 | !$OMP END MASTER |
---|
344 | !$OMP BARRIER |
---|
345 | endif |
---|
346 | ENDIF |
---|
347 | #endif |
---|
348 | |
---|
349 | c |
---|
350 | c IF( MOD( itau, 10* day_step ).EQ.0 ) THEN |
---|
351 | c CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
352 | c PRINT *,' ---- Test_period apres continue OK ! -----', itau |
---|
353 | c ENDIF |
---|
354 | c |
---|
355 | cym CALL SCOPY( ijmllm ,vcov , 1, vcovm1 , 1 ) |
---|
356 | cym CALL SCOPY( ijp1llm,ucov , 1, ucovm1 , 1 ) |
---|
357 | cym CALL SCOPY( ijp1llm,teta , 1, tetam1 , 1 ) |
---|
358 | cym CALL SCOPY( ijp1llm,masse, 1, massem1, 1 ) |
---|
359 | cym CALL SCOPY( ip1jmp1, ps , 1, psm1 , 1 ) |
---|
360 | |
---|
361 | if (FirstCaldyn) then |
---|
362 | c$OMP MASTER |
---|
363 | ucovm1=ucov |
---|
364 | vcovm1=vcov |
---|
365 | tetam1= teta |
---|
366 | massem1= masse |
---|
367 | psm1= ps |
---|
368 | |
---|
369 | ! Ehouarn: finvmaold is actually not used |
---|
370 | ! finvmaold = masse |
---|
371 | ! CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
372 | c$OMP END MASTER |
---|
373 | c$OMP BARRIER |
---|
374 | else |
---|
375 | ! Save fields obtained at previous time step as '...m1' |
---|
376 | ijb=ij_begin |
---|
377 | ije=ij_end |
---|
378 | |
---|
379 | c$OMP MASTER |
---|
380 | psm1 (ijb:ije) = ps (ijb:ije) |
---|
381 | c$OMP END MASTER |
---|
382 | |
---|
383 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
384 | DO l=1,llm |
---|
385 | ije=ij_end |
---|
386 | ucovm1 (ijb:ije,l) = ucov (ijb:ije,l) |
---|
387 | tetam1 (ijb:ije,l) = teta (ijb:ije,l) |
---|
388 | massem1 (ijb:ije,l) = masse (ijb:ije,l) |
---|
389 | ! finvmaold(ijb:ije,l)=masse(ijb:ije,l) |
---|
390 | |
---|
391 | if (pole_sud) ije=ij_end-iip1 |
---|
392 | vcovm1(ijb:ije,l) = vcov (ijb:ije,l) |
---|
393 | |
---|
394 | |
---|
395 | ENDDO |
---|
396 | c$OMP ENDDO |
---|
397 | |
---|
398 | |
---|
399 | ! Ehouarn: finvmaold not used |
---|
400 | ! CALL filtreg_p ( finvmaold ,jj_begin,jj_end,jjp1, |
---|
401 | ! . llm, -2,2, .TRUE., 1 ) |
---|
402 | |
---|
403 | endif ! of if (FirstCaldyn) |
---|
404 | |
---|
405 | forward = .TRUE. |
---|
406 | leapf = .FALSE. |
---|
407 | dt = dtvr |
---|
408 | |
---|
409 | c ... P.Le Van .26/04/94 .... |
---|
410 | |
---|
411 | cym CALL SCOPY ( ijp1llm, masse, 1, finvmaold, 1 ) |
---|
412 | cym CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
413 | |
---|
414 | cym ne sert a rien |
---|
415 | cym call minmax(ijp1llm,q(:,:,3),zqmin,zqmax) |
---|
416 | |
---|
417 | 2 CONTINUE ! Matsuno backward or leapfrog step begins here |
---|
418 | |
---|
419 | c$OMP MASTER |
---|
420 | ItCount=ItCount+1 |
---|
421 | if (MOD(ItCount,1)==1) then |
---|
422 | debug=.true. |
---|
423 | else |
---|
424 | debug=.false. |
---|
425 | endif |
---|
426 | c$OMP END MASTER |
---|
427 | c----------------------------------------------------------------------- |
---|
428 | |
---|
429 | c date: (NB: only leapfrog step requires recomputing date) |
---|
430 | c ----- |
---|
431 | |
---|
432 | IF (leapf) THEN |
---|
433 | jD_cur = jD_ref + day_ini - day_ref + |
---|
434 | & (itau+1)/day_step |
---|
435 | IF (planet_type .eq. "mars") THEN |
---|
436 | jH_cur = jH_ref + hour_ini + |
---|
437 | & mod(itau+1,day_step)/float(day_step) |
---|
438 | ELSE |
---|
439 | jH_cur = jH_ref + start_time + |
---|
440 | & mod(itau+1,day_step)/float(day_step) |
---|
441 | ENDIF |
---|
442 | if (jH_cur > 1.0 ) then |
---|
443 | jD_cur = jD_cur +1. |
---|
444 | jH_cur = jH_cur -1. |
---|
445 | endif |
---|
446 | ENDIF |
---|
447 | |
---|
448 | |
---|
449 | c gestion des appels de la physique et des dissipations: |
---|
450 | c ------------------------------------------------------ |
---|
451 | c |
---|
452 | c ... P.Le Van ( 6/02/95 ) .... |
---|
453 | |
---|
454 | apphys = .FALSE. |
---|
455 | statcl = .FALSE. |
---|
456 | conser = .FALSE. |
---|
457 | apdiss = .FALSE. |
---|
458 | c idissip=1 |
---|
459 | IF( purmats ) THEN |
---|
460 | ! Purely Matsuno time stepping |
---|
461 | IF( MOD(itau,iconser) .EQ.0.AND. forward ) conser = .TRUE. |
---|
462 | IF( MOD(itau,dissip_period ).EQ.0.AND..NOT.forward ) |
---|
463 | s apdiss = .TRUE. |
---|
464 | IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward |
---|
465 | s .and. physics ) apphys = .TRUE. |
---|
466 | ELSE |
---|
467 | ! Leapfrog/Matsuno time stepping |
---|
468 | IF( MOD(itau ,iconser) .EQ. 0 ) conser = .TRUE. |
---|
469 | IF( MOD(itau+1,dissip_period).EQ.0 .AND. .NOT. forward ) |
---|
470 | s apdiss = .TRUE. |
---|
471 | IF( MOD(itau+1,iphysiq).EQ.0.AND.physics) apphys=.TRUE. |
---|
472 | END IF |
---|
473 | |
---|
474 | ! Ehouarn: for Shallow Water case (ie: 1 vertical layer), |
---|
475 | ! supress dissipation step |
---|
476 | if (llm.eq.1) then |
---|
477 | apdiss=.false. |
---|
478 | endif |
---|
479 | |
---|
480 | #ifdef NODYN |
---|
481 | apdiss=.false. |
---|
482 | #endif |
---|
483 | |
---|
484 | |
---|
485 | cym ---> Pour le moment |
---|
486 | cym apphys = .FALSE. |
---|
487 | statcl = .FALSE. |
---|
488 | conser = .FALSE. ! ie: no output of control variables to stdout in // |
---|
489 | |
---|
490 | if (firstCaldyn) then |
---|
491 | c$OMP MASTER |
---|
492 | call SetDistrib(jj_Nb_Caldyn) |
---|
493 | c$OMP END MASTER |
---|
494 | c$OMP BARRIER |
---|
495 | firstCaldyn=.FALSE. |
---|
496 | cym call InitTime |
---|
497 | c$OMP MASTER |
---|
498 | call Init_timer |
---|
499 | c$OMP END MASTER |
---|
500 | endif |
---|
501 | |
---|
502 | c$OMP MASTER |
---|
503 | IF (ok_start_timer) THEN |
---|
504 | CALL InitTime |
---|
505 | ok_start_timer=.FALSE. |
---|
506 | ENDIF |
---|
507 | c$OMP END MASTER |
---|
508 | |
---|
509 | if (Adjust) then |
---|
510 | c$OMP MASTER |
---|
511 | AdjustCount=AdjustCount+1 |
---|
512 | if (iapptrac==iapp_tracvl .and. (forward. OR . leapf) |
---|
513 | & .and. itau/iphysiq>2 .and. Adjustcount>30) then |
---|
514 | AdjustCount=0 |
---|
515 | call allgather_timer_average |
---|
516 | |
---|
517 | if (prt_level > 9) then |
---|
518 | |
---|
519 | print *,'*********************************' |
---|
520 | print *,'****** TIMER CALDYN ******' |
---|
521 | do i=0,mpi_size-1 |
---|
522 | print *,'proc',i,' : Nb Bandes :',jj_nb_caldyn(i), |
---|
523 | & ' : temps moyen :', |
---|
524 | & timer_average(jj_nb_caldyn(i),timer_caldyn,i), |
---|
525 | & '+-',timer_delta(jj_nb_caldyn(i),timer_caldyn,i) |
---|
526 | enddo |
---|
527 | |
---|
528 | print *,'*********************************' |
---|
529 | print *,'****** TIMER VANLEER ******' |
---|
530 | do i=0,mpi_size-1 |
---|
531 | print *,'proc',i,' : Nb Bandes :',jj_nb_vanleer(i), |
---|
532 | & ' : temps moyen :', |
---|
533 | & timer_average(jj_nb_vanleer(i),timer_vanleer,i), |
---|
534 | & '+-',timer_delta(jj_nb_vanleer(i),timer_vanleer,i) |
---|
535 | enddo |
---|
536 | |
---|
537 | print *,'*********************************' |
---|
538 | print *,'****** TIMER DISSIP ******' |
---|
539 | do i=0,mpi_size-1 |
---|
540 | print *,'proc',i,' : Nb Bandes :',jj_nb_dissip(i), |
---|
541 | & ' : temps moyen :', |
---|
542 | & timer_average(jj_nb_dissip(i),timer_dissip,i), |
---|
543 | & '+-',timer_delta(jj_nb_dissip(i),timer_dissip,i) |
---|
544 | enddo |
---|
545 | |
---|
546 | if (mpi_rank==0) call WriteBands |
---|
547 | |
---|
548 | endif |
---|
549 | |
---|
550 | call AdjustBands_caldyn |
---|
551 | if (mpi_rank==0) call WriteBands |
---|
552 | |
---|
553 | call Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, |
---|
554 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
555 | call Register_SwapFieldHallo(ucovm1,ucovm1,ip1jmp1,llm, |
---|
556 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
557 | call Register_SwapFieldHallo(vcov,vcov,ip1jm,llm, |
---|
558 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
559 | call Register_SwapFieldHallo(vcovm1,vcovm1,ip1jm,llm, |
---|
560 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
561 | call Register_SwapFieldHallo(teta,teta,ip1jmp1,llm, |
---|
562 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
563 | call Register_SwapFieldHallo(tetam1,tetam1,ip1jmp1,llm, |
---|
564 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
565 | call Register_SwapFieldHallo(masse,masse,ip1jmp1,llm, |
---|
566 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
567 | call Register_SwapFieldHallo(massem1,massem1,ip1jmp1,llm, |
---|
568 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
569 | call Register_SwapFieldHallo(ps,ps,ip1jmp1,1, |
---|
570 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
571 | call Register_SwapFieldHallo(psm1,psm1,ip1jmp1,1, |
---|
572 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
573 | call Register_SwapFieldHallo(pkf,pkf,ip1jmp1,llm, |
---|
574 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
575 | call Register_SwapFieldHallo(pk,pk,ip1jmp1,llm, |
---|
576 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
577 | call Register_SwapFieldHallo(pks,pks,ip1jmp1,1, |
---|
578 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
579 | call Register_SwapFieldHallo(phis,phis,ip1jmp1,1, |
---|
580 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
581 | call Register_SwapFieldHallo(phi,phi,ip1jmp1,llm, |
---|
582 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
583 | ! call Register_SwapFieldHallo(finvmaold,finvmaold,ip1jmp1,llm, |
---|
584 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
585 | |
---|
586 | do j=1,nqtot |
---|
587 | call Register_SwapFieldHallo(q(1,1,j),q(1,1,j),ip1jmp1,llm, |
---|
588 | & jj_nb_caldyn,0,0,TestRequest) |
---|
589 | enddo |
---|
590 | ! ADAPTATION GCM POUR CP(T) |
---|
591 | call Register_SwapFieldHallo(temp,temp,ip1jmp1,llm, |
---|
592 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
593 | call Register_SwapFieldHallo(tsurpk,tsurpk,ip1jmp1,llm, |
---|
594 | & jj_Nb_caldyn,0,0,TestRequest) |
---|
595 | |
---|
596 | call SetDistrib(jj_nb_caldyn) |
---|
597 | call SendRequest(TestRequest) |
---|
598 | call WaitRequest(TestRequest) |
---|
599 | |
---|
600 | call AdjustBands_dissip |
---|
601 | call AdjustBands_physic |
---|
602 | |
---|
603 | endif |
---|
604 | c$OMP END MASTER |
---|
605 | endif ! of if (Adjust) |
---|
606 | |
---|
607 | |
---|
608 | |
---|
609 | c----------------------------------------------------------------------- |
---|
610 | c calcul des tendances dynamiques: |
---|
611 | c -------------------------------- |
---|
612 | ! ADAPTATION GCM POUR CP(T) |
---|
613 | call tpot2t_glo_p(teta,temp,pk) |
---|
614 | ijb=ij_begin |
---|
615 | ije=ij_end |
---|
616 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
617 | do l=1,llm |
---|
618 | tsurpk(ijb:ije,l)=cpp*temp(ijb:ije,l)/pk(ijb:ije,l) |
---|
619 | enddo |
---|
620 | !$OMP END DO |
---|
621 | |
---|
622 | if (debug) then |
---|
623 | !$OMP BARRIER |
---|
624 | !$OMP MASTER |
---|
625 | call WriteField_p('temp',reshape(temp,(/iip1,jmp1,llm/))) |
---|
626 | call WriteField_p('tsurpk',reshape(tsurpk,(/iip1,jmp1,llm/))) |
---|
627 | !$OMP END MASTER |
---|
628 | !$OMP BARRIER |
---|
629 | endif ! of if (debug) |
---|
630 | |
---|
631 | c$OMP BARRIER |
---|
632 | c$OMP MASTER |
---|
633 | call VTb(VThallo) |
---|
634 | c$OMP END MASTER |
---|
635 | |
---|
636 | call Register_Hallo(ucov,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
637 | call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,TestRequest) |
---|
638 | call Register_Hallo(teta,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
639 | call Register_Hallo(ps,ip1jmp1,1,1,2,2,1,TestRequest) |
---|
640 | call Register_Hallo(pkf,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
641 | call Register_Hallo(pk,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
642 | call Register_Hallo(pks,ip1jmp1,1,1,1,1,1,TestRequest) |
---|
643 | call Register_Hallo(p,ip1jmp1,llmp1,1,1,1,1,TestRequest) |
---|
644 | ! ADAPTATION GCM POUR CP(T) |
---|
645 | call Register_Hallo(temp,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
646 | call Register_Hallo(tsurpk,ip1jmp1,llm,1,1,1,1,TestRequest) |
---|
647 | |
---|
648 | c do j=1,nqtot |
---|
649 | c call Register_Hallo(q(1,1,j),ip1jmp1,llm,1,1,1,1, |
---|
650 | c * TestRequest) |
---|
651 | c enddo |
---|
652 | |
---|
653 | call SendRequest(TestRequest) |
---|
654 | c$OMP BARRIER |
---|
655 | call WaitRequest(TestRequest) |
---|
656 | |
---|
657 | c$OMP MASTER |
---|
658 | call VTe(VThallo) |
---|
659 | c$OMP END MASTER |
---|
660 | c$OMP BARRIER |
---|
661 | |
---|
662 | if (debug) then |
---|
663 | !$OMP BARRIER |
---|
664 | !$OMP MASTER |
---|
665 | call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
666 | call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
667 | call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
668 | call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) |
---|
669 | call WriteField_p('masse',reshape(masse,(/iip1,jmp1,llm/))) |
---|
670 | call WriteField_p('pk',reshape(pk,(/iip1,jmp1,llm/))) |
---|
671 | call WriteField_p('pks',reshape(pks,(/iip1,jmp1/))) |
---|
672 | call WriteField_p('pkf',reshape(pkf,(/iip1,jmp1,llm/))) |
---|
673 | call WriteField_p('phis',reshape(phis,(/iip1,jmp1/))) |
---|
674 | if (nqtot > 0) then |
---|
675 | do j=1,nqtot |
---|
676 | call WriteField_p('q'//trim(int2str(j)), |
---|
677 | . reshape(q(:,:,j),(/iip1,jmp1,llm/))) |
---|
678 | enddo |
---|
679 | endif |
---|
680 | !$OMP END MASTER |
---|
681 | c$OMP BARRIER |
---|
682 | endif |
---|
683 | |
---|
684 | |
---|
685 | True_itau=True_itau+1 |
---|
686 | |
---|
687 | c$OMP MASTER |
---|
688 | IF (prt_level>9) THEN |
---|
689 | WRITE(lunout,*)"leapfrog_p: Iteration No",True_itau |
---|
690 | ENDIF |
---|
691 | |
---|
692 | |
---|
693 | call start_timer(timer_caldyn) |
---|
694 | |
---|
695 | ! compute geopotential phi() |
---|
696 | ! ADAPTATION GCM POUR CP(T) |
---|
697 | ! CALL geopot_p ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
698 | CALL geopot_p ( ip1jmp1, tsurpk , pk , pks, phis , phi ) |
---|
699 | |
---|
700 | call VTb(VTcaldyn) |
---|
701 | c$OMP END MASTER |
---|
702 | ! var_time=time+iday-day_ini |
---|
703 | |
---|
704 | c$OMP BARRIER |
---|
705 | ! CALL FTRACE_REGION_BEGIN("caldyn") |
---|
706 | time = jD_cur + jH_cur |
---|
707 | rdaym_ini = itau * dtvr / daysec |
---|
708 | |
---|
709 | #ifdef NODYN |
---|
710 | !WRITE(lunout,*)"NO DYN !!!!!" |
---|
711 | dv(:,:) = 0.D+0 |
---|
712 | du(:,:) = 0.D+0 |
---|
713 | dteta(:,:) = 0.D+0 |
---|
714 | dq(:,:,:) = 0.D+0 |
---|
715 | dp(:) = 0.D+0 |
---|
716 | flxw(:,:) = 0.D+0 |
---|
717 | if (planet_type.eq."generic") then |
---|
718 | if (ok_guide) then |
---|
719 | DO l=1,llm |
---|
720 | ucov(:,l) = ucov(:,l) + dt*attenua(l)* |
---|
721 | & ((uforc(:,l)-ucov(:,l))/facwind) |
---|
722 | ENDDO |
---|
723 | endif |
---|
724 | endif |
---|
725 | #else |
---|
726 | ! ADAPTATION GCM POUR CP(T) |
---|
727 | ! CALL caldyn_p |
---|
728 | ! $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , |
---|
729 | ! $ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, time ) |
---|
730 | CALL caldyn_p |
---|
731 | $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,tsurpk,phis, |
---|
732 | $ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, time ) |
---|
733 | |
---|
734 | ! CALL FTRACE_REGION_END("caldyn") |
---|
735 | |
---|
736 | c$OMP MASTER |
---|
737 | call VTe(VTcaldyn) |
---|
738 | c$OMP END MASTER |
---|
739 | |
---|
740 | cc$OMP BARRIER |
---|
741 | cc$OMP MASTER |
---|
742 | ! call WriteField_p('du',reshape(du,(/iip1,jmp1,llm/))) |
---|
743 | ! call WriteField_p('dv',reshape(dv,(/iip1,jjm,llm/))) |
---|
744 | ! call WriteField_p('dteta',reshape(dteta,(/iip1,jmp1,llm/))) |
---|
745 | ! call WriteField_p('dp',reshape(dp,(/iip1,jmp1/))) |
---|
746 | ! call WriteField_p('w',reshape(w,(/iip1,jmp1,llm/))) |
---|
747 | ! call WriteField_p('pbaru',reshape(pbaru,(/iip1,jmp1,llm/))) |
---|
748 | ! call WriteField_p('pbarv',reshape(pbarv,(/iip1,jjm,llm/))) |
---|
749 | ! call WriteField_p('p',reshape(p,(/iip1,jmp1,llmp1/))) |
---|
750 | ! call WriteField_p('masse',reshape(masse,(/iip1,jmp1,llm/))) |
---|
751 | ! call WriteField_p('pk',reshape(pk,(/iip1,jmp1,llm/))) |
---|
752 | cc$OMP END MASTER |
---|
753 | |
---|
754 | |
---|
755 | ! Simple zonal wind nudging for generic planetary model |
---|
756 | ! AS 09/2013 |
---|
757 | ! --------------------------------------------------- |
---|
758 | if (planet_type.eq."generic") then |
---|
759 | if (ok_guide) then |
---|
760 | DO l=1,llm |
---|
761 | du(:,l)=du(:,l)+attenua(l)*((uforc(:,l)-ucov(:,l))/facwind) |
---|
762 | ENDDO |
---|
763 | endif |
---|
764 | endif |
---|
765 | |
---|
766 | c----------------------------------------------------------------------- |
---|
767 | c calcul des tendances advection des traceurs (dont l'humidite) |
---|
768 | c ------------------------------------------------------------- |
---|
769 | |
---|
770 | IF( forward. OR . leapf ) THEN |
---|
771 | ! Ehouarn: NB: fields sent to advtrac are those at the beginning of the time step |
---|
772 | CALL advtrac_p( pbaru,pbarv, |
---|
773 | * p, masse,q,iapptrac, teta, |
---|
774 | . flxw, pk) |
---|
775 | |
---|
776 | C Stokage du flux de masse pour traceurs OFF-LINE |
---|
777 | IF (offline .AND. .NOT. adjust) THEN |
---|
778 | CALL fluxstokenc_p(pbaru,pbarv,masse,teta,phi,phis, |
---|
779 | . dtvr, itau) |
---|
780 | ENDIF |
---|
781 | |
---|
782 | ENDIF ! of IF( forward. OR . leapf ) |
---|
783 | |
---|
784 | c----------------------------------------------------------------------- |
---|
785 | c integrations dynamique et traceurs: |
---|
786 | c ---------------------------------- |
---|
787 | |
---|
788 | c$OMP MASTER |
---|
789 | call VTb(VTintegre) |
---|
790 | c$OMP END MASTER |
---|
791 | c call WriteField_p('ucovm1',reshape(ucovm1,(/iip1,jmp1,llm/))) |
---|
792 | c call WriteField_p('vcovm1',reshape(vcovm1,(/iip1,jjm,llm/))) |
---|
793 | c call WriteField_p('tetam1',reshape(tetam1,(/iip1,jmp1,llm/))) |
---|
794 | c call WriteField_p('psm1',reshape(psm1,(/iip1,jmp1/))) |
---|
795 | c call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
796 | c call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
797 | c call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
798 | c call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) |
---|
799 | cc$OMP PARALLEL DEFAULT(SHARED) |
---|
800 | c$OMP BARRIER |
---|
801 | ! CALL FTRACE_REGION_BEGIN("integrd") |
---|
802 | |
---|
803 | CALL integrd_p (nqtot,vcovm1,ucovm1,tetam1,psm1,massem1 , |
---|
804 | $ dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps,masse,phis ) |
---|
805 | ! $ finvmaold ) |
---|
806 | |
---|
807 | IF ((planet_type.eq."titan").and.(tidal)) then |
---|
808 | c----------------------------------------------------------------------- |
---|
809 | c Marées gravitationnelles causées par Saturne |
---|
810 | c B. Charnay (28/10/2010) |
---|
811 | c ---------------------------------------------------------- |
---|
812 | CALL tidal_forces(rdaym_ini, dutidal, dvtidal) |
---|
813 | ucov=ucov+dutidal*dt |
---|
814 | vcov=vcov+dvtidal*dt |
---|
815 | ENDIF |
---|
816 | |
---|
817 | ! CALL FTRACE_REGION_END("integrd") |
---|
818 | c$OMP BARRIER |
---|
819 | cc$OMP MASTER |
---|
820 | c call WriteField_p('ucovm1',reshape(ucovm1,(/iip1,jmp1,llm/))) |
---|
821 | c call WriteField_p('vcovm1',reshape(vcovm1,(/iip1,jjm,llm/))) |
---|
822 | c call WriteField_p('tetam1',reshape(tetam1,(/iip1,jmp1,llm/))) |
---|
823 | c call WriteField_p('psm1',reshape(psm1,(/iip1,jmp1/))) |
---|
824 | c call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
825 | c call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
826 | c call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
827 | c call WriteField_p('dteta',reshape(dteta,(/iip1,jmp1,llm/))) |
---|
828 | c |
---|
829 | c call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) |
---|
830 | c do j=1,nqtot |
---|
831 | c call WriteField_p('q'//trim(int2str(j)), |
---|
832 | c . reshape(q(:,:,j),(/iip1,jmp1,llm/))) |
---|
833 | c call WriteField_p('dq'//trim(int2str(j)), |
---|
834 | c . reshape(dq(:,:,j),(/iip1,jmp1,llm/))) |
---|
835 | c enddo |
---|
836 | cc$OMP END MASTER |
---|
837 | |
---|
838 | ! NODYN precompiling flag |
---|
839 | #endif |
---|
840 | |
---|
841 | c$OMP MASTER |
---|
842 | call VTe(VTintegre) |
---|
843 | c$OMP END MASTER |
---|
844 | c .P.Le Van (26/04/94 ajout de finvpold dans l'appel d'integrd) |
---|
845 | c |
---|
846 | c----------------------------------------------------------------------- |
---|
847 | c calcul des tendances physiques: |
---|
848 | c ------------------------------- |
---|
849 | c ######## P.Le Van ( Modif le 6/02/95 ) ########### |
---|
850 | c |
---|
851 | IF( purmats ) THEN |
---|
852 | IF( itau.EQ.itaufin.AND..NOT.forward ) lafin = .TRUE. |
---|
853 | ELSE |
---|
854 | IF( itau+1. EQ. itaufin ) lafin = .TRUE. |
---|
855 | ENDIF |
---|
856 | |
---|
857 | cc$OMP END PARALLEL |
---|
858 | |
---|
859 | c |
---|
860 | c |
---|
861 | IF( apphys ) THEN |
---|
862 | c |
---|
863 | c ....... Ajout P.Le Van ( 17/04/96 ) ........... |
---|
864 | c |
---|
865 | cc$OMP PARALLEL DEFAULT(SHARED) |
---|
866 | cc$OMP+ PRIVATE(rdaym_ini,rdayvrai,ijb,ije) |
---|
867 | |
---|
868 | c$OMP MASTER |
---|
869 | call suspend_timer(timer_caldyn) |
---|
870 | |
---|
871 | if (prt_level >= 10) then |
---|
872 | write(lunout,*) |
---|
873 | & 'leapfrog_p: Entree dans la physique : Iteration No ',true_itau |
---|
874 | endif |
---|
875 | c$OMP END MASTER |
---|
876 | |
---|
877 | CALL pression_p ( ip1jmp1, ap, bp, ps, p ) |
---|
878 | |
---|
879 | c$OMP BARRIER |
---|
880 | if (pressure_exner) then |
---|
881 | CALL exner_hyb_p( ip1jmp1, ps, p,pks, pk, pkf ) |
---|
882 | else |
---|
883 | CALL exner_milieu_p( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
884 | endif |
---|
885 | c$OMP BARRIER |
---|
886 | ! Compute geopotential (physics might need it) |
---|
887 | !==== |
---|
888 | ! GEOP CORRECTION |
---|
889 | ! ADAPTATION GCM POUR CP(T) |
---|
890 | call tpot2t_glo_p(teta,temp,pk) |
---|
891 | ijb=ij_begin |
---|
892 | ije=ij_end |
---|
893 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
894 | do l=1,llm |
---|
895 | tsurpk(ijb:ije,l)=cpp*temp(ijb:ije,l)/pk(ijb:ije,l) |
---|
896 | enddo |
---|
897 | !$OMP END DO |
---|
898 | c$OMP MASTER |
---|
899 | ! CALL geopot_p ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
900 | CALL geopot_p( ip1jmp1, tsurpk, pk, pks, phis, phi ) |
---|
901 | c$OMP END MASTER |
---|
902 | c$OMP BARRIER |
---|
903 | !==== |
---|
904 | |
---|
905 | jD_cur = jD_ref + day_ini - day_ref |
---|
906 | $ + (itau+1)/day_step |
---|
907 | |
---|
908 | IF ((planet_type .eq."generic").or. |
---|
909 | & (planet_type.eq."mars")) THEN |
---|
910 | ! AS: we make jD_cur to be pday |
---|
911 | jD_cur = int(day_ini + itau/day_step) |
---|
912 | ENDIF |
---|
913 | |
---|
914 | IF (planet_type .eq. "mars") THEN |
---|
915 | jH_cur = jH_ref + hour_ini + & |
---|
916 | & mod(itau,day_step)/float(day_step) |
---|
917 | ELSE IF (planet_type .eq. "generic") THEN |
---|
918 | jH_cur = jH_ref + start_time + & |
---|
919 | & mod(itau,day_step)/float(day_step) |
---|
920 | ELSE |
---|
921 | jH_cur = jH_ref + start_time + & |
---|
922 | & mod(itau+1,day_step)/float(day_step) |
---|
923 | ENDIF |
---|
924 | if (jH_cur > 1.0 ) then |
---|
925 | jD_cur = jD_cur +1. |
---|
926 | jH_cur = jH_cur -1. |
---|
927 | endif |
---|
928 | |
---|
929 | c rajout debug |
---|
930 | c lafin = .true. |
---|
931 | |
---|
932 | |
---|
933 | c Interface avec les routines de phylmd (phymars ... ) |
---|
934 | c ----------------------------------------------------- |
---|
935 | |
---|
936 | c+jld |
---|
937 | |
---|
938 | c Diagnostique de conservation de l'energie : initialisation |
---|
939 | IF (ip_ebil_dyn.ge.1 ) THEN |
---|
940 | ztit='bil dyn' |
---|
941 | ! Ehouarn: be careful, diagedyn is Earth-specific! |
---|
942 | IF (planet_type.eq."earth") THEN |
---|
943 | CALL diagedyn(ztit,2,1,1,dtphys |
---|
944 | & , ucov , vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2)) |
---|
945 | ENDIF |
---|
946 | ENDIF |
---|
947 | c-jld |
---|
948 | c$OMP BARRIER |
---|
949 | c$OMP MASTER |
---|
950 | call VTb(VThallo) |
---|
951 | c$OMP END MASTER |
---|
952 | |
---|
953 | call SetTag(Request_physic,800) |
---|
954 | |
---|
955 | call Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, |
---|
956 | * jj_Nb_physic,2,2,Request_physic) |
---|
957 | |
---|
958 | call Register_SwapFieldHallo(vcov,vcov,ip1jm,llm, |
---|
959 | * jj_Nb_physic,2,2,Request_physic) |
---|
960 | |
---|
961 | call Register_SwapFieldHallo(teta,teta,ip1jmp1,llm, |
---|
962 | * jj_Nb_physic,2,2,Request_physic) |
---|
963 | |
---|
964 | call Register_SwapFieldHallo(masse,masse,ip1jmp1,llm, |
---|
965 | * jj_Nb_physic,1,2,Request_physic) |
---|
966 | |
---|
967 | call Register_SwapFieldHallo(ps,ps,ip1jmp1,1, |
---|
968 | * jj_Nb_physic,2,2,Request_physic) |
---|
969 | |
---|
970 | call Register_SwapFieldHallo(p,p,ip1jmp1,llmp1, |
---|
971 | * jj_Nb_physic,2,2,Request_physic) |
---|
972 | |
---|
973 | call Register_SwapFieldHallo(pk,pk,ip1jmp1,llm, |
---|
974 | * jj_Nb_physic,2,2,Request_physic) |
---|
975 | |
---|
976 | call Register_SwapFieldHallo(phis,phis,ip1jmp1,1, |
---|
977 | * jj_Nb_physic,2,2,Request_physic) |
---|
978 | |
---|
979 | call Register_SwapFieldHallo(phi,phi,ip1jmp1,llm, |
---|
980 | * jj_Nb_physic,2,2,Request_physic) |
---|
981 | |
---|
982 | call Register_SwapFieldHallo(w,w,ip1jmp1,llm, |
---|
983 | * jj_Nb_physic,2,2,Request_physic) |
---|
984 | |
---|
985 | c call SetDistrib(jj_nb_vanleer) |
---|
986 | do j=1,nqtot |
---|
987 | |
---|
988 | call Register_SwapFieldHallo(q(1,1,j),q(1,1,j),ip1jmp1,llm, |
---|
989 | * jj_Nb_physic,2,2,Request_physic) |
---|
990 | enddo |
---|
991 | |
---|
992 | call Register_SwapFieldHallo(flxw,flxw,ip1jmp1,llm, |
---|
993 | * jj_Nb_physic,2,2,Request_physic) |
---|
994 | |
---|
995 | call SendRequest(Request_Physic) |
---|
996 | c$OMP BARRIER |
---|
997 | call WaitRequest(Request_Physic) |
---|
998 | |
---|
999 | c$OMP BARRIER |
---|
1000 | c$OMP MASTER |
---|
1001 | call SetDistrib(jj_nb_Physic) |
---|
1002 | call VTe(VThallo) |
---|
1003 | |
---|
1004 | call VTb(VTphysiq) |
---|
1005 | c$OMP END MASTER |
---|
1006 | c$OMP BARRIER |
---|
1007 | |
---|
1008 | cc$OMP MASTER |
---|
1009 | c call WriteField_p('ucovfi',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
1010 | c call WriteField_p('vcovfi',reshape(vcov,(/iip1,jjm,llm/))) |
---|
1011 | c call WriteField_p('tetafi',reshape(teta,(/iip1,jmp1,llm/))) |
---|
1012 | c call WriteField_p('pfi',reshape(p,(/iip1,jmp1,llmp1/))) |
---|
1013 | c call WriteField_p('pkfi',reshape(pk,(/iip1,jmp1,llm/))) |
---|
1014 | cc$OMP END MASTER |
---|
1015 | cc$OMP BARRIER |
---|
1016 | ! CALL FTRACE_REGION_BEGIN("calfis") |
---|
1017 | CALL calfis_p(lafin ,jD_cur, jH_cur, |
---|
1018 | $ ucov,vcov,teta,q,masse,ps,p,pk,phis,phi , |
---|
1019 | $ du,dv,dteta,dq, |
---|
1020 | $ flxw, |
---|
1021 | $ dufi,dvfi,dtetafi,dqfi,dpfi ) |
---|
1022 | ! CALL FTRACE_REGION_END("calfis") |
---|
1023 | ijb=ij_begin |
---|
1024 | ije=ij_end |
---|
1025 | if ( .not. pole_nord) then |
---|
1026 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1027 | DO l=1,llm |
---|
1028 | dufi_tmp(1:iip1,l) = dufi(ijb:ijb+iim,l) |
---|
1029 | dvfi_tmp(1:iip1,l) = dvfi(ijb:ijb+iim,l) |
---|
1030 | dtetafi_tmp(1:iip1,l)= dtetafi(ijb:ijb+iim,l) |
---|
1031 | dqfi_tmp(1:iip1,l,:) = dqfi(ijb:ijb+iim,l,:) |
---|
1032 | ENDDO |
---|
1033 | c$OMP END DO NOWAIT |
---|
1034 | |
---|
1035 | c$OMP MASTER |
---|
1036 | dpfi_tmp(1:iip1) = dpfi(ijb:ijb+iim) |
---|
1037 | c$OMP END MASTER |
---|
1038 | endif ! of if ( .not. pole_nord) |
---|
1039 | |
---|
1040 | c$OMP BARRIER |
---|
1041 | c$OMP MASTER |
---|
1042 | call SetDistrib(jj_nb_Physic_bis) |
---|
1043 | |
---|
1044 | call VTb(VThallo) |
---|
1045 | c$OMP END MASTER |
---|
1046 | c$OMP BARRIER |
---|
1047 | |
---|
1048 | call Register_Hallo(dufi,ip1jmp1,llm, |
---|
1049 | * 1,0,0,1,Request_physic) |
---|
1050 | |
---|
1051 | call Register_Hallo(dvfi,ip1jm,llm, |
---|
1052 | * 1,0,0,1,Request_physic) |
---|
1053 | |
---|
1054 | call Register_Hallo(dtetafi,ip1jmp1,llm, |
---|
1055 | * 1,0,0,1,Request_physic) |
---|
1056 | |
---|
1057 | call Register_Hallo(dpfi,ip1jmp1,1, |
---|
1058 | * 1,0,0,1,Request_physic) |
---|
1059 | |
---|
1060 | if (nqtot > 0) then |
---|
1061 | do j=1,nqtot |
---|
1062 | call Register_Hallo(dqfi(1,1,j),ip1jmp1,llm, |
---|
1063 | * 1,0,0,1,Request_physic) |
---|
1064 | enddo |
---|
1065 | endif |
---|
1066 | |
---|
1067 | call SendRequest(Request_Physic) |
---|
1068 | c$OMP BARRIER |
---|
1069 | call WaitRequest(Request_Physic) |
---|
1070 | |
---|
1071 | c$OMP BARRIER |
---|
1072 | c$OMP MASTER |
---|
1073 | call VTe(VThallo) |
---|
1074 | |
---|
1075 | call SetDistrib(jj_nb_Physic) |
---|
1076 | c$OMP END MASTER |
---|
1077 | c$OMP BARRIER |
---|
1078 | ijb=ij_begin |
---|
1079 | if (.not. pole_nord) then |
---|
1080 | |
---|
1081 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1082 | DO l=1,llm |
---|
1083 | dufi(ijb:ijb+iim,l) = dufi(ijb:ijb+iim,l)+dufi_tmp(1:iip1,l) |
---|
1084 | dvfi(ijb:ijb+iim,l) = dvfi(ijb:ijb+iim,l)+dvfi_tmp(1:iip1,l) |
---|
1085 | dtetafi(ijb:ijb+iim,l) = dtetafi(ijb:ijb+iim,l) |
---|
1086 | & +dtetafi_tmp(1:iip1,l) |
---|
1087 | dqfi(ijb:ijb+iim,l,:) = dqfi(ijb:ijb+iim,l,:) |
---|
1088 | & + dqfi_tmp(1:iip1,l,:) |
---|
1089 | ENDDO |
---|
1090 | c$OMP END DO NOWAIT |
---|
1091 | |
---|
1092 | c$OMP MASTER |
---|
1093 | dpfi(ijb:ijb+iim) = dpfi(ijb:ijb+iim)+ dpfi_tmp(1:iip1) |
---|
1094 | c$OMP END MASTER |
---|
1095 | |
---|
1096 | endif ! of if (.not. pole_nord) |
---|
1097 | c$OMP BARRIER |
---|
1098 | cc$OMP MASTER |
---|
1099 | c call WriteField_p('dufi',reshape(dufi,(/iip1,jmp1,llm/))) |
---|
1100 | c call WriteField_p('dvfi',reshape(dvfi,(/iip1,jjm,llm/))) |
---|
1101 | c call WriteField_p('dtetafi',reshape(dtetafi,(/iip1,jmp1,llm/))) |
---|
1102 | cc$OMP END MASTER |
---|
1103 | |
---|
1104 | c ajout des tendances physiques: |
---|
1105 | c ------------------------------ |
---|
1106 | CALL addfi_p( dtphys, leapf, forward , |
---|
1107 | $ ucov, vcov, teta , q ,ps , |
---|
1108 | $ dufi, dvfi, dtetafi , dqfi ,dpfi ) |
---|
1109 | ! since addfi updates ps(), also update p(), masse() and pk() |
---|
1110 | CALL pression_p(ip1jmp1,ap,bp,ps,p) |
---|
1111 | c$OMP BARRIER |
---|
1112 | CALL massdair_p(p,masse) |
---|
1113 | c$OMP BARRIER |
---|
1114 | if (pressure_exner) then |
---|
1115 | CALL exner_hyb_p(ip1jmp1,ps,p,pks,pk,pkf) |
---|
1116 | else |
---|
1117 | CALL exner_milieu_p(ip1jmp1,ps,p,pks,pk,pkf) |
---|
1118 | endif |
---|
1119 | c$OMP BARRIER |
---|
1120 | |
---|
1121 | c Couche superieure : |
---|
1122 | c ------------------- |
---|
1123 | IF (iflag_top_bound > 0) THEN |
---|
1124 | CALL top_bound_p(vcov,ucov,teta,masse,dtphys, |
---|
1125 | $ dutop) |
---|
1126 | ijb=ij_begin |
---|
1127 | ije=ij_end |
---|
1128 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1129 | DO l=1,llm |
---|
1130 | dutop(ijb:ije,l)=dutop(ijb:ije,l)/dtphys ! convert to a tendency in (m/s)/s |
---|
1131 | ENDDO |
---|
1132 | c$OMP END DO NOWAIT |
---|
1133 | ENDIF ! of IF (ok_strato) |
---|
1134 | |
---|
1135 | c$OMP BARRIER |
---|
1136 | c$OMP MASTER |
---|
1137 | call VTe(VTphysiq) |
---|
1138 | |
---|
1139 | call VTb(VThallo) |
---|
1140 | c$OMP END MASTER |
---|
1141 | |
---|
1142 | call SetTag(Request_physic,800) |
---|
1143 | call Register_SwapField(ucov,ucov,ip1jmp1,llm, |
---|
1144 | * jj_Nb_caldyn,Request_physic) |
---|
1145 | |
---|
1146 | call Register_SwapField(vcov,vcov,ip1jm,llm, |
---|
1147 | * jj_Nb_caldyn,Request_physic) |
---|
1148 | |
---|
1149 | call Register_SwapField(teta,teta,ip1jmp1,llm, |
---|
1150 | * jj_Nb_caldyn,Request_physic) |
---|
1151 | |
---|
1152 | call Register_SwapField(masse,masse,ip1jmp1,llm, |
---|
1153 | * jj_Nb_caldyn,Request_physic) |
---|
1154 | |
---|
1155 | call Register_SwapField(ps,ps,ip1jmp1,1, |
---|
1156 | * jj_Nb_caldyn,Request_physic) |
---|
1157 | |
---|
1158 | call Register_SwapField(p,p,ip1jmp1,llmp1, |
---|
1159 | * jj_Nb_caldyn,Request_physic) |
---|
1160 | |
---|
1161 | call Register_SwapField(pk,pk,ip1jmp1,llm, |
---|
1162 | * jj_Nb_caldyn,Request_physic) |
---|
1163 | |
---|
1164 | call Register_SwapField(phis,phis,ip1jmp1,1, |
---|
1165 | * jj_Nb_caldyn,Request_physic) |
---|
1166 | |
---|
1167 | call Register_SwapField(phi,phi,ip1jmp1,llm, |
---|
1168 | * jj_Nb_caldyn,Request_physic) |
---|
1169 | |
---|
1170 | call Register_SwapField(w,w,ip1jmp1,llm, |
---|
1171 | * jj_Nb_caldyn,Request_physic) |
---|
1172 | |
---|
1173 | do j=1,nqtot |
---|
1174 | |
---|
1175 | call Register_SwapField(q(1,1,j),q(1,1,j),ip1jmp1,llm, |
---|
1176 | * jj_Nb_caldyn,Request_physic) |
---|
1177 | |
---|
1178 | enddo |
---|
1179 | |
---|
1180 | call SendRequest(Request_Physic) |
---|
1181 | c$OMP BARRIER |
---|
1182 | call WaitRequest(Request_Physic) |
---|
1183 | |
---|
1184 | c$OMP BARRIER |
---|
1185 | c$OMP MASTER |
---|
1186 | call VTe(VThallo) |
---|
1187 | call SetDistrib(jj_Nb_caldyn) |
---|
1188 | c$OMP END MASTER |
---|
1189 | c$OMP BARRIER |
---|
1190 | c |
---|
1191 | c Diagnostique de conservation de l'energie : difference |
---|
1192 | IF ((ip_ebil_dyn.ge.1 ) .and. (nqtot > 1)) THEN |
---|
1193 | ztit='bil phys' |
---|
1194 | CALL diagedyn(ztit,2,1,1,dtphys |
---|
1195 | e , ucov , vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2)) |
---|
1196 | ENDIF |
---|
1197 | |
---|
1198 | cc$OMP MASTER |
---|
1199 | c if (debug) then |
---|
1200 | c call WriteField_p('ucovfi',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
1201 | c call WriteField_p('vcovfi',reshape(vcov,(/iip1,jjm,llm/))) |
---|
1202 | c call WriteField_p('tetafi',reshape(teta,(/iip1,jmp1,llm/))) |
---|
1203 | c endif |
---|
1204 | cc$OMP END MASTER |
---|
1205 | |
---|
1206 | |
---|
1207 | c-jld |
---|
1208 | c$OMP MASTER |
---|
1209 | call resume_timer(timer_caldyn) |
---|
1210 | if (FirstPhysic) then |
---|
1211 | ok_start_timer=.TRUE. |
---|
1212 | FirstPhysic=.false. |
---|
1213 | endif |
---|
1214 | c$OMP END MASTER |
---|
1215 | ENDIF ! of IF( apphys ) |
---|
1216 | |
---|
1217 | IF(iflag_phys.EQ.2) THEN ! "Newtonian" case |
---|
1218 | ! Academic case : Simple friction and Newtonan relaxation |
---|
1219 | ! ------------------------------------------------------- |
---|
1220 | c$OMP MASTER |
---|
1221 | if (FirstPhysic) then |
---|
1222 | ok_start_timer=.TRUE. |
---|
1223 | FirstPhysic=.false. |
---|
1224 | endif |
---|
1225 | c$OMP END MASTER |
---|
1226 | |
---|
1227 | ijb=ij_begin |
---|
1228 | ije=ij_end |
---|
1229 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1230 | do l=1,llm |
---|
1231 | teta(ijb:ije,l)=teta(ijb:ije,l)-dtvr* |
---|
1232 | & (teta(ijb:ije,l)-tetarappel(ijb:ije,l))* |
---|
1233 | & (knewt_g+knewt_t(l)*clat4(ijb:ije)) |
---|
1234 | enddo ! of do l=1,llm |
---|
1235 | !$OMP END DO |
---|
1236 | |
---|
1237 | if (planet_type.eq."giant") then |
---|
1238 | ! Intrinsic heat flux |
---|
1239 | ! Aymeric -- for giant planets |
---|
1240 | if (ihf .gt. 1.e-6) then |
---|
1241 | !print *, '**** INTRINSIC HEAT FLUX ****', ihf |
---|
1242 | teta(ijb:ije,1) = teta(ijb:ije,1) |
---|
1243 | & + dtvr * aire(ijb:ije) * ihf / cpp / masse(ijb:ije,1) |
---|
1244 | !print *, '**** d teta ' |
---|
1245 | !print *, dtvr * aire(ijb:ije) * ihf / cpp / masse(ijb:ije,1) |
---|
1246 | endif |
---|
1247 | endif |
---|
1248 | |
---|
1249 | call Register_Hallo(ucov,ip1jmp1,llm,0,1,1,0,Request_Physic) |
---|
1250 | call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,Request_Physic) |
---|
1251 | call SendRequest(Request_Physic) |
---|
1252 | c$OMP BARRIER |
---|
1253 | call WaitRequest(Request_Physic) |
---|
1254 | c$OMP BARRIER |
---|
1255 | call friction_p(ucov,vcov,dtvr) |
---|
1256 | !$OMP BARRIER |
---|
1257 | |
---|
1258 | ! Sponge layer (if any) |
---|
1259 | IF (ok_strato) THEN |
---|
1260 | CALL top_bound_p(vcov,ucov,teta,masse,dtvr, |
---|
1261 | $ dutop) |
---|
1262 | ijb=ij_begin |
---|
1263 | ije=ij_end |
---|
1264 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1265 | DO l=1,llm |
---|
1266 | dutop(ijb:ije,l)=dutop(ijb:ije,l)/dtvr ! convert to a tendency in (m/s)/s |
---|
1267 | ENDDO |
---|
1268 | c$OMP END DO NOWAIT |
---|
1269 | !$OMP BARRIER |
---|
1270 | ENDIF ! of IF (ok_strato) |
---|
1271 | ENDIF ! of IF(iflag_phys.EQ.2) |
---|
1272 | |
---|
1273 | |
---|
1274 | CALL pression_p ( ip1jmp1, ap, bp, ps, p ) |
---|
1275 | c$OMP BARRIER |
---|
1276 | if (pressure_exner) then |
---|
1277 | CALL exner_hyb_p( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
1278 | else |
---|
1279 | CALL exner_milieu_p( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
1280 | endif |
---|
1281 | c$OMP BARRIER |
---|
1282 | CALL massdair_p(p,masse) |
---|
1283 | c$OMP BARRIER |
---|
1284 | |
---|
1285 | cc$OMP END PARALLEL |
---|
1286 | |
---|
1287 | c----------------------------------------------------------------------- |
---|
1288 | c dissipation horizontale et verticale des petites echelles: |
---|
1289 | c ---------------------------------------------------------- |
---|
1290 | |
---|
1291 | IF(apdiss) THEN |
---|
1292 | |
---|
1293 | c$OMP MASTER |
---|
1294 | call suspend_timer(timer_caldyn) |
---|
1295 | |
---|
1296 | c print*,'Entree dans la dissipation : Iteration No ',true_itau |
---|
1297 | c calcul de l'energie cinetique avant dissipation |
---|
1298 | c print *,'Passage dans la dissipation' |
---|
1299 | |
---|
1300 | call VTb(VThallo) |
---|
1301 | c$OMP END MASTER |
---|
1302 | |
---|
1303 | ! sponge layer |
---|
1304 | if (callsponge) then |
---|
1305 | ! NB: Call to Register_Hallo is in principle only required for ps |
---|
1306 | ! but it seems that then WaitRequest crashes (only in mixed MPI/OpenMP) |
---|
1307 | ! unless a 3D field has also been registered |
---|
1308 | call Register_Hallo(teta,ip1jmp1,llm,0,1,1,0,Request_Dissip) |
---|
1309 | call Register_Hallo(ps,ip1jmp1,1,0,1,1,0,Request_Dissip) |
---|
1310 | call SendRequest(Request_Dissip) |
---|
1311 | c$OMP BARRIER |
---|
1312 | call WaitRequest(Request_Dissip) |
---|
1313 | c$OMP BARRIER |
---|
1314 | c$OMP MASTER |
---|
1315 | call VTe(VThallo) |
---|
1316 | call VTb(VThallo) |
---|
1317 | c$OMP END MASTER |
---|
1318 | c$OMP BARRIER |
---|
1319 | CALL sponge_p(ucov,vcov,teta,ps,dtdiss,mode_sponge) |
---|
1320 | endif |
---|
1321 | |
---|
1322 | |
---|
1323 | c$OMP BARRIER |
---|
1324 | |
---|
1325 | call Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, |
---|
1326 | * jj_Nb_dissip,1,1,Request_dissip) |
---|
1327 | |
---|
1328 | call Register_SwapFieldHallo(vcov,vcov,ip1jm,llm, |
---|
1329 | * jj_Nb_dissip,1,1,Request_dissip) |
---|
1330 | |
---|
1331 | call Register_SwapField(teta,teta,ip1jmp1,llm, |
---|
1332 | * jj_Nb_dissip,Request_dissip) |
---|
1333 | |
---|
1334 | call Register_SwapField(p,p,ip1jmp1,llmp1, |
---|
1335 | * jj_Nb_dissip,Request_dissip) |
---|
1336 | |
---|
1337 | call Register_SwapField(pk,pk,ip1jmp1,llm, |
---|
1338 | * jj_Nb_dissip,Request_dissip) |
---|
1339 | |
---|
1340 | call SendRequest(Request_dissip) |
---|
1341 | c$OMP BARRIER |
---|
1342 | call WaitRequest(Request_dissip) |
---|
1343 | |
---|
1344 | c$OMP BARRIER |
---|
1345 | c$OMP MASTER |
---|
1346 | call SetDistrib(jj_Nb_dissip) |
---|
1347 | call VTe(VThallo) |
---|
1348 | call VTb(VTdissipation) |
---|
1349 | call start_timer(timer_dissip) |
---|
1350 | c$OMP END MASTER |
---|
1351 | c$OMP BARRIER |
---|
1352 | |
---|
1353 | call covcont_p(llm,ucov,vcov,ucont,vcont) |
---|
1354 | call enercin_p(vcov,ucov,vcont,ucont,ecin0) |
---|
1355 | |
---|
1356 | c dissipation |
---|
1357 | ! ADAPTATION GCM POUR CP(T) |
---|
1358 | call tpot2t_glo_p(teta,temp,pk) |
---|
1359 | |
---|
1360 | ! CALL FTRACE_REGION_BEGIN("dissip") |
---|
1361 | CALL dissip_p(vcov,ucov,teta,p,dvdis,dudis,dtetadis) |
---|
1362 | ! CALL FTRACE_REGION_END("dissip") |
---|
1363 | |
---|
1364 | ijb=ij_begin |
---|
1365 | ije=ij_end |
---|
1366 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1367 | DO l=1,llm |
---|
1368 | ucov(ijb:ije,l)=ucov(ijb:ije,l)+dudis(ijb:ije,l) |
---|
1369 | dudis(ijb:ije,l)=dudis(ijb:ije,l)/dtdiss ! passage en (m/s)/s |
---|
1370 | ENDDO |
---|
1371 | c$OMP END DO NOWAIT |
---|
1372 | if (pole_sud) ije=ije-iip1 |
---|
1373 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1374 | DO l=1,llm |
---|
1375 | vcov(ijb:ije,l)=vcov(ijb:ije,l)+dvdis(ijb:ije,l) |
---|
1376 | dvdis(ijb:ije,l)=dvdis(ijb:ije,l)/dtdiss ! passage en (m/s)/s |
---|
1377 | ENDDO |
---|
1378 | c$OMP END DO NOWAIT |
---|
1379 | |
---|
1380 | |
---|
1381 | c------------------------------------------------------------------------ |
---|
1382 | if (dissip_conservative) then |
---|
1383 | C On rajoute la tendance due a la transform. Ec -> E therm. cree |
---|
1384 | C lors de la dissipation |
---|
1385 | c$OMP BARRIER |
---|
1386 | c$OMP MASTER |
---|
1387 | call suspend_timer(timer_dissip) |
---|
1388 | call VTb(VThallo) |
---|
1389 | c$OMP END MASTER |
---|
1390 | call Register_Hallo(ucov,ip1jmp1,llm,1,1,1,1,Request_Dissip) |
---|
1391 | call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,Request_Dissip) |
---|
1392 | call SendRequest(Request_Dissip) |
---|
1393 | c$OMP BARRIER |
---|
1394 | call WaitRequest(Request_Dissip) |
---|
1395 | c$OMP MASTER |
---|
1396 | call VTe(VThallo) |
---|
1397 | call resume_timer(timer_dissip) |
---|
1398 | c$OMP END MASTER |
---|
1399 | c$OMP BARRIER |
---|
1400 | call covcont_p(llm,ucov,vcov,ucont,vcont) |
---|
1401 | call enercin_p(vcov,ucov,vcont,ucont,ecin) |
---|
1402 | |
---|
1403 | ijb=ij_begin |
---|
1404 | ije=ij_end |
---|
1405 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1406 | do l=1,llm |
---|
1407 | do ij=ijb,ije |
---|
1408 | ! ADAPTATION GCM POUR CP(T) |
---|
1409 | ! dtetaecdt(ij,l)= (ecin0(ij,l)-ecin(ij,l))/ pk(ij,l) |
---|
1410 | ! dtetadis(ij,l)=dtetadis(ij,l)+dtetaecdt(ij,l) |
---|
1411 | temp(ij,l)=temp(ij,l) + |
---|
1412 | & (ecin0(ij,l)-ecin(ij,l))/cpdet(temp(ij,l)) |
---|
1413 | enddo |
---|
1414 | enddo |
---|
1415 | c$OMP END DO |
---|
1416 | ! call t2tpot_p(ije-ijb+1,llm,temp(ijb:ije,:),ztetaec(ijb:ije,:), |
---|
1417 | ! & pk(ijb:ije,:)) |
---|
1418 | call t2tpot_glo_p(temp,ztetaec,pk) |
---|
1419 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1420 | do l=1,llm |
---|
1421 | do ij=ijb,ije |
---|
1422 | dtetaecdt(ij,l)=ztetaec(ij,l)-teta(ij,l) |
---|
1423 | dtetadis(ij,l)=dtetadis(ij,l)+dtetaecdt(ij,l) |
---|
1424 | enddo |
---|
1425 | enddo |
---|
1426 | c$OMP END DO NOWAIT |
---|
1427 | endif ! of if (dissip_conservative) |
---|
1428 | |
---|
1429 | ijb=ij_begin |
---|
1430 | ije=ij_end |
---|
1431 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1432 | do l=1,llm |
---|
1433 | do ij=ijb,ije |
---|
1434 | teta(ij,l)=teta(ij,l)+dtetadis(ij,l) |
---|
1435 | dtetadis(ij,l)=dtetadis(ij,l)/dtdiss ! passage en K/s |
---|
1436 | enddo |
---|
1437 | enddo |
---|
1438 | c$OMP END DO NOWAIT |
---|
1439 | c------------------------------------------------------------------------ |
---|
1440 | |
---|
1441 | |
---|
1442 | c ....... P. Le Van ( ajout le 17/04/96 ) ........... |
---|
1443 | c ... Calcul de la valeur moyenne, unique de h aux poles ..... |
---|
1444 | c |
---|
1445 | |
---|
1446 | ijb=ij_begin |
---|
1447 | ije=ij_end |
---|
1448 | |
---|
1449 | if (pole_nord) then |
---|
1450 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1451 | DO l = 1, llm |
---|
1452 | DO ij = 1,iim |
---|
1453 | tppn(ij) = aire( ij ) * teta( ij ,l) |
---|
1454 | ENDDO |
---|
1455 | tpn = SSUM(iim,tppn,1)/apoln |
---|
1456 | |
---|
1457 | DO ij = 1, iip1 |
---|
1458 | teta( ij ,l) = tpn |
---|
1459 | ENDDO |
---|
1460 | ENDDO |
---|
1461 | c$OMP END DO NOWAIT |
---|
1462 | |
---|
1463 | if (1 == 0) then |
---|
1464 | !!! Ehouarn: lines here 1) kill 1+1=2 in the dynamics |
---|
1465 | !!! 2) should probably not be here anyway |
---|
1466 | !!! but are kept for those who would want to revert to previous behaviour |
---|
1467 | c$OMP MASTER |
---|
1468 | DO ij = 1,iim |
---|
1469 | tppn(ij) = aire( ij ) * ps ( ij ) |
---|
1470 | ENDDO |
---|
1471 | tpn = SSUM(iim,tppn,1)/apoln |
---|
1472 | |
---|
1473 | DO ij = 1, iip1 |
---|
1474 | ps( ij ) = tpn |
---|
1475 | ENDDO |
---|
1476 | c$OMP END MASTER |
---|
1477 | endif ! of if (1 == 0) |
---|
1478 | endif ! of of (pole_nord) |
---|
1479 | |
---|
1480 | if (pole_sud) then |
---|
1481 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1482 | DO l = 1, llm |
---|
1483 | DO ij = 1,iim |
---|
1484 | tpps(ij) = aire(ij+ip1jm) * teta(ij+ip1jm,l) |
---|
1485 | ENDDO |
---|
1486 | tps = SSUM(iim,tpps,1)/apols |
---|
1487 | |
---|
1488 | DO ij = 1, iip1 |
---|
1489 | teta(ij+ip1jm,l) = tps |
---|
1490 | ENDDO |
---|
1491 | ENDDO |
---|
1492 | c$OMP END DO NOWAIT |
---|
1493 | |
---|
1494 | if (1 == 0) then |
---|
1495 | !!! Ehouarn: lines here 1) kill 1+1=2 in the dynamics |
---|
1496 | !!! 2) should probably not be here anyway |
---|
1497 | !!! but are kept for those who would want to revert to previous behaviour |
---|
1498 | c$OMP MASTER |
---|
1499 | DO ij = 1,iim |
---|
1500 | tpps(ij) = aire(ij+ip1jm) * ps (ij+ip1jm) |
---|
1501 | ENDDO |
---|
1502 | tps = SSUM(iim,tpps,1)/apols |
---|
1503 | |
---|
1504 | DO ij = 1, iip1 |
---|
1505 | ps(ij+ip1jm) = tps |
---|
1506 | ENDDO |
---|
1507 | c$OMP END MASTER |
---|
1508 | endif ! of if (1 == 0) |
---|
1509 | endif ! of if (pole_sud) |
---|
1510 | |
---|
1511 | |
---|
1512 | c$OMP BARRIER |
---|
1513 | c$OMP MASTER |
---|
1514 | call VTe(VTdissipation) |
---|
1515 | |
---|
1516 | call stop_timer(timer_dissip) |
---|
1517 | |
---|
1518 | call VTb(VThallo) |
---|
1519 | c$OMP END MASTER |
---|
1520 | call Register_SwapField(ucov,ucov,ip1jmp1,llm, |
---|
1521 | * jj_Nb_caldyn,Request_dissip) |
---|
1522 | |
---|
1523 | call Register_SwapField(vcov,vcov,ip1jm,llm, |
---|
1524 | * jj_Nb_caldyn,Request_dissip) |
---|
1525 | |
---|
1526 | call Register_SwapField(teta,teta,ip1jmp1,llm, |
---|
1527 | * jj_Nb_caldyn,Request_dissip) |
---|
1528 | |
---|
1529 | call Register_SwapField(p,p,ip1jmp1,llmp1, |
---|
1530 | * jj_Nb_caldyn,Request_dissip) |
---|
1531 | |
---|
1532 | call Register_SwapField(pk,pk,ip1jmp1,llm, |
---|
1533 | * jj_Nb_caldyn,Request_dissip) |
---|
1534 | |
---|
1535 | call SendRequest(Request_dissip) |
---|
1536 | c$OMP BARRIER |
---|
1537 | call WaitRequest(Request_dissip) |
---|
1538 | |
---|
1539 | c$OMP BARRIER |
---|
1540 | c$OMP MASTER |
---|
1541 | call SetDistrib(jj_Nb_caldyn) |
---|
1542 | call VTe(VThallo) |
---|
1543 | call resume_timer(timer_caldyn) |
---|
1544 | c print *,'fin dissipation' |
---|
1545 | c$OMP END MASTER |
---|
1546 | c$OMP BARRIER |
---|
1547 | END IF ! of IF(apdiss) |
---|
1548 | |
---|
1549 | cc$OMP END PARALLEL |
---|
1550 | |
---|
1551 | c ajout debug |
---|
1552 | c IF( lafin ) then |
---|
1553 | c abort_message = 'Simulation finished' |
---|
1554 | c call abort_gcm(modname,abort_message,0) |
---|
1555 | c ENDIF |
---|
1556 | |
---|
1557 | c ******************************************************************** |
---|
1558 | c ******************************************************************** |
---|
1559 | c .... fin de l'integration dynamique et physique pour le pas itau .. |
---|
1560 | c ******************************************************************** |
---|
1561 | c ******************************************************************** |
---|
1562 | |
---|
1563 | c preparation du pas d'integration suivant ...... |
---|
1564 | cym call WriteField('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
1565 | cym call WriteField('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
1566 | c$OMP MASTER |
---|
1567 | call stop_timer(timer_caldyn) |
---|
1568 | c$OMP END MASTER |
---|
1569 | IF (itau==itaumax) then |
---|
1570 | c$OMP MASTER |
---|
1571 | call allgather_timer_average |
---|
1572 | |
---|
1573 | if (mpi_rank==0) then |
---|
1574 | |
---|
1575 | print *,'*********************************' |
---|
1576 | print *,'****** TIMER CALDYN ******' |
---|
1577 | do i=0,mpi_size-1 |
---|
1578 | print *,'proc',i,' : Nb Bandes :',jj_nb_caldyn(i), |
---|
1579 | & ' : temps moyen :', |
---|
1580 | & timer_average(jj_nb_caldyn(i),timer_caldyn,i) |
---|
1581 | enddo |
---|
1582 | |
---|
1583 | print *,'*********************************' |
---|
1584 | print *,'****** TIMER VANLEER ******' |
---|
1585 | do i=0,mpi_size-1 |
---|
1586 | print *,'proc',i,' : Nb Bandes :',jj_nb_vanleer(i), |
---|
1587 | & ' : temps moyen :', |
---|
1588 | & timer_average(jj_nb_vanleer(i),timer_vanleer,i) |
---|
1589 | enddo |
---|
1590 | |
---|
1591 | print *,'*********************************' |
---|
1592 | print *,'****** TIMER DISSIP ******' |
---|
1593 | do i=0,mpi_size-1 |
---|
1594 | print *,'proc',i,' : Nb Bandes :',jj_nb_dissip(i), |
---|
1595 | & ' : temps moyen :', |
---|
1596 | & timer_average(jj_nb_dissip(i),timer_dissip,i) |
---|
1597 | enddo |
---|
1598 | |
---|
1599 | print *,'*********************************' |
---|
1600 | print *,'****** TIMER PHYSIC ******' |
---|
1601 | do i=0,mpi_size-1 |
---|
1602 | print *,'proc',i,' : Nb Bandes :',jj_nb_physic(i), |
---|
1603 | & ' : temps moyen :', |
---|
1604 | & timer_average(jj_nb_physic(i),timer_physic,i) |
---|
1605 | enddo |
---|
1606 | |
---|
1607 | endif |
---|
1608 | |
---|
1609 | print *,'Taille du Buffer MPI (REAL*8)',MaxBufferSize |
---|
1610 | print *,'Taille du Buffer MPI utilise (REAL*8)',MaxBufferSize_Used |
---|
1611 | print *, 'Temps total ecoule sur la parallelisation :',DiffTime() |
---|
1612 | print *, 'Temps CPU ecoule sur la parallelisation :',DiffCpuTime() |
---|
1613 | CALL print_filtre_timer |
---|
1614 | call fin_getparam |
---|
1615 | call finalize_parallel |
---|
1616 | c$OMP END MASTER |
---|
1617 | c$OMP BARRIER |
---|
1618 | RETURN |
---|
1619 | ENDIF ! of IF (itau==itaumax) |
---|
1620 | |
---|
1621 | IF ( .NOT.purmats ) THEN |
---|
1622 | c ........................................................ |
---|
1623 | c .............. schema matsuno + leapfrog .............. |
---|
1624 | c ........................................................ |
---|
1625 | |
---|
1626 | IF(forward. OR. leapf) THEN |
---|
1627 | itau= itau + 1 |
---|
1628 | ! iday= day_ini+itau/day_step |
---|
1629 | ! time= REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
1630 | ! IF(time.GT.1.) THEN |
---|
1631 | ! time = time-1. |
---|
1632 | ! iday = iday+1 |
---|
1633 | ! ENDIF |
---|
1634 | ENDIF |
---|
1635 | |
---|
1636 | |
---|
1637 | IF( itau. EQ. itaufinp1 ) then |
---|
1638 | |
---|
1639 | if (flag_verif) then |
---|
1640 | write(79,*) 'ucov',ucov |
---|
1641 | write(80,*) 'vcov',vcov |
---|
1642 | write(81,*) 'teta',teta |
---|
1643 | write(82,*) 'ps',ps |
---|
1644 | write(83,*) 'q',q |
---|
1645 | if (nqtot > 2) then |
---|
1646 | WRITE(85,*) 'q1 = ',q(:,:,1) |
---|
1647 | WRITE(86,*) 'q3 = ',q(:,:,3) |
---|
1648 | endif |
---|
1649 | endif |
---|
1650 | |
---|
1651 | |
---|
1652 | c$OMP MASTER |
---|
1653 | call fin_getparam |
---|
1654 | c$OMP END MASTER |
---|
1655 | #ifdef INCA |
---|
1656 | call finalize_inca |
---|
1657 | #endif |
---|
1658 | c$OMP MASTER |
---|
1659 | call finalize_parallel |
---|
1660 | c$OMP END MASTER |
---|
1661 | abort_message = 'Simulation finished' |
---|
1662 | call abort_gcm(modname,abort_message,0) |
---|
1663 | RETURN |
---|
1664 | ENDIF |
---|
1665 | c----------------------------------------------------------------------- |
---|
1666 | c ecriture du fichier histoire moyenne: |
---|
1667 | c ------------------------------------- |
---|
1668 | |
---|
1669 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
1670 | c$OMP BARRIER |
---|
1671 | IF(itau.EQ.itaufin) THEN |
---|
1672 | iav=1 |
---|
1673 | ELSE |
---|
1674 | iav=0 |
---|
1675 | ENDIF |
---|
1676 | #ifdef CPP_IOIPSL |
---|
1677 | IF (ok_dynzon) THEN |
---|
1678 | CALL bilan_dyn_p(2,dtvr*iperiod,dtvr*day_step*periodav, |
---|
1679 | , ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) |
---|
1680 | c les traceurs ne sont pas sortis, trop lourd. |
---|
1681 | c Peut changer eventuellement si besoin. |
---|
1682 | ! CALL bilan_dyn_p(dtvr*iperiod,dtvr*day_step*periodav, |
---|
1683 | ! & ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov, |
---|
1684 | ! & du,dudis,dutop,dufi) |
---|
1685 | ENDIF !ok_dynzon |
---|
1686 | #endif |
---|
1687 | IF (ok_dyn_ave) THEN |
---|
1688 | !$OMP MASTER |
---|
1689 | #ifdef CPP_IOIPSL |
---|
1690 | ! Ehouarn: Gather fields and make master send to output |
---|
1691 | call Gather_Field(vcov,ip1jm,llm,0) |
---|
1692 | call Gather_Field(ucov,ip1jmp1,llm,0) |
---|
1693 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
1694 | call Gather_Field(pk,ip1jmp1,llm,0) |
---|
1695 | call Gather_Field(phi,ip1jmp1,llm,0) |
---|
1696 | do iq=1,nqtot |
---|
1697 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
1698 | enddo |
---|
1699 | call Gather_Field(masse,ip1jmp1,llm,0) |
---|
1700 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
1701 | call Gather_Field(phis,ip1jmp1,1,0) |
---|
1702 | if (mpi_rank==0) then |
---|
1703 | CALL writedynav(itau,vcov, |
---|
1704 | & ucov,teta,pk,phi,q,masse,ps,phis) |
---|
1705 | endif |
---|
1706 | #endif |
---|
1707 | !$OMP END MASTER |
---|
1708 | ENDIF ! of IF (ok_dyn_ave) |
---|
1709 | ENDIF ! of IF((MOD(itau,iperiod).EQ.0).OR.(itau.EQ.itaufin)) |
---|
1710 | |
---|
1711 | c----------------------------------------------------------------------- |
---|
1712 | c ecriture de la bande histoire: |
---|
1713 | c ------------------------------ |
---|
1714 | |
---|
1715 | IF( MOD(itau,iecri).EQ.0) THEN |
---|
1716 | ! Ehouarn: output only during LF or Backward Matsuno |
---|
1717 | if (leapf.or.(.not.leapf.and.(.not.forward))) then |
---|
1718 | c$OMP BARRIER |
---|
1719 | |
---|
1720 | ! ADAPTATION GCM POUR CP(T) |
---|
1721 | call tpot2t_glo_p(teta,temp,pk) |
---|
1722 | ijb=ij_begin |
---|
1723 | ije=ij_end |
---|
1724 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1725 | do l=1,llm |
---|
1726 | tsurpk(ijb:ije,l)=cpp*temp(ijb:ije,l)/pk(ijb:ije,l) |
---|
1727 | enddo |
---|
1728 | !$OMP END DO |
---|
1729 | |
---|
1730 | !$OMP MASTER |
---|
1731 | ! CALL geopot_p(ip1jmp1,teta,pk,pks,phis,phi) |
---|
1732 | CALL geopot_p ( ip1jmp1, tsurpk , pk , pks, phis , phi ) |
---|
1733 | |
---|
1734 | cym unat=0. |
---|
1735 | |
---|
1736 | ijb=ij_begin |
---|
1737 | ije=ij_end |
---|
1738 | |
---|
1739 | if (pole_nord) then |
---|
1740 | ijb=ij_begin+iip1 |
---|
1741 | unat(1:iip1,:)=0. |
---|
1742 | endif |
---|
1743 | |
---|
1744 | if (pole_sud) then |
---|
1745 | ije=ij_end-iip1 |
---|
1746 | unat(ij_end-iip1+1:ij_end,:)=0. |
---|
1747 | endif |
---|
1748 | |
---|
1749 | do l=1,llm |
---|
1750 | unat(ijb:ije,l)=ucov(ijb:ije,l)/cu(ijb:ije) |
---|
1751 | enddo |
---|
1752 | |
---|
1753 | ijb=ij_begin |
---|
1754 | ije=ij_end |
---|
1755 | if (pole_sud) ije=ij_end-iip1 |
---|
1756 | |
---|
1757 | do l=1,llm |
---|
1758 | vnat(ijb:ije,l)=vcov(ijb:ije,l)/cv(ijb:ije) |
---|
1759 | enddo |
---|
1760 | |
---|
1761 | #ifdef CPP_IOIPSL |
---|
1762 | if (ok_dyn_ins) then |
---|
1763 | ! Ehouarn: Gather fields and make master write to output |
---|
1764 | call Gather_Field(vcov,ip1jm,llm,0) |
---|
1765 | call Gather_Field(ucov,ip1jmp1,llm,0) |
---|
1766 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
1767 | call Gather_Field(phi,ip1jmp1,llm,0) |
---|
1768 | do iq=1,nqtot |
---|
1769 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
1770 | enddo |
---|
1771 | call Gather_Field(masse,ip1jmp1,llm,0) |
---|
1772 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
1773 | call Gather_Field(phis,ip1jmp1,1,0) |
---|
1774 | if (mpi_rank==0) then |
---|
1775 | CALL writehist(itau,vcov,ucov,teta,phi,q,masse,ps,phis) |
---|
1776 | endif |
---|
1777 | ! CALL writehist_p(histid,histvid, itau,vcov, |
---|
1778 | ! & ucov,teta,phi,q,masse,ps,phis) |
---|
1779 | ! or use writefield_p |
---|
1780 | ! call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
1781 | ! call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
1782 | ! call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
1783 | ! call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) |
---|
1784 | endif ! of if (ok_dyn_ins) |
---|
1785 | #endif |
---|
1786 | ! For some Grads outputs of fields |
---|
1787 | if (output_grads_dyn) then |
---|
1788 | ! Ehouarn: hope this works the way I think it does: |
---|
1789 | call Gather_Field(unat,ip1jmp1,llm,0) |
---|
1790 | call Gather_Field(vnat,ip1jm,llm,0) |
---|
1791 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
1792 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
1793 | do iq=1,nqtot |
---|
1794 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
1795 | enddo |
---|
1796 | if (mpi_rank==0) then |
---|
1797 | #include "write_grads_dyn.h" |
---|
1798 | endif |
---|
1799 | endif ! of if (output_grads_dyn) |
---|
1800 | !$OMP END MASTER |
---|
1801 | endif ! of if (leapf.or.(.not.leapf.and.(.not.forward))) |
---|
1802 | ENDIF ! of IF(MOD(itau,iecri).EQ.0) |
---|
1803 | |
---|
1804 | c Determine whether to write to the restart.nc file |
---|
1805 | c Decision can't be made in one IF statement as if |
---|
1806 | c ecritstart==0 there will be a divide-by-zero error |
---|
1807 | lrestart = .false. |
---|
1808 | IF (itau.EQ.itaufin) THEN |
---|
1809 | lrestart = .true. |
---|
1810 | ELSE IF (ecritstart.GT.0) THEN |
---|
1811 | IF (MOD(itau,ecritstart).EQ.0) lrestart = .true. |
---|
1812 | ENDIF |
---|
1813 | |
---|
1814 | c Write to restart.nc if required |
---|
1815 | IF (lrestart) THEN |
---|
1816 | c$OMP BARRIER |
---|
1817 | c$OMP MASTER |
---|
1818 | if (planet_type=="mars") then |
---|
1819 | ! CALL dynredem1_p("restart.nc",REAL(itau)/REAL(day_step), |
---|
1820 | ! & vcov,ucov,teta,q,masse,ps) |
---|
1821 | if(ecritstart.GT.0) then |
---|
1822 | CALL dynredem1_p("restart.nc", |
---|
1823 | & REAL(itau)/REAL(day_step) |
---|
1824 | & +time_0-floor(time_0), |
---|
1825 | & vcov,ucov,teta,q,masse,ps) |
---|
1826 | else |
---|
1827 | CALL dynredem1_p("restart.nc", |
---|
1828 | & REAL(itau)/REAL(day_step)-(day_end-day_ini) |
---|
1829 | & +time_0-floor(time_0), |
---|
1830 | & vcov,ucov,teta,q,masse,ps) |
---|
1831 | endif |
---|
1832 | else |
---|
1833 | CALL dynredem1_p("restart.nc",start_time, |
---|
1834 | & vcov,ucov,teta,q,masse,ps) |
---|
1835 | endif |
---|
1836 | ! CLOSE(99) |
---|
1837 | c$OMP END MASTER |
---|
1838 | ENDIF ! of IF (lrestart) |
---|
1839 | |
---|
1840 | c----------------------------------------------------------------------- |
---|
1841 | c gestion de l'integration temporelle: |
---|
1842 | c ------------------------------------ |
---|
1843 | |
---|
1844 | IF( MOD(itau,iperiod).EQ.0 ) THEN |
---|
1845 | GO TO 1 |
---|
1846 | ELSE IF ( MOD(itau-1,iperiod). EQ. 0 ) THEN |
---|
1847 | |
---|
1848 | IF( forward ) THEN |
---|
1849 | c fin du pas forward et debut du pas backward |
---|
1850 | |
---|
1851 | forward = .FALSE. |
---|
1852 | leapf = .FALSE. |
---|
1853 | GO TO 2 |
---|
1854 | |
---|
1855 | ELSE |
---|
1856 | c fin du pas backward et debut du premier pas leapfrog |
---|
1857 | |
---|
1858 | leapf = .TRUE. |
---|
1859 | dt = 2.*dtvr |
---|
1860 | GO TO 2 |
---|
1861 | END IF |
---|
1862 | ELSE |
---|
1863 | |
---|
1864 | c ...... pas leapfrog ..... |
---|
1865 | |
---|
1866 | leapf = .TRUE. |
---|
1867 | dt = 2.*dtvr |
---|
1868 | GO TO 2 |
---|
1869 | END IF ! of IF (MOD(itau,iperiod).EQ.0) |
---|
1870 | ! ELSEIF (MOD(itau-1,iperiod).EQ.0) |
---|
1871 | |
---|
1872 | |
---|
1873 | ELSE ! of IF (.not.purmats) |
---|
1874 | |
---|
1875 | c ........................................................ |
---|
1876 | c .............. schema matsuno ............... |
---|
1877 | c ........................................................ |
---|
1878 | IF( forward ) THEN |
---|
1879 | |
---|
1880 | itau = itau + 1 |
---|
1881 | ! iday = day_ini+itau/day_step |
---|
1882 | ! time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
1883 | ! |
---|
1884 | ! IF(time.GT.1.) THEN |
---|
1885 | ! time = time-1. |
---|
1886 | ! iday = iday+1 |
---|
1887 | ! ENDIF |
---|
1888 | |
---|
1889 | forward = .FALSE. |
---|
1890 | IF( itau. EQ. itaufinp1 ) then |
---|
1891 | c$OMP MASTER |
---|
1892 | call fin_getparam |
---|
1893 | call finalize_parallel |
---|
1894 | c$OMP END MASTER |
---|
1895 | abort_message = 'Simulation finished' |
---|
1896 | call abort_gcm(modname,abort_message,0) |
---|
1897 | RETURN |
---|
1898 | ENDIF |
---|
1899 | GO TO 2 |
---|
1900 | |
---|
1901 | ELSE ! of IF(forward) i.e. backward step |
---|
1902 | |
---|
1903 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
1904 | IF(itau.EQ.itaufin) THEN |
---|
1905 | iav=1 |
---|
1906 | ELSE |
---|
1907 | iav=0 |
---|
1908 | ENDIF |
---|
1909 | #ifdef CPP_IOIPSL |
---|
1910 | IF (ok_dynzon) THEN |
---|
1911 | CALL bilan_dyn_p(2,dtvr*iperiod,dtvr*day_step*periodav, |
---|
1912 | , ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) |
---|
1913 | c les traceurs ne sont pas sortis, trop lourd. |
---|
1914 | c Peut changer eventuellement si besoin. |
---|
1915 | ! CALL bilan_dyn_p(dtvr*iperiod,dtvr*day_step*periodav, |
---|
1916 | ! & ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov, |
---|
1917 | ! & du,dudis,dutop,dufi) |
---|
1918 | END IF !ok_dynzon |
---|
1919 | #endif |
---|
1920 | IF (ok_dyn_ave) THEN |
---|
1921 | !$OMP MASTER |
---|
1922 | #ifdef CPP_IOIPSL |
---|
1923 | ! Ehouarn: Gather fields and make master send to output |
---|
1924 | call Gather_Field(vcov,ip1jm,llm,0) |
---|
1925 | call Gather_Field(ucov,ip1jmp1,llm,0) |
---|
1926 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
1927 | call Gather_Field(pk,ip1jmp1,llm,0) |
---|
1928 | call Gather_Field(phi,ip1jmp1,llm,0) |
---|
1929 | do iq=1,nqtot |
---|
1930 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
1931 | enddo |
---|
1932 | call Gather_Field(masse,ip1jmp1,llm,0) |
---|
1933 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
1934 | call Gather_Field(phis,ip1jmp1,1,0) |
---|
1935 | if (mpi_rank==0) then |
---|
1936 | CALL writedynav(itau,vcov, |
---|
1937 | & ucov,teta,pk,phi,q,masse,ps,phis) |
---|
1938 | endif |
---|
1939 | #endif |
---|
1940 | !$OMP END MASTER |
---|
1941 | ENDIF ! of IF (ok_dyn_ave) |
---|
1942 | |
---|
1943 | ENDIF ! of IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) |
---|
1944 | |
---|
1945 | |
---|
1946 | IF(MOD(itau,iecri ).EQ.0) THEN |
---|
1947 | c IF(MOD(itau,iecri*day_step).EQ.0) THEN |
---|
1948 | c$OMP BARRIER |
---|
1949 | |
---|
1950 | ! ADAPTATION GCM POUR CP(T) |
---|
1951 | call tpot2t_glo_p(teta,temp,pk) |
---|
1952 | ijb=ij_begin |
---|
1953 | ije=ij_end |
---|
1954 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
1955 | do l=1,llm |
---|
1956 | tsurpk(ijb:ije,l)=cpp*temp(ijb:ije,l)/ |
---|
1957 | & pk(ijb:ije,l) |
---|
1958 | enddo |
---|
1959 | !$OMP END DO |
---|
1960 | |
---|
1961 | !$OMP MASTER |
---|
1962 | ! CALL geopot_p(ip1jmp1,teta,pk,pks,phis,phi) |
---|
1963 | CALL geopot_p(ip1jmp1,tsurpk,pk,pks,phis,phi) |
---|
1964 | |
---|
1965 | cym unat=0. |
---|
1966 | ijb=ij_begin |
---|
1967 | ije=ij_end |
---|
1968 | |
---|
1969 | if (pole_nord) then |
---|
1970 | ijb=ij_begin+iip1 |
---|
1971 | unat(1:iip1,:)=0. |
---|
1972 | endif |
---|
1973 | |
---|
1974 | if (pole_sud) then |
---|
1975 | ije=ij_end-iip1 |
---|
1976 | unat(ij_end-iip1+1:ij_end,:)=0. |
---|
1977 | endif |
---|
1978 | |
---|
1979 | do l=1,llm |
---|
1980 | unat(ijb:ije,l)=ucov(ijb:ije,l)/cu(ijb:ije) |
---|
1981 | enddo |
---|
1982 | |
---|
1983 | ijb=ij_begin |
---|
1984 | ije=ij_end |
---|
1985 | if (pole_sud) ije=ij_end-iip1 |
---|
1986 | |
---|
1987 | do l=1,llm |
---|
1988 | vnat(ijb:ije,l)=vcov(ijb:ije,l)/cv(ijb:ije) |
---|
1989 | enddo |
---|
1990 | |
---|
1991 | #ifdef CPP_IOIPSL |
---|
1992 | if (ok_dyn_ins) then |
---|
1993 | ! Ehouarn: Gather fields and make master send to output |
---|
1994 | call Gather_Field(vcov,ip1jm,llm,0) |
---|
1995 | call Gather_Field(ucov,ip1jmp1,llm,0) |
---|
1996 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
1997 | call Gather_Field(phi,ip1jmp1,llm,0) |
---|
1998 | do iq=1,nqtot |
---|
1999 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
2000 | enddo |
---|
2001 | call Gather_Field(masse,ip1jmp1,llm,0) |
---|
2002 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
2003 | call Gather_Field(phis,ip1jmp1,1,0) |
---|
2004 | if (mpi_rank==0) then |
---|
2005 | CALL writehist(itau,vcov,ucov,teta,phi,q,masse,ps,phis) |
---|
2006 | endif |
---|
2007 | ! CALL writehist_p(histid, histvid, itau,vcov , |
---|
2008 | ! & ucov,teta,phi,q,masse,ps,phis) |
---|
2009 | endif ! of if (ok_dyn_ins) |
---|
2010 | #endif |
---|
2011 | ! For some Grads output (but does it work?) |
---|
2012 | if (output_grads_dyn) then |
---|
2013 | call Gather_Field(unat,ip1jmp1,llm,0) |
---|
2014 | call Gather_Field(vnat,ip1jm,llm,0) |
---|
2015 | call Gather_Field(teta,ip1jmp1,llm,0) |
---|
2016 | call Gather_Field(ps,ip1jmp1,1,0) |
---|
2017 | do iq=1,nqtot |
---|
2018 | call Gather_Field(q(1,1,iq),ip1jmp1,llm,0) |
---|
2019 | enddo |
---|
2020 | c |
---|
2021 | if (mpi_rank==0) then |
---|
2022 | #include "write_grads_dyn.h" |
---|
2023 | endif |
---|
2024 | endif ! of if (output_grads_dyn) |
---|
2025 | |
---|
2026 | !$OMP END MASTER |
---|
2027 | ENDIF ! of IF(MOD(itau,iecri).EQ.0) |
---|
2028 | |
---|
2029 | c Determine whether to write to the restart.nc file |
---|
2030 | c Decision can't be made in one IF statement as if |
---|
2031 | c ecritstart==0 there will be a divide-by-zero error |
---|
2032 | lrestart = .false. |
---|
2033 | IF (itau.EQ.itaufin) THEN |
---|
2034 | lrestart = .true. |
---|
2035 | ELSE IF (ecritstart.GT.0) THEN |
---|
2036 | IF (MOD(itau,ecritstart).EQ.0) lrestart = .true. |
---|
2037 | ENDIF |
---|
2038 | |
---|
2039 | c Write to restart.nc if required |
---|
2040 | IF (lrestart) THEN |
---|
2041 | c$OMP MASTER |
---|
2042 | if (planet_type=="mars") then |
---|
2043 | ! CALL dynredem1_p("restart.nc", |
---|
2044 | ! & REAL(itau)/REAL(day_step), |
---|
2045 | ! & vcov,ucov,teta,q,masse,ps) |
---|
2046 | if(ecritstart.GT.0) then |
---|
2047 | CALL dynredem1_p("restart.nc", |
---|
2048 | & REAL(itau)/REAL(day_step), |
---|
2049 | & vcov,ucov,teta,q,masse,ps) |
---|
2050 | else |
---|
2051 | CALL dynredem1_p("restart.nc", |
---|
2052 | & REAL(itau)/REAL(day_step)-(day_end-day_ini), |
---|
2053 | & vcov,ucov,teta,q,masse,ps) |
---|
2054 | endif |
---|
2055 | else |
---|
2056 | CALL dynredem1_p("restart.nc",start_time, |
---|
2057 | & vcov,ucov,teta,q,masse,ps) |
---|
2058 | endif |
---|
2059 | c$OMP END MASTER |
---|
2060 | ENDIF ! of IF (lrestart) |
---|
2061 | |
---|
2062 | forward = .TRUE. |
---|
2063 | GO TO 1 |
---|
2064 | |
---|
2065 | ENDIF ! of IF (forward) |
---|
2066 | |
---|
2067 | END IF ! of IF(.not.purmats) |
---|
2068 | c$OMP MASTER |
---|
2069 | call fin_getparam |
---|
2070 | call finalize_parallel |
---|
2071 | c$OMP END MASTER |
---|
2072 | RETURN |
---|
2073 | END |
---|