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