1 | MODULE lmdz_scm |
---|
2 | PRIVATE ! -- We'd love to put IMPLICIT NONE; here... |
---|
3 | PUBLIC scm |
---|
4 | CONTAINS |
---|
5 | SUBROUTINE scm |
---|
6 | USE ioipsl, ONLY: ju2ymds, ymds2ju, ioconf_calendar, getin |
---|
7 | USE phys_state_var_mod, ONLY: phys_state_var_init, phys_state_var_end, & |
---|
8 | clwcon, detr_therm, & |
---|
9 | qsol, fevap, z0m, z0h, agesno, & |
---|
10 | du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, & |
---|
11 | falb_dir, falb_dif, & |
---|
12 | ftsol, beta_aridity, pbl_tke, pctsrf, radsol, rain_fall, snow_fall, ratqs, & |
---|
13 | rnebcon, rugoro, sig1, w01, solaire_etat0, sollw, sollwdown, & |
---|
14 | solsw, solswfdiff, t_ancien, q_ancien, u_ancien, v_ancien, rneb_ancien, & |
---|
15 | wake_delta_pbl_TKE, delta_tsurf, wake_fip, wake_pe, & |
---|
16 | wake_deltaq, wake_deltat, wake_s, awake_s, wake_dens, & |
---|
17 | awake_dens, cv_gen, wake_cstar, & |
---|
18 | zgam, zmax0, zmea, zpic, zsig, & |
---|
19 | zstd, zthe, zval, ale_bl, ale_bl_trig, alp_bl, ql_ancien, qs_ancien, & |
---|
20 | prlw_ancien, prsw_ancien, prw_ancien, & |
---|
21 | u10m, v10m, ale_wake, ale_bl_stat, ratqs_inter_ |
---|
22 | |
---|
23 | USE dimphy |
---|
24 | USE surface_data, ONLY: type_ocean, ok_veget |
---|
25 | USE pbl_surface_mod, ONLY: ftsoil, pbl_surface_init, & |
---|
26 | pbl_surface_final |
---|
27 | USE fonte_neige_mod, ONLY: fonte_neige_init, fonte_neige_final |
---|
28 | |
---|
29 | USE infotrac |
---|
30 | USE control_mod |
---|
31 | USE indice_sol_mod |
---|
32 | USE phyaqua_mod |
---|
33 | USE mod_1D_cases_read_std |
---|
34 | USE lmdz_print_control, ONLY: lunout, prt_level |
---|
35 | USE iniphysiq_mod, ONLY: iniphysiq |
---|
36 | USE mod_const_mpi, ONLY: comm_lmdz |
---|
37 | USE physiq_mod, ONLY: physiq |
---|
38 | USE comvert_mod, ONLY: presnivs, ap, bp, dpres, nivsig, nivsigs, pa, & |
---|
39 | preff, aps, bps, pseudoalt, scaleheight |
---|
40 | USE temps_mod, ONLY: annee_ref, calend, day_end, day_ini, day_ref, & |
---|
41 | itau_dyn, itau_phy, start_time, year_len |
---|
42 | USE phys_cal_mod, ONLY: year_len_phys_cal_mod => year_len |
---|
43 | USE lmdz_1dutils, ONLY: fq_sat, conf_unicol, dyn1deta0, dyn1dredem, disvert0 |
---|
44 | |
---|
45 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_OUTPUTPHYSSCM |
---|
46 | USE lmdz_clesphys |
---|
47 | USE lmdz_flux_arp, ONLY: fsens, flat, betaevap, ust, tg, ok_flux_surf, ok_prescr_ust, ok_prescr_beta, ok_forc_tsurf |
---|
48 | USE lmdz_compbl, ONLY: iflag_pbl, iflag_pbl_split, iflag_order2_sollw, ifl_pbltree |
---|
49 | USE lmdz_fcs_gcssold, ONLY: imp_fcg_gcssold, ts_fcg_gcssold, Tp_fcg_gcssold, Tp_ini_gcssold, xTurb_fcg_gcssold |
---|
50 | USE lmdz_tsoilnudge, ONLY: nudge_tsoil, isoil_nudge, Tsoil_nudge, tau_soil_nudge |
---|
51 | USE lmdz_yomcst |
---|
52 | USE lmdz_compar1d |
---|
53 | USE lmdz_date_cas, ONLY: year_ini_cas, mth_ini_cas, day_deb, heure_ini_cas, pdt_cas, day_ju_ini_cas |
---|
54 | |
---|
55 | INCLUDE "dimensions.h" |
---|
56 | INCLUDE "dimsoil.h" |
---|
57 | |
---|
58 | !===================================================================== |
---|
59 | ! DECLARATIONS |
---|
60 | !===================================================================== |
---|
61 | |
---|
62 | !--------------------------------------------------------------------- |
---|
63 | ! Arguments d' initialisations de la physique (USER DEFINE) |
---|
64 | !--------------------------------------------------------------------- |
---|
65 | |
---|
66 | INTEGER, parameter :: ngrid = 1 |
---|
67 | REAL :: zcufi = 1. |
---|
68 | REAL :: zcvfi = 1. |
---|
69 | REAL :: fnday |
---|
70 | REAL :: day, daytime |
---|
71 | REAL :: day1 |
---|
72 | REAL :: heure |
---|
73 | INTEGER :: jour |
---|
74 | INTEGER :: mois |
---|
75 | INTEGER :: an |
---|
76 | |
---|
77 | !--------------------------------------------------------------------- |
---|
78 | ! Declarations related to forcing and initial profiles |
---|
79 | !--------------------------------------------------------------------- |
---|
80 | |
---|
81 | INTEGER :: kmax = llm |
---|
82 | INTEGER llm700, nq1, nq2 |
---|
83 | INTEGER, PARAMETER :: nlev_max = 1000, nqmx = 1000 |
---|
84 | REAL timestep, frac |
---|
85 | REAL height(nlev_max), tttprof(nlev_max), qtprof(nlev_max) |
---|
86 | real uprof(nlev_max), vprof(nlev_max), e12prof(nlev_max) |
---|
87 | real ugprof(nlev_max), vgprof(nlev_max), wfls(nlev_max) |
---|
88 | real dqtdxls(nlev_max), dqtdyls(nlev_max) |
---|
89 | real dqtdtls(nlev_max), thlpcar(nlev_max) |
---|
90 | real qprof(nlev_max, nqmx) |
---|
91 | |
---|
92 | ! INTEGER :: forcing_type |
---|
93 | LOGICAL :: forcing_les = .FALSE. |
---|
94 | LOGICAL :: forcing_armcu = .FALSE. |
---|
95 | LOGICAL :: forcing_rico = .FALSE. |
---|
96 | LOGICAL :: forcing_radconv = .FALSE. |
---|
97 | LOGICAL :: forcing_toga = .FALSE. |
---|
98 | LOGICAL :: forcing_twpice = .FALSE. |
---|
99 | LOGICAL :: forcing_amma = .FALSE. |
---|
100 | LOGICAL :: forcing_dice = .FALSE. |
---|
101 | LOGICAL :: forcing_gabls4 = .FALSE. |
---|
102 | |
---|
103 | LOGICAL :: forcing_GCM2SCM = .FALSE. |
---|
104 | LOGICAL :: forcing_GCSSold = .FALSE. |
---|
105 | LOGICAL :: forcing_sandu = .FALSE. |
---|
106 | LOGICAL :: forcing_astex = .FALSE. |
---|
107 | LOGICAL :: forcing_fire = .FALSE. |
---|
108 | LOGICAL :: forcing_case = .FALSE. |
---|
109 | LOGICAL :: forcing_case2 = .FALSE. |
---|
110 | LOGICAL :: forcing_SCM = .FALSE. |
---|
111 | |
---|
112 | !flag forcings |
---|
113 | LOGICAL :: nudge_wind = .TRUE. |
---|
114 | LOGICAL :: nudge_thermo = .FALSE. |
---|
115 | LOGICAL :: cptadvw = .TRUE. |
---|
116 | |
---|
117 | |
---|
118 | !===================================================================== |
---|
119 | ! DECLARATIONS FOR EACH CASE |
---|
120 | !===================================================================== |
---|
121 | |
---|
122 | INCLUDE "1D_decl_cases.h" |
---|
123 | |
---|
124 | !--------------------------------------------------------------------- |
---|
125 | ! Declarations related to nudging |
---|
126 | !--------------------------------------------------------------------- |
---|
127 | INTEGER :: nudge_max |
---|
128 | parameter (nudge_max = 9) |
---|
129 | INTEGER :: inudge_RHT = 1 |
---|
130 | INTEGER :: inudge_UV = 2 |
---|
131 | LOGICAL :: nudge(nudge_max) |
---|
132 | REAL :: t_targ(llm) |
---|
133 | REAL :: rh_targ(llm) |
---|
134 | REAL :: u_targ(llm) |
---|
135 | REAL :: v_targ(llm) |
---|
136 | |
---|
137 | !--------------------------------------------------------------------- |
---|
138 | ! Declarations related to vertical discretization: |
---|
139 | !--------------------------------------------------------------------- |
---|
140 | REAL :: pzero = 1.e5 |
---|
141 | REAL :: play (llm), zlay (llm), sig_s(llm), plev(llm + 1) |
---|
142 | REAL :: playd(llm), zlayd(llm), ap_amma(llm + 1), bp_amma(llm + 1) |
---|
143 | |
---|
144 | !--------------------------------------------------------------------- |
---|
145 | ! Declarations related to variables |
---|
146 | !--------------------------------------------------------------------- |
---|
147 | |
---|
148 | REAL :: phi(llm) |
---|
149 | REAL :: teta(llm), tetal(llm), temp(llm), u(llm), v(llm), w(llm) |
---|
150 | REAL rot(1, llm) ! relative vorticity, in s-1 |
---|
151 | REAL :: rlat_rad(1), rlon_rad(1) |
---|
152 | REAL :: omega(llm), omega2(llm), rho(llm + 1) |
---|
153 | REAL :: ug(llm), vg(llm), fcoriolis |
---|
154 | REAL :: sfdt, cfdt |
---|
155 | REAL :: du_phys(llm), dv_phys(llm), dt_phys(llm) |
---|
156 | REAL :: w_adv(llm), z_adv(llm) |
---|
157 | REAL :: d_t_vert_adv(llm), d_u_vert_adv(llm), d_v_vert_adv(llm) |
---|
158 | REAL :: dt_cooling(llm), d_t_adv(llm), d_t_nudge(llm) |
---|
159 | REAL :: d_u_nudge(llm), d_v_nudge(llm) |
---|
160 | ! REAL :: d_u_adv(llm),d_v_adv(llm) |
---|
161 | REAL :: d_u_age(llm), d_v_age(llm) |
---|
162 | REAL :: alpha |
---|
163 | REAL :: ttt |
---|
164 | |
---|
165 | REAL, ALLOCATABLE, DIMENSION(:, :) :: q |
---|
166 | REAL, ALLOCATABLE, DIMENSION(:, :) :: dq |
---|
167 | REAL, ALLOCATABLE, DIMENSION(:, :) :: d_q_vert_adv |
---|
168 | REAL, ALLOCATABLE, DIMENSION(:, :) :: d_q_adv |
---|
169 | REAL, ALLOCATABLE, DIMENSION(:, :) :: d_q_nudge |
---|
170 | ! REAL, ALLOCATABLE, DIMENSION(:):: d_th_adv |
---|
171 | |
---|
172 | !--------------------------------------------------------------------- |
---|
173 | ! Initialization of surface variables |
---|
174 | !--------------------------------------------------------------------- |
---|
175 | REAL :: run_off_lic_0(1) |
---|
176 | REAL :: fder(1), snsrf(1, nbsrf), qsurfsrf(1, nbsrf) |
---|
177 | REAL :: tsoil(1, nsoilmx, nbsrf) |
---|
178 | ! REAL :: agesno(1,nbsrf) |
---|
179 | |
---|
180 | !--------------------------------------------------------------------- |
---|
181 | ! Call to phyredem |
---|
182 | !--------------------------------------------------------------------- |
---|
183 | LOGICAL :: ok_writedem = .TRUE. |
---|
184 | REAL :: sollw_in = 0. |
---|
185 | REAL :: solsw_in = 0. |
---|
186 | |
---|
187 | !--------------------------------------------------------------------- |
---|
188 | ! Call to physiq |
---|
189 | !--------------------------------------------------------------------- |
---|
190 | LOGICAL :: firstcall = .TRUE. |
---|
191 | LOGICAL :: lastcall = .FALSE. |
---|
192 | REAL :: phis(1) = 0.0 |
---|
193 | REAL :: dpsrf(1) |
---|
194 | |
---|
195 | !--------------------------------------------------------------------- |
---|
196 | ! Initializations of boundary conditions |
---|
197 | !--------------------------------------------------------------------- |
---|
198 | REAL, ALLOCATABLE :: phy_nat (:) ! 0=ocean libre,1=land,2=glacier,3=banquise |
---|
199 | REAL, ALLOCATABLE :: phy_alb (:) ! Albedo land only (old value condsurf_jyg=0.3) |
---|
200 | REAL, ALLOCATABLE :: phy_sst (:) ! SST (will not be used; cf read_tsurf1d.F) |
---|
201 | REAL, ALLOCATABLE :: phy_bil (:) ! Ne sert que pour les slab_ocean |
---|
202 | REAL, ALLOCATABLE :: phy_rug (:) ! Longueur rugosite utilisee sur land only |
---|
203 | REAL, ALLOCATABLE :: phy_ice (:) ! Fraction de glace |
---|
204 | REAL, ALLOCATABLE :: phy_fter(:) ! Fraction de terre |
---|
205 | REAL, ALLOCATABLE :: phy_foce(:) ! Fraction de ocean |
---|
206 | REAL, ALLOCATABLE :: phy_fsic(:) ! Fraction de glace |
---|
207 | REAL, ALLOCATABLE :: phy_flic(:) ! Fraction de glace |
---|
208 | |
---|
209 | !--------------------------------------------------------------------- |
---|
210 | ! Fichiers et d'autres variables |
---|
211 | !--------------------------------------------------------------------- |
---|
212 | INTEGER :: k, l, i, it = 1, mxcalc |
---|
213 | INTEGER :: nsrf |
---|
214 | INTEGER jcode |
---|
215 | INTEGER read_climoz |
---|
216 | |
---|
217 | INTEGER :: it_end ! iteration number of the last call |
---|
218 | !Al1,plev,play,phi,phis,presnivs, |
---|
219 | INTEGER ecrit_slab_oc !1=ecrit,-1=lit,0=no file |
---|
220 | data ecrit_slab_oc/-1/ |
---|
221 | |
---|
222 | ! if flag_inhib_forcing = 0, tendencies of forcing are added |
---|
223 | ! <> 0, tendencies of forcing are not added |
---|
224 | INTEGER :: flag_inhib_forcing = 0 |
---|
225 | |
---|
226 | PRINT*, 'VOUS ENTREZ DANS LE 1D FORMAT STANDARD' |
---|
227 | |
---|
228 | !===================================================================== |
---|
229 | ! INITIALIZATIONS |
---|
230 | !===================================================================== |
---|
231 | du_phys(:) = 0. |
---|
232 | dv_phys(:) = 0. |
---|
233 | dt_phys(:) = 0. |
---|
234 | d_t_vert_adv(:) = 0. |
---|
235 | d_u_vert_adv(:) = 0. |
---|
236 | d_v_vert_adv(:) = 0. |
---|
237 | dt_cooling(:) = 0. |
---|
238 | d_t_adv(:) = 0. |
---|
239 | d_t_nudge(:) = 0. |
---|
240 | d_u_nudge(:) = 0. |
---|
241 | d_v_nudge(:) = 0. |
---|
242 | d_u_adv(:) = 0. |
---|
243 | d_v_adv(:) = 0. |
---|
244 | d_u_age(:) = 0. |
---|
245 | d_v_age(:) = 0. |
---|
246 | |
---|
247 | |
---|
248 | ! Initialization of Common turb_forcing |
---|
249 | dtime_frcg = 0. |
---|
250 | Turb_fcg_gcssold = .FALSE. |
---|
251 | hthturb_gcssold = 0. |
---|
252 | hqturb_gcssold = 0. |
---|
253 | |
---|
254 | |
---|
255 | |
---|
256 | |
---|
257 | !--------------------------------------------------------------------- |
---|
258 | ! OPTIONS OF THE 1D SIMULATION (lmdz1d.def => unicol.def) |
---|
259 | !--------------------------------------------------------------------- |
---|
260 | CALL conf_unicol |
---|
261 | !Al1 moves this gcssold var from common fcg_gcssold to |
---|
262 | Turb_fcg_gcssold = xTurb_fcg_gcssold |
---|
263 | ! -------------------------------------------------------------------- |
---|
264 | close(1) |
---|
265 | WRITE(*, *) 'lmdz1d.def lu => unicol.def' |
---|
266 | |
---|
267 | forcing_SCM = .TRUE. |
---|
268 | year_ini_cas = 1997 |
---|
269 | ! It is possible that those parameters are run twice. |
---|
270 | ! A REVOIR : LIRE PEUT ETRE AN MOIS JOUR DIRECETEMENT |
---|
271 | |
---|
272 | CALL getin('anneeref', year_ini_cas) |
---|
273 | CALL getin('dayref', day_deb) |
---|
274 | mth_ini_cas = 1 ! pour le moment on compte depuis le debut de l'annee |
---|
275 | CALL getin('time_ini', heure_ini_cas) |
---|
276 | |
---|
277 | PRINT*, 'NATURE DE LA SURFACE ', nat_surf |
---|
278 | |
---|
279 | ! Initialization of the LOGICAL switch for nudging |
---|
280 | |
---|
281 | jcode = iflag_nudge |
---|
282 | DO i = 1, nudge_max |
---|
283 | nudge(i) = mod(jcode, 10) >= 1 |
---|
284 | jcode = jcode / 10 |
---|
285 | enddo |
---|
286 | !----------------------------------------------------------------------- |
---|
287 | ! Definition of the run |
---|
288 | !----------------------------------------------------------------------- |
---|
289 | |
---|
290 | CALL conf_gcm(99, .TRUE.) |
---|
291 | |
---|
292 | !----------------------------------------------------------------------- |
---|
293 | allocate(phy_nat (year_len)) ! 0=ocean libre,1=land,2=glacier,3=banquise |
---|
294 | phy_nat(:) = 0.0 |
---|
295 | allocate(phy_alb (year_len)) ! Albedo land only (old value condsurf_jyg=0.3) |
---|
296 | allocate(phy_sst (year_len)) ! SST (will not be used; cf read_tsurf1d.F) |
---|
297 | allocate(phy_bil (year_len)) ! Ne sert que pour les slab_ocean |
---|
298 | phy_bil(:) = 1.0 |
---|
299 | allocate(phy_rug (year_len)) ! Longueur rugosite utilisee sur land only |
---|
300 | allocate(phy_ice (year_len)) ! Fraction de glace |
---|
301 | phy_ice(:) = 0.0 |
---|
302 | allocate(phy_fter(year_len)) ! Fraction de terre |
---|
303 | phy_fter(:) = 0.0 |
---|
304 | allocate(phy_foce(year_len)) ! Fraction de ocean |
---|
305 | phy_foce(:) = 0.0 |
---|
306 | allocate(phy_fsic(year_len)) ! Fraction de glace |
---|
307 | phy_fsic(:) = 0.0 |
---|
308 | allocate(phy_flic(year_len)) ! Fraction de glace |
---|
309 | phy_flic(:) = 0.0 |
---|
310 | |
---|
311 | |
---|
312 | !----------------------------------------------------------------------- |
---|
313 | ! Choix du calendrier |
---|
314 | ! ------------------- |
---|
315 | |
---|
316 | ! calend = 'earth_365d' |
---|
317 | IF (calend == 'earth_360d') THEN |
---|
318 | CALL ioconf_calendar('360_day') |
---|
319 | WRITE(*, *)'CALENDRIER CHOISI: Terrestre a 360 jours/an' |
---|
320 | ELSE IF (calend == 'earth_365d') THEN |
---|
321 | CALL ioconf_calendar('noleap') |
---|
322 | WRITE(*, *)'CALENDRIER CHOISI: Terrestre a 365 jours/an' |
---|
323 | ELSE IF (calend == 'earth_366d') THEN |
---|
324 | CALL ioconf_calendar('all_leap') |
---|
325 | WRITE(*, *)'CALENDRIER CHOISI: Terrestre bissextile' |
---|
326 | ELSE IF (calend == 'gregorian') THEN |
---|
327 | stop 'gregorian calend should not be used by normal user' |
---|
328 | CALL ioconf_calendar('gregorian') ! not to be used by normal users |
---|
329 | WRITE(*, *)'CALENDRIER CHOISI: Gregorien' |
---|
330 | else |
---|
331 | write (*, *) 'ERROR : unknown calendar ', calend |
---|
332 | stop 'calend should be 360d,earth_365d,earth_366d,gregorian' |
---|
333 | endif |
---|
334 | !----------------------------------------------------------------------- |
---|
335 | |
---|
336 | !c Date : |
---|
337 | ! La date est supposee donnee sous la forme [annee, numero du jour dans |
---|
338 | ! l annee] ; l heure est donnee dans time_ini, lu dans lmdz1d.def. |
---|
339 | ! On appelle ymds2ju pour convertir [annee, jour] en [jour Julien]. |
---|
340 | ! Le numero du jour est dans "day". L heure est traitee separement. |
---|
341 | ! La date complete est dans "daytime" (l'unite est le jour). |
---|
342 | |
---|
343 | IF (nday>0) THEN |
---|
344 | fnday = nday |
---|
345 | else |
---|
346 | fnday = -nday / float(day_step) |
---|
347 | endif |
---|
348 | print *, 'fnday=', fnday |
---|
349 | ! start_time doit etre en FRACTION DE JOUR |
---|
350 | start_time = time_ini / 24. |
---|
351 | |
---|
352 | annee_ref = anneeref |
---|
353 | mois = 1 |
---|
354 | day_ref = dayref |
---|
355 | heure = 0. |
---|
356 | itau_dyn = 0 |
---|
357 | itau_phy = 0 |
---|
358 | CALL ymds2ju(annee_ref, mois, day_ref, heure, day) |
---|
359 | day_ini = int(day) |
---|
360 | day_end = day_ini + int(fnday) |
---|
361 | |
---|
362 | ! Convert the initial date to Julian day |
---|
363 | day_ini_cas = day_deb |
---|
364 | PRINT*, 'time case', year_ini_cas, mth_ini_cas, day_ini_cas |
---|
365 | CALL ymds2ju & |
---|
366 | (year_ini_cas, mth_ini_cas, day_ini_cas, heure_ini_cas * 3600 & |
---|
367 | , day_ju_ini_cas) |
---|
368 | PRINT*, 'time case 2', day_ini_cas, day_ju_ini_cas |
---|
369 | daytime = day + heure_ini_cas / 24. ! 1st day and initial time of the simulation |
---|
370 | |
---|
371 | ! Print out the actual date of the beginning of the simulation : |
---|
372 | CALL ju2ymds(daytime, year_print, month_print, day_print, sec_print) |
---|
373 | print *, ' Time of beginning : ', & |
---|
374 | year_print, month_print, day_print, sec_print |
---|
375 | |
---|
376 | !--------------------------------------------------------------------- |
---|
377 | ! Initialization of dimensions, geometry and initial state |
---|
378 | !--------------------------------------------------------------------- |
---|
379 | ! CALL init_phys_lmdz(1,1,llm,1,(/1/)) ! job now done via iniphysiq |
---|
380 | ! but we still need to initialize dimphy module (klon,klev,etc.) here. |
---|
381 | CALL init_dimphy1D(1, llm) |
---|
382 | CALL suphel |
---|
383 | CALL init_infotrac |
---|
384 | |
---|
385 | IF (nqtot>nqmx) STOP 'Augmenter nqmx dans lmdz1d.F' |
---|
386 | allocate(q(llm, nqtot)) ; q(:, :) = 0. |
---|
387 | allocate(dq(llm, nqtot)) |
---|
388 | allocate(d_q_vert_adv(llm, nqtot)) |
---|
389 | allocate(d_q_adv(llm, nqtot)) |
---|
390 | allocate(d_q_nudge(llm, nqtot)) |
---|
391 | ! allocate(d_th_adv(llm)) |
---|
392 | |
---|
393 | q(:, :) = 0. |
---|
394 | dq(:, :) = 0. |
---|
395 | d_q_vert_adv(:, :) = 0. |
---|
396 | d_q_adv(:, :) = 0. |
---|
397 | d_q_nudge(:, :) = 0. |
---|
398 | |
---|
399 | ! No ozone climatology need be read in this pre-initialization |
---|
400 | ! (phys_state_var_init is called again in physiq) |
---|
401 | read_climoz = 0 |
---|
402 | nsw = 6 |
---|
403 | |
---|
404 | CALL phys_state_var_init(read_climoz) |
---|
405 | |
---|
406 | IF (ngrid/=klon) THEN |
---|
407 | PRINT*, 'stop in inifis' |
---|
408 | PRINT*, 'Probleme de dimensions :' |
---|
409 | PRINT*, 'ngrid = ', ngrid |
---|
410 | PRINT*, 'klon = ', klon |
---|
411 | stop |
---|
412 | endif |
---|
413 | !!!===================================================================== |
---|
414 | !!! Feedback forcing values for Gateaux differentiation (al1) |
---|
415 | !!!===================================================================== |
---|
416 | !! |
---|
417 | qsol = qsolinp |
---|
418 | qsurf = fq_sat(tsurf, psurf / 100.) |
---|
419 | beta_aridity(:, :) = beta_surf |
---|
420 | day1 = day_ini |
---|
421 | time = daytime - day |
---|
422 | ts_toga(1) = tsurf ! needed by read_tsurf1d.F |
---|
423 | rho(1) = psurf / (rd * tsurf * (1. + (rv / rd - 1.) * qsurf)) |
---|
424 | |
---|
425 | !! mpl et jyg le 22/08/2012 : |
---|
426 | !! pour que les cas a flux de surface imposes marchent |
---|
427 | IF(.NOT.ok_flux_surf.OR.max(abs(wtsurf), abs(wqsurf))>0.) THEN |
---|
428 | fsens = -wtsurf * rcpd * rho(1) |
---|
429 | flat = -wqsurf * rlvtt * rho(1) |
---|
430 | print *, 'Flux: ok_flux wtsurf wqsurf', ok_flux_surf, wtsurf, wqsurf |
---|
431 | ENDIF |
---|
432 | PRINT*, 'Flux sol ', fsens, flat |
---|
433 | |
---|
434 | ! Vertical discretization and pressure levels at half and mid levels: |
---|
435 | |
---|
436 | pa = 5e4 |
---|
437 | !! preff= 1.01325e5 |
---|
438 | preff = psurf |
---|
439 | IF (ok_old_disvert) THEN |
---|
440 | CALL disvert0(pa, preff, ap, bp, dpres, presnivs, nivsigs, nivsig) |
---|
441 | print *, 'On utilise disvert0' |
---|
442 | aps(1:llm) = 0.5 * (ap(1:llm) + ap(2:llm + 1)) |
---|
443 | bps(1:llm) = 0.5 * (bp(1:llm) + bp(2:llm + 1)) |
---|
444 | scaleheight = 8. |
---|
445 | pseudoalt(1:llm) = -scaleheight * log(presnivs(1:llm) / preff) |
---|
446 | ELSE |
---|
447 | CALL disvert() |
---|
448 | print *, 'On utilise disvert' |
---|
449 | ! Nouvelle version disvert permettant d imposer ap,bp (modif L.Guez) MPL 18092012 |
---|
450 | ! Dans ce cas, on lit ap,bp dans le fichier hybrid.txt |
---|
451 | ENDIF |
---|
452 | |
---|
453 | sig_s = presnivs / preff |
---|
454 | plev = ap + bp * psurf |
---|
455 | play = 0.5 * (plev(1:llm) + plev(2:llm + 1)) |
---|
456 | zlay = -rd * 300. * log(play / psurf) / rg ! moved after reading profiles. |
---|
457 | |
---|
458 | IF (forcing_type == 59) THEN |
---|
459 | ! pour forcing_sandu, on cherche l'indice le plus proche de 700hpa#3000m |
---|
460 | WRITE(*, *) '***********************' |
---|
461 | DO l = 1, llm |
---|
462 | WRITE(*, *) 'l,play(l),presnivs(l): ', l, play(l), presnivs(l) |
---|
463 | IF (trouve_700 .AND. play(l)<=70000) THEN |
---|
464 | llm700 = l |
---|
465 | print *, 'llm700,play=', llm700, play(l) / 100. |
---|
466 | trouve_700 = .FALSE. |
---|
467 | endif |
---|
468 | enddo |
---|
469 | WRITE(*, *) '***********************' |
---|
470 | ENDIF |
---|
471 | |
---|
472 | !===================================================================== |
---|
473 | ! EVENTUALLY, READ FORCING DATA : |
---|
474 | !===================================================================== |
---|
475 | |
---|
476 | INCLUDE "1D_read_forc_cases.h" |
---|
477 | PRINT*, 'A d_t_adv ', d_t_adv(1:20)*86400 |
---|
478 | |
---|
479 | IF (forcing_GCM2SCM) THEN |
---|
480 | write (*, *) 'forcing_GCM2SCM not yet implemented' |
---|
481 | stop 'in initialization' |
---|
482 | ENDIF ! forcing_GCM2SCM |
---|
483 | |
---|
484 | |
---|
485 | !===================================================================== |
---|
486 | ! Initialisation de la physique : |
---|
487 | !===================================================================== |
---|
488 | |
---|
489 | ! Rq: conf_phys.F90 lit tous les flags de physiq.def; conf_phys appele depuis physiq.F |
---|
490 | |
---|
491 | ! day_step, iphysiq lus dans gcm.def ci-dessus |
---|
492 | ! timestep: calcule ci-dessous from rday et day_step |
---|
493 | ! ngrid=1 |
---|
494 | ! llm: defini dans .../modipsl/modeles/LMDZ4/libf/grid/dimension |
---|
495 | ! rday: defini dans suphel.F (86400.) |
---|
496 | ! day_ini: lu dans run.def (dayref) |
---|
497 | ! rlat_rad,rlon-rad: transformes en radian de rlat,rlon lus dans lmdz1d.def (en degres) |
---|
498 | ! airefi,zcufi,zcvfi initialises au debut de ce programme |
---|
499 | ! rday,ra,rg,rd,rcpd declares dans YOMCST.h et calcules dans suphel.F |
---|
500 | |
---|
501 | |
---|
502 | day_step = float(nsplit_phys)*day_step/float(iphysiq) |
---|
503 | write (*, *) 'Time step divided by nsplit_phys (=', nsplit_phys, ')' |
---|
504 | timestep = rday/day_step |
---|
505 | dtime_frcg = timestep |
---|
506 | |
---|
507 | zcufi = airefi |
---|
508 | zcvfi = airefi |
---|
509 | |
---|
510 | rlat_rad(1) = xlat*rpi/180. |
---|
511 | rlon_rad(1) = xlon*rpi/180. |
---|
512 | |
---|
513 | ! iniphysiq will CALL iniaqua who needs year_len from phys_cal_mod |
---|
514 | year_len_phys_cal_mod = year_len |
---|
515 | |
---|
516 | ! Ehouarn: iniphysiq requires arrays related to (3D) dynamics grid, |
---|
517 | ! e.g. for cell boundaries, which are meaningless in 1D; so pad these |
---|
518 | ! with '0.' when necessary |
---|
519 | |
---|
520 | CALL iniphysiq(iim, jjm, llm, & |
---|
521 | 1, comm_lmdz, & |
---|
522 | rday, day_ini, timestep, & |
---|
523 | (/rlat_rad(1), 0./), (/0./), & |
---|
524 | (/0., 0./), (/rlon_rad(1), 0./), & |
---|
525 | (/ (/airefi, 0./), (/0., 0./) /), & |
---|
526 | (/zcufi, 0., 0., 0./), & |
---|
527 | (/zcvfi, 0./), & |
---|
528 | ra, rg, rd,rcpd, 1) |
---|
529 | PRINT*, 'apres iniphysiq' |
---|
530 | |
---|
531 | ! 2 PARAMETRES QUI DEVRAIENT ETRE LUS DANS run.def MAIS NE LE SONT PAS ICI: |
---|
532 | co2_ppm = 330.0 |
---|
533 | solaire = 1370.0 |
---|
534 | |
---|
535 | ! Ecriture du startphy avant le premier appel a la physique. |
---|
536 | ! On le met juste avant pour avoir acces a tous les champs |
---|
537 | |
---|
538 | IF (ok_writedem) THEN |
---|
539 | !-------------------------------------------------------------------------- |
---|
540 | ! pbl_surface_init (called here) and pbl_surface_final (called by phyredem) |
---|
541 | ! need : qsol fder snow qsurf evap rugos agesno ftsoil |
---|
542 | !-------------------------------------------------------------------------- |
---|
543 | |
---|
544 | type_ocean = "force" |
---|
545 | run_off_lic_0(1) = restart_runoff |
---|
546 | CALL fonte_neige_init(run_off_lic_0) |
---|
547 | |
---|
548 | fder = 0. |
---|
549 | snsrf(1, :) = snowmass ! masse de neige des sous surface |
---|
550 | qsurfsrf(1, :) = qsurf ! humidite de l'air des sous surface |
---|
551 | fevap = 0. |
---|
552 | z0m(1, :) = rugos ! couverture de neige des sous surface |
---|
553 | z0h(1, :) = rugosh ! couverture de neige des sous surface |
---|
554 | agesno = xagesno |
---|
555 | tsoil(:, :, :) = tsurf |
---|
556 | !------ AMMA 2e run avec modele sol et rayonnement actif (MPL 23052012) |
---|
557 | ! tsoil(1,1,1)=299.18 |
---|
558 | ! tsoil(1,2,1)=300.08 |
---|
559 | ! tsoil(1,3,1)=301.88 |
---|
560 | ! tsoil(1,4,1)=305.48 |
---|
561 | ! tsoil(1,5,1)=308.00 |
---|
562 | ! tsoil(1,6,1)=308.00 |
---|
563 | ! tsoil(1,7,1)=308.00 |
---|
564 | ! tsoil(1,8,1)=308.00 |
---|
565 | ! tsoil(1,9,1)=308.00 |
---|
566 | ! tsoil(1,10,1)=308.00 |
---|
567 | ! tsoil(1,11,1)=308.00 |
---|
568 | !----------------------------------------------------------------------- |
---|
569 | CALL pbl_surface_init(fder, snsrf, qsurfsrf, tsoil) |
---|
570 | |
---|
571 | !------------------ prepare limit conditions for limit.nc ----------------- |
---|
572 | !-- Ocean force |
---|
573 | |
---|
574 | PRINT*, 'avant phyredem' |
---|
575 | pctsrf(1, :) = 0. |
---|
576 | IF (nat_surf==0.) THEN |
---|
577 | pctsrf(1, is_oce) = 1. |
---|
578 | pctsrf(1, is_ter) = 0. |
---|
579 | pctsrf(1, is_lic) = 0. |
---|
580 | pctsrf(1, is_sic) = 0. |
---|
581 | ELSE IF (nat_surf == 1) THEN |
---|
582 | pctsrf(1, is_oce) = 0. |
---|
583 | pctsrf(1, is_ter) = 1. |
---|
584 | pctsrf(1, is_lic) = 0. |
---|
585 | pctsrf(1, is_sic) = 0. |
---|
586 | ELSE IF (nat_surf == 2) THEN |
---|
587 | pctsrf(1, is_oce) = 0. |
---|
588 | pctsrf(1, is_ter) = 0. |
---|
589 | pctsrf(1, is_lic) = 1. |
---|
590 | pctsrf(1, is_sic) = 0. |
---|
591 | ELSE IF (nat_surf == 3) THEN |
---|
592 | pctsrf(1, is_oce) = 0. |
---|
593 | pctsrf(1, is_ter) = 0. |
---|
594 | pctsrf(1, is_lic) = 0. |
---|
595 | pctsrf(1, is_sic) = 1. |
---|
596 | |
---|
597 | end if |
---|
598 | |
---|
599 | |
---|
600 | PRINT*, 'nat_surf,pctsrf(1,is_oce),pctsrf(1,is_ter)', nat_surf & |
---|
601 | , pctsrf(1, is_oce), pctsrf(1, is_ter) |
---|
602 | |
---|
603 | zmasq = pctsrf(1, is_ter)+pctsrf(1, is_lic) |
---|
604 | zpic = zpicinp |
---|
605 | ftsol = tsurf |
---|
606 | falb_dir= albedo |
---|
607 | falb_dif = albedo |
---|
608 | rugoro = rugos |
---|
609 | t_ancien(1, :)= temp(:) |
---|
610 | q_ancien(1, :)= q(:, 1) |
---|
611 | ql_ancien = 0. |
---|
612 | qs_ancien = 0. |
---|
613 | prlw_ancien = 0. |
---|
614 | prsw_ancien = 0. |
---|
615 | prw_ancien = 0. |
---|
616 | !jyg< |
---|
617 | ! Etienne: comment those lines since now the TKE is inialized in 1D_read_forc_cases |
---|
618 | !! pbl_tke(:,:,:)=1.e-8 |
---|
619 | ! pbl_tke(:,:,:)=0. |
---|
620 | ! pbl_tke(:,2,:)=1.e-2 |
---|
621 | !>jyg |
---|
622 | rain_fall = 0. |
---|
623 | snow_fall = 0. |
---|
624 | solsw = 0. |
---|
625 | solswfdiff= 0. |
---|
626 | sollw = 0. |
---|
627 | sollwdown = rsigma*tsurf**4 |
---|
628 | radsol = 0. |
---|
629 | rnebcon= 0. |
---|
630 | ratqs = 0. |
---|
631 | clwcon = 0. |
---|
632 | zmax0 = 0. |
---|
633 | zmea = zsurf |
---|
634 | zstd= 0. |
---|
635 | zsig = 0. |
---|
636 | zgam = 0. |
---|
637 | zval = 0. |
---|
638 | zthe = 0. |
---|
639 | sig1= 0. |
---|
640 | w01 = 0. |
---|
641 | |
---|
642 | wake_deltaq = 0. |
---|
643 | wake_deltat = 0. |
---|
644 | wake_delta_pbl_TKE(:, :, :) = 0. |
---|
645 | delta_tsurf = 0. |
---|
646 | wake_fip = 0. |
---|
647 | wake_pe = 0. |
---|
648 | wake_s = 0. |
---|
649 | awake_s = 0. |
---|
650 | wake_dens = 0. |
---|
651 | awake_dens = 0. |
---|
652 | cv_gen = 0. |
---|
653 | wake_cstar = 0. |
---|
654 | ale_bl = 0. |
---|
655 | ale_bl_trig = 0. |
---|
656 | alp_bl = 0. |
---|
657 | IF (ALLOCATED(du_gwd_rando)) du_gwd_rando = 0. |
---|
658 | IF (ALLOCATED(du_gwd_front)) du_gwd_front = 0. |
---|
659 | entr_therm = 0. |
---|
660 | detr_therm = 0. |
---|
661 | f0 = 0. |
---|
662 | fm_therm = 0. |
---|
663 | u_ancien(1, :)= u(:) |
---|
664 | v_ancien(1, :)= v(:) |
---|
665 | rneb_ancien(1, :)= 0. |
---|
666 | |
---|
667 | u10m = 0. |
---|
668 | v10m = 0. |
---|
669 | ale_wake = 0. |
---|
670 | ale_bl_stat = 0. |
---|
671 | ratqs_inter_(:, :)= 0.002 |
---|
672 | |
---|
673 | !------------------------------------------------------------------------ |
---|
674 | ! Make file containing restart for the physics (startphy.nc) |
---|
675 | |
---|
676 | ! NB: List of the variables to be written by phyredem (via put_field): |
---|
677 | ! rlon,rlat,zmasq,pctsrf(:,is_ter),pctsrf(:,is_lic),pctsrf(:,is_oce) |
---|
678 | ! pctsrf(:,is_sic),ftsol(:,nsrf),tsoil(:,isoil,nsrf),qsurf(:,nsrf) |
---|
679 | ! qsol,falb_dir(:,nsrf),falb_dif(:,nsrf),evap(:,nsrf),snow(:,nsrf) |
---|
680 | ! radsol,solsw,solswfdiff,sollw, sollwdown,fder,rain_fall,snow_fall,frugs(:,nsrf) |
---|
681 | ! agesno(:,nsrf),zmea,zstd,zsig,zgam,zthe,zpic,zval,rugoro |
---|
682 | ! t_ancien,q_ancien,,frugs(:,is_oce),clwcon(:,1),rnebcon(:,1),ratqs(:,1) |
---|
683 | ! run_off_lic_0,pbl_tke(:,1:klev,nsrf), zmax0,f0,sig1,w01 |
---|
684 | ! wake_deltat,wake_deltaq,wake_s,awake_s,wake_dens,awake_dens,cv_gen,wake_cstar, |
---|
685 | ! wake_fip,wake_delta_pbl_tke(:,1:klev,nsrf) |
---|
686 | |
---|
687 | ! NB2: The content of the startphy.nc file depends on some flags defined in |
---|
688 | ! the ".def" files. However, since conf_phys is not called in lmdz1d.F90, these flags have |
---|
689 | ! to be set at some arbitratry convenient values. |
---|
690 | !------------------------------------------------------------------------ |
---|
691 | !Al1 =============== restart option ====================================== |
---|
692 | iflag_physiq = 0 |
---|
693 | CALL getin('iflag_physiq', iflag_physiq) |
---|
694 | |
---|
695 | IF (.NOT.restart) THEN |
---|
696 | iflag_pbl = 5 |
---|
697 | CALL phyredem ("startphy.nc") |
---|
698 | else |
---|
699 | ! (desallocations) |
---|
700 | PRINT*, 'callin surf final' |
---|
701 | CALL pbl_surface_final(fder, snsrf, qsurfsrf, tsoil) |
---|
702 | PRINT*, 'after surf final' |
---|
703 | CALL fonte_neige_final(run_off_lic_0) |
---|
704 | endif |
---|
705 | |
---|
706 | ok_writedem = .FALSE. |
---|
707 | PRINT*,'apres phyredem' |
---|
708 | |
---|
709 | endif ! ok_writedem |
---|
710 | |
---|
711 | !------------------------------------------------------------------------ |
---|
712 | ! Make file containing boundary conditions (limit.nc) **Al1->restartdyn*** |
---|
713 | ! -------------------------------------------------- |
---|
714 | ! NB: List of the variables to be written in limit.nc |
---|
715 | ! (by writelim.F, SUBROUTINE of 1DUTILS.h): |
---|
716 | ! phy_nat,phy_alb,phy_sst,phy_bil,phy_rug,phy_ice, |
---|
717 | ! phy_fter,phy_foce,phy_flic,phy_fsic) |
---|
718 | !------------------------------------------------------------------------ |
---|
719 | DO i = 1, year_len |
---|
720 | phy_nat(i) = nat_surf |
---|
721 | phy_alb(i) = albedo |
---|
722 | phy_sst(i) = tsurf ! read_tsurf1d will be used instead |
---|
723 | phy_rug(i) = rugos |
---|
724 | phy_fter(i) = pctsrf(1, is_ter) |
---|
725 | phy_foce(i) = pctsrf(1, is_oce) |
---|
726 | phy_fsic(i) = pctsrf(1, is_sic) |
---|
727 | phy_flic(i) = pctsrf(1, is_lic) |
---|
728 | enddo |
---|
729 | |
---|
730 | ! fabrication de limit.nc |
---|
731 | CALL writelim (1, phy_nat, phy_alb, phy_sst, phy_bil,phy_rug, & |
---|
732 | phy_ice, phy_fter, phy_foce, phy_flic,phy_fsic) |
---|
733 | |
---|
734 | |
---|
735 | CALL phys_state_var_end |
---|
736 | !Al1 |
---|
737 | IF (restart) THEN |
---|
738 | PRINT*, 'CALL to restart dyn 1d' |
---|
739 | Call dyn1deta0("start1dyn.nc", plev, play, phi, phis,presnivs, & |
---|
740 | u, v, temp, q,omega2) |
---|
741 | |
---|
742 | PRINT*, 'fnday,annee_ref,day_ref,day_ini', & |
---|
743 | fnday, annee_ref,day_ref, day_ini |
---|
744 | !** CALL ymds2ju(annee_ref,mois,day_ini,heure,day) |
---|
745 | day = day_ini |
---|
746 | day_end = day_ini + nday |
---|
747 | daytime = day + time_ini/24. ! 1st day and initial time of the simulation |
---|
748 | |
---|
749 | ! Print out the actual date of the beginning of the simulation : |
---|
750 | CALL ju2ymds(daytime, an, mois, jour, heure) |
---|
751 | print *, ' Time of beginning : y m d h', an, mois,jour, heure/3600. |
---|
752 | |
---|
753 | day = int(daytime) |
---|
754 | time = daytime-day |
---|
755 | |
---|
756 | PRINT*,'****** intialised fields from restart1dyn *******' |
---|
757 | PRINT*, 'plev,play,phi,phis,presnivs,u,v,temp,q,omega2' |
---|
758 | PRINT*,'temp(1),q(1,1),u(1),v(1),plev(1),phis :' |
---|
759 | PRINT*, temp(1), q(1, 1), u(1), v(1), plev(1), phis(1) |
---|
760 | ! raz for safety |
---|
761 | DO l = 1, llm |
---|
762 | d_q_vert_adv(l, 1) = 0. |
---|
763 | enddo |
---|
764 | endif |
---|
765 | !====================== end restart ================================= |
---|
766 | IF (ecrit_slab_oc==1) THEN |
---|
767 | open(97, file = 'div_slab.dat', STATUS = 'UNKNOWN') |
---|
768 | elseif (ecrit_slab_oc==0) THEN |
---|
769 | open(97, file = 'div_slab.dat', STATUS = 'OLD') |
---|
770 | endif |
---|
771 | |
---|
772 | !===================================================================== |
---|
773 | IF (CPPKEY_OUTPUTPHYSSCM) THEN |
---|
774 | CALL iophys_ini(timestep) |
---|
775 | END IF |
---|
776 | |
---|
777 | !===================================================================== |
---|
778 | ! START OF THE TEMPORAL LOOP : |
---|
779 | !===================================================================== |
---|
780 | |
---|
781 | it_end = nint(fnday*day_step) |
---|
782 | DO while(it<=it_end) |
---|
783 | |
---|
784 | IF (prt_level>=1) THEN |
---|
785 | PRINT*, 'XXXXXXXXXXXXXXXXXXX ITAP,day,time=', & |
---|
786 | it, day, time, it_end, day_step |
---|
787 | PRINT*,'PAS DE TEMPS ', timestep |
---|
788 | endif |
---|
789 | IF (it==it_end) lastcall = .True. |
---|
790 | |
---|
791 | !--------------------------------------------------------------------- |
---|
792 | ! Interpolation of forcings in time and onto model levels |
---|
793 | !--------------------------------------------------------------------- |
---|
794 | |
---|
795 | INCLUDE "1D_interp_cases.h" |
---|
796 | |
---|
797 | !--------------------------------------------------------------------- |
---|
798 | ! Geopotential : |
---|
799 | !--------------------------------------------------------------------- |
---|
800 | phis(1)= zsurf*RG |
---|
801 | ! phi(1)=phis(1)+RD*temp(1)*(plev(1)-play(1))/(.5*(plev(1)+play(1))) |
---|
802 | |
---|
803 | ! Calculate geopotential from the ground surface since phi and phis are added in physiq_mod |
---|
804 | phi(1)= RD*temp(1)*(plev(1)-play(1))/(.5*(plev(1)+play(1))) |
---|
805 | |
---|
806 | DO l = 1, llm-1 |
---|
807 | phi(l+1)= phi(l)+RD*(temp(l)+temp(l+1))* & |
---|
808 | (play(l)-play(l+1))/(play(l)+play(l+1)) |
---|
809 | enddo |
---|
810 | |
---|
811 | !--------------------------------------------------------------------- |
---|
812 | ! Vertical advection |
---|
813 | !--------------------------------------------------------------------- |
---|
814 | |
---|
815 | IF (forc_w+forc_omega > 0) THEN |
---|
816 | |
---|
817 | IF (forc_w == 1) THEN |
---|
818 | w_adv = w_mod_cas |
---|
819 | z_adv = phi/RG |
---|
820 | ELSE |
---|
821 | w_adv = omega |
---|
822 | z_adv =play |
---|
823 | ENDIF |
---|
824 | |
---|
825 | teta = temp*(pzero/play)**rkappa |
---|
826 | DO l = 2, llm-1 |
---|
827 | ! vertical tendencies computed as d X / d t = -W d X / d z |
---|
828 | d_u_vert_adv(l)= -w_adv(l)*(u(l+1)-u(l-1))/(z_adv(l+1)-z_adv(l-1)) |
---|
829 | d_v_vert_adv(l)= -w_adv(l)*(v(l+1)-v(l-1))/(z_adv(l+1)-z_adv(l-1)) |
---|
830 | ! d theta / dt = -W d theta / d z, transformed into d temp / d t dividing by (pzero/play(l))**rkappa |
---|
831 | d_t_vert_adv(l)= -w_adv(l)*(teta(l+1)-teta(l-1))/(z_adv(l+1)-z_adv(l-1)) / (pzero/play(l))**rkappa |
---|
832 | d_q_vert_adv(l, 1)= -w_adv(l)*(q(l+1, 1)-q(l-1, 1))/(z_adv(l+1)-z_adv(l-1)) |
---|
833 | enddo |
---|
834 | d_u_adv(:)= d_u_adv(:)+d_u_vert_adv(:) |
---|
835 | d_v_adv(:)= d_v_adv(:)+d_v_vert_adv(:) |
---|
836 | d_t_adv(:)= d_t_adv(:)+d_t_vert_adv(:) |
---|
837 | d_q_adv(:, 1)= d_q_adv(:, 1)+d_q_vert_adv(:, 1) |
---|
838 | |
---|
839 | ENDIF |
---|
840 | |
---|
841 | !--------------------------------------------------------------------- |
---|
842 | ! Listing output for debug prt_level>=1 |
---|
843 | !--------------------------------------------------------------------- |
---|
844 | IF (prt_level>=1) THEN |
---|
845 | print *, ' avant physiq : -------- day time ', day, time |
---|
846 | WRITE(*, *) 'firstcall,lastcall,phis', & |
---|
847 | firstcall, lastcall, phis |
---|
848 | end if |
---|
849 | IF (prt_level>=5) THEN |
---|
850 | WRITE(*, '(a10,2a4,4a13)') 'BEFOR1 IT=', 'it', 'l', & |
---|
851 | 'presniv', 'plev','play', 'phi' |
---|
852 | WRITE(*, '(a10,2i4,4f13.2)') ('BEFOR1 IT= ', it, l, & |
---|
853 | presnivs(l), plev(l), play(l), phi(l), l = 1, llm) |
---|
854 | WRITE(*, '(a11,2a4,a11,6a8)') 'BEFOR2', 'it', 'l', & |
---|
855 | 'presniv', 'u','v', 'temp', 'q1', 'q2', 'omega2' |
---|
856 | WRITE(*, '(a11,2i4,f11.2,5f8.2,e10.2)') ('BEFOR2 IT= ', it, l, & |
---|
857 | presnivs(l), u(l), v(l), temp(l), q(l, 1), q(l, 2), omega2(l), l = 1, llm) |
---|
858 | endif |
---|
859 | |
---|
860 | !--------------------------------------------------------------------- |
---|
861 | ! Call physiq : |
---|
862 | !--------------------------------------------------------------------- |
---|
863 | CALL physiq(ngrid, llm, & |
---|
864 | firstcall, lastcall, timestep, & |
---|
865 | plev, play, phi, phis, presnivs, & |
---|
866 | u, v, rot, temp, q,omega2, & |
---|
867 | du_phys, dv_phys, dt_phys, dq,dpsrf) |
---|
868 | firstcall = .FALSE. |
---|
869 | |
---|
870 | !--------------------------------------------------------------------- |
---|
871 | ! Listing output for debug |
---|
872 | !--------------------------------------------------------------------- |
---|
873 | IF (prt_level>=5) THEN |
---|
874 | WRITE(*, '(a11,2a4,4a13)') 'AFTER1 IT=', 'it', 'l', & |
---|
875 | 'presniv', 'plev','play', 'phi' |
---|
876 | WRITE(*, '(a11,2i4,4f13.2)') ('AFTER1 it= ', it, l, & |
---|
877 | presnivs(l), plev(l), play(l), phi(l), l = 1, llm) |
---|
878 | WRITE(*, '(a11,2a4,a11,6a8)') 'AFTER2', 'it', 'l', & |
---|
879 | 'presniv', 'u','v', 'temp', 'q1', 'q2', 'omega2' |
---|
880 | WRITE(*, '(a11,2i4,f11.2,5f8.2,e10.2)') ('AFTER2 it= ', it, l, & |
---|
881 | presnivs(l), u(l), v(l), temp(l), q(l, 1), q(l, 2), omega2(l), l = 1, llm) |
---|
882 | WRITE(*, '(a11,2a4,a11,5a8)') 'AFTER3', 'it', 'l', & |
---|
883 | 'presniv', 'du_phys','dv_phys', 'dt_phys', 'dq1', 'dq2' |
---|
884 | WRITE(*, '(a11,2i4,f11.2,5f8.2)') ('AFTER3 it= ', it, l, & |
---|
885 | presnivs(l), 86400*du_phys(l), 86400*dv_phys(l), & |
---|
886 | 86400*dt_phys(l), 86400*dq(l, 1), dq(l, 2), l = 1, llm) |
---|
887 | WRITE(*, *) 'dpsrf', dpsrf |
---|
888 | endif |
---|
889 | !--------------------------------------------------------------------- |
---|
890 | ! Add physical tendencies : |
---|
891 | !--------------------------------------------------------------------- |
---|
892 | |
---|
893 | fcoriolis= 2.*sin(rpi*xlat/180.)*romega |
---|
894 | |
---|
895 | IF (prt_level >= 5) PRINT*, 'fcoriolis, xlat,mxcalc ', & |
---|
896 | fcoriolis, xlat, mxcalc |
---|
897 | |
---|
898 | !--------------------------------------------------------------------- |
---|
899 | ! Geostrophic forcing |
---|
900 | !--------------------------------------------------------------------- |
---|
901 | |
---|
902 | IF (forc_geo == 0) THEN |
---|
903 | d_u_age(1:mxcalc)= 0. |
---|
904 | d_v_age(1:mxcalc)= 0. |
---|
905 | ELSE |
---|
906 | sfdt = sin(0.5*fcoriolis*timestep) |
---|
907 | cfdt = cos(0.5*fcoriolis*timestep) |
---|
908 | |
---|
909 | d_u_age(1:mxcalc)= -2.*sfdt/timestep* & |
---|
910 | (sfdt*(u(1:mxcalc)-ug(1:mxcalc)) - & |
---|
911 | cfdt*(v(1:mxcalc)-vg(1:mxcalc))) |
---|
912 | !! : fcoriolis*(v(1:mxcalc)-vg(1:mxcalc)) |
---|
913 | |
---|
914 | d_v_age(1:mxcalc)= -2.*sfdt/timestep* & |
---|
915 | (cfdt*(u(1:mxcalc)-ug(1:mxcalc)) + & |
---|
916 | sfdt*(v(1:mxcalc)-vg(1:mxcalc))) |
---|
917 | !! : -fcoriolis*(u(1:mxcalc)-ug(1:mxcalc)) |
---|
918 | ENDIF |
---|
919 | |
---|
920 | !--------------------------------------------------------------------- |
---|
921 | ! Nudging |
---|
922 | ! EV: rewrite the section to account for a time- and height-varying |
---|
923 | ! nudging |
---|
924 | !--------------------------------------------------------------------- |
---|
925 | d_t_nudge(:) = 0. |
---|
926 | d_u_nudge(:) = 0. |
---|
927 | d_v_nudge(:) = 0. |
---|
928 | d_q_nudge(:, :) = 0. |
---|
929 | |
---|
930 | DO l = 1, llm |
---|
931 | |
---|
932 | IF (nudging_u < 0) THEN |
---|
933 | |
---|
934 | d_u_nudge(l)=(u_nudg_mod_cas(l)-u(l))*invtau_u_nudg_mod_cas(l) |
---|
935 | |
---|
936 | ELSE |
---|
937 | |
---|
938 | IF (play(l) < p_nudging_u .AND. nint(nudging_u) /= 0) & |
---|
939 | d_u_nudge(l)=(u_nudg_mod_cas(l)-u(l))/nudging_u |
---|
940 | |
---|
941 | ENDIF |
---|
942 | |
---|
943 | |
---|
944 | IF (nudging_v < 0) THEN |
---|
945 | |
---|
946 | d_v_nudge(l)=(v_nudg_mod_cas(l)-v(l))*invtau_v_nudg_mod_cas(l) |
---|
947 | |
---|
948 | ELSE |
---|
949 | |
---|
950 | |
---|
951 | IF (play(l) < p_nudging_v .AND. nint(nudging_v) /= 0) & |
---|
952 | d_v_nudge(l)=(v_nudg_mod_cas(l)-v(l))/nudging_v |
---|
953 | |
---|
954 | ENDIF |
---|
955 | |
---|
956 | |
---|
957 | IF (nudging_t < 0) THEN |
---|
958 | |
---|
959 | d_t_nudge(l)=(temp_nudg_mod_cas(l)-temp(l))*invtau_temp_nudg_mod_cas(l) |
---|
960 | |
---|
961 | ELSE |
---|
962 | |
---|
963 | |
---|
964 | IF (play(l) < p_nudging_t .AND. nint(nudging_t) /= 0) & |
---|
965 | d_t_nudge(l)=(temp_nudg_mod_cas(l)-temp(l))/nudging_t |
---|
966 | |
---|
967 | ENDIF |
---|
968 | |
---|
969 | |
---|
970 | IF (nudging_qv < 0) THEN |
---|
971 | |
---|
972 | d_q_nudge(l, 1)=(qv_nudg_mod_cas(l)-q(l, 1))*invtau_qv_nudg_mod_cas(l) |
---|
973 | |
---|
974 | ELSE |
---|
975 | |
---|
976 | IF (play(l) < p_nudging_qv .AND. nint(nudging_qv) /= 0) & |
---|
977 | d_q_nudge(l, 1)=(qv_nudg_mod_cas(l)-q(l, 1))/nudging_qv |
---|
978 | |
---|
979 | ENDIF |
---|
980 | |
---|
981 | ENDDO |
---|
982 | |
---|
983 | !--------------------------------------------------------------------- |
---|
984 | ! Optional outputs |
---|
985 | !--------------------------------------------------------------------- |
---|
986 | |
---|
987 | IF (CPPKEY_OUTPUTPHYSSCM) THEN |
---|
988 | CALL iophys_ecrit('w_adv', klev, 'w_adv', 'K/day', w_adv) |
---|
989 | CALL iophys_ecrit('z_adv', klev, 'z_adv', 'K/day', z_adv) |
---|
990 | CALL iophys_ecrit('dtadv', klev, 'dtadv', 'K/day', 86400*d_t_adv) |
---|
991 | CALL iophys_ecrit('dtdyn', klev, 'dtdyn', 'K/day', 86400*d_t_vert_adv) |
---|
992 | CALL iophys_ecrit('qv', klev, 'qv', 'g/kg', 1000*q(:, 1)) |
---|
993 | CALL iophys_ecrit('qvnud', klev, 'qvnud', 'g/kg', 1000*u_nudg_mod_cas) |
---|
994 | CALL iophys_ecrit('u', klev, 'u', 'm/s', u) |
---|
995 | CALL iophys_ecrit('unud', klev, 'unud', 'm/s', u_nudg_mod_cas) |
---|
996 | CALL iophys_ecrit('v', klev, 'v', 'm/s', v) |
---|
997 | CALL iophys_ecrit('vnud', klev, 'vnud', 'm/s', v_nudg_mod_cas) |
---|
998 | CALL iophys_ecrit('temp', klev, 'temp', 'K', temp) |
---|
999 | CALL iophys_ecrit('tempnud', klev, 'temp_nudg_mod_cas', 'K', temp_nudg_mod_cas) |
---|
1000 | CALL iophys_ecrit('dtnud', klev, 'dtnud', 'K/day', 86400*d_t_nudge) |
---|
1001 | CALL iophys_ecrit('dqnud', klev, 'dqnud', 'K/day', 1000*86400*d_q_nudge(:, 1)) |
---|
1002 | END IF |
---|
1003 | |
---|
1004 | IF (flag_inhib_forcing == 0) then ! if tendency of forcings should be added |
---|
1005 | |
---|
1006 | u(1:mxcalc)= u(1:mxcalc) + timestep*(& |
---|
1007 | du_phys(1:mxcalc) & |
---|
1008 | +d_u_age(1:mxcalc)+d_u_adv(1:mxcalc) & |
---|
1009 | +d_u_nudge(1:mxcalc)) |
---|
1010 | v(1:mxcalc)= v(1:mxcalc) + timestep*(& |
---|
1011 | dv_phys(1:mxcalc) & |
---|
1012 | +d_v_age(1:mxcalc)+d_v_adv(1:mxcalc) & |
---|
1013 | +d_v_nudge(1:mxcalc)) |
---|
1014 | q(1:mxcalc, :)= q(1:mxcalc, :)+timestep*(& |
---|
1015 | dq(1:mxcalc, :) & |
---|
1016 | +d_q_adv(1:mxcalc, :) & |
---|
1017 | +d_q_nudge(1:mxcalc, :)) |
---|
1018 | |
---|
1019 | IF (prt_level>=3) THEN |
---|
1020 | print *, & |
---|
1021 | 'physiq-> temp(1),dt_phys(1),d_t_adv(1),dt_cooling(1) ', & |
---|
1022 | temp(1), dt_phys(1), d_t_adv(1), dt_cooling(1) |
---|
1023 | PRINT*, 'dv_phys=', dv_phys |
---|
1024 | PRINT* , 'd_v_age=', d_v_age |
---|
1025 | PRINT*, 'd_v_adv=',d_v_adv |
---|
1026 | PRINT*, 'd_v_nudge=', d_v_nudge |
---|
1027 | PRINT*, v |
---|
1028 | PRINT*, vg |
---|
1029 | endif |
---|
1030 | |
---|
1031 | temp(1:mxcalc)= temp(1:mxcalc)+timestep*(& |
---|
1032 | dt_phys(1:mxcalc) & |
---|
1033 | +d_t_adv(1:mxcalc) & |
---|
1034 | +d_t_nudge(1:mxcalc) & |
---|
1035 | +dt_cooling(1:mxcalc)) ! Taux de chauffage ou refroid. |
---|
1036 | |
---|
1037 | |
---|
1038 | !======================================================================= |
---|
1039 | !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !! |
---|
1040 | !======================================================================= |
---|
1041 | |
---|
1042 | teta = temp*(pzero/play)**rkappa |
---|
1043 | |
---|
1044 | !--------------------------------------------------------------------- |
---|
1045 | ! Nudge soil temperature if requested |
---|
1046 | !--------------------------------------------------------------------- |
---|
1047 | |
---|
1048 | IF (nudge_tsoil .AND. .NOT. lastcall) THEN |
---|
1049 | ftsoil(1, isoil_nudge, :) = ftsoil(1, isoil_nudge, :) & |
---|
1050 | -timestep/tau_soil_nudge*(ftsoil(1, isoil_nudge, :)-Tsoil_nudge) |
---|
1051 | ENDIF |
---|
1052 | |
---|
1053 | !--------------------------------------------------------------------- |
---|
1054 | ! Add large-scale tendencies (advection, etc) : |
---|
1055 | !--------------------------------------------------------------------- |
---|
1056 | |
---|
1057 | !cc nrlmd |
---|
1058 | !cc tmpvar=teta |
---|
1059 | !cc CALL advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
1060 | !cc |
---|
1061 | !cc teta(1:mxcalc)=tmpvar(1:mxcalc) |
---|
1062 | !cc tmpvar(:)=q(:,1) |
---|
1063 | !cc CALL advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
1064 | !cc q(1:mxcalc,1)=tmpvar(1:mxcalc) |
---|
1065 | !cc tmpvar(:)=q(:,2) |
---|
1066 | !cc CALL advect_vert(llm,omega,timestep,tmpvar,plev) |
---|
1067 | !cc q(1:mxcalc,2)=tmpvar(1:mxcalc) |
---|
1068 | |
---|
1069 | END IF ! end if tendency of tendency should be added |
---|
1070 | |
---|
1071 | !--------------------------------------------------------------------- |
---|
1072 | ! Air temperature : |
---|
1073 | !--------------------------------------------------------------------- |
---|
1074 | IF (lastcall) THEN |
---|
1075 | PRINT*, 'Pas de temps final ', it |
---|
1076 | CALL ju2ymds(daytime, an, mois, jour, heure) |
---|
1077 | PRINT*, 'a la date : a m j h', an, mois, jour, heure/3600. |
---|
1078 | endif |
---|
1079 | |
---|
1080 | ! incremente day time |
---|
1081 | daytime = daytime+1./day_step |
---|
1082 | day = int(daytime+0.1/day_step) |
---|
1083 | ! time = max(daytime-day,0.0) |
---|
1084 | !Al1&jyg: correction de bug |
---|
1085 | !cc time = real(mod(it,day_step))/day_step |
---|
1086 | time = time_ini/24.+real(mod(it, day_step))/day_step |
---|
1087 | it = it+1 |
---|
1088 | |
---|
1089 | enddo |
---|
1090 | |
---|
1091 | IF (ecrit_slab_oc/=-1) close(97) |
---|
1092 | |
---|
1093 | !Al1 Call to 1D equivalent of dynredem (an,mois,jour,heure ?) |
---|
1094 | ! --------------------------------------------------------------------------- |
---|
1095 | CALL dyn1dredem("restart1dyn.nc", & |
---|
1096 | plev, play, phi, phis,presnivs, & |
---|
1097 | u, v, temp, q,omega2) |
---|
1098 | |
---|
1099 | CALL abort_gcm ('lmdz1d ', 'The End ', 0) |
---|
1100 | |
---|
1101 | END SUBROUTINE scm |
---|
1102 | END MODULE lmdz_scm |
---|