1 | !#ifdef CPP_1D |
---|
2 | !#include "../dyn3d/mod_const_mpi.F90" |
---|
3 | !#include "../dyn3d_common/control_mod.F90" |
---|
4 | !#include "../dyn3d_common/infotrac.F90" |
---|
5 | !#include "../dyn3d_common/disvert.F90" |
---|
6 | |
---|
7 | |
---|
8 | PROGRAM lmdz1d |
---|
9 | |
---|
10 | USE ioipsl, only: ju2ymds, ymds2ju, ioconf_calendar |
---|
11 | USE phys_state_var_mod, ONLY : phys_state_var_init, phys_state_var_end, & |
---|
12 | clwcon, detr_therm, & |
---|
13 | qsol, fevap, z0m, z0h, agesno, & |
---|
14 | du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, & |
---|
15 | falb_dir, falb_dif, & |
---|
16 | ftsol, pbl_tke, pctsrf, radsol, rain_fall, snow_fall, ratqs, & |
---|
17 | rnebcon, rugoro, sig1, w01, solaire_etat0, sollw, sollwdown, & |
---|
18 | solsw, t_ancien, q_ancien, u_ancien, v_ancien, wake_cstar, & |
---|
19 | wake_delta_pbl_TKE, delta_tsurf, wake_fip, wake_pe, & |
---|
20 | wake_deltaq, wake_deltat, wake_s, wake_dens, & |
---|
21 | zgam, zmax0, zmea, zpic, zsig, & |
---|
22 | zstd, zthe, zval, ale_bl, ale_bl_trig, alp_bl, ql_ancien, qs_ancien, & |
---|
23 | prlw_ancien, prsw_ancien, prw_ancien |
---|
24 | |
---|
25 | USE dimphy |
---|
26 | USE surface_data, only : type_ocean,ok_veget |
---|
27 | USE pbl_surface_mod, only : ftsoil, pbl_surface_init, & |
---|
28 | pbl_surface_final |
---|
29 | USE fonte_neige_mod, only : fonte_neige_init, fonte_neige_final |
---|
30 | |
---|
31 | USE infotrac ! new |
---|
32 | USE control_mod |
---|
33 | USE indice_sol_mod |
---|
34 | USE phyaqua_mod |
---|
35 | ! USE mod_1D_cases_read |
---|
36 | USE mod_1D_cases_read2 |
---|
37 | USE mod_1D_amma_read |
---|
38 | USE print_control_mod, ONLY: lunout, prt_level |
---|
39 | USE iniphysiq_mod, ONLY: iniphysiq |
---|
40 | USE mod_const_mpi, ONLY: comm_lmdz |
---|
41 | USE physiq_mod, ONLY: physiq |
---|
42 | USE comvert_mod, ONLY: presnivs, ap, bp, dpres,nivsig, nivsigs, pa, & |
---|
43 | preff, aps, bps, pseudoalt, scaleheight |
---|
44 | USE temps_mod, ONLY: annee_ref, calend, day_end, day_ini, day_ref, & |
---|
45 | itau_dyn, itau_phy, start_time |
---|
46 | |
---|
47 | implicit none |
---|
48 | #include "dimensions.h" |
---|
49 | #include "YOMCST.h" |
---|
50 | !!#include "control.h" |
---|
51 | #include "clesphys.h" |
---|
52 | #include "dimsoil.h" |
---|
53 | !#include "indicesol.h" |
---|
54 | |
---|
55 | #include "compar1d.h" |
---|
56 | #include "flux_arp.h" |
---|
57 | #include "date_cas.h" |
---|
58 | #include "tsoilnudge.h" |
---|
59 | #include "fcg_gcssold.h" |
---|
60 | !!!#include "fbforcing.h" |
---|
61 | #include "compbl.h" |
---|
62 | |
---|
63 | !===================================================================== |
---|
64 | ! DECLARATIONS |
---|
65 | !===================================================================== |
---|
66 | |
---|
67 | !--------------------------------------------------------------------- |
---|
68 | ! Externals |
---|
69 | !--------------------------------------------------------------------- |
---|
70 | external fq_sat |
---|
71 | real fq_sat |
---|
72 | |
---|
73 | !--------------------------------------------------------------------- |
---|
74 | ! Arguments d' initialisations de la physique (USER DEFINE) |
---|
75 | !--------------------------------------------------------------------- |
---|
76 | |
---|
77 | integer, parameter :: ngrid=1 |
---|
78 | real :: zcufi = 1. |
---|
79 | real :: zcvfi = 1. |
---|
80 | |
---|
81 | !- real :: nat_surf |
---|
82 | !- logical :: ok_flux_surf |
---|
83 | !- real :: fsens |
---|
84 | !- real :: flat |
---|
85 | !- real :: tsurf |
---|
86 | !- real :: rugos |
---|
87 | !- real :: qsol(1:2) |
---|
88 | !- real :: qsurf |
---|
89 | !- real :: psurf |
---|
90 | !- real :: zsurf |
---|
91 | !- real :: albedo |
---|
92 | !- |
---|
93 | !- real :: time = 0. |
---|
94 | !- real :: time_ini |
---|
95 | !- real :: xlat |
---|
96 | !- real :: xlon |
---|
97 | !- real :: wtsurf |
---|
98 | !- real :: wqsurf |
---|
99 | !- real :: restart_runoff |
---|
100 | !- real :: xagesno |
---|
101 | !- real :: qsolinp |
---|
102 | !- real :: zpicinp |
---|
103 | !- |
---|
104 | real :: fnday |
---|
105 | real :: day, daytime |
---|
106 | real :: day1 |
---|
107 | real :: heure |
---|
108 | integer :: jour |
---|
109 | integer :: mois |
---|
110 | integer :: an |
---|
111 | |
---|
112 | !--------------------------------------------------------------------- |
---|
113 | ! Declarations related to forcing and initial profiles |
---|
114 | !--------------------------------------------------------------------- |
---|
115 | |
---|
116 | integer :: kmax = llm |
---|
117 | integer llm700,nq1,nq2 |
---|
118 | INTEGER, PARAMETER :: nlev_max=1000, nqmx=1000 |
---|
119 | real timestep, frac |
---|
120 | real height(nlev_max),tttprof(nlev_max),qtprof(nlev_max) |
---|
121 | real uprof(nlev_max),vprof(nlev_max),e12prof(nlev_max) |
---|
122 | real ugprof(nlev_max),vgprof(nlev_max),wfls(nlev_max) |
---|
123 | real dqtdxls(nlev_max),dqtdyls(nlev_max) |
---|
124 | real dqtdtls(nlev_max),thlpcar(nlev_max) |
---|
125 | real qprof(nlev_max,nqmx) |
---|
126 | |
---|
127 | ! integer :: forcing_type |
---|
128 | logical :: forcing_les = .false. |
---|
129 | logical :: forcing_armcu = .false. |
---|
130 | logical :: forcing_rico = .false. |
---|
131 | logical :: forcing_radconv = .false. |
---|
132 | logical :: forcing_toga = .false. |
---|
133 | logical :: forcing_twpice = .false. |
---|
134 | logical :: forcing_amma = .false. |
---|
135 | logical :: forcing_dice = .false. |
---|
136 | logical :: forcing_gabls4 = .false. |
---|
137 | |
---|
138 | logical :: forcing_GCM2SCM = .false. |
---|
139 | logical :: forcing_GCSSold = .false. |
---|
140 | logical :: forcing_sandu = .false. |
---|
141 | logical :: forcing_astex = .false. |
---|
142 | logical :: forcing_fire = .false. |
---|
143 | logical :: forcing_case = .false. |
---|
144 | logical :: forcing_case2 = .false. |
---|
145 | integer :: type_ts_forcing ! 0 = SST constant; 1 = SST read from a file |
---|
146 | ! (cf read_tsurf1d.F) |
---|
147 | |
---|
148 | !vertical advection computation |
---|
149 | ! real d_t_z(llm), d_q_z(llm) |
---|
150 | ! real d_t_dyn_z(llm), dq_dyn_z(llm) |
---|
151 | ! real zz(llm) |
---|
152 | ! real zfact |
---|
153 | |
---|
154 | !flag forcings |
---|
155 | logical :: nudge_wind=.true. |
---|
156 | logical :: nudge_thermo=.false. |
---|
157 | logical :: cptadvw=.true. |
---|
158 | !===================================================================== |
---|
159 | ! DECLARATIONS FOR EACH CASE |
---|
160 | !===================================================================== |
---|
161 | ! |
---|
162 | #include "1D_decl_cases.h" |
---|
163 | ! |
---|
164 | !--------------------------------------------------------------------- |
---|
165 | ! Declarations related to nudging |
---|
166 | !--------------------------------------------------------------------- |
---|
167 | integer :: nudge_max |
---|
168 | parameter (nudge_max=9) |
---|
169 | integer :: inudge_RHT=1 |
---|
170 | integer :: inudge_UV=2 |
---|
171 | logical :: nudge(nudge_max) |
---|
172 | real :: t_targ(llm) |
---|
173 | real :: rh_targ(llm) |
---|
174 | real :: u_targ(llm) |
---|
175 | real :: v_targ(llm) |
---|
176 | ! |
---|
177 | !--------------------------------------------------------------------- |
---|
178 | ! Declarations related to vertical discretization: |
---|
179 | !--------------------------------------------------------------------- |
---|
180 | real :: pzero=1.e5 |
---|
181 | real :: play (llm),zlay (llm),sig_s(llm),plev(llm+1) |
---|
182 | real :: playd(llm),zlayd(llm),ap_amma(llm+1),bp_amma(llm+1) |
---|
183 | |
---|
184 | !--------------------------------------------------------------------- |
---|
185 | ! Declarations related to variables |
---|
186 | !--------------------------------------------------------------------- |
---|
187 | |
---|
188 | real :: phi(llm) |
---|
189 | real :: teta(llm),tetal(llm),temp(llm),u(llm),v(llm),w(llm) |
---|
190 | REAL rot(1, llm) ! relative vorticity, in s-1 |
---|
191 | real :: rlat_rad(1),rlon_rad(1) |
---|
192 | real :: omega(llm+1),omega2(llm),rho(llm+1) |
---|
193 | real :: ug(llm),vg(llm),fcoriolis |
---|
194 | real :: sfdt, cfdt |
---|
195 | real :: du_phys(llm),dv_phys(llm),dt_phys(llm) |
---|
196 | real :: dt_dyn(llm) |
---|
197 | real :: dt_cooling(llm),d_t_adv(llm),d_th_adv(llm),d_t_nudge(llm) |
---|
198 | real :: d_u_nudge(llm),d_v_nudge(llm) |
---|
199 | real :: du_adv(llm),dv_adv(llm) |
---|
200 | real :: du_age(llm),dv_age(llm) |
---|
201 | real :: alpha |
---|
202 | real :: ttt |
---|
203 | |
---|
204 | REAL, ALLOCATABLE, DIMENSION(:,:):: q |
---|
205 | REAL, ALLOCATABLE, DIMENSION(:,:):: dq |
---|
206 | REAL, ALLOCATABLE, DIMENSION(:,:):: dq_dyn |
---|
207 | REAL, ALLOCATABLE, DIMENSION(:,:):: d_q_adv |
---|
208 | REAL, ALLOCATABLE, DIMENSION(:,:):: d_q_nudge |
---|
209 | ! REAL, ALLOCATABLE, DIMENSION(:):: d_th_adv |
---|
210 | |
---|
211 | !--------------------------------------------------------------------- |
---|
212 | ! Initialization of surface variables |
---|
213 | !--------------------------------------------------------------------- |
---|
214 | real :: run_off_lic_0(1) |
---|
215 | real :: fder(1),snsrf(1,nbsrf),qsurfsrf(1,nbsrf) |
---|
216 | real :: tsoil(1,nsoilmx,nbsrf) |
---|
217 | ! real :: agesno(1,nbsrf) |
---|
218 | |
---|
219 | !--------------------------------------------------------------------- |
---|
220 | ! Call to phyredem |
---|
221 | !--------------------------------------------------------------------- |
---|
222 | logical :: ok_writedem =.true. |
---|
223 | real :: sollw_in = 0. |
---|
224 | real :: solsw_in = 0. |
---|
225 | |
---|
226 | !--------------------------------------------------------------------- |
---|
227 | ! Call to physiq |
---|
228 | !--------------------------------------------------------------------- |
---|
229 | logical :: firstcall=.true. |
---|
230 | logical :: lastcall=.false. |
---|
231 | real :: phis(1) = 0.0 |
---|
232 | real :: dpsrf(1) |
---|
233 | |
---|
234 | !--------------------------------------------------------------------- |
---|
235 | ! Initializations of boundary conditions |
---|
236 | !--------------------------------------------------------------------- |
---|
237 | integer, parameter :: yd = 360 |
---|
238 | real :: phy_nat (yd) = 0.0 ! 0=ocean libre,1=land,2=glacier,3=banquise |
---|
239 | real :: phy_alb (yd) ! Albedo land only (old value condsurf_jyg=0.3) |
---|
240 | real :: phy_sst (yd) ! SST (will not be used; cf read_tsurf1d.F) |
---|
241 | real :: phy_bil (yd) = 1.0 ! Ne sert que pour les slab_ocean |
---|
242 | real :: phy_rug (yd) ! Longueur rugosite utilisee sur land only |
---|
243 | real :: phy_ice (yd) = 0.0 ! Fraction de glace |
---|
244 | real :: phy_fter(yd) = 0.0 ! Fraction de terre |
---|
245 | real :: phy_foce(yd) = 0.0 ! Fraction de ocean |
---|
246 | real :: phy_fsic(yd) = 0.0 ! Fraction de glace |
---|
247 | real :: phy_flic(yd) = 0.0 ! Fraction de glace |
---|
248 | |
---|
249 | !--------------------------------------------------------------------- |
---|
250 | ! Fichiers et d'autres variables |
---|
251 | !--------------------------------------------------------------------- |
---|
252 | integer :: k,l,i,it=1,mxcalc |
---|
253 | integer :: nsrf |
---|
254 | integer jcode |
---|
255 | INTEGER read_climoz |
---|
256 | ! |
---|
257 | integer :: it_end ! iteration number of the last call |
---|
258 | !Al1 |
---|
259 | integer ecrit_slab_oc !1=ecrit,-1=lit,0=no file |
---|
260 | data ecrit_slab_oc/-1/ |
---|
261 | ! |
---|
262 | ! if flag_inhib_forcing = 0, tendencies of forcing are added |
---|
263 | ! <> 0, tendencies of forcing are not added |
---|
264 | INTEGER :: flag_inhib_forcing = 0 |
---|
265 | |
---|
266 | !===================================================================== |
---|
267 | ! INITIALIZATIONS |
---|
268 | !===================================================================== |
---|
269 | du_phys(:)=0. |
---|
270 | dv_phys(:)=0. |
---|
271 | dt_phys(:)=0. |
---|
272 | dt_dyn(:)=0. |
---|
273 | dt_cooling(:)=0. |
---|
274 | d_th_adv(:)=0. |
---|
275 | d_t_nudge(:)=0. |
---|
276 | d_u_nudge(:)=0. |
---|
277 | d_v_nudge(:)=0. |
---|
278 | du_adv(:)=0. |
---|
279 | dv_adv(:)=0. |
---|
280 | du_age(:)=0. |
---|
281 | dv_age(:)=0. |
---|
282 | |
---|
283 | ! Initialization of Common turb_forcing |
---|
284 | dtime_frcg = 0. |
---|
285 | Turb_fcg_gcssold=.false. |
---|
286 | hthturb_gcssold = 0. |
---|
287 | hqturb_gcssold = 0. |
---|
288 | |
---|
289 | !--------------------------------------------------------------------- |
---|
290 | ! OPTIONS OF THE 1D SIMULATION (lmdz1d.def => unicol.def) |
---|
291 | !--------------------------------------------------------------------- |
---|
292 | !Al1 |
---|
293 | call conf_unicol |
---|
294 | !Al1 moves this gcssold var from common fcg_gcssold to |
---|
295 | Turb_fcg_gcssold = xTurb_fcg_gcssold |
---|
296 | ! -------------------------------------------------------------------- |
---|
297 | close(1) |
---|
298 | !Al1 |
---|
299 | write(*,*) 'lmdz1d.def lu => unicol.def' |
---|
300 | |
---|
301 | ! forcing_type defines the way the SCM is forced: |
---|
302 | !forcing_type = 0 ==> forcing_les = .true. |
---|
303 | ! initial profiles from file prof.inp.001 |
---|
304 | ! no forcing by LS convergence ; |
---|
305 | ! surface temperature imposed ; |
---|
306 | ! radiative cooling may be imposed (iflag_radia=0 in physiq.def) |
---|
307 | !forcing_type = 1 ==> forcing_radconv = .true. |
---|
308 | ! idem forcing_type = 0, but the imposed radiative cooling |
---|
309 | ! is set to 0 (hence, if iflag_radia=0 in physiq.def, |
---|
310 | ! then there is no radiative cooling at all) |
---|
311 | !forcing_type = 2 ==> forcing_toga = .true. |
---|
312 | ! initial profiles from TOGA-COARE IFA files |
---|
313 | ! LS convergence and SST imposed from TOGA-COARE IFA files |
---|
314 | !forcing_type = 3 ==> forcing_GCM2SCM = .true. |
---|
315 | ! initial profiles from the GCM output |
---|
316 | ! LS convergence imposed from the GCM output |
---|
317 | !forcing_type = 4 ==> forcing_twpice = .true. |
---|
318 | ! initial profiles from TWP-ICE cdf file |
---|
319 | ! LS convergence, omega and SST imposed from TWP-ICE files |
---|
320 | !forcing_type = 5 ==> forcing_rico = .true. |
---|
321 | ! initial profiles from RICO files |
---|
322 | ! LS convergence imposed from RICO files |
---|
323 | !forcing_type = 6 ==> forcing_amma = .true. |
---|
324 | ! initial profiles from AMMA nc file |
---|
325 | ! LS convergence, omega and surface fluxes imposed from AMMA file |
---|
326 | !forcing_type = 7 ==> forcing_dice = .true. |
---|
327 | ! initial profiles and large scale forcings in dice_driver.nc |
---|
328 | ! Different stages: soil model alone, atm. model alone |
---|
329 | ! then both models coupled |
---|
330 | !forcing_type = 8 ==> forcing_gabls4 = .true. |
---|
331 | ! initial profiles and large scale forcings in gabls4_driver.nc |
---|
332 | !forcing_type >= 100 ==> forcing_case = .true. |
---|
333 | ! initial profiles and large scale forcings in cas.nc |
---|
334 | ! LS convergence, omega and SST imposed from CINDY-DYNAMO files |
---|
335 | ! 101=cindynamo |
---|
336 | ! 102=bomex |
---|
337 | !forcing_type >= 100 ==> forcing_case2 = .true. |
---|
338 | ! temporary flag while all the 1D cases are not whith the same cas.nc forcing file |
---|
339 | ! 103=arm_cu2 ie arm_cu with new forcing format |
---|
340 | ! 104=rico2 ie rico with new forcing format |
---|
341 | !forcing_type = 40 ==> forcing_GCSSold = .true. |
---|
342 | ! initial profile from GCSS file |
---|
343 | ! LS convergence imposed from GCSS file |
---|
344 | !forcing_type = 50 ==> forcing_fire = .true. |
---|
345 | ! forcing from fire.nc |
---|
346 | !forcing_type = 59 ==> forcing_sandu = .true. |
---|
347 | ! initial profiles from sanduref file: see prof.inp.001 |
---|
348 | ! SST varying with time and divergence constante: see ifa_sanduref.txt file |
---|
349 | ! Radiation has to be computed interactively |
---|
350 | !forcing_type = 60 ==> forcing_astex = .true. |
---|
351 | ! initial profiles from file: see prof.inp.001 |
---|
352 | ! SST,divergence,ug,vg,ufa,vfa varying with time : see ifa_astex.txt file |
---|
353 | ! Radiation has to be computed interactively |
---|
354 | !forcing_type = 61 ==> forcing_armcu = .true. |
---|
355 | ! initial profiles from file: see prof.inp.001 |
---|
356 | ! sensible and latent heat flux imposed: see ifa_arm_cu_1.txt |
---|
357 | ! large scale advective forcing & radiative tendencies applied below 1000m: see ifa_arm_cu_2.txt |
---|
358 | ! use geostrophic wind ug=10m/s vg=0m/s. Duration of the case 53100s |
---|
359 | ! Radiation to be switched off |
---|
360 | ! |
---|
361 | if (forcing_type .eq.0) THEN |
---|
362 | forcing_les = .true. |
---|
363 | elseif (forcing_type .eq.1) THEN |
---|
364 | forcing_radconv = .true. |
---|
365 | elseif (forcing_type .eq.2) THEN |
---|
366 | forcing_toga = .true. |
---|
367 | elseif (forcing_type .eq.3) THEN |
---|
368 | forcing_GCM2SCM = .true. |
---|
369 | elseif (forcing_type .eq.4) THEN |
---|
370 | forcing_twpice = .true. |
---|
371 | elseif (forcing_type .eq.5) THEN |
---|
372 | forcing_rico = .true. |
---|
373 | elseif (forcing_type .eq.6) THEN |
---|
374 | forcing_amma = .true. |
---|
375 | elseif (forcing_type .eq.7) THEN |
---|
376 | forcing_dice = .true. |
---|
377 | elseif (forcing_type .eq.8) THEN |
---|
378 | forcing_gabls4 = .true. |
---|
379 | elseif (forcing_type .eq.101) THEN ! Cindynamo starts 1-10-2011 0h |
---|
380 | forcing_case = .true. |
---|
381 | year_ini_cas=2011 |
---|
382 | mth_ini_cas=10 |
---|
383 | day_deb=1 |
---|
384 | heure_ini_cas=0. |
---|
385 | pdt_cas=3*3600. ! forcing frequency |
---|
386 | elseif (forcing_type .eq.102) THEN ! Bomex starts 24-6-1969 0h |
---|
387 | forcing_case = .true. |
---|
388 | year_ini_cas=1969 |
---|
389 | mth_ini_cas=6 |
---|
390 | day_deb=24 |
---|
391 | heure_ini_cas=0. |
---|
392 | pdt_cas=1800. ! forcing frequency |
---|
393 | elseif (forcing_type .eq.103) THEN ! Arm_cu starts 21-6-1997 11h30 |
---|
394 | forcing_case2 = .true. |
---|
395 | year_ini_cas=1997 |
---|
396 | mth_ini_cas=6 |
---|
397 | day_deb=21 |
---|
398 | heure_ini_cas=11.5 |
---|
399 | pdt_cas=1800. ! forcing frequency |
---|
400 | elseif (forcing_type .eq.104) THEN ! rico starts 16-12-2004 0h |
---|
401 | forcing_case2 = .true. |
---|
402 | year_ini_cas=2004 |
---|
403 | mth_ini_cas=12 |
---|
404 | day_deb=16 |
---|
405 | heure_ini_cas=0. |
---|
406 | pdt_cas=1800. ! forcing frequency |
---|
407 | elseif (forcing_type .eq.40) THEN |
---|
408 | forcing_GCSSold = .true. |
---|
409 | elseif (forcing_type .eq.50) THEN |
---|
410 | forcing_fire = .true. |
---|
411 | elseif (forcing_type .eq.59) THEN |
---|
412 | forcing_sandu = .true. |
---|
413 | elseif (forcing_type .eq.60) THEN |
---|
414 | forcing_astex = .true. |
---|
415 | elseif (forcing_type .eq.61) THEN |
---|
416 | forcing_armcu = .true. |
---|
417 | IF(llm.NE.19.AND.llm.NE.40) stop 'Erreur nombre de niveaux !!' |
---|
418 | else |
---|
419 | write (*,*) 'ERROR : unknown forcing_type ', forcing_type |
---|
420 | stop 'Forcing_type should be 0,1,2,3,4,5,6 or 40,59,60,61' |
---|
421 | ENDIF |
---|
422 | print*,"forcing type=",forcing_type |
---|
423 | |
---|
424 | ! if type_ts_forcing=0, the surface temp of 1D simulation is constant in time |
---|
425 | ! (specified by tsurf in lmdz1d.def); if type_ts_forcing=1, the surface temperature |
---|
426 | ! varies in time according to a forcing (e.g. forcing_toga) and is passed to read_tsurf1d.F |
---|
427 | ! through the common sst_forcing. |
---|
428 | |
---|
429 | type_ts_forcing = 0 |
---|
430 | if (forcing_toga.or.forcing_sandu.or.forcing_astex .or. forcing_dice) & |
---|
431 | & type_ts_forcing = 1 |
---|
432 | ! |
---|
433 | ! Initialization of the logical switch for nudging |
---|
434 | jcode = iflag_nudge |
---|
435 | do i = 1,nudge_max |
---|
436 | nudge(i) = mod(jcode,10) .ge. 1 |
---|
437 | jcode = jcode/10 |
---|
438 | enddo |
---|
439 | !--------------------------------------------------------------------- |
---|
440 | ! Definition of the run |
---|
441 | !--------------------------------------------------------------------- |
---|
442 | |
---|
443 | call conf_gcm( 99, .TRUE. ) |
---|
444 | !----------------------------------------------------------------------- |
---|
445 | ! Choix du calendrier |
---|
446 | ! ------------------- |
---|
447 | |
---|
448 | ! calend = 'earth_365d' |
---|
449 | if (calend == 'earth_360d') then |
---|
450 | call ioconf_calendar('360d') |
---|
451 | write(*,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an' |
---|
452 | else if (calend == 'earth_365d') then |
---|
453 | call ioconf_calendar('noleap') |
---|
454 | write(*,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an' |
---|
455 | else if (calend == 'earth_366d') then |
---|
456 | call ioconf_calendar('all_leap') |
---|
457 | write(*,*)'CALENDRIER CHOISI: Terrestre bissextile' |
---|
458 | else if (calend == 'gregorian') then |
---|
459 | call ioconf_calendar('gregorian') ! not to be used by normal users |
---|
460 | write(*,*)'CALENDRIER CHOISI: Gregorien' |
---|
461 | else |
---|
462 | write (*,*) 'ERROR : unknown calendar ', calend |
---|
463 | stop 'calend should be 360d,earth_365d,earth_366d,gregorian' |
---|
464 | endif |
---|
465 | !----------------------------------------------------------------------- |
---|
466 | ! |
---|
467 | !c Date : |
---|
468 | ! La date est supposee donnee sous la forme [annee, numero du jour dans |
---|
469 | ! l annee] ; l heure est donnee dans time_ini, lu dans lmdz1d.def. |
---|
470 | ! On appelle ymds2ju pour convertir [annee, jour] en [jour Julien]. |
---|
471 | ! Le numero du jour est dans "day". L heure est traitee separement. |
---|
472 | ! La date complete est dans "daytime" (l'unite est le jour). |
---|
473 | if (nday>0) then |
---|
474 | fnday=nday |
---|
475 | else |
---|
476 | fnday=-nday/float(day_step) |
---|
477 | endif |
---|
478 | print *,'fnday=',fnday |
---|
479 | ! start_time doit etre en FRACTION DE JOUR |
---|
480 | start_time=time_ini/24. |
---|
481 | |
---|
482 | ! Special case for arm_cu which lasts less than one day : 53100s !! (MPL 20111026) |
---|
483 | IF(forcing_type .EQ. 61) fnday=53100./86400. |
---|
484 | IF(forcing_type .EQ. 103) fnday=53100./86400. |
---|
485 | ! Special case for amma which lasts less than one day : 64800s !! (MPL 20120216) |
---|
486 | IF(forcing_type .EQ. 6) fnday=64800./86400. |
---|
487 | ! IF(forcing_type .EQ. 6) fnday=50400./86400. |
---|
488 | IF(forcing_type .EQ. 8 ) fnday=129600./86400. |
---|
489 | annee_ref = anneeref |
---|
490 | mois = 1 |
---|
491 | day_ref = dayref |
---|
492 | heure = 0. |
---|
493 | itau_dyn = 0 |
---|
494 | itau_phy = 0 |
---|
495 | call ymds2ju(annee_ref,mois,day_ref,heure,day) |
---|
496 | day_ini = int(day) |
---|
497 | day_end = day_ini + fnday |
---|
498 | |
---|
499 | IF (forcing_type .eq.2) THEN |
---|
500 | ! Convert the initial date of Toga-Coare to Julian day |
---|
501 | call ymds2ju & |
---|
502 | & (year_ini_toga,mth_ini_toga,day_ini_toga,heure,day_ju_ini_toga) |
---|
503 | |
---|
504 | ELSEIF (forcing_type .eq.4) THEN |
---|
505 | ! Convert the initial date of TWPICE to Julian day |
---|
506 | call ymds2ju & |
---|
507 | & (year_ini_twpi,mth_ini_twpi,day_ini_twpi,heure_ini_twpi & |
---|
508 | & ,day_ju_ini_twpi) |
---|
509 | ELSEIF (forcing_type .eq.6) THEN |
---|
510 | ! Convert the initial date of AMMA to Julian day |
---|
511 | call ymds2ju & |
---|
512 | & (year_ini_amma,mth_ini_amma,day_ini_amma,heure_ini_amma & |
---|
513 | & ,day_ju_ini_amma) |
---|
514 | ELSEIF (forcing_type .eq.7) THEN |
---|
515 | ! Convert the initial date of DICE to Julian day |
---|
516 | call ymds2ju & |
---|
517 | & (year_ini_dice,mth_ini_dice,day_ini_dice,heure_ini_dice & |
---|
518 | & ,day_ju_ini_dice) |
---|
519 | ELSEIF (forcing_type .eq.8 ) THEN |
---|
520 | ! Convert the initial date of GABLS4 to Julian day |
---|
521 | call ymds2ju & |
---|
522 | & (year_ini_gabls4,mth_ini_gabls4,day_ini_gabls4,heure_ini_gabls4 & |
---|
523 | & ,day_ju_ini_gabls4) |
---|
524 | ELSEIF (forcing_type .gt.100) THEN |
---|
525 | ! Convert the initial date to Julian day |
---|
526 | day_ini_cas=day_deb |
---|
527 | print*,'time case',year_ini_cas,mth_ini_cas,day_ini_cas |
---|
528 | call ymds2ju & |
---|
529 | & (year_ini_cas,mth_ini_cas,day_ini_cas,heure_ini_cas*3600 & |
---|
530 | & ,day_ju_ini_cas) |
---|
531 | print*,'time case 2',day_ini_cas,day_ju_ini_cas |
---|
532 | ELSEIF (forcing_type .eq.59) THEN |
---|
533 | ! Convert the initial date of Sandu case to Julian day |
---|
534 | call ymds2ju & |
---|
535 | & (year_ini_sandu,mth_ini_sandu,day_ini_sandu, & |
---|
536 | & time_ini*3600.,day_ju_ini_sandu) |
---|
537 | |
---|
538 | ELSEIF (forcing_type .eq.60) THEN |
---|
539 | ! Convert the initial date of Astex case to Julian day |
---|
540 | call ymds2ju & |
---|
541 | & (year_ini_astex,mth_ini_astex,day_ini_astex, & |
---|
542 | & time_ini*3600.,day_ju_ini_astex) |
---|
543 | |
---|
544 | ELSEIF (forcing_type .eq.61) THEN |
---|
545 | ! Convert the initial date of Arm_cu case to Julian day |
---|
546 | call ymds2ju & |
---|
547 | & (year_ini_armcu,mth_ini_armcu,day_ini_armcu,heure_ini_armcu & |
---|
548 | & ,day_ju_ini_armcu) |
---|
549 | ENDIF |
---|
550 | |
---|
551 | IF (forcing_type .gt.100) THEN |
---|
552 | daytime = day + heure_ini_cas/24. ! 1st day and initial time of the simulation |
---|
553 | ELSE |
---|
554 | daytime = day + time_ini/24. ! 1st day and initial time of the simulation |
---|
555 | ENDIF |
---|
556 | ! Print out the actual date of the beginning of the simulation : |
---|
557 | call ju2ymds(daytime,year_print, month_print,day_print,sec_print) |
---|
558 | print *,' Time of beginning : ', & |
---|
559 | & year_print, month_print, day_print, sec_print |
---|
560 | |
---|
561 | !--------------------------------------------------------------------- |
---|
562 | ! Initialization of dimensions, geometry and initial state |
---|
563 | !--------------------------------------------------------------------- |
---|
564 | ! call init_phys_lmdz(1,1,llm,1,(/1/)) ! job now done via iniphysiq |
---|
565 | ! but we still need to initialize dimphy module (klon,klev,etc.) here. |
---|
566 | call init_dimphy(1,llm) |
---|
567 | call suphel |
---|
568 | call infotrac_init |
---|
569 | |
---|
570 | if (nqtot>nqmx) STOP'Augmenter nqmx dans lmdz1d.F' |
---|
571 | allocate(q(llm,nqtot)) ; q(:,:)=0. |
---|
572 | allocate(dq(llm,nqtot)) |
---|
573 | allocate(dq_dyn(llm,nqtot)) |
---|
574 | allocate(d_q_adv(llm,nqtot)) |
---|
575 | allocate(d_q_nudge(llm,nqtot)) |
---|
576 | ! allocate(d_th_adv(llm)) |
---|
577 | |
---|
578 | q(:,:) = 0. |
---|
579 | dq(:,:) = 0. |
---|
580 | dq_dyn(:,:) = 0. |
---|
581 | d_q_adv(:,:) = 0. |
---|
582 | d_q_nudge(:,:) = 0. |
---|
583 | |
---|
584 | ! |
---|
585 | ! No ozone climatology need be read in this pre-initialization |
---|
586 | ! (phys_state_var_init is called again in physiq) |
---|
587 | read_climoz = 0 |
---|
588 | ! |
---|
589 | call phys_state_var_init(read_climoz) |
---|
590 | |
---|
591 | if (ngrid.ne.klon) then |
---|
592 | print*,'stop in inifis' |
---|
593 | print*,'Probleme de dimensions :' |
---|
594 | print*,'ngrid = ',ngrid |
---|
595 | print*,'klon = ',klon |
---|
596 | stop |
---|
597 | endif |
---|
598 | !!!===================================================================== |
---|
599 | !!! Feedback forcing values for Gateaux differentiation (al1) |
---|
600 | !!!===================================================================== |
---|
601 | !!! Surface Planck forcing bracketing call radiation |
---|
602 | !! surf_Planck = 0. |
---|
603 | !! surf_Conv = 0. |
---|
604 | !! write(*,*) 'Gateaux-dif Planck,Conv:',surf_Planck,surf_Conv |
---|
605 | !!! a mettre dans le lmdz1d.def ou autre |
---|
606 | !! |
---|
607 | !! |
---|
608 | qsol = qsolinp |
---|
609 | qsurf = fq_sat(tsurf,psurf/100.) |
---|
610 | day1= day_ini |
---|
611 | time=daytime-day |
---|
612 | ts_toga(1)=tsurf ! needed by read_tsurf1d.F |
---|
613 | rho(1)=psurf/(rd*tsurf*(1.+(rv/rd-1.)*qsurf)) |
---|
614 | |
---|
615 | ! |
---|
616 | !! mpl et jyg le 22/08/2012 : |
---|
617 | !! pour que les cas a flux de surface imposes marchent |
---|
618 | IF(.NOT.ok_flux_surf.or.max(abs(wtsurf),abs(wqsurf))>0.) THEN |
---|
619 | fsens=-wtsurf*rcpd*rho(1) |
---|
620 | flat=-wqsurf*rlvtt*rho(1) |
---|
621 | print *,'Flux: ok_flux wtsurf wqsurf',ok_flux_surf,wtsurf,wqsurf |
---|
622 | ENDIF |
---|
623 | print*,'Flux sol ',fsens,flat |
---|
624 | !! ok_flux_surf=.false. |
---|
625 | !! fsens=-wtsurf*rcpd*rho(1) |
---|
626 | !! flat=-wqsurf*rlvtt*rho(1) |
---|
627 | !!!! |
---|
628 | |
---|
629 | ! Vertical discretization and pressure levels at half and mid levels: |
---|
630 | |
---|
631 | pa = 5e4 |
---|
632 | !! preff= 1.01325e5 |
---|
633 | preff = psurf |
---|
634 | IF (ok_old_disvert) THEN |
---|
635 | call disvert0(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig) |
---|
636 | print *,'On utilise disvert0' |
---|
637 | aps(1:llm)=0.5*(ap(1:llm)+ap(2:llm+1)) |
---|
638 | bps(1:llm)=0.5*(bp(1:llm)+bp(2:llm+1)) |
---|
639 | scaleheight=8. |
---|
640 | pseudoalt(1:llm)=-scaleheight*log(presnivs(1:llm)/preff) |
---|
641 | ELSE |
---|
642 | call disvert() |
---|
643 | print *,'On utilise disvert' |
---|
644 | ! Nouvelle version disvert permettant d imposer ap,bp (modif L.Guez) MPL 18092012 |
---|
645 | ! Dans ce cas, on lit ap,bp dans le fichier hybrid.txt |
---|
646 | ENDIF |
---|
647 | |
---|
648 | sig_s=presnivs/preff |
---|
649 | plev =ap+bp*psurf |
---|
650 | play = 0.5*(plev(1:llm)+plev(2:llm+1)) |
---|
651 | zlay=-rd*300.*log(play/psurf)/rg ! moved after reading profiles |
---|
652 | |
---|
653 | IF (forcing_type .eq. 59) THEN |
---|
654 | ! pour forcing_sandu, on cherche l'indice le plus proche de 700hpa#3000m |
---|
655 | write(*,*) '***********************' |
---|
656 | do l = 1, llm |
---|
657 | write(*,*) 'l,play(l),presnivs(l): ',l,play(l),presnivs(l) |
---|
658 | if (trouve_700 .and. play(l).le.70000) then |
---|
659 | llm700=l |
---|
660 | print *,'llm700,play=',llm700,play(l)/100. |
---|
661 | trouve_700= .false. |
---|
662 | endif |
---|
663 | enddo |
---|
664 | write(*,*) '***********************' |
---|
665 | ENDIF |
---|
666 | |
---|
667 | ! |
---|
668 | !===================================================================== |
---|
669 | ! EVENTUALLY, READ FORCING DATA : |
---|
670 | !===================================================================== |
---|
671 | |
---|
672 | #include "1D_read_forc_cases.h" |
---|
673 | |
---|
674 | if (forcing_GCM2SCM) then |
---|
675 | write (*,*) 'forcing_GCM2SCM not yet implemented' |
---|
676 | stop 'in initialization' |
---|
677 | endif ! forcing_GCM2SCM |
---|
678 | |
---|
679 | print*,'mxcalc=',mxcalc |
---|
680 | ! print*,'zlay=',zlay(mxcalc) |
---|
681 | print*,'play=',play(mxcalc) |
---|
682 | |
---|
683 | !Al1 pour SST forced, appell?? depuis ocean_forced_noice |
---|
684 | ts_cur = tsurf ! SST used in read_tsurf1d |
---|
685 | !===================================================================== |
---|
686 | ! Initialisation de la physique : |
---|
687 | !===================================================================== |
---|
688 | |
---|
689 | ! Rq: conf_phys.F90 lit tous les flags de physiq.def; conf_phys appele depuis physiq.F |
---|
690 | ! |
---|
691 | ! day_step, iphysiq lus dans gcm.def ci-dessus |
---|
692 | ! timestep: calcule ci-dessous from rday et day_step |
---|
693 | ! ngrid=1 |
---|
694 | ! llm: defini dans .../modipsl/modeles/LMDZ4/libf/grid/dimension |
---|
695 | ! rday: defini dans suphel.F (86400.) |
---|
696 | ! day_ini: lu dans run.def (dayref) |
---|
697 | ! rlat_rad,rlon-rad: transformes en radian de rlat,rlon lus dans lmdz1d.def (en degres) |
---|
698 | ! airefi,zcufi,zcvfi initialises au debut de ce programme |
---|
699 | ! rday,ra,rg,rd,rcpd declares dans YOMCST.h et calcules dans suphel.F |
---|
700 | day_step = float(nsplit_phys)*day_step/float(iphysiq) |
---|
701 | write (*,*) 'Time step divided by nsplit_phys (=',nsplit_phys,')' |
---|
702 | timestep =rday/day_step |
---|
703 | dtime_frcg = timestep |
---|
704 | ! |
---|
705 | zcufi=airefi |
---|
706 | zcvfi=airefi |
---|
707 | ! |
---|
708 | rlat_rad(1)=xlat*rpi/180. |
---|
709 | rlon_rad(1)=xlon*rpi/180. |
---|
710 | |
---|
711 | ! Ehouarn: iniphysiq requires arrays related to (3D) dynamics grid, |
---|
712 | ! e.g. for cell boundaries, which are meaningless in 1D; so pad these |
---|
713 | ! with '0.' when necessary |
---|
714 | call iniphysiq(iim,jjm,llm, & |
---|
715 | 1,comm_lmdz, & |
---|
716 | rday,day_ini,timestep, & |
---|
717 | (/rlat_rad(1),0./),(/0./), & |
---|
718 | (/0.,0./),(/rlon_rad(1),0./), & |
---|
719 | (/ (/airefi,0./),(/0.,0./) /), & |
---|
720 | (/zcufi,0.,0.,0./), & |
---|
721 | (/zcvfi,0./), & |
---|
722 | ra,rg,rd,rcpd,1) |
---|
723 | print*,'apres iniphysiq' |
---|
724 | |
---|
725 | ! 2 PARAMETRES QUI DEVRAIENT ETRE LUS DANS run.def MAIS NE LE SONT PAS ICI: |
---|
726 | co2_ppm= 330.0 |
---|
727 | solaire=1370.0 |
---|
728 | |
---|
729 | ! Ecriture du startphy avant le premier appel a la physique. |
---|
730 | ! On le met juste avant pour avoir acces a tous les champs |
---|
731 | |
---|
732 | if (ok_writedem) then |
---|
733 | |
---|
734 | !-------------------------------------------------------------------------- |
---|
735 | ! pbl_surface_init (called here) and pbl_surface_final (called by phyredem) |
---|
736 | ! need : qsol fder snow qsurf evap rugos agesno ftsoil |
---|
737 | !-------------------------------------------------------------------------- |
---|
738 | |
---|
739 | type_ocean = "force" |
---|
740 | run_off_lic_0(1) = restart_runoff |
---|
741 | call fonte_neige_init(run_off_lic_0) |
---|
742 | |
---|
743 | fder=0. |
---|
744 | snsrf(1,:)=snowmass ! masse de neige des sous surface |
---|
745 | qsurfsrf(1,:)=qsurf ! humidite de l'air des sous surface |
---|
746 | fevap=0. |
---|
747 | z0m(1,:)=rugos ! couverture de neige des sous surface |
---|
748 | z0h(1,:)=rugosh ! couverture de neige des sous surface |
---|
749 | agesno = xagesno |
---|
750 | tsoil(:,:,:)=tsurf |
---|
751 | !------ AMMA 2e run avec modele sol et rayonnement actif (MPL 23052012) |
---|
752 | ! tsoil(1,1,1)=299.18 |
---|
753 | ! tsoil(1,2,1)=300.08 |
---|
754 | ! tsoil(1,3,1)=301.88 |
---|
755 | ! tsoil(1,4,1)=305.48 |
---|
756 | ! tsoil(1,5,1)=308.00 |
---|
757 | ! tsoil(1,6,1)=308.00 |
---|
758 | ! tsoil(1,7,1)=308.00 |
---|
759 | ! tsoil(1,8,1)=308.00 |
---|
760 | ! tsoil(1,9,1)=308.00 |
---|
761 | ! tsoil(1,10,1)=308.00 |
---|
762 | ! tsoil(1,11,1)=308.00 |
---|
763 | !----------------------------------------------------------------------- |
---|
764 | call pbl_surface_init(fder, snsrf, qsurfsrf, tsoil) |
---|
765 | |
---|
766 | !------------------ prepare limit conditions for limit.nc ----------------- |
---|
767 | !-- Ocean force |
---|
768 | |
---|
769 | print*,'avant phyredem' |
---|
770 | pctsrf(1,:)=0. |
---|
771 | if (nat_surf.eq.0.) then |
---|
772 | pctsrf(1,is_oce)=1. |
---|
773 | pctsrf(1,is_ter)=0. |
---|
774 | pctsrf(1,is_lic)=0. |
---|
775 | pctsrf(1,is_sic)=0. |
---|
776 | else if (nat_surf .eq. 1) then |
---|
777 | pctsrf(1,is_oce)=0. |
---|
778 | pctsrf(1,is_ter)=1. |
---|
779 | pctsrf(1,is_lic)=0. |
---|
780 | pctsrf(1,is_sic)=0. |
---|
781 | else if (nat_surf .eq. 2) then |
---|
782 | pctsrf(1,is_oce)=0. |
---|
783 | pctsrf(1,is_ter)=0. |
---|
784 | pctsrf(1,is_lic)=1. |
---|
785 | pctsrf(1,is_sic)=0. |
---|
786 | else if (nat_surf .eq. 3) then |
---|
787 | pctsrf(1,is_oce)=0. |
---|
788 | pctsrf(1,is_ter)=0. |
---|
789 | pctsrf(1,is_lic)=0. |
---|
790 | pctsrf(1,is_sic)=1. |
---|
791 | |
---|
792 | end if |
---|
793 | |
---|
794 | |
---|
795 | print*,'nat_surf,pctsrf(1,is_oce),pctsrf(1,is_ter)',nat_surf & |
---|
796 | & ,pctsrf(1,is_oce),pctsrf(1,is_ter) |
---|
797 | |
---|
798 | zmasq=pctsrf(1,is_ter)+pctsrf(1,is_lic) |
---|
799 | zpic = zpicinp |
---|
800 | ftsol=tsurf |
---|
801 | nsw=6 ! on met le nb de bandes SW=6, pour initialiser |
---|
802 | ! 6 albedo, mais on peut quand meme tourner avec |
---|
803 | ! moins. Seules les 2 ou 4 premiers seront lus |
---|
804 | falb_dir=albedo |
---|
805 | falb_dif=albedo |
---|
806 | rugoro=rugos |
---|
807 | t_ancien(1,:)=temp(:) |
---|
808 | q_ancien(1,:)=q(:,1) |
---|
809 | ql_ancien = 0. |
---|
810 | qs_ancien = 0. |
---|
811 | prlw_ancien = 0. |
---|
812 | prsw_ancien = 0. |
---|
813 | prw_ancien = 0. |
---|
814 | !jyg< |
---|
815 | !! pbl_tke(:,:,:)=1.e-8 |
---|
816 | pbl_tke(:,:,:)=0. |
---|
817 | pbl_tke(:,2,:)=1.e-2 |
---|
818 | PRINT *, ' pbl_tke dans lmdz1d ' |
---|
819 | if (prt_level .ge. 5) then |
---|
820 | DO nsrf = 1,4 |
---|
821 | PRINT *,'pbl_tke(1,:,',nsrf,') ',pbl_tke(1,:,nsrf) |
---|
822 | ENDDO |
---|
823 | end if |
---|
824 | |
---|
825 | !>jyg |
---|
826 | |
---|
827 | rain_fall=0. |
---|
828 | snow_fall=0. |
---|
829 | solsw=0. |
---|
830 | sollw=0. |
---|
831 | sollwdown=rsigma*tsurf**4 |
---|
832 | radsol=0. |
---|
833 | rnebcon=0. |
---|
834 | ratqs=0. |
---|
835 | clwcon=0. |
---|
836 | zmax0 = 0. |
---|
837 | zmea=0. |
---|
838 | zstd=0. |
---|
839 | zsig=0. |
---|
840 | zgam=0. |
---|
841 | zval=0. |
---|
842 | zthe=0. |
---|
843 | sig1=0. |
---|
844 | w01=0. |
---|
845 | wake_cstar = 0. |
---|
846 | wake_deltaq = 0. |
---|
847 | wake_deltat = 0. |
---|
848 | wake_delta_pbl_TKE(:,:,:) = 0. |
---|
849 | delta_tsurf = 0. |
---|
850 | wake_fip = 0. |
---|
851 | wake_pe = 0. |
---|
852 | wake_s = 0. |
---|
853 | wake_dens = 0. |
---|
854 | ale_bl = 0. |
---|
855 | ale_bl_trig = 0. |
---|
856 | alp_bl = 0. |
---|
857 | IF (ALLOCATED(du_gwd_rando)) du_gwd_rando = 0. |
---|
858 | IF (ALLOCATED(du_gwd_front)) du_gwd_front = 0. |
---|
859 | entr_therm = 0. |
---|
860 | detr_therm = 0. |
---|
861 | f0 = 0. |
---|
862 | fm_therm = 0. |
---|
863 | u_ancien(1,:)=u(:) |
---|
864 | v_ancien(1,:)=v(:) |
---|
865 | |
---|
866 | !------------------------------------------------------------------------ |
---|
867 | ! Make file containing restart for the physics (startphy.nc) |
---|
868 | ! |
---|
869 | ! NB: List of the variables to be written by phyredem (via put_field): |
---|
870 | ! rlon,rlat,zmasq,pctsrf(:,is_ter),pctsrf(:,is_lic),pctsrf(:,is_oce) |
---|
871 | ! pctsrf(:,is_sic),ftsol(:,nsrf),tsoil(:,isoil,nsrf),qsurf(:,nsrf) |
---|
872 | ! qsol,falb_dir(:,nsrf),falb_dif(:,nsrf),evap(:,nsrf),snow(:,nsrf) |
---|
873 | ! radsol,solsw,sollw, sollwdown,fder,rain_fall,snow_fall,frugs(:,nsrf) |
---|
874 | ! agesno(:,nsrf),zmea,zstd,zsig,zgam,zthe,zpic,zval,rugoro |
---|
875 | ! t_ancien,q_ancien,,frugs(:,is_oce),clwcon(:,1),rnebcon(:,1),ratqs(:,1) |
---|
876 | ! run_off_lic_0,pbl_tke(:,1:klev,nsrf), zmax0,f0,sig1,w01 |
---|
877 | ! wake_deltat,wake_deltaq,wake_s,wake_dens,wake_cstar, |
---|
878 | ! wake_fip,wake_delta_pbl_tke(:,1:klev,nsrf) |
---|
879 | ! |
---|
880 | ! NB2: The content of the startphy.nc file depends on some flags defined in |
---|
881 | ! the ".def" files. However, since conf_phys is not called in lmdz1d.F90, these flags have |
---|
882 | ! to be set at some arbitratry convenient values. |
---|
883 | !------------------------------------------------------------------------ |
---|
884 | !Al1 =============== restart option ========================== |
---|
885 | if (.not.restart) then |
---|
886 | iflag_pbl = 5 |
---|
887 | call phyredem ("startphy.nc") |
---|
888 | else |
---|
889 | ! (desallocations) |
---|
890 | print*,'callin surf final' |
---|
891 | call pbl_surface_final( fder, snsrf, qsurfsrf, tsoil) |
---|
892 | print*,'after surf final' |
---|
893 | CALL fonte_neige_final(run_off_lic_0) |
---|
894 | endif |
---|
895 | |
---|
896 | ok_writedem=.false. |
---|
897 | print*,'apres phyredem' |
---|
898 | |
---|
899 | endif ! ok_writedem |
---|
900 | |
---|
901 | !------------------------------------------------------------------------ |
---|
902 | ! Make file containing boundary conditions (limit.nc) **Al1->restartdyn*** |
---|
903 | ! -------------------------------------------------- |
---|
904 | ! NB: List of the variables to be written in limit.nc |
---|
905 | ! (by writelim.F, subroutine of 1DUTILS.h): |
---|
906 | ! phy_nat,phy_alb,phy_sst,phy_bil,phy_rug,phy_ice, |
---|
907 | ! phy_fter,phy_foce,phy_flic,phy_fsic) |
---|
908 | !------------------------------------------------------------------------ |
---|
909 | do i=1,yd |
---|
910 | phy_nat(i) = nat_surf |
---|
911 | phy_alb(i) = albedo |
---|
912 | phy_sst(i) = tsurf ! read_tsurf1d will be used instead |
---|
913 | phy_rug(i) = rugos |
---|
914 | phy_fter(i) = pctsrf(1,is_ter) |
---|
915 | phy_foce(i) = pctsrf(1,is_oce) |
---|
916 | phy_fsic(i) = pctsrf(1,is_sic) |
---|
917 | phy_flic(i) = pctsrf(1,is_lic) |
---|
918 | enddo |
---|
919 | |
---|
920 | ! fabrication de limit.nc |
---|
921 | call writelim (1,phy_nat,phy_alb,phy_sst,phy_bil,phy_rug, & |
---|
922 | & phy_ice,phy_fter,phy_foce,phy_flic,phy_fsic) |
---|
923 | |
---|
924 | |
---|
925 | call phys_state_var_end |
---|
926 | !Al1 |
---|
927 | if (restart) then |
---|
928 | print*,'call to restart dyn 1d' |
---|
929 | Call dyn1deta0("start1dyn.nc",plev,play,phi,phis,presnivs, & |
---|
930 | & u,v,temp,q,omega2) |
---|
931 | |
---|
932 | print*,'fnday,annee_ref,day_ref,day_ini', & |
---|
933 | & fnday,annee_ref,day_ref,day_ini |
---|
934 | !** call ymds2ju(annee_ref,mois,day_ini,heure,day) |
---|
935 | day = day_ini |
---|
936 | day_end = day_ini + nday |
---|
937 | daytime = day + time_ini/24. ! 1st day and initial time of the simulation |
---|
938 | |
---|
939 | ! Print out the actual date of the beginning of the simulation : |
---|
940 | call ju2ymds(daytime, an, mois, jour, heure) |
---|
941 | print *,' Time of beginning : y m d h',an, mois,jour,heure/3600. |
---|
942 | |
---|
943 | day = int(daytime) |
---|
944 | time=daytime-day |
---|
945 | |
---|
946 | print*,'****** intialised fields from restart1dyn *******' |
---|
947 | print*,'plev,play,phi,phis,presnivs,u,v,temp,q,omega2' |
---|
948 | print*,'temp(1),q(1,1),u(1),v(1),plev(1),phis :' |
---|
949 | print*,temp(1),q(1,1),u(1),v(1),plev(1),phis |
---|
950 | ! raz for safety |
---|
951 | do l=1,llm |
---|
952 | dq_dyn(l,1) = 0. |
---|
953 | enddo |
---|
954 | endif |
---|
955 | !Al1 ================ end restart ================================= |
---|
956 | IF (ecrit_slab_oc.eq.1) then |
---|
957 | open(97,file='div_slab.dat',STATUS='UNKNOWN') |
---|
958 | elseif (ecrit_slab_oc.eq.0) then |
---|
959 | open(97,file='div_slab.dat',STATUS='OLD') |
---|
960 | endif |
---|
961 | ! |
---|
962 | !--------------------------------------------------------------------- |
---|
963 | ! Initialize target profile for RHT nudging if needed |
---|
964 | !--------------------------------------------------------------------- |
---|
965 | if (nudge(inudge_RHT)) then |
---|
966 | call nudge_RHT_init(plev,play,temp,q(:,1),t_targ,rh_targ) |
---|
967 | endif |
---|
968 | if (nudge(inudge_UV)) then |
---|
969 | call nudge_UV_init(plev,play,u,v,u_targ,v_targ) |
---|
970 | endif |
---|
971 | ! |
---|
972 | !===================================================================== |
---|
973 | ! START OF THE TEMPORAL LOOP : |
---|
974 | !===================================================================== |
---|
975 | |
---|
976 | it_end = nint(fnday*day_step) |
---|
977 | !test JLD it_end = 10 |
---|
978 | do while(it.le.it_end) |
---|
979 | |
---|
980 | if (prt_level.ge.1) then |
---|
981 | print*,'XXXXXXXXXXXXXXXXXXX ITAP,day,time=', & |
---|
982 | & it,day,time,it_end,day_step |
---|
983 | print*,'PAS DE TEMPS ',timestep |
---|
984 | endif |
---|
985 | !Al1 demande de restartphy.nc |
---|
986 | if (it.eq.it_end) lastcall=.True. |
---|
987 | |
---|
988 | !--------------------------------------------------------------------- |
---|
989 | ! Interpolation of forcings in time and onto model levels |
---|
990 | !--------------------------------------------------------------------- |
---|
991 | |
---|
992 | #include "1D_interp_cases.h" |
---|
993 | |
---|
994 | if (forcing_GCM2SCM) then |
---|
995 | write (*,*) 'forcing_GCM2SCM not yet implemented' |
---|
996 | stop 'in time loop' |
---|
997 | endif ! forcing_GCM2SCM |
---|
998 | |
---|
999 | !--------------------------------------------------------------------- |
---|
1000 | ! Geopotential : |
---|
1001 | !--------------------------------------------------------------------- |
---|
1002 | |
---|
1003 | phi(1)=RD*temp(1)*(plev(1)-play(1))/(.5*(plev(1)+play(1))) |
---|
1004 | do l = 1, llm-1 |
---|
1005 | phi(l+1)=phi(l)+RD*(temp(l)+temp(l+1))* & |
---|
1006 | & (play(l)-play(l+1))/(play(l)+play(l+1)) |
---|
1007 | enddo |
---|
1008 | |
---|
1009 | !--------------------------------------------------------------------- |
---|
1010 | ! Listing output for debug prt_level>=1 |
---|
1011 | !--------------------------------------------------------------------- |
---|
1012 | if (prt_level>=1) then |
---|
1013 | print *,' avant physiq : -------- day time ',day,time |
---|
1014 | write(*,*) 'firstcall,lastcall,phis', & |
---|
1015 | & firstcall,lastcall,phis |
---|
1016 | end if |
---|
1017 | if (prt_level>=5) then |
---|
1018 | write(*,'(a10,2a4,4a13)') 'BEFOR1 IT=','it','l', & |
---|
1019 | & 'presniv','plev','play','phi' |
---|
1020 | write(*,'(a10,2i4,4f13.2)') ('BEFOR1 IT= ',it,l, & |
---|
1021 | & presnivs(l),plev(l),play(l),phi(l),l=1,llm) |
---|
1022 | write(*,'(a11,2a4,a11,6a8)') 'BEFOR2','it','l', & |
---|
1023 | & 'presniv','u','v','temp','q1','q2','omega2' |
---|
1024 | write(*,'(a11,2i4,f11.2,5f8.2,e10.2)') ('BEFOR2 IT= ',it,l, & |
---|
1025 | & presnivs(l),u(l),v(l),temp(l),q(l,1),q(l,2),omega2(l),l=1,llm) |
---|
1026 | endif |
---|
1027 | |
---|
1028 | !--------------------------------------------------------------------- |
---|
1029 | ! Call physiq : |
---|
1030 | !--------------------------------------------------------------------- |
---|
1031 | call physiq(ngrid,llm, & |
---|
1032 | firstcall,lastcall,timestep, & |
---|
1033 | plev,play,phi,phis,presnivs, & |
---|
1034 | u,v, rot, temp,q,omega2, & |
---|
1035 | du_phys,dv_phys,dt_phys,dq,dpsrf) |
---|
1036 | firstcall=.false. |
---|
1037 | |
---|
1038 | !--------------------------------------------------------------------- |
---|
1039 | ! Listing output for debug |
---|
1040 | !--------------------------------------------------------------------- |
---|
1041 | if (prt_level>=5) then |
---|
1042 | write(*,'(a11,2a4,4a13)') 'AFTER1 IT=','it','l', & |
---|
1043 | & 'presniv','plev','play','phi' |
---|
1044 | write(*,'(a11,2i4,4f13.2)') ('AFTER1 it= ',it,l, & |
---|
1045 | & presnivs(l),plev(l),play(l),phi(l),l=1,llm) |
---|
1046 | write(*,'(a11,2a4,a11,6a8)') 'AFTER2','it','l', & |
---|
1047 | & 'presniv','u','v','temp','q1','q2','omega2' |
---|
1048 | write(*,'(a11,2i4,f11.2,5f8.2,e10.2)') ('AFTER2 it= ',it,l, & |
---|
1049 | & presnivs(l),u(l),v(l),temp(l),q(l,1),q(l,2),omega2(l),l=1,llm) |
---|
1050 | write(*,'(a11,2a4,a11,5a8)') 'AFTER3','it','l', & |
---|
1051 | & 'presniv','du_phys','dv_phys','dt_phys','dq1','dq2' |
---|
1052 | write(*,'(a11,2i4,f11.2,5f8.2)') ('AFTER3 it= ',it,l, & |
---|
1053 | & presnivs(l),86400*du_phys(l),86400*dv_phys(l), & |
---|
1054 | & 86400*dt_phys(l),86400*dq(l,1),dq(l,2),l=1,llm) |
---|
1055 | write(*,*) 'dpsrf',dpsrf |
---|
1056 | endif |
---|
1057 | !--------------------------------------------------------------------- |
---|
1058 | ! Add physical tendencies : |
---|
1059 | !--------------------------------------------------------------------- |
---|
1060 | |
---|
1061 | fcoriolis=2.*sin(rpi*xlat/180.)*romega |
---|
1062 | if (forcing_radconv .or. forcing_fire) then |
---|
1063 | fcoriolis=0.0 |
---|
1064 | dt_cooling=0.0 |
---|
1065 | d_th_adv=0.0 |
---|
1066 | d_q_adv=0.0 |
---|
1067 | endif |
---|
1068 | ! print*, 'calcul de fcoriolis ', fcoriolis |
---|
1069 | |
---|
1070 | if (forcing_toga .or. forcing_GCSSold .or. forcing_twpice & |
---|
1071 | & .or.forcing_amma .or. forcing_type.eq.101) then |
---|
1072 | fcoriolis=0.0 ; ug=0. ; vg=0. |
---|
1073 | endif |
---|
1074 | |
---|
1075 | if(forcing_rico) then |
---|
1076 | dt_cooling=0. |
---|
1077 | endif |
---|
1078 | |
---|
1079 | !CRio:Attention modif spécifique cas de Caroline |
---|
1080 | if (forcing_les) then |
---|
1081 | fcoriolis=0. |
---|
1082 | !Nudging |
---|
1083 | |
---|
1084 | !on calcule dt_cooling |
---|
1085 | do l=1,llm |
---|
1086 | if (play(l).ge.20000.) then |
---|
1087 | dt_cooling(l)=-1.5/86400. |
---|
1088 | elseif ((play(l).ge.10000.).and.((play(l).lt.20000.))) then |
---|
1089 | dt_cooling(l)=-1.5/86400.*(play(l)-10000.)/(10000.)-1./86400.*(20000.-play(l))/10000.*(temp(l)-200.) |
---|
1090 | else |
---|
1091 | dt_cooling(l)=-1.*(temp(l)-200.)/86400. |
---|
1092 | endif |
---|
1093 | enddo |
---|
1094 | |
---|
1095 | endif |
---|
1096 | !RC |
---|
1097 | |
---|
1098 | IF (prt_level >= 5) print*, 'fcoriolis, xlat,mxcalc ', & |
---|
1099 | fcoriolis, xlat,mxcalc |
---|
1100 | |
---|
1101 | du_age(1:mxcalc)=fcoriolis*(v(1:mxcalc)-vg(1:mxcalc)) |
---|
1102 | dv_age(1:mxcalc)=-fcoriolis*(u(1:mxcalc)-ug(1:mxcalc)) |
---|
1103 | ! print *,'u-ug=',u-ug |
---|
1104 | |
---|
1105 | !!!!!!!!!!!!!!!!!!!!!!!! |
---|
1106 | ! Geostrophic wind |
---|
1107 | !!!!!!!!!!!!!!!!!!!!!!!! |
---|
1108 | sfdt = sin(0.5*fcoriolis*timestep) |
---|
1109 | cfdt = cos(0.5*fcoriolis*timestep) |
---|
1110 | ! print *,'fcoriolis,sfdt,cfdt,timestep',fcoriolis,sfdt,cfdt,timestep |
---|
1111 | ! |
---|
1112 | du_age(1:mxcalc)= -2.*sfdt/timestep* & |
---|
1113 | & (sfdt*(u(1:mxcalc)-ug(1:mxcalc)) - & |
---|
1114 | & cfdt*(v(1:mxcalc)-vg(1:mxcalc)) ) |
---|
1115 | !! : fcoriolis*(v(1:mxcalc)-vg(1:mxcalc)) |
---|
1116 | ! |
---|
1117 | dv_age(1:mxcalc)= -2.*sfdt/timestep* & |
---|
1118 | & (cfdt*(u(1:mxcalc)-ug(1:mxcalc)) + & |
---|
1119 | & sfdt*(v(1:mxcalc)-vg(1:mxcalc)) ) |
---|
1120 | !! : -fcoriolis*(u(1:mxcalc)-ug(1:mxcalc)) |
---|
1121 | ! |
---|
1122 | !!!!!!!!!!!!!!!!!!!!!!!! |
---|
1123 | ! Nudging |
---|
1124 | !!!!!!!!!!!!!!!!!!!!!!!! |
---|
1125 | d_t_nudge(:) = 0. |
---|
1126 | d_q_nudge(:,:) = 0. |
---|
1127 | d_u_nudge(:) = 0. |
---|
1128 | d_v_nudge(:) = 0. |
---|
1129 | if (nudge(inudge_RHT)) then |
---|
1130 | call nudge_RHT(timestep,plev,play,t_targ,rh_targ,temp,q(:,1), & |
---|
1131 | & d_t_nudge,d_q_nudge(:,1)) |
---|
1132 | endif |
---|
1133 | if (nudge(inudge_UV)) then |
---|
1134 | call nudge_UV(timestep,plev,play,u_targ,v_targ,u,v, & |
---|
1135 | & d_u_nudge,d_v_nudge) |
---|
1136 | endif |
---|
1137 | ! |
---|
1138 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
1139 | ! call writefield_phy('dv_age' ,dv_age,llm) |
---|
1140 | ! call writefield_phy('du_age' ,du_age,llm) |
---|
1141 | ! call writefield_phy('du_phys' ,du_phys,llm) |
---|
1142 | ! call writefield_phy('u_tend' ,u,llm) |
---|
1143 | ! call writefield_phy('u_g' ,ug,llm) |
---|
1144 | ! |
---|
1145 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
1146 | !! Increment state variables |
---|
1147 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
1148 | IF (flag_inhib_forcing == 0) then ! if tendency of forcings should be added |
---|
1149 | |
---|
1150 | ! pour les cas sandu et astex, on reclacule u,v,q,temp et teta dans 1D_nudge_sandu_astex.h |
---|
1151 | ! au dessus de 700hpa, on relaxe vers les profils initiaux |
---|
1152 | if (forcing_sandu .OR. forcing_astex) then |
---|
1153 | #include "1D_nudge_sandu_astex.h" |
---|
1154 | else |
---|
1155 | u(1:mxcalc)=u(1:mxcalc) + timestep*( & |
---|
1156 | & du_phys(1:mxcalc) & |
---|
1157 | & +du_age(1:mxcalc)+du_adv(1:mxcalc) & |
---|
1158 | & +d_u_nudge(1:mxcalc) ) |
---|
1159 | v(1:mxcalc)=v(1:mxcalc) + timestep*( & |
---|
1160 | & dv_phys(1:mxcalc) & |
---|
1161 | & +dv_age(1:mxcalc)+dv_adv(1:mxcalc) & |
---|
1162 | & +d_v_nudge(1:mxcalc) ) |
---|
1163 | q(1:mxcalc,:)=q(1:mxcalc,:)+timestep*( & |
---|
1164 | & dq(1:mxcalc,:) & |
---|
1165 | & +d_q_adv(1:mxcalc,:) & |
---|
1166 | & +d_q_nudge(1:mxcalc,:) ) |
---|
1167 | |
---|
1168 | if (prt_level.ge.3) then |
---|
1169 | print *, & |
---|
1170 | & 'physiq-> temp(1),dt_phys(1),d_th_adv(1),dt_cooling(1) ', & |
---|
1171 | & temp(1),dt_phys(1),d_th_adv(1),dt_cooling(1) |
---|
1172 | print* ,'dv_phys=',dv_phys |
---|
1173 | print* ,'dv_age=',dv_age |
---|
1174 | print* ,'dv_adv=',dv_adv |
---|
1175 | print* ,'d_v_nudge=',d_v_nudge |
---|
1176 | print*, v |
---|
1177 | print*, vg |
---|
1178 | endif |
---|
1179 | |
---|
1180 | temp(1:mxcalc)=temp(1:mxcalc)+timestep*( & |
---|
1181 | & dt_phys(1:mxcalc) & |
---|
1182 | & +d_th_adv(1:mxcalc) & |
---|
1183 | & +d_t_nudge(1:mxcalc) & |
---|
1184 | & +dt_cooling(1:mxcalc)) ! Taux de chauffage ou refroid. |
---|
1185 | |
---|
1186 | endif ! forcing_sandu or forcing_astex |
---|
1187 | |
---|
1188 | teta=temp*(pzero/play)**rkappa |
---|
1189 | ! |
---|
1190 | !--------------------------------------------------------------------- |
---|
1191 | ! Nudge soil temperature if requested |
---|
1192 | !--------------------------------------------------------------------- |
---|
1193 | |
---|
1194 | IF (nudge_tsoil .AND. .NOT. lastcall) THEN |
---|
1195 | ftsoil(1,isoil_nudge,:) = ftsoil(1,isoil_nudge,:) & |
---|
1196 | & -timestep/tau_soil_nudge*(ftsoil(1,isoil_nudge,:)-Tsoil_nudge) |
---|
1197 | ENDIF |
---|
1198 | |
---|
1199 | !--------------------------------------------------------------------- |
---|
1200 | ! Add large-scale tendencies (advection, etc) : |
---|
1201 | !--------------------------------------------------------------------- |
---|
1202 | |
---|
1203 | !cc nrlmd |
---|
1204 | !cc tmpvar=teta |
---|
1205 | !cc call advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
1206 | !cc |
---|
1207 | !cc teta(1:mxcalc)=tmpvar(1:mxcalc) |
---|
1208 | !cc tmpvar(:)=q(:,1) |
---|
1209 | !cc call advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
1210 | !cc q(1:mxcalc,1)=tmpvar(1:mxcalc) |
---|
1211 | !cc tmpvar(:)=q(:,2) |
---|
1212 | !cc call advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
1213 | !cc q(1:mxcalc,2)=tmpvar(1:mxcalc) |
---|
1214 | |
---|
1215 | END IF ! end if tendency of tendency should be added |
---|
1216 | |
---|
1217 | !--------------------------------------------------------------------- |
---|
1218 | ! Air temperature : |
---|
1219 | !--------------------------------------------------------------------- |
---|
1220 | if (lastcall) then |
---|
1221 | print*,'Pas de temps final ',it |
---|
1222 | call ju2ymds(daytime, an, mois, jour, heure) |
---|
1223 | print*,'a la date : a m j h',an, mois, jour ,heure/3600. |
---|
1224 | endif |
---|
1225 | |
---|
1226 | ! incremente day time |
---|
1227 | ! print*,'daytime bef',daytime,1./day_step |
---|
1228 | daytime = daytime+1./day_step |
---|
1229 | !Al1dbg |
---|
1230 | day = int(daytime+0.1/day_step) |
---|
1231 | ! time = max(daytime-day,0.0) |
---|
1232 | !Al1&jyg: correction de bug |
---|
1233 | !cc time = real(mod(it,day_step))/day_step |
---|
1234 | time = time_ini/24.+real(mod(it,day_step))/day_step |
---|
1235 | ! print*,'daytime nxt time',daytime,time |
---|
1236 | it=it+1 |
---|
1237 | |
---|
1238 | enddo |
---|
1239 | |
---|
1240 | !Al1 |
---|
1241 | if (ecrit_slab_oc.ne.-1) close(97) |
---|
1242 | |
---|
1243 | !Al1 Call to 1D equivalent of dynredem (an,mois,jour,heure ?) |
---|
1244 | ! ------------------------------------- |
---|
1245 | call dyn1dredem("restart1dyn.nc", & |
---|
1246 | & plev,play,phi,phis,presnivs, & |
---|
1247 | & u,v,temp,q,omega2) |
---|
1248 | |
---|
1249 | CALL abort_gcm ('lmdz1d ','The End ',0) |
---|
1250 | |
---|
1251 | end |
---|
1252 | |
---|
1253 | #include "1DUTILS.h" |
---|
1254 | #include "1Dconv.h" |
---|
1255 | |
---|
1256 | !#endif |
---|
1257 | |
---|
1258 | |
---|