1 | PROGRAM lmdz1d |
---|
2 | |
---|
3 | USE ioipsl, only: ju2ymds, ymds2ju, ioconf_calendar |
---|
4 | use phys_state_var_mod |
---|
5 | use comgeomphy |
---|
6 | use dimphy |
---|
7 | use surface_data, only : type_ocean,ok_veget |
---|
8 | use pbl_surface_mod, only : pbl_surface_init, pbl_surface_final |
---|
9 | use fonte_neige_mod, only : fonte_neige_init, fonte_neige_final |
---|
10 | |
---|
11 | use infotrac ! new |
---|
12 | use control_mod |
---|
13 | |
---|
14 | implicit none |
---|
15 | #include "dimensions.h" |
---|
16 | #include "YOMCST.h" |
---|
17 | #include "temps.h" |
---|
18 | !!#include "control.h" |
---|
19 | #include "iniprint.h" |
---|
20 | #include "clesphys.h" |
---|
21 | #include "dimsoil.h" |
---|
22 | #include "indicesol.h" |
---|
23 | |
---|
24 | #include "comvert.h" |
---|
25 | #include "compar1d.h" |
---|
26 | #include "flux_arp.h" |
---|
27 | #include "fcg_gcssold.h" |
---|
28 | !!!#include "fbforcing.h" |
---|
29 | |
---|
30 | !===================================================================== |
---|
31 | ! DECLARATIONS |
---|
32 | !===================================================================== |
---|
33 | |
---|
34 | !--------------------------------------------------------------------- |
---|
35 | ! Externals |
---|
36 | !--------------------------------------------------------------------- |
---|
37 | external fq_sat |
---|
38 | real fq_sat |
---|
39 | |
---|
40 | !--------------------------------------------------------------------- |
---|
41 | ! Arguments d' initialisations de la physique (USER DEFINE) |
---|
42 | !--------------------------------------------------------------------- |
---|
43 | |
---|
44 | integer, parameter :: ngrid=1 |
---|
45 | real :: zcufi = 1. |
---|
46 | real :: zcvfi = 1. |
---|
47 | |
---|
48 | !- real :: nat_surf |
---|
49 | !- logical :: ok_flux_surf |
---|
50 | !- real :: fsens |
---|
51 | !- real :: flat |
---|
52 | !- real :: tsurf |
---|
53 | !- real :: rugos |
---|
54 | !- real :: qsol(1:2) |
---|
55 | !- real :: qsurf |
---|
56 | !- real :: psurf |
---|
57 | !- real :: zsurf |
---|
58 | !- real :: albedo |
---|
59 | !- |
---|
60 | !- real :: time = 0. |
---|
61 | !- real :: time_ini |
---|
62 | !- real :: xlat |
---|
63 | !- real :: xlon |
---|
64 | !- real :: wtsurf |
---|
65 | !- real :: wqsurf |
---|
66 | !- real :: restart_runoff |
---|
67 | !- real :: xagesno |
---|
68 | !- real :: qsolinp |
---|
69 | !- real :: zpicinp |
---|
70 | !- |
---|
71 | real :: fnday |
---|
72 | real :: day, daytime |
---|
73 | real :: day1 |
---|
74 | real :: heure |
---|
75 | integer :: jour |
---|
76 | integer :: mois |
---|
77 | integer :: an |
---|
78 | |
---|
79 | ! |
---|
80 | real :: paire = 1. ! aire de la maille |
---|
81 | !** common /flux_arp/fsens,flat,ok_flux_surf |
---|
82 | |
---|
83 | !--------------------------------------------------------------------- |
---|
84 | ! Declarations related to forcing and initial profiles |
---|
85 | !--------------------------------------------------------------------- |
---|
86 | |
---|
87 | integer :: kmax = llm |
---|
88 | integer nlev_max |
---|
89 | parameter (nlev_max = 100) |
---|
90 | real timestep, frac, timeit |
---|
91 | real height(nlev_max),tttprof(nlev_max),qtprof(nlev_max), |
---|
92 | . uprof(nlev_max),vprof(nlev_max),e12prof(nlev_max), |
---|
93 | . ugprof(nlev_max),vgprof(nlev_max),wfls(nlev_max), |
---|
94 | . dqtdxls(nlev_max),dqtdyls(nlev_max), |
---|
95 | . dqtdtls(nlev_max),thlpcar(nlev_max) |
---|
96 | |
---|
97 | real :: fff |
---|
98 | c integer :: forcing_type |
---|
99 | logical :: forcing_les = .false. |
---|
100 | logical :: forcing_armcu = .false. |
---|
101 | logical :: forcing_rico = .false. |
---|
102 | logical :: forcing_radconv = .false. |
---|
103 | logical :: forcing_toga = .false. |
---|
104 | logical :: forcing_twpice = .false. |
---|
105 | logical :: forcing_GCM2SCM = .false. |
---|
106 | logical :: forcing_GCSSold = .false. |
---|
107 | integer :: type_ts_forcing ! 0 = SST constant; 1 = SST read from a file |
---|
108 | ! (cf read_tsurf1d.F) |
---|
109 | |
---|
110 | !vertical advection computation |
---|
111 | real d_t_z(llm), d_q_z(llm) |
---|
112 | real d_t_dyn_z(llm), d_q_dyn_z(llm) |
---|
113 | real zz(llm) |
---|
114 | real zfact |
---|
115 | |
---|
116 | !flag forcings |
---|
117 | logical :: nudge_wind=.true. |
---|
118 | logical :: nudge_thermo=.false. |
---|
119 | logical :: cptadvw=.true. |
---|
120 | !===================================================================== |
---|
121 | ! DECLARATIONS FOR EACH CASE |
---|
122 | !===================================================================== |
---|
123 | ! |
---|
124 | #include "1D_decl_cases.h" |
---|
125 | ! |
---|
126 | !--------------------------------------------------------------------- |
---|
127 | ! Declarations related to vertical discretization: |
---|
128 | !--------------------------------------------------------------------- |
---|
129 | real :: pzero=1.e5 |
---|
130 | real :: play (llm),zlay (llm),sig_s(llm),plev(llm+1) |
---|
131 | real :: playd(llm),zlayd(llm) |
---|
132 | |
---|
133 | !--------------------------------------------------------------------- |
---|
134 | ! Declarations related to variables |
---|
135 | !--------------------------------------------------------------------- |
---|
136 | |
---|
137 | integer :: iq |
---|
138 | real :: phi(llm) |
---|
139 | real :: rlat_rad(1),rlon_rad(1) |
---|
140 | real :: teta(llm),temp(llm),u(llm),v(llm) |
---|
141 | real :: omega(llm+1),omega2(llm),rho(llm+1) |
---|
142 | real :: ug(llm),vg(llm),fcoriolis |
---|
143 | real :: sfdt, cfdt |
---|
144 | real :: du_phys(llm),dv_phys(llm),dt_phys(llm) |
---|
145 | real :: du_dyn(llm),dv_dyn(llm),dt_dyn(llm) |
---|
146 | real :: dt_cooling(llm),d_t_cool(llm),d_th_adv(llm) |
---|
147 | real :: dq_cooling(llm),d_q_cool(llm) |
---|
148 | real :: tmpvar(llm) |
---|
149 | real :: alpha |
---|
150 | |
---|
151 | REAL, ALLOCATABLE, DIMENSION(:,:):: q |
---|
152 | REAL, ALLOCATABLE, DIMENSION(:,:):: dq |
---|
153 | REAL, ALLOCATABLE, DIMENSION(:,:):: dq_dyn |
---|
154 | REAL, ALLOCATABLE, DIMENSION(:,:):: d_q_adv |
---|
155 | |
---|
156 | !--------------------------------------------------------------------- |
---|
157 | ! Initialization of surface variables |
---|
158 | !--------------------------------------------------------------------- |
---|
159 | real :: run_off_lic_0(1) |
---|
160 | real :: fder(1),snsrf(1,nbsrf),qsurfsrf(1,nbsrf) |
---|
161 | real :: evap(1,nbsrf),frugs(1,nbsrf) |
---|
162 | real :: tsoil(1,nsoilmx,nbsrf) |
---|
163 | real :: agesno(1,nbsrf) |
---|
164 | |
---|
165 | !--------------------------------------------------------------------- |
---|
166 | ! Call to phyredem |
---|
167 | !--------------------------------------------------------------------- |
---|
168 | logical :: ok_writedem =.true. |
---|
169 | |
---|
170 | !--------------------------------------------------------------------- |
---|
171 | ! Call to physiq |
---|
172 | !--------------------------------------------------------------------- |
---|
173 | integer, parameter :: longcles=20 |
---|
174 | logical :: firstcall=.true. |
---|
175 | logical :: lastcall=.false. |
---|
176 | real :: phis = 0.0 |
---|
177 | real :: clesphy0(longcles) = 0.0 |
---|
178 | real :: dpsrf |
---|
179 | |
---|
180 | !--------------------------------------------------------------------- |
---|
181 | ! Initializations of boundary conditions |
---|
182 | !--------------------------------------------------------------------- |
---|
183 | integer, parameter :: yd = 360 |
---|
184 | real :: phy_nat (yd) = 0.0 ! 0=ocean libre,1=land,2=glacier,3=banquise |
---|
185 | real :: phy_alb (yd) ! Albedo land only (old value condsurf_jyg=0.3) |
---|
186 | real :: phy_sst (yd) ! SST (will not be used; cf read_tsurf1d.F) |
---|
187 | real :: phy_bil (yd) = 1.0 ! Ne sert que pour les slab_ocean |
---|
188 | real :: phy_rug (yd) ! Longueur rugosite utilisee sur land only |
---|
189 | real :: phy_ice (yd) = 0.0 ! Fraction de glace |
---|
190 | real :: phy_fter(yd) = 0.0 ! Fraction de terre |
---|
191 | real :: phy_foce(yd) = 0.0 ! Fraction de ocean |
---|
192 | real :: phy_fsic(yd) = 0.0 ! Fraction de glace |
---|
193 | real :: phy_flic(yd) = 0.0 ! Fraction de glace |
---|
194 | |
---|
195 | !--------------------------------------------------------------------- |
---|
196 | ! Fichiers et d'autres variables |
---|
197 | !--------------------------------------------------------------------- |
---|
198 | real ttt |
---|
199 | integer :: ierr,k,l,i,it=1,mxcalc |
---|
200 | integer jjmp1 |
---|
201 | parameter (jjmp1=jjm+1-1/jjm) |
---|
202 | INTEGER nbteta |
---|
203 | PARAMETER(nbteta=3) |
---|
204 | REAL dudyn(iim+1,jjmp1,llm) |
---|
205 | REAL PVteta(1,nbteta) |
---|
206 | INTEGER read_climoz |
---|
207 | !Al1 |
---|
208 | integer ecrit_slab_oc !1=ecrit,-1=lit,0=no file |
---|
209 | data ecrit_slab_oc/-1/ |
---|
210 | |
---|
211 | !===================================================================== |
---|
212 | ! INITIALIZATIONS |
---|
213 | !===================================================================== |
---|
214 | ! Initialization of Common turb_forcing |
---|
215 | dtime_frcg = 0. |
---|
216 | Turb_fcg_gcssold=.false. |
---|
217 | hthturb_gcssold = 0. |
---|
218 | hqturb_gcssold = 0. |
---|
219 | |
---|
220 | !--------------------------------------------------------------------- |
---|
221 | ! OPTIONS OF THE 1D SIMULATION (lmdz1d.def => unicol.def) |
---|
222 | !--------------------------------------------------------------------- |
---|
223 | cAl1 |
---|
224 | call conf_unicol(99) |
---|
225 | cAl1 moves this gcssold var from common fcg_gcssold to |
---|
226 | Turb_fcg_gcssold = xTurb_fcg_gcssold |
---|
227 | c -------------------------------------------------------------------- |
---|
228 | close(1) |
---|
229 | cAl1 |
---|
230 | write(*,*) 'lmdz1d.def lu => unicol.def' |
---|
231 | |
---|
232 | ! forcing_type defines the way the SCM is forced: |
---|
233 | !forcing_type = 0 ==> forcing_les = .true. |
---|
234 | ! initial profiles from file prof.inp.001 |
---|
235 | ! no forcing by LS convergence ; |
---|
236 | ! surface temperature imposed ; |
---|
237 | ! radiative cooling may be imposed (iflag_radia=0 in physiq.def) |
---|
238 | !forcing_type = 1 ==> forcing_radconv = .true. |
---|
239 | ! idem forcing_type = 0, but the imposed radiative cooling |
---|
240 | ! is set to 0 (hence, if iflag_radia=0 in physiq.def, |
---|
241 | ! then there is no radiative cooling at all) |
---|
242 | !forcing_type = 2 ==> forcing_toga = .true. |
---|
243 | ! initial profiles from TOGA-COARE IFA files |
---|
244 | ! LS convergence and SST imposed from TOGA-COARE IFA files |
---|
245 | !forcing_type = 3 ==> forcing_GCM2SCM = .true. |
---|
246 | ! initial profiles from the GCM output |
---|
247 | ! LS convergence imposed from the GCM output |
---|
248 | !forcing_type = 4 ==> forcing_twpice = .true. |
---|
249 | ! initial profiles from TWP-ICE cdf file |
---|
250 | ! LS convergence, omega and SST imposed from TWP-ICE files |
---|
251 | !forcing_type = 5 ==> forcing_rico = .true. |
---|
252 | ! initial profiles from RICO files |
---|
253 | ! LS convergence imposed from RICO files |
---|
254 | !forcing_type = 40 ==> forcing_GCSSold = .true. |
---|
255 | ! initial profile from GCSS file |
---|
256 | ! LS convergence imposed from GCSS file |
---|
257 | !forcing_type = 61 ==> forcing_armcu = .true. |
---|
258 | ! initial profile from arm_cu file |
---|
259 | ! LS convergence imposed from arm_cu file |
---|
260 | ! |
---|
261 | if (forcing_type .eq.0) THEN |
---|
262 | forcing_les = .true. |
---|
263 | elseif (forcing_type .eq.1) THEN |
---|
264 | forcing_radconv = .true. |
---|
265 | elseif (forcing_type .eq.2) THEN |
---|
266 | forcing_toga = .true. |
---|
267 | elseif (forcing_type .eq.3) THEN |
---|
268 | forcing_GCM2SCM = .true. |
---|
269 | elseif (forcing_type .eq.4) THEN |
---|
270 | forcing_twpice = .true. |
---|
271 | elseif (forcing_type .eq.5) THEN |
---|
272 | forcing_rico = .true. |
---|
273 | elseif (forcing_type .eq.40) THEN |
---|
274 | forcing_GCSSold = .true. |
---|
275 | elseif (forcing_type .eq.61) THEN |
---|
276 | forcing_armcu = .true. |
---|
277 | IF(llm.NE.19.AND.llm.NE.40) stop 'Erreur nombre de niveaux !!' |
---|
278 | else |
---|
279 | write (*,*) 'ERROR : unknown forcing_type ', forcing_type |
---|
280 | stop 'Forcing_type should be 0,1,2,3 or 40' |
---|
281 | ENDIF |
---|
282 | print*,"forcing type=",forcing_type |
---|
283 | |
---|
284 | ! if type_ts_forcing=0, the surface temp of 1D simulation is constant in time |
---|
285 | ! (specified by tsurf in lmdz1d.def); if type_ts_forcing=1, the surface temperature |
---|
286 | ! varies in time according to a forcing (e.g. forcing_toga) and is passed to read_tsurf1d.F |
---|
287 | ! through the common sst_forcing. |
---|
288 | |
---|
289 | type_ts_forcing = 0 |
---|
290 | if (forcing_toga) type_ts_forcing = 1 |
---|
291 | |
---|
292 | !--------------------------------------------------------------------- |
---|
293 | ! Definition of the run |
---|
294 | !--------------------------------------------------------------------- |
---|
295 | |
---|
296 | call conf_gcm( 99, .TRUE. , clesphy0 ) |
---|
297 | c----------------------------------------------------------------------- |
---|
298 | c Choix du calendrier |
---|
299 | c ------------------- |
---|
300 | |
---|
301 | c calend = 'earth_365d' |
---|
302 | if (calend == 'earth_360d') then |
---|
303 | call ioconf_calendar('360d') |
---|
304 | write(*,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an' |
---|
305 | else if (calend == 'earth_365d') then |
---|
306 | call ioconf_calendar('noleap') |
---|
307 | write(*,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an' |
---|
308 | else if (calend == 'earth_366d') then |
---|
309 | call ioconf_calendar('all_leap') |
---|
310 | write(*,*)'CALENDRIER CHOISI: Terrestre bissextile' |
---|
311 | else if (calend == 'gregorian') then |
---|
312 | call ioconf_calendar('gregorian') ! not to be used by normal users |
---|
313 | write(*,*)'CALENDRIER CHOISI: Gregorien' |
---|
314 | else |
---|
315 | write (*,*) 'ERROR : unknown calendar ', calend |
---|
316 | stop 'calend should be 360d,earth_365d,earth_366d,gregorian' |
---|
317 | endif |
---|
318 | c----------------------------------------------------------------------- |
---|
319 | c |
---|
320 | cc Date : |
---|
321 | c La date est supposee donnee sous la forme [annee, numero du jour dans |
---|
322 | c l annee] ; l heure est donnee dans time_ini, lu dans lmdz1d.def. |
---|
323 | c On appelle ymds2ju pour convertir [annee, jour] en [jour Julien]. |
---|
324 | c Le numero du jour est dans "day". L heure est traitee separement. |
---|
325 | c La date complete est dans "daytime" (l'unite est le jour). |
---|
326 | fnday=nday |
---|
327 | c Special case for arm_cu which lasts less than one day : 53100s !! (MPL 20111026) |
---|
328 | IF(forcing_type .EQ. 61) fnday=53100./86400. |
---|
329 | annee_ref = anneeref |
---|
330 | mois = 1 |
---|
331 | day_ref = dayref |
---|
332 | heure = 0. |
---|
333 | itau_dyn = 0 |
---|
334 | itau_phy = 0 |
---|
335 | call ymds2ju(annee_ref,mois,day_ref,heure,day) |
---|
336 | day_ini = day |
---|
337 | day_end = day_ini + nday |
---|
338 | ! Convert the initial date of Toga-Coare to Julian day |
---|
339 | call ymds2ju |
---|
340 | $ (year_ini_toga,mth_ini_toga,day_ini_toga,heure,day_ju_ini_toga) |
---|
341 | |
---|
342 | ! Convert the initial date of TWPICE to Julian day |
---|
343 | call ymds2ju |
---|
344 | $ (year_ini_twpi,mth_ini_twpi,day_ini_twpi,heure_ini_twpi |
---|
345 | $ ,day_ju_ini_twpi) |
---|
346 | |
---|
347 | ! Convert the initial date of Arm_cu to Julian day |
---|
348 | call ymds2ju |
---|
349 | $ (year_ini_armcu,mth_ini_armcu,day_ini_armcu,heure_ini_armcu |
---|
350 | $ ,day_ju_ini_armcu) |
---|
351 | |
---|
352 | daytime = day + time_ini/24. ! 1st day and initial time of the simulation |
---|
353 | ! Print out the actual date of the beginning of the simulation : |
---|
354 | call ju2ymds(daytime,year_print, month_print,day_print,sec_print) |
---|
355 | print *,' Time of beginning : ', |
---|
356 | $ year_print, month_print, day_print, sec_print |
---|
357 | |
---|
358 | !--------------------------------------------------------------------- |
---|
359 | ! Initialization of dimensions, geometry and initial state |
---|
360 | !--------------------------------------------------------------------- |
---|
361 | call init_phys_lmdz(1,1,llm,1,(/1/)) |
---|
362 | call suphel |
---|
363 | call initcomgeomphy |
---|
364 | call infotrac_init |
---|
365 | |
---|
366 | allocate(q(llm,nqtot)) ; q(:,:)=0. |
---|
367 | allocate(dq(llm,nqtot)) |
---|
368 | allocate(dq_dyn(llm,nqtot)) |
---|
369 | allocate(d_q_adv(llm,nqtot)) |
---|
370 | |
---|
371 | c |
---|
372 | c No ozone climatology need be read in this pre-initialization |
---|
373 | c (phys_state_var_init is called again in physiq) |
---|
374 | read_climoz = 0 |
---|
375 | c |
---|
376 | call phys_state_var_init(read_climoz) |
---|
377 | |
---|
378 | if (ngrid.ne.klon) then |
---|
379 | print*,'stop in inifis' |
---|
380 | print*,'Probleme de dimensions :' |
---|
381 | print*,'ngrid = ',ngrid |
---|
382 | print*,'klon = ',klon |
---|
383 | stop |
---|
384 | endif |
---|
385 | !!!===================================================================== |
---|
386 | !!! Feedback forcing values for Gateaux differentiation (al1) |
---|
387 | !!!===================================================================== |
---|
388 | !!! Surface Planck forcing bracketing call radiation |
---|
389 | !! surf_Planck = 0. |
---|
390 | !! surf_Conv = 0. |
---|
391 | !! write(*,*) 'Gateaux-dif Planck,Conv:',surf_Planck,surf_Conv |
---|
392 | !!! a mettre dans le lmdz1d.def ou autre |
---|
393 | !! |
---|
394 | !! |
---|
395 | qsol = qsolinp |
---|
396 | qsurf = fq_sat(tsurf,psurf/100.) |
---|
397 | rlat=xlat |
---|
398 | rlon=xlon |
---|
399 | day1= day_ini |
---|
400 | time=daytime-day |
---|
401 | ts_toga(1)=tsurf ! needed by read_tsurf1d.F |
---|
402 | rho(1)=psurf/(rd*tsurf*(1.+(rv/rd-1.)*qsurf)) |
---|
403 | |
---|
404 | ! |
---|
405 | !! mpl et jyg le 22/08/2012 : |
---|
406 | !! pour que les cas a flux de surface imposes marchent |
---|
407 | IF(.NOT.ok_flux_surf) THEN |
---|
408 | fsens=-wtsurf*rcpd*rho(1) |
---|
409 | flat=-wqsurf*rlvtt*rho(1) |
---|
410 | print *,'Flux: ok_flux wtsurf wqsurf',ok_flux_surf,wtsurf,wqsurf |
---|
411 | ENDIF |
---|
412 | !! ok_flux_surf=.false. |
---|
413 | !! fsens=-wtsurf*rcpd*rho(1) |
---|
414 | !! flat=-wqsurf*rlvtt*rho(1) |
---|
415 | !!!! |
---|
416 | |
---|
417 | ! Vertical discretization and pressure levels at half and mid levels: |
---|
418 | |
---|
419 | pa = 5e4 |
---|
420 | !! preff= 1.01325e5 |
---|
421 | preff = psurf |
---|
422 | IF (ok_old_disvert) THEN |
---|
423 | call disvert0(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig) |
---|
424 | print *,'On utilise disvert0' |
---|
425 | ELSE |
---|
426 | call disvert(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig, |
---|
427 | : scaleheight) |
---|
428 | print *,'On utilise disvert' |
---|
429 | c Nouvelle version disvert permettant d imposer ap,bp (modif L.Guez) MPL 18092012 |
---|
430 | c Dans ce cas, on lit ap,bp dans le fichier hybrid.txt |
---|
431 | ENDIF |
---|
432 | sig_s=presnivs/preff |
---|
433 | plev =ap+bp*psurf |
---|
434 | play = 0.5*(plev(1:llm)+plev(2:llm+1)) |
---|
435 | ccc zlay=-rd*300.*log(play/psurf)/rg ! moved after reading profiles |
---|
436 | |
---|
437 | write(*,*) '***********************' |
---|
438 | do l = 1, llm |
---|
439 | write(*,*) 'l,play(l),presnivs(l): ',l,play(l),presnivs(l) |
---|
440 | enddo |
---|
441 | write(*,*) '***********************' |
---|
442 | |
---|
443 | c |
---|
444 | !===================================================================== |
---|
445 | ! EVENTUALLY, READ FORCING DATA : |
---|
446 | !===================================================================== |
---|
447 | |
---|
448 | #include "1D_read_forc_cases.h" |
---|
449 | |
---|
450 | if (forcing_GCM2SCM) then |
---|
451 | write (*,*) 'forcing_GCM2SCM not yet implemented' |
---|
452 | stop 'in initialization' |
---|
453 | endif ! forcing_GCM2SCM |
---|
454 | |
---|
455 | print*,'mxcalc=',mxcalc |
---|
456 | print*,'zlay=',zlay(mxcalc) |
---|
457 | print*,'play=',play(mxcalc) |
---|
458 | |
---|
459 | cAl1 pour SST forced, appellé depuis ocean_forced_noice |
---|
460 | ts_cur = tsurf ! SST used in read_tsurf1d |
---|
461 | !===================================================================== |
---|
462 | ! Initialisation de la physique : |
---|
463 | !===================================================================== |
---|
464 | |
---|
465 | ! Rq: conf_phys.F90 lit tous les flags de physiq.def; conf_phys appele depuis physiq.F |
---|
466 | ! |
---|
467 | ! day_step, iphysiq lus dans gcm.def ci-dessus |
---|
468 | ! timestep: calcule ci-dessous from rday et day_step |
---|
469 | ! ngrid=1 |
---|
470 | ! llm: defini dans .../modipsl/modeles/LMDZ4/libf/grid/dimension |
---|
471 | ! rday: defini dans suphel.F (86400.) |
---|
472 | ! day_ini: lu dans run.def (dayref) |
---|
473 | ! rlat_rad,rlon-rad: transformes en radian de rlat,rlon lus dans lmdz1d.def (en degres) |
---|
474 | ! airefi,zcufi,zcvfi initialises au debut de ce programme |
---|
475 | ! rday,ra,rg,rd,rcpd declares dans YOMCST.h et calcules dans suphel.F |
---|
476 | day_step = float(nsplit_phys)*day_step/float(iphysiq) |
---|
477 | write (*,*) 'Time step divided by nsplit_phys (=',nsplit_phys,')' |
---|
478 | timestep =rday/day_step |
---|
479 | dtime_frcg = timestep |
---|
480 | ! |
---|
481 | zcufi=airefi |
---|
482 | zcvfi=airefi |
---|
483 | ! |
---|
484 | rlat_rad(:)=rlat(:)*rpi/180. |
---|
485 | rlon_rad(:)=rlon(:)*rpi/180. |
---|
486 | |
---|
487 | call iniphysiq(ngrid,llm,rday,day_ini,timestep, |
---|
488 | . rlat_rad,rlon_rad,airefi,zcufi,zcvfi,ra,rg,rd,rcpd,(/1/)) |
---|
489 | print*,'apres iniphysiq' |
---|
490 | |
---|
491 | ! 2 PARAMETRES QUI DEVRAIENT ETRE LUS DANS run.def MAIS NE LE SONT PAS ICI: |
---|
492 | co2_ppm= 330.0 |
---|
493 | solaire=1370.0 |
---|
494 | |
---|
495 | ! Ecriture du startphy avant le premier appel a la physique. |
---|
496 | ! On le met juste avant pour avoir acces a tous les champs |
---|
497 | ! NB: les clesphy0 seront remplies dans phyredem d'apres les flags lus dans gcm.def |
---|
498 | |
---|
499 | if (ok_writedem) then |
---|
500 | |
---|
501 | !-------------------------------------------------------------------------- |
---|
502 | ! pbl_surface_init (called here) and pbl_surface_final (called by phyredem) |
---|
503 | ! need : qsol fder snow qsurf evap rugos agesno ftsoil |
---|
504 | !-------------------------------------------------------------------------- |
---|
505 | |
---|
506 | type_ocean = "force" |
---|
507 | run_off_lic_0(1) = restart_runoff |
---|
508 | call fonte_neige_init(run_off_lic_0) |
---|
509 | |
---|
510 | fder=0. |
---|
511 | snsrf(1,:)=0. ! couverture de neige des sous surface |
---|
512 | qsurfsrf(1,:)=qsurf ! humidite de l'air des sous surface |
---|
513 | evap=0. |
---|
514 | frugs(1,:)=rugos ! couverture de neige des sous surface |
---|
515 | agesno = xagesno |
---|
516 | tsoil(:,:,:)=tsurf |
---|
517 | call pbl_surface_init(qsol, fder, snsrf, qsurfsrf, |
---|
518 | & evap, frugs, agesno, tsoil) |
---|
519 | |
---|
520 | !------------------ prepare limit conditions for limit.nc ----------------- |
---|
521 | !-- Ocean force |
---|
522 | |
---|
523 | print*,'avant phyredem' |
---|
524 | pctsrf(1,:)=0. |
---|
525 | if (nat_surf.eq.0.) then |
---|
526 | pctsrf(1,is_oce)=1. |
---|
527 | pctsrf(1,is_ter)=0. |
---|
528 | else |
---|
529 | pctsrf(1,is_oce)=0. |
---|
530 | pctsrf(1,is_ter)=1. |
---|
531 | end if |
---|
532 | |
---|
533 | print*,'nat_surf,pctsrf(1,is_oce),pctsrf(1,is_ter)',nat_surf |
---|
534 | $ ,pctsrf(1,is_oce),pctsrf(1,is_ter) |
---|
535 | |
---|
536 | zmasq=pctsrf(1,is_ter)+pctsrf(1,is_lic) |
---|
537 | zpic = zpicinp |
---|
538 | ftsol=tsurf |
---|
539 | falb1 = albedo |
---|
540 | falb2 = albedo |
---|
541 | rugoro=rugos |
---|
542 | t_ancien(1,:)=temp(:) |
---|
543 | q_ancien(1,:)=q(:,1) |
---|
544 | pbl_tke=1.e-8 |
---|
545 | |
---|
546 | rain_fall=0. |
---|
547 | snow_fall=0. |
---|
548 | solsw=0. |
---|
549 | sollw=0. |
---|
550 | radsol=0. |
---|
551 | rnebcon=0. |
---|
552 | ratqs=0. |
---|
553 | clwcon=0. |
---|
554 | zmea=0. |
---|
555 | zstd=0. |
---|
556 | zsig=0. |
---|
557 | zgam=0. |
---|
558 | zval=0. |
---|
559 | zthe=0. |
---|
560 | ema_work1=0. |
---|
561 | ema_work2=0. |
---|
562 | |
---|
563 | !------------------------------------------------------------------------ |
---|
564 | ! Make file containing restart for the physics (startphy.nc) |
---|
565 | ! |
---|
566 | ! NB: List of the variables to be written by phyredem (via put_field): |
---|
567 | ! rlon,rlat,zmasq,pctsrf(:,is_ter),pctsrf(:,is_lic),pctsrf(:,is_oce) |
---|
568 | ! pctsrf(:,is_sic),ftsol(:,nsrf),tsoil(:,isoil,nsrf),qsurf(:,nsrf) |
---|
569 | ! qsol,falb1(:,nsrf),falb2(:,nsrf),evap(:,nsrf),snow(:,nsrf) |
---|
570 | ! radsol,solsw,sollw,fder,rain_fall,snow_fall,frugs(:,nsrf) |
---|
571 | ! agesno(:,nsrf),zmea,zstd,zsig,zgam,zthe,zpic,zval,rugoro |
---|
572 | ! t_ancien,q_ancien,frugs(:,is_oce),clwcon(:,1),rnebcon(:,1),ratqs(:,1) |
---|
573 | ! run_off_lic_0,pbl_tke(:,1:klev,nsrf),zmax0,f0,ema_work1,ema_work2 |
---|
574 | ! wake_deltat,wake_deltaq,wake_s,wake_cstar,wake_fip |
---|
575 | !------------------------------------------------------------------------ |
---|
576 | CAl1 =============== restart option ========================== |
---|
577 | if (.not.restart) then |
---|
578 | call phyredem ("startphy.nc") |
---|
579 | else |
---|
580 | c (desallocations) |
---|
581 | print*,'callin surf final' |
---|
582 | call pbl_surface_final(qsol, fder, snsrf, qsurfsrf, |
---|
583 | & evap, frugs, agesno, tsoil) |
---|
584 | print*,'after surf final' |
---|
585 | CALL fonte_neige_final(run_off_lic_0) |
---|
586 | endif |
---|
587 | |
---|
588 | ok_writedem=.false. |
---|
589 | print*,'apres phyredem' |
---|
590 | |
---|
591 | endif ! ok_writedem |
---|
592 | |
---|
593 | !------------------------------------------------------------------------ |
---|
594 | ! Make file containing boundary conditions (limit.nc) **Al1->restartdyn*** |
---|
595 | ! -------------------------------------------------- |
---|
596 | ! NB: List of the variables to be written in limit.nc |
---|
597 | ! (by writelim.F, subroutine of 1DUTILS.h): |
---|
598 | ! phy_nat,phy_alb,phy_sst,phy_bil,phy_rug,phy_ice, |
---|
599 | ! phy_fter,phy_foce,phy_flic,phy_fsic) |
---|
600 | !------------------------------------------------------------------------ |
---|
601 | do i=1,yd |
---|
602 | phy_nat(i) = nat_surf |
---|
603 | phy_alb(i) = albedo |
---|
604 | phy_sst(i) = tsurf ! read_tsurf1d will be used instead |
---|
605 | phy_rug(i) = rugos |
---|
606 | phy_fter(i) = pctsrf(1,is_ter) |
---|
607 | phy_foce(i) = pctsrf(1,is_oce) |
---|
608 | phy_fsic(i) = pctsrf(1,is_sic) |
---|
609 | phy_flic(i) = pctsrf(1,is_lic) |
---|
610 | enddo |
---|
611 | |
---|
612 | C fabrication de limit.nc |
---|
613 | call writelim (1,phy_nat,phy_alb,phy_sst,phy_bil,phy_rug, |
---|
614 | & phy_ice,phy_fter,phy_foce,phy_flic,phy_fsic) |
---|
615 | |
---|
616 | |
---|
617 | call phys_state_var_end |
---|
618 | cAl1 |
---|
619 | if (restart) then |
---|
620 | print*,'call to restart dyn 1d' |
---|
621 | Call dyn1deta0("start1dyn.nc", |
---|
622 | & plev,play,phi,phis,presnivs, |
---|
623 | & u,v,temp,q,omega2) |
---|
624 | |
---|
625 | print*,'fnday,annee_ref,day_ref,day_ini', |
---|
626 | & fnday,annee_ref,day_ref,day_ini |
---|
627 | c** call ymds2ju(annee_ref,mois,day_ini,heure,day) |
---|
628 | day = day_ini |
---|
629 | day_end = day_ini + nday |
---|
630 | daytime = day + time_ini/24. ! 1st day and initial time of the simulation |
---|
631 | |
---|
632 | ! Print out the actual date of the beginning of the simulation : |
---|
633 | call ju2ymds(daytime, an, mois, jour, heure) |
---|
634 | print *,' Time of beginning : y m d h',an, mois,jour,heure/3600. |
---|
635 | |
---|
636 | day = int(daytime) |
---|
637 | time=daytime-day |
---|
638 | |
---|
639 | print*,'****** intialised fields from restart1dyn *******' |
---|
640 | print*,'plev,play,phi,phis,presnivs,u,v,temp,q,omega2' |
---|
641 | print*,'temp(1),q(1,1),u(1),v(1),plev(1),phis :' |
---|
642 | print*,temp(1),q(1,1),u(1),v(1),plev(1),phis |
---|
643 | c raz for safety |
---|
644 | do l=1,llm |
---|
645 | dq_dyn(l,1) = 0. |
---|
646 | enddo |
---|
647 | endif |
---|
648 | !Al1 ================ end restart ================================= |
---|
649 | IF (ecrit_slab_oc.eq.1) then |
---|
650 | open(97,file='div_slab.dat',STATUS='UNKNOWN') |
---|
651 | elseif (ecrit_slab_oc.eq.0) then |
---|
652 | open(97,file='div_slab.dat',STATUS='OLD') |
---|
653 | endif |
---|
654 | !===================================================================== |
---|
655 | ! START OF THE TEMPORAL LOOP : |
---|
656 | !===================================================================== |
---|
657 | |
---|
658 | do while(it.le.nint(fnday*day_step)) |
---|
659 | |
---|
660 | if (prt_level.ge.1) then |
---|
661 | print*,'XXXXXXXXXXXXXXXXXXX ITAP,day,time=', |
---|
662 | . it,day,time,nint(fnday*day_step) |
---|
663 | print*,'PAS DE TEMPS ',timestep |
---|
664 | endif |
---|
665 | !Al1 demande de restartphy.nc |
---|
666 | if (it.eq.nint(fnday*day_step)) lastcall=.True. |
---|
667 | |
---|
668 | !--------------------------------------------------------------------- |
---|
669 | ! Interpolation of forcings in time and onto model levels |
---|
670 | !--------------------------------------------------------------------- |
---|
671 | |
---|
672 | #include "1D_interp_cases.h" |
---|
673 | |
---|
674 | if (forcing_GCM2SCM) then |
---|
675 | write (*,*) 'forcing_GCM2SCM not yet implemented' |
---|
676 | stop 'in time loop' |
---|
677 | endif ! forcing_GCM2SCM |
---|
678 | |
---|
679 | !--------------------------------------------------------------------- |
---|
680 | ! Geopotential : |
---|
681 | !--------------------------------------------------------------------- |
---|
682 | |
---|
683 | phi(1)=RD*temp(1)*(plev(1)-play(1))/(.5*(plev(1)+play(1))) |
---|
684 | do l = 1, llm-1 |
---|
685 | phi(l+1)=phi(l)+RD*(temp(l)+temp(l+1))* |
---|
686 | . (play(l)-play(l+1))/(play(l)+play(l+1)) |
---|
687 | enddo |
---|
688 | |
---|
689 | !--------------------------------------------------------------------- |
---|
690 | ! Listing output for debug prt_level>=1 |
---|
691 | !--------------------------------------------------------------------- |
---|
692 | if (prt_level>=1) then |
---|
693 | print *,' avant physiq : -------- day time ',day,time |
---|
694 | write(*,*) 'firstcall,lastcall,phis', |
---|
695 | : firstcall,lastcall,phis |
---|
696 | write(*,'(a10,2a4,4a13)') 'BEFOR1 IT=','it','l', |
---|
697 | : 'presniv','plev','play','phi' |
---|
698 | write(*,'(a10,2i4,4f13.2)') ('BEFOR1 IT= ',it,l, |
---|
699 | : presnivs(l),plev(l),play(l),phi(l),l=1,llm) |
---|
700 | write(*,'(a11,2a4,a11,6a8)') 'BEFOR2','it','l', |
---|
701 | : 'presniv','u','v','temp','q1','q2','omega2' |
---|
702 | write(*,'(a11,2i4,f11.2,5f8.2,e10.2)') ('BEFOR2 IT= ',it,l, |
---|
703 | : presnivs(l),u(l),v(l),temp(l),q(l,1),q(l,2),omega2(l),l=1,llm) |
---|
704 | endif |
---|
705 | |
---|
706 | !--------------------------------------------------------------------- |
---|
707 | ! Call physiq : |
---|
708 | !--------------------------------------------------------------------- |
---|
709 | |
---|
710 | call physiq(ngrid,llm, |
---|
711 | : firstcall,lastcall, |
---|
712 | : day,time,timestep, |
---|
713 | : plev,play,phi,phis,presnivs,clesphy0, |
---|
714 | : u,v,temp,q,omega2, |
---|
715 | : du_phys,dv_phys,dt_phys,dq,dpsrf, |
---|
716 | : dudyn,PVteta) |
---|
717 | firstcall=.false. |
---|
718 | |
---|
719 | !--------------------------------------------------------------------- |
---|
720 | ! Listing output for debug prt_level>=1 |
---|
721 | !--------------------------------------------------------------------- |
---|
722 | if (prt_level>=1) then |
---|
723 | write(*,'(a11,2a4,4a13)') 'AFTER1 IT=','it','l', |
---|
724 | : 'presniv','plev','play','phi' |
---|
725 | write(*,'(a11,2i4,4f13.2)') ('AFTER1 it= ',it,l, |
---|
726 | : presnivs(l),plev(l),play(l),phi(l),l=1,llm) |
---|
727 | write(*,'(a11,2a4,a11,6a8)') 'AFTER2','it','l', |
---|
728 | : 'presniv','u','v','temp','q1','q2','omega2' |
---|
729 | write(*,'(a11,2i4,f11.2,5f8.2,e10.2)') ('AFTER2 it= ',it,l, |
---|
730 | : presnivs(l),u(l),v(l),temp(l),q(l,1),q(l,2),omega2(l),l=1,llm) |
---|
731 | write(*,'(a11,2a4,a11,5a8)') 'AFTER3','it','l', |
---|
732 | : 'presniv','du_phys','dv_phys','dt_phys','dq1','dq2' |
---|
733 | write(*,'(a11,2i4,f11.2,5f8.2)') ('AFTER3 it= ',it,l, |
---|
734 | : presnivs(l),86400*du_phys(l),86400*dv_phys(l), |
---|
735 | : 86400*dt_phys(l),86400*dq(l,1),dq(l,2),l=1,llm) |
---|
736 | write(*,*) 'dpsrf',dpsrf |
---|
737 | endif |
---|
738 | !--------------------------------------------------------------------- |
---|
739 | ! Add physical tendencies : |
---|
740 | !--------------------------------------------------------------------- |
---|
741 | |
---|
742 | fcoriolis=2.*sin(rpi*xlat/180.)*romega |
---|
743 | if (forcing_radconv) then |
---|
744 | fcoriolis=0.0 |
---|
745 | dt_cooling=0.0 |
---|
746 | d_th_adv=0.0 |
---|
747 | d_q_adv=0.0 |
---|
748 | endif |
---|
749 | |
---|
750 | if (forcing_toga .or. forcing_GCSSold .or. forcing_twpice) then |
---|
751 | fcoriolis=0.0 ; ug=0. ; vg=0. |
---|
752 | endif |
---|
753 | if(forcing_rico) then |
---|
754 | dt_cooling=0. |
---|
755 | endif |
---|
756 | |
---|
757 | print*, 'fcoriolis ', fcoriolis, xlat |
---|
758 | |
---|
759 | du_age(1:mxcalc)= |
---|
760 | : fcoriolis*(v(1:mxcalc)-vg(1:mxcalc)) |
---|
761 | dv_age(1:mxcalc)= |
---|
762 | : -fcoriolis*(u(1:mxcalc)-ug(1:mxcalc)) |
---|
763 | |
---|
764 | !!!!!!!!!!!!!!!!!!!!!!!! |
---|
765 | ! Geostrophic wind |
---|
766 | !!!!!!!!!!!!!!!!!!!!!!!! |
---|
767 | sfdt = sin(0.5*fcoriolis*timestep) |
---|
768 | cfdt = cos(0.5*fcoriolis*timestep) |
---|
769 | ! |
---|
770 | du_age(1:mxcalc)= -2.*sfdt/timestep* |
---|
771 | : (sfdt*(u(1:mxcalc)-ug(1:mxcalc)) - |
---|
772 | : cfdt*(v(1:mxcalc)-vg(1:mxcalc)) ) |
---|
773 | !! : fcoriolis*(v(1:mxcalc)-vg(1:mxcalc)) |
---|
774 | ! |
---|
775 | dv_age(1:mxcalc)= -2.*sfdt/timestep* |
---|
776 | : (cfdt*(u(1:mxcalc)-ug(1:mxcalc)) + |
---|
777 | : sfdt*(v(1:mxcalc)-vg(1:mxcalc)) ) |
---|
778 | !! : -fcoriolis*(u(1:mxcalc)-ug(1:mxcalc)) |
---|
779 | ! |
---|
780 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
781 | ! call writefield_phy('dv_age' ,dv_age,llm) |
---|
782 | ! call writefield_phy('du_age' ,du_age,llm) |
---|
783 | ! call writefield_phy('du_phys' ,du_phys,llm) |
---|
784 | ! call writefield_phy('u_tend' ,u,llm) |
---|
785 | ! call writefield_phy('u_g' ,ug,llm) |
---|
786 | ! |
---|
787 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
788 | !! Increment state variables |
---|
789 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
790 | u(1:mxcalc)=u(1:mxcalc) + timestep*( |
---|
791 | : du_phys(1:mxcalc) |
---|
792 | : +du_age(1:mxcalc) ) |
---|
793 | v(1:mxcalc)=v(1:mxcalc) + timestep*( |
---|
794 | : dv_phys(1:mxcalc) |
---|
795 | : +dv_age(1:mxcalc) ) |
---|
796 | q(1:mxcalc,:)=q(1:mxcalc,:)+timestep*( |
---|
797 | : dq(1:mxcalc,:) |
---|
798 | : +d_q_adv(1:mxcalc,:) ) |
---|
799 | |
---|
800 | if (prt_level.ge.1) then |
---|
801 | print *, |
---|
802 | : 'physiq-> temp(1),dt_phys(1),d_th_adv(1),dt_cooling(1) ', |
---|
803 | : temp(1),dt_phys(1),d_th_adv(1),dt_cooling(1) |
---|
804 | print*,du_phys |
---|
805 | print*, v |
---|
806 | print*, vg |
---|
807 | endif |
---|
808 | |
---|
809 | temp(1:mxcalc)=temp(1:mxcalc)+timestep*( |
---|
810 | . dt_phys(1:mxcalc) |
---|
811 | . +d_th_adv(1:mxcalc) |
---|
812 | . +dt_cooling(1:mxcalc)) ! Taux de chauffage ou refroid. |
---|
813 | |
---|
814 | teta=temp*(pzero/play)**rkappa |
---|
815 | |
---|
816 | !--------------------------------------------------------------------- |
---|
817 | ! Add large-scale tendencies (advection, etc) : |
---|
818 | !--------------------------------------------------------------------- |
---|
819 | |
---|
820 | ccc nrlmd |
---|
821 | ccc tmpvar=teta |
---|
822 | ccc call advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
823 | ccc |
---|
824 | ccc teta(1:mxcalc)=tmpvar(1:mxcalc) |
---|
825 | ccc tmpvar(:)=q(:,1) |
---|
826 | ccc call advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
827 | ccc q(1:mxcalc,1)=tmpvar(1:mxcalc) |
---|
828 | ccc tmpvar(:)=q(:,2) |
---|
829 | ccc call advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
830 | ccc q(1:mxcalc,2)=tmpvar(1:mxcalc) |
---|
831 | |
---|
832 | !--------------------------------------------------------------------- |
---|
833 | ! Air temperature : |
---|
834 | !--------------------------------------------------------------------- |
---|
835 | if (lastcall) then |
---|
836 | print*,'Pas de temps final ',it |
---|
837 | call ju2ymds(daytime, an, mois, jour, heure) |
---|
838 | print*,'a la date : a m j h',an, mois, jour ,heure/3600. |
---|
839 | endif |
---|
840 | |
---|
841 | c incremente day time |
---|
842 | c print*,'daytime bef',daytime,1./day_step |
---|
843 | daytime = daytime+1./day_step |
---|
844 | !Al1dbg |
---|
845 | day = int(daytime+0.1/day_step) |
---|
846 | c time = max(daytime-day,0.0) |
---|
847 | cAl1&jyg: correction de bug |
---|
848 | ccc time = real(mod(it,day_step))/day_step |
---|
849 | time = time_ini/24.+real(mod(it,day_step))/day_step |
---|
850 | c print*,'daytime nxt time',daytime,time |
---|
851 | it=it+1 |
---|
852 | |
---|
853 | enddo |
---|
854 | |
---|
855 | !Al1 |
---|
856 | if (ecrit_slab_oc.ne.-1) close(97) |
---|
857 | |
---|
858 | !Al1 Call to 1D equivalent of dynredem (an,mois,jour,heure ?) |
---|
859 | ! ------------------------------------- |
---|
860 | call dyn1dredem("restart1dyn.nc", |
---|
861 | : plev,play,phi,phis,presnivs, |
---|
862 | : u,v,temp,q,omega2) |
---|
863 | |
---|
864 | CALL abort_gcm ('lmdz1d ','The End ',0) |
---|
865 | |
---|
866 | end |
---|
867 | |
---|
868 | #include "1DUTILS.h" |
---|
869 | #include "1Dconv.h" |
---|
870 | |
---|
871 | |
---|