source: LMDZ5/trunk/libf/phylmd/dyn1d/lmdz1d.F90 @ 2672

Last change on this file since 2672 was 2672, checked in by fhourdin, 8 years ago

Introduction du cas GABLS4 par Etienne Vignon

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