Index: /LMDZ5/trunk/libf/phylmd/YOEGWD.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/YOEGWD.h	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/YOEGWD.h	(revision 1938)
@@ -13,5 +13,16 @@
       real GFRCRIT,GKWAKE,GRCRIT,GVCRIT,GKDRAG,GKLIFT
       real GHMAX,GRAHILO,GSIGCR,GSSEC,GTSEC,GVSEC
-      COMMON/YOEGWD/ GFRCRIT,GKWAKE,GRCRIT,GVCRIT,GKDRAG,GKLIFT         &
-     &        ,GHMAX,GRAHILO,GSIGCR,NKTOPG,NSTRA,GSSEC,GTSEC,GVSEC
+
+      REAL RUWMAX
+!     Maximum Eliassen-Palm flux at launch level, in "FLOTT_GWD_rando"
+
+      REAL SAT ! saturation parameter in "FLOTT_GWD_rando"
+!     S_c in equation (12) of Lott (JGR, vol 118, page 8897, 2013)
+
+
+      COMMON/YOEGWD/ GFRCRIT,GKWAKE,GRCRIT,GVCRIT,GKDRAG,GKLIFT,        &
+     &     GHMAX,GRAHILO,GSIGCR,NKTOPG,NSTRA,GSSEC,GTSEC,GVSEC,         &
+     &     RUWMAX, sat
+
+      save /YOEGWD/
 !$OMP THREADPRIVATE(/YOEGWD/)
Index: /LMDZ5/trunk/libf/phylmd/clesphys.h
===================================================================
--- /LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 1938)
@@ -65,5 +65,5 @@
        CHARACTER(len=4) type_run
 ! aer_type: pour utiliser un fichier constant dans readaerosol 
-       CHARACTER*8 :: aer_type 
+       CHARACTER(len=8) :: aer_type 
        LOGICAL ok_regdyn
        REAL lonmin_ins, lonmax_ins, latmin_ins, latmax_ins
@@ -76,5 +76,5 @@
        INTEGER :: ip_ebil_phy, iflag_rrtm, iflag_ice_thermo
        LOGICAL :: ok_strato
-       LOGICAL :: ok_hines
+       LOGICAL :: ok_hines, ok_gwd_rando
 
        COMMON/clesphys/cycle_diurne, soil_model, new_oliq,              &
@@ -103,5 +103,5 @@
      &     , qsol0,albsno0,evap0                                        &
      &     , iflag_rrtm, ok_strato,ok_hines,ecrit_LES                   &
-     &     , co2_ppm0, iflag_ice_thermo
+     &     , co2_ppm0, iflag_ice_thermo, ok_gwd_rando
      
        save /clesphys/
Index: /LMDZ5/trunk/libf/phylmd/conf_phys_m.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/conf_phys_m.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/conf_phys_m.F90	(revision 1938)
@@ -6,1655 +6,1670 @@
 module conf_phys_m
 
-   implicit none
+  implicit none
 
 contains
 
   subroutine conf_phys(ok_journe, ok_mensuel, ok_instan, ok_hf, &
-                       ok_LES,&
-                       callstats,&
-                       solarlong0,seuil_inversion, &
-                       fact_cldcon, facttemps,ok_newmicro,iflag_radia,&
-                       iflag_cldcon, &
-                       iflag_ratqs,ratqsbas,ratqshaut,tau_ratqs, &
-  		       ok_ade, ok_aie, ok_cdnc, aerosol_couple, &
-                       flag_aerosol, flag_aerosol_strat, new_aod, &
-                       bl95_b0, bl95_b1,&
-                       read_climoz, &
-                       alp_offset)
-
-   use IOIPSL
-   USE surface_data
-   USE phys_cal_mod
-   USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl
-   use control_mod
-
- include "conema3.h"
- include "fisrtilp.h"
- include "nuage.h"
- include "YOMCST.h"
- include "YOMCST2.h"
-
- include "thermcell.h"
- include "iniprint.h"
-
-!IM : on inclut/initialise les taux de CH4, N2O, CFC11 et CFC12
-include "clesphys.h"
-include "compbl.h"
-include "comsoil.h"
-!
-! Configuration de la "physique" de LMDZ a l'aide de la fonction
-! GETIN de IOIPSL
-!
-! LF 05/2001
-!
-
-!
-! type_ocean:      type d'ocean (force, slab, couple)
-! version_ocean:   version d'ocean (opa8/nemo pour type_ocean=couple ou 
-!                                   sicOBS pour type_ocean=slab)
-! ok_veget:   type de modele de vegetation
-! ok_journe:  sorties journalieres
-! ok_hf:  sorties haute frequence
-! ok_mensuel: sorties mensuelles
-! ok_instan:  sorties instantanees
-! ok_ade, ok_aie: apply or not aerosol direct and indirect effects
-! ok_cdnc, ok cloud droplet number concentration
-! flag_aerosol_strat : flag pour les aerosols stratos
-! bl95_b*: parameters in the formula to link CDNC to aerosol mass conc 
-!
-
-
-! Sortie:
-  logical              :: ok_newmicro
-  integer              :: iflag_radia
-  logical              :: ok_journe, ok_mensuel, ok_instan, ok_hf
-  logical              :: ok_LES
-  LOGICAL              :: callstats
-  LOGICAL              :: ok_ade, ok_aie, ok_cdnc, aerosol_couple
-  INTEGER              :: flag_aerosol
-  LOGICAL              :: flag_aerosol_strat
-  LOGICAL              :: new_aod
-  REAL                 :: bl95_b0, bl95_b1
-  real                 :: fact_cldcon, facttemps,ratqsbas,ratqshaut,tau_ratqs
-  integer              :: iflag_cldcon
-  integer              :: iflag_ratqs
-
-  character (len = 6),SAVE  :: type_ocean_omp, version_ocean_omp, ocean_omp
-  character (len = 10),SAVE  :: type_veget_omp
-  CHARACTER(len = 8),SAVE   :: aer_type_omp
-  logical,SAVE              :: ok_snow_omp
-  logical,SAVE              :: ok_newmicro_omp
-  logical,SAVE        :: ok_journe_omp, ok_mensuel_omp, ok_instan_omp, ok_hf_omp        
-  logical,SAVE        :: ok_LES_omp   
-  LOGICAL,SAVE        :: callstats_omp
-  LOGICAL,SAVE        :: ok_ade_omp, ok_aie_omp, ok_cdnc_omp, aerosol_couple_omp
-  INTEGER, SAVE       :: flag_aerosol_omp
-  LOGICAL, SAVE       :: flag_aerosol_strat_omp
-  LOGICAL, SAVE       :: new_aod_omp
-  REAL,SAVE           :: bl95_b0_omp, bl95_b1_omp
-  REAL,SAVE           :: freq_ISCCP_omp, ecrit_ISCCP_omp
-  REAL,SAVE           :: freq_COSP_omp
-  real,SAVE           :: fact_cldcon_omp, facttemps_omp,ratqsbas_omp
-  real,SAVE           :: ratqshaut_omp
-  real,SAVE           :: tau_ratqs_omp
-  integer,SAVE        :: iflag_radia_omp
-  integer,SAVE        :: iflag_rrtm_omp
-  integer,SAVE        :: iflag_cldcon_omp, ip_ebil_phy_omp
-  integer,SAVE        :: iflag_ratqs_omp
-
-  Real,SAVE           :: f_cdrag_ter_omp,f_cdrag_oce_omp
-  Real,SAVE           :: f_rugoro_omp   
-
-! Local
-  real                 :: zzz
-
-  real :: seuil_inversion
-  real,save :: seuil_inversion_omp
-
-  integer,SAVE :: iflag_thermals_ed_omp,iflag_thermals_optflux_omp
-  integer,SAVE :: iflag_thermals_omp,nsplit_thermals_omp
-  real,save :: tau_thermals_omp,alp_bl_k_omp
-!!! nrlmd le 10/04/2012
-  integer,SAVE :: iflag_trig_bl_omp,iflag_clos_bl_omp
-  integer,SAVE :: tau_trig_shallow_omp,tau_trig_deep_omp
-  real,SAVE    :: s_trig_omp
-!!! fin nrlmd le 10/04/2012
-  real :: alp_offset
-  REAL, SAVE :: alp_offset_omp
-  integer,SAVE :: iflag_coupl_omp,iflag_clos_omp,iflag_wake_omp
-  integer,SAVE :: iflag_cvl_sigd_omp
-  REAL, SAVE :: supcrit1_omp, supcrit2_omp
-  INTEGER, SAVE :: iflag_mix_omp
-  real, save :: scut_omp, qqa1_omp, qqa2_omp, gammas_omp, Fmax_omp, alphas_omp
-
-  REAL,SAVE :: R_ecc_omp,R_peri_omp,R_incl_omp,solaire_omp
-  REAL,SAVE :: co2_ppm_omp, RCO2_omp, co2_ppm_per_omp, RCO2_per_omp
-  REAL,SAVE :: CH4_ppb_omp, RCH4_omp, CH4_ppb_per_omp, RCH4_per_omp
-  REAL,SAVE :: N2O_ppb_omp, RN2O_omp, N2O_ppb_per_omp, RN2O_per_omp
-  REAL,SAVE :: CFC11_ppt_omp,RCFC11_omp,CFC11_ppt_per_omp,RCFC11_per_omp
-  REAL,SAVE :: CFC12_ppt_omp,RCFC12_omp,CFC12_ppt_per_omp,RCFC12_per_omp
-  LOGICAL,SAVE :: ok_4xCO2atm_omp
-  REAL,SAVE :: epmax_omp
-  LOGICAL,SAVE :: ok_adj_ema_omp
-  INTEGER,SAVE :: iflag_clw_omp
-  REAL,SAVE :: cld_lc_lsc_omp,cld_lc_con_omp,cld_tau_lsc_omp,cld_tau_con_omp
-  REAL,SAVE :: ffallv_lsc_omp, ffallv_con_omp,coef_eva_omp
-  LOGICAL,SAVE :: reevap_ice_omp
-  INTEGER,SAVE :: iflag_pdf_omp
-  INTEGER,SAVE :: iflag_ice_thermo_omp
-  REAL,SAVE :: rad_froid_omp, rad_chau1_omp, rad_chau2_omp
-  REAL,SAVE :: t_glace_min_omp, t_glace_max_omp
-  REAL,SAVE :: rei_min_omp, rei_max_omp
-  REAL,SAVE :: inertie_sol_omp,inertie_sno_omp,inertie_ice_omp
-  REAL,SAVE :: qsol0_omp
-  REAL,SAVE :: evap0_omp
-  REAL,SAVE :: albsno0_omp
-  REAL      :: solarlong0
-  REAL,SAVE :: solarlong0_omp
-  INTEGER,SAVE :: top_height_omp,overlap_omp
-  REAL,SAVE :: cdmmax_omp,cdhmax_omp,ksta_omp,ksta_ter_omp
-  LOGICAL,SAVE :: ok_kzmin_omp
-  REAL, SAVE ::  fmagic_omp, pmagic_omp
-  INTEGER,SAVE :: iflag_pbl_omp,lev_histhf_omp,lev_histday_omp,lev_histmth_omp
-  Integer, save :: lev_histins_omp, lev_histLES_omp 
-  INTEGER, SAVE :: lev_histdayNMC_omp
-  INTEGER, SAVE :: levout_histNMC_omp(3)
-  LOGICAL, SAVE :: ok_histNMC_omp(3)
-  REAL, SAVE :: freq_outNMC_omp(3), freq_calNMC_omp(3)
-  CHARACTER*4, SAVE :: type_run_omp
-  LOGICAL,SAVE :: ok_cosp_omp
-  LOGICAL,SAVE :: ok_mensuelCOSP_omp,ok_journeCOSP_omp,ok_hfCOSP_omp
-  REAL,SAVE :: lonmin_ins_omp, lonmax_ins_omp, latmin_ins_omp, latmax_ins_omp
-  REAL,SAVE :: ecrit_hf_omp, ecrit_day_omp, ecrit_mth_omp, ecrit_reg_omp
-  REAL,SAVE :: ecrit_ins_omp
-  REAL,SAVE :: ecrit_LES_omp
-  REAL,SAVE :: ecrit_tra_omp
-  REAL,SAVE :: cvl_corr_omp
-  LOGICAL,SAVE :: ok_lic_melt_omp
-!
-  LOGICAL,SAVE :: cycle_diurne_omp,soil_model_omp,new_oliq_omp
-  LOGICAL,SAVE :: ok_orodr_omp, ok_orolf_omp, ok_limitvrai_omp
-  INTEGER, SAVE :: nbapp_rad_omp, iflag_con_omp
-  INTEGER, SAVE :: iflag_ener_conserv_omp
-  INTEGER, SAVE :: iflag_fisrtilp_qsat_omp
-  LOGICAL,SAVE :: ok_strato_omp
-  LOGICAL,SAVE :: ok_hines_omp
-  LOGICAL,SAVE      :: carbon_cycle_tr_omp
-  LOGICAL,SAVE      :: carbon_cycle_cpl_omp
-
-  integer, intent(out):: read_climoz ! read ozone climatology, OpenMP shared
-  ! Allowed values are 0, 1 and 2
-  ! 0: do not read an ozone climatology
-  ! 1: read a single ozone climatology that will be used day and night
-  ! 2: read two ozone climatologies, the average day and night
-  ! climatology and the daylight climatology
-
-!$OMP MASTER 
-!Config Key  = type_ocean 
-!Config Desc = Type d'ocean
-!Config Def  = force
-!Config Help = Type d'ocean utilise: force, slab,couple
-!
-  type_ocean_omp = 'force '
-  call getin('type_ocean', type_ocean_omp)
-!
-!Config Key  = version_ocean 
-!Config Desc = Version d'ocean
-!Config Def  = xxxxxx
-!Config Help = Version d'ocean utilise: opa8/nemo/sicOBS/xxxxxx
-!
-  version_ocean_omp = 'xxxxxx'
-  call getin('version_ocean', version_ocean_omp)
-
-!Config Key  = OCEAN
-!Config Desc = Old parameter name for type_ocean
-!Config Def  = yyyyyy
-!Config Help = This is only for testing purpose
-!
-  ocean_omp = 'yyyyyy'
-  call getin('OCEAN', ocean_omp)
-  IF (ocean_omp /= 'yyyyyy') THEN
-     WRITE(lunout,*)'ERROR!! Old variable name OCEAN used in parmeter file.'
-     WRITE(lunout,*)'Variable OCEAN has been replaced by the variable type_ocean.'
-     WRITE(lunout,*)'You have to update your parameter file physiq.def to succed running'
-     CALL abort_gcm('conf_phys','Variable OCEAN no longer existing, use variable name type_ocean',1)
-  END IF
-
-!
-!Config Key  = VEGET 
-!Config Desc = Type de modele de vegetation
-!Config Def  = .false.
-!Config Help = Type de modele de vegetation utilise
-!
-  type_veget_omp ='orchidee'
-  call getin('VEGET', type_veget_omp)
-!
-
-! Martin
-!Config Key  = ok_snow
-!Config Desc = Flag to activate snow model SISVAT
-!Config Def  = .false.
-  ok_snow_omp = .false.
-  call getin('ok_snow', ok_snow_omp)
-! Martin
-
-!Config Key  = OK_journe
-!Config Desc = Pour des sorties journalieres 
-!Config Def  = .false.
-!Config Help = Pour creer le fichier histday contenant les sorties
-!              journalieres 
-!
-  ok_journe_omp = .false.
-  call getin('OK_journe', ok_journe_omp)
-!
-!Config Key  = ok_hf
-!Config Desc = Pour des sorties haute frequence
-!Config Def  = .false.
-!Config Help = Pour creer le fichier histhf contenant les sorties
-!              haute frequence ( 3h ou 6h)
-!
-  ok_hf_omp = .false.
-  call getin('ok_hf', ok_hf_omp)
-!
-!Config Key  = OK_mensuel
-!Config Desc = Pour des sorties mensuelles 
-!Config Def  = .true.
-!Config Help = Pour creer le fichier histmth contenant les sorties
-!              mensuelles 
-!
-  ok_mensuel_omp = .true.
-  call getin('OK_mensuel', ok_mensuel_omp)
-!
-!Config Key  = OK_instan
-!Config Desc = Pour des sorties instantanees 
-!Config Def  = .false.
-!Config Help = Pour creer le fichier histins contenant les sorties
-!              instantanees 
-!
-  ok_instan_omp = .false.
-  call getin('OK_instan', ok_instan_omp)
-!
-!Config Key  = ok_ade
-!Config Desc = Aerosol direct effect or not?
-!Config Def  = .false.
-!Config Help = Used in radlwsw.F
-!
-  ok_ade_omp = .false.
-  call getin('ok_ade', ok_ade_omp)
-
-!
-!Config Key  = ok_aie
-!Config Desc = Aerosol indirect effect or not?
-!Config Def  = .false.
-!Config Help = Used in nuage.F and radlwsw.F
-!
-  ok_aie_omp = .false.
-  call getin('ok_aie', ok_aie_omp)
-
-!
-!Config Key  = ok_cdnc
-!Config Desc = ok cloud droplet number concentration
-!Config Def  = .false.
-!Config Help = Used in newmicro.F
-!
-  ok_cdnc_omp = .false.
-  call getin('ok_cdnc', ok_cdnc_omp)
-!
-!Config Key  = aerosol_couple
-!Config Desc = read aerosol in file or calcul by inca
-!Config Def  = .false.
-!Config Help = Used in physiq.F
-!
-  aerosol_couple_omp = .false.
-  CALL getin('aerosol_couple',aerosol_couple_omp)
-!
-!Config Key  = flag_aerosol
-!Config Desc = which aerosol is use for coupled model
-!Config Def  = 1
-!Config Help = Used in physiq.F
-!
-! - flag_aerosol=0 => no aerosol
-! - flag_aerosol=1 => so4 only (defaut) 
-! - flag_aerosol=2 => bc  only 
-! - flag_aerosol=3 => pom only
-! - flag_aerosol=4 => seasalt only 
-! - flag_aerosol=5 => dust only
-! - flag_aerosol=6 => all aerosol
-
-  flag_aerosol_omp = 0
-  CALL getin('flag_aerosol',flag_aerosol_omp)
-!
-!Config Key  = flag_aerosol_strat
-!Config Desc = use stratospheric aerosols T/F
-!Config Def  = false
-!Config Help = Used in physiq.F
-!
-!
-  flag_aerosol_strat_omp = .false.
-  CALL getin('flag_aerosol_strat',flag_aerosol_strat_omp)
-
-! Temporary variable for testing purpose!!
-!Config Key  = new_aod
-!Config Desc = which calcul of aeropt
-!Config Def  = false
-!Config Help = Used in physiq.F
-!
-  new_aod_omp = .true.
-  CALL getin('new_aod',new_aod_omp)
-
-! 
-!Config Key  = aer_type 
-!Config Desc = Use a constant field for the aerosols 
-!Config Def  = scenario 
-!Config Help = Used in readaerosol.F90 
-! 
-  aer_type_omp = 'scenario' 
-  call getin('aer_type', aer_type_omp) 
-
-!
-!Config Key  = bl95_b0
-!Config Desc = Parameter in CDNC-maer link (Boucher&Lohmann 1995)
-!Config Def  = .false.
-!Config Help = Used in nuage.F
-!
-  bl95_b0_omp = 2.
-  call getin('bl95_b0', bl95_b0_omp)
-
-!Config Key  = bl95_b1
-!Config Desc = Parameter in CDNC-maer link (Boucher&Lohmann 1995)
-!Config Def  = .false.
-!Config Help = Used in nuage.F
-!
-  bl95_b1_omp = 0.2
-  call getin('bl95_b1', bl95_b1_omp)
-
-!Config Key  = freq_ISCCP
-!Config Desc = Frequence d'appel du simulateur ISCCP en secondes;
-!              par defaut 10800, i.e. 3 heures 
-!Config Def  = 10800.
-!Config Help = Used in ini_histISCCP.h
-!
-  freq_ISCCP_omp = 10800.
-  call getin('freq_ISCCP', freq_ISCCP_omp)
-!
-!Config Key  = ecrit_ISCCP
-!Config Desc = Frequence d'ecriture des resultats du simulateur ISCCP en nombre de jours;
-!              par defaut 1., i.e. 1 jour
-!Config Def  = 1.
-!Config Help = Used in ini_histISCCP.h
-!
-!
-  ecrit_ISCCP_omp = 1.
-  call getin('ecrit_ISCCP', ecrit_ISCCP_omp)
-
-!Config Key  = freq_COSP
-!Config Desc = Frequence d'appel du simulateur COSP en secondes;
-!              par defaut 10800, i.e. 3 heures
-!Config Def  = 10800.
-!Config Help = Used in ini_histdayCOSP.h
-!
-  freq_COSP_omp = 10800.
-  call getin('freq_COSP', freq_COSP_omp)
-
-!
-!Config Key  = ip_ebil_phy
-!Config Desc = Niveau de sortie pour les diags bilan d'energie 
-!Config Def  = 0
-!Config Help = 
-!               
-  ip_ebil_phy_omp = 0
-  call getin('ip_ebil_phy', ip_ebil_phy_omp)
-!
-!Config Key  = seuil_inversion
-!Config Desc = Seuil ur dTh pour le choix entre les schemas de CL
-!Config Def  = -0.1
-!Config Help = 
-!               
-  seuil_inversion_omp = -0.1
-  call getin('seuil_inversion', seuil_inversion_omp)
-
-!!
-!! Constante solaire & Parametres orbitaux & taux gaz effet de serre BEG
-!!
-!Config Key  = R_ecc
-!Config Desc = Excentricite
-!Config Def  = 0.016715
-!Config Help = 
-!               
-!valeur AMIP II
-  R_ecc_omp = 0.016715
-  call getin('R_ecc', R_ecc_omp)
-!!
-!Config Key  = R_peri
-!Config Desc = Equinoxe
-!Config Def  = 
-!Config Help = 
-!               
-!
-!valeur AMIP II
-  R_peri_omp = 102.7
-  call getin('R_peri', R_peri_omp)
-!!
-!Config Key  = R_incl
-!Config Desc = Inclinaison
-!Config Def  = 
-!Config Help = 
-!               
-!
-!valeur AMIP II
-  R_incl_omp = 23.441
-  call getin('R_incl', R_incl_omp)
-!!
-!Config Key  = solaire
-!Config Desc = Constante solaire en W/m2
-!Config Def  = 1365.
-!Config Help = 
-!               
-!
-!valeur AMIP II
-  solaire_omp = 1365.
-  call getin('solaire', solaire_omp)
-!!
-!Config Key  = co2_ppm
-!Config Desc = concentration du gaz carbonique en ppmv
-!Config Def  = 348.
-!Config Help = 
-!               
-!
-!valeur AMIP II
-  co2_ppm_omp = 348.
-  call getin('co2_ppm', co2_ppm_omp)
-!!
-!Config Key  = RCO2
-!Config Desc = Concentration du CO2
-!Config Def  = co2_ppm * 1.0e-06  * 44.011/28.97
-!Config Def  = 348. * 1.0e-06  * 44.011/28.97
-!Config Help = 
-!               
-! RCO2 = 5.286789092164308E-04
-!ancienne valeur
-  RCO2_omp = co2_ppm_omp * 1.0e-06  * 44.011/28.97 ! pour co2_ppm=348.
-
-!!  call getin('RCO2', RCO2)
-!!
-!Config Key  = RCH4
-!Config Desc = Concentration du CH4
-!Config Def  = 1.65E-06* 16.043/28.97
-!Config Help = 
-!               
-!
-!valeur AMIP II
-!OK  RCH4 = 1.65E-06* 16.043/28.97
-! RCH4 = 9.137366240938903E-07
-!
-!ancienne valeur
-! RCH4 = 1.72E-06* 16.043/28.97
-!OK call getin('RCH4', RCH4)
-  zzz = 1650.
-  call getin('CH4_ppb', zzz)
-  CH4_ppb_omp = zzz
-  RCH4_omp = CH4_ppb_omp * 1.0E-09 * 16.043/28.97
-!!
-!Config Key  = RN2O
-!Config Desc = Concentration du N2O
-!Config Def  = 306.E-09* 44.013/28.97
-!Config Help = 
-!               
-!
-!valeur AMIP II
-!OK  RN2O = 306.E-09* 44.013/28.97
-! RN2O = 4.648939592682085E-07
-!
-!ancienne valeur
-! RN2O = 310.E-09* 44.013/28.97
-!OK  call getin('RN2O', RN2O)
-  zzz=306.
-  call getin('N2O_ppb', zzz)
-  N2O_ppb_omp = zzz
-  RN2O_omp = N2O_ppb_omp * 1.0E-09 * 44.013/28.97
-!!
-!Config Key  = RCFC11
-!Config Desc = Concentration du CFC11
-!Config Def  = 280.E-12* 137.3686/28.97
-!Config Help = 
-!               
-!
-!OK RCFC11 = 280.E-12* 137.3686/28.97
-  zzz = 280.
-  call getin('CFC11_ppt',zzz)
-  CFC11_ppt_omp = zzz
-  RCFC11_omp=CFC11_ppt_omp* 1.0E-12 * 137.3686/28.97
-! RCFC11 = 1.327690990680013E-09
-!OK call getin('RCFC11', RCFC11)
-!!
-!Config Key  = RCFC12
-!Config Desc = Concentration du CFC12
-!Config Def  = 484.E-12* 120.9140/28.97
-!Config Help = 
-!               
-!
-!OK RCFC12 = 484.E-12* 120.9140/28.97
-  zzz = 484.
-  call getin('CFC12_ppt',zzz)
-  CFC12_ppt_omp = zzz
-  RCFC12_omp = CFC12_ppt_omp * 1.0E-12 * 120.9140/28.97
-! RCFC12 = 2.020102726958923E-09
-!OK call getin('RCFC12', RCFC12)
-
-!ajout CFMIP begin
-!!
-!Config Key  = co2_ppm_per
-!Config Desc = concentration du co2_ppm_per
-!Config Def  = 348.
-!Config Help = 
-!               
-  co2_ppm_per_omp = co2_ppm_omp
-  call getin('co2_ppm_per', co2_ppm_per_omp)
-!!
-!Config Key  = RCO2_per
-!Config Desc = Concentration du CO2_per
-!Config Def  = co2_ppm_per * 1.0e-06  * 44.011/28.97
-!Config Def  = 348. * 1.0e-06  * 44.011/28.97
-!Config Help = 
-!               
-  RCO2_per_omp = co2_ppm_per_omp * 1.0e-06  * 44.011/28.97
-
-!Config Key  = ok_4xCO2atm
-!Config Desc = Calcul ou non effet radiatif 4xco2
-!Config Def  = .false.
-!Config Help = 
-
-  ok_4xCO2atm_omp = .false.
-  call getin('ok_4xCO2atm',ok_4xCO2atm_omp)
-
-!Config Key  = RCH4_per
-!Config Desc = Concentration du CH4_per
-!Config Def  = 1.65E-06* 16.043/28.97
-!Config Help = 
-!               
-  zzz = CH4_ppb_omp
-  call getin('CH4_ppb_per', zzz)
-  CH4_ppb_per_omp = zzz
-  RCH4_per_omp = CH4_ppb_per_omp * 1.0E-09 * 16.043/28.97
-!!
-!Config Key  = RN2O_per
-!Config Desc = Concentration du N2O_per
-!Config Def  = 306.E-09* 44.013/28.97
-!Config Help = 
-!               
-  zzz = N2O_ppb_omp
-  call getin('N2O_ppb_per', zzz)
-  N2O_ppb_per_omp = zzz
-  RN2O_per_omp = N2O_ppb_per_omp * 1.0E-09 * 44.013/28.97
-!!
-!Config Key  = RCFC11_per
-!Config Desc = Concentration du CFC11_per
-!Config Def  = 280.E-12* 137.3686/28.97
-!Config Help = 
-!               
-  zzz = CFC11_ppt_omp
-  call getin('CFC11_ppt_per',zzz)
-  CFC11_ppt_per_omp = zzz
-  RCFC11_per_omp=CFC11_ppt_per_omp* 1.0E-12 * 137.3686/28.97
-!!
-!Config Key  = RCFC12_per
-!Config Desc = Concentration du CFC12_per
-!Config Def  = 484.E-12* 120.9140/28.97
-!Config Help = 
-!               
-  zzz = CFC12_ppt_omp
-  call getin('CFC12_ppt_per',zzz)
-  CFC12_ppt_per_omp = zzz
-  RCFC12_per_omp = CFC12_ppt_per_omp * 1.0E-12 * 120.9140/28.97
-!ajout CFMIP end
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
-! Constantes precedemment dans dyn3d/conf_gcm
-
-!Config  Key  = cycle_diurne
-!Config  Desc = Cycle ddiurne
-!Config  Def  = y
-!Config  Help = Cette option permet d'eteidre le cycle diurne.
-!Config         Peut etre util pour accelerer le code !
-       cycle_diurne_omp = .TRUE.
-       CALL getin('cycle_diurne',cycle_diurne_omp)
-
-!Config  Key  = soil_model
-!Config  Desc = Modele de sol
-!Config  Def  = y
-!Config  Help = Choix du modele de sol (Thermique ?)
-!Config         Option qui pourait un string afin de pouvoir
-!Config         plus de choix ! Ou meme une liste d'options !
-       soil_model_omp = .TRUE.
-       CALL getin('soil_model',soil_model_omp)
-
-!Config  Key  = new_oliq
-!Config  Desc = Nouvelle eau liquide
-!Config  Def  = y
-!Config  Help = Permet de mettre en route la
-!Config         nouvelle parametrisation de l'eau liquide !
-       new_oliq_omp = .TRUE.
-       CALL getin('new_oliq',new_oliq_omp)
-
-!Config  Key  = ok_orodr
-!Config  Desc = Orodr ???
-!Config  Def  = y
-!Config  Help = Y en a pas comprendre !
-!Config         
-       ok_orodr_omp = .TRUE.
-       CALL getin('ok_orodr',ok_orodr_omp)
-
-!Config  Key  =  ok_orolf
-!Config  Desc = Orolf ??
-!Config  Def  = y
-!Config  Help = Connais pas !
-       ok_orolf_omp = .TRUE.
-       CALL getin('ok_orolf', ok_orolf_omp)
-
-!Config  Key  = ok_limitvrai
-!Config  Desc = Force la lecture de la bonne annee
-!Config  Def  = n
-!Config  Help = On peut forcer le modele a lire le
-!Config         fichier SST de la bonne annee. C'est une tres bonne
-!Config         idee, pourquoi ne pas mettre toujours a y ???
-       ok_limitvrai_omp = .FALSE.
-       CALL getin('ok_limitvrai',ok_limitvrai_omp)
-
-!Config  Key  = nbapp_rad
-!Config  Desc = Frequence d'appel au rayonnement
-!Config  Def  = 12
-!Config  Help = Nombre  d'appels des routines de rayonnements
-!Config         par jour.
-       nbapp_rad_omp = 12
-       CALL getin('nbapp_rad',nbapp_rad_omp)
-
-!Config  Key  = iflag_con
-!Config  Desc = Flag de convection
-!Config  Def  = 2
-!Config  Help = Flag  pour la convection les options suivantes existent :
-!Config         1 pour LMD,
-!Config         2 pour Tiedtke,
-!Config         3 pour CCM(NCAR)  
-       iflag_con_omp = 2
-       CALL getin('iflag_con',iflag_con_omp)
-
-!Config  Key  = iflag_ener_conserv
-!Config  Desc = Flag de convection
-!Config  Def  = 1
-!Config  Help = Flag  pour la convection les options suivantes existent :
-!Config         -1 pour Kinetic energy correction
-!Config         1  conservation kinetic and enthalpy
-       iflag_ener_conserv_omp = -1
-       CALL getin('iflag_ener_conserv',iflag_ener_conserv_omp)
-
-!Config  Key  = iflag_fisrtilp_qsat
-!Config  Desc = Flag de convection
-!Config  Def  = 1
-!Config  Help = Flag  pour la convection les options suivantes existent :
-!Config         -1 pour Kinetic energy correction
-!Config         1  conservation kinetic and enthalpy
-       iflag_fisrtilp_qsat_omp = 0
-       CALL getin('iflag_fisrtilp_qsat',iflag_fisrtilp_qsat_omp)
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!
-!! Constante solaire & Parametres orbitaux & taux gaz effet de serre END
-!!
-!! KE
-!
-
-!Config key  = cvl_corr
-!Config Desc = Facteur multiplication des precip convectives dans KE
-!Config Def  = 1.00
-!Config Help = 1.02 pour un moderne ou un pre-ind. A ajuster pour un glaciaire
-  cvl_corr_omp = 1.00
-  CALL getin('cvl_corr', cvl_corr_omp)
-
-
-!Config Key  = epmax
-!Config Desc = Efficacite precip
-!Config Def  = 0.993
-!Config Help = 
-!
-  epmax_omp = .993
-  call getin('epmax', epmax_omp)
-!
-!Config Key  = ok_adj_ema
-!Config Desc =  
-!Config Def  = false
-!Config Help = 
-!
-  ok_adj_ema_omp = .false.
-  call getin('ok_adj_ema',ok_adj_ema_omp)
-!
-!Config Key  = iflag_clw
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_clw_omp = 0
-  call getin('iflag_clw',iflag_clw_omp)
-!
-!Config Key  = cld_lc_lsc 
-!Config Desc =  
-!Config Def  = 2.6e-4
-!Config Help = 
-!
-  cld_lc_lsc_omp = 2.6e-4
-  call getin('cld_lc_lsc',cld_lc_lsc_omp)
-!
-!Config Key  = cld_lc_con
-!Config Desc =  
-!Config Def  = 2.6e-4
-!Config Help = 
-!
-  cld_lc_con_omp = 2.6e-4
-  call getin('cld_lc_con',cld_lc_con_omp)
-!
-!Config Key  = cld_tau_lsc
-!Config Desc =  
-!Config Def  = 3600.
-!Config Help = 
-!
-  cld_tau_lsc_omp = 3600.
-  call getin('cld_tau_lsc',cld_tau_lsc_omp)
-!
-!Config Key  = cld_tau_con
-!Config Desc =  
-!Config Def  = 3600.
-!Config Help = 
-!
-  cld_tau_con_omp = 3600.
-  call getin('cld_tau_con',cld_tau_con_omp)
-!
-!Config Key  = ffallv_lsc
-!Config Desc =  
-!Config Def  = 1.
-!Config Help = 
-!
-  ffallv_lsc_omp = 1.
-  call getin('ffallv_lsc',ffallv_lsc_omp)
-!
-!Config Key  = ffallv_con
-!Config Desc =  
-!Config Def  = 1.
-!Config Help = 
-!
-  ffallv_con_omp = 1.
-  call getin('ffallv_con',ffallv_con_omp)
-!
-!Config Key  = coef_eva
-!Config Desc =  
-!Config Def  = 2.e-5
-!Config Help = 
-!
-  coef_eva_omp = 2.e-5
-  call getin('coef_eva',coef_eva_omp)
-!
-!Config Key  = reevap_ice
-!Config Desc =  
-!Config Def  = .false.
-!Config Help = 
-!
-  reevap_ice_omp = .false.
-  call getin('reevap_ice',reevap_ice_omp)
-
-!Config Key  = iflag_ratqs
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  iflag_ratqs_omp = 1
-  call getin('iflag_ratqs',iflag_ratqs_omp)
-
-!
-!Config Key  = iflag_radia 
-!Config Desc =  
-!Config Def  = 1
-!Config Help = 
-!
-  iflag_radia_omp = 1
-  call getin('iflag_radia',iflag_radia_omp)
-
-!
-!Config Key  = iflag_rrtm 
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_rrtm_omp = 0
-  call getin('iflag_rrtm',iflag_rrtm_omp)
-
-!
-!Config Key  = iflag_cldcon 
-!Config Desc =  
-!Config Def  = 1
-!Config Help = 
-!
-  iflag_cldcon_omp = 1
-  call getin('iflag_cldcon',iflag_cldcon_omp)
-
-!
-!Config Key  = iflag_pdf 
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_pdf_omp = 0
-  call getin('iflag_pdf',iflag_pdf_omp)
-!
-!Config Key  = fact_cldcon
-!Config Desc =  
-!Config Def  = 0.375
-!Config Help = 
-!
-  fact_cldcon_omp = 0.375
-  call getin('fact_cldcon',fact_cldcon_omp)
-
-!
-!Config Key  = facttemps
-!Config Desc =  
-!Config Def  = 1.e-4
-!Config Help = 
-!
-  facttemps_omp = 1.e-4
-  call getin('facttemps',facttemps_omp)
-
-!
-!Config Key  = ok_newmicro
-!Config Desc =  
-!Config Def  = .true.
-!Config Help = 
-!
-  ok_newmicro_omp = .true.
-  call getin('ok_newmicro',ok_newmicro_omp)
-!
-!Config Key  = ratqsbas
-!Config Desc =  
-!Config Def  = 0.01
-!Config Help = 
-!
-  ratqsbas_omp = 0.01
-  call getin('ratqsbas',ratqsbas_omp)
-!
-!Config Key  = ratqshaut
-!Config Desc =  
-!Config Def  = 0.3
-!Config Help = 
-!
-  ratqshaut_omp = 0.3
-  call getin('ratqshaut',ratqshaut_omp)
-
-!Config Key  = tau_ratqs
-!Config Desc =  
-!Config Def  = 1800.
-!Config Help = 
-!
-  tau_ratqs_omp = 1800.
-  call getin('tau_ratqs',tau_ratqs_omp)
-
-!
-!-----------------------------------------------------------------------
-! Longitude solaire pour le calcul de l'ensoleillement en degre
-! si on veut imposer la saison. Sinon, solarlong0=-999.999
-!Config Key  = solarlong0
-!Config Desc =  
-!Config Def  = -999.999 
-!Config Help = 
-!
-  solarlong0_omp = -999.999
-  call getin('solarlong0',solarlong0_omp)
-!
-!-----------------------------------------------------------------------
-!  Valeur imposee pour configuration idealisees
-!Config Key  = qsol0 pour le bucket, evap0 pour aquaplanetes, albsno0
-! Default value -1 to activate the full computation
-  qsol0_omp = -1.
-  call getin('qsol0',qsol0_omp)
-  evap0_omp = -1.
-  call getin('evap0',evap0_omp)
-  albsno0_omp = -1.
-  call getin('albsno0',albsno0_omp)
-!
-!-----------------------------------------------------------------------
-!
-!Config Key  = inertie_ice
-!Config Desc =  
-!Config Def  = 2000.
-!Config Help = 
-!
-  inertie_ice_omp = 2000.
-  call getin('inertie_ice',inertie_ice_omp)
-!
-!Config Key  = inertie_sno
-!Config Desc =  
-!Config Def  = 2000.
-!Config Help = 
-!
-  inertie_sno_omp = 2000.
-  call getin('inertie_sno',inertie_sno_omp)
-!
-!Config Key  = inertie_sol
-!Config Desc =  
-!Config Def  = 2000.
-!Config Help = 
-!
-  inertie_sol_omp = 2000.
-  call getin('inertie_sol',inertie_sol_omp)
-
-!
-!Config Key  = rad_froid
-!Config Desc =  
-!Config Def  = 35.0
-!Config Help = 
-!
-  rad_froid_omp = 35.0
-  call getin('rad_froid',rad_froid_omp)
-
-!
-!Config Key  = rad_chau1
-!Config Desc =  
-!Config Def  = 13.0
-!Config Help = 
-!
-  rad_chau1_omp = 13.0
-  call getin('rad_chau1',rad_chau1_omp)
-
-!
-!Config Key  = rad_chau2
-!Config Desc =  
-!Config Def  = 9.0
-!Config Help = 
-!
-  rad_chau2_omp = 9.0
-  call getin('rad_chau2',rad_chau2_omp)
-
-!
-!Config Key  = t_glace_min
-!Config Desc =  
-!Config Def  = 258.
-!Config Help = 
-!
-  t_glace_min_omp = 258.
-  call getin('t_glace_min',t_glace_min_omp)
-
-!
-!Config Key  = t_glace_max
-!Config Desc =  
-!Config Def  = 273.13
-!Config Help = 
-!
-  t_glace_max_omp = 273.13
-  call getin('t_glace_max',t_glace_max_omp)
-
-!
-!Config Key  = iflag_ice_thermo
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_ice_thermo_omp = 0
-  call getin('iflag_ice_thermo',iflag_ice_thermo_omp)
-
-!Config Key  = rei_min
-!Config Desc =  
-!Config Def  = 3.5
-!Config Help = 
-!
-  rei_min_omp = 3.5
-  call getin('rei_min',rei_min_omp)
-
-!
-!Config Key  = rei_max
-!Config Desc =  
-!Config Def  = 61.29
-!Config Help = 
-!
-  rei_max_omp = 61.29
-  call getin('rei_max',rei_max_omp)
-
-!
-!Config Key  = top_height
-!Config Desc =
-!Config Def  = 3
-!Config Help =
-!
-  top_height_omp = 3
-  call getin('top_height',top_height_omp)
-
-!
-!Config Key  = overlap
-!Config Desc =
-!Config Def  = 3
-!Config Help =
-!
-  overlap_omp = 3
-  call getin('overlap',overlap_omp)
-
-
-!
-!
-!Config Key  = cdmmax
-!Config Desc =
-!Config Def  = 1.3E-3
-!Config Help =
-!
-  cdmmax_omp = 1.3E-3
-  call getin('cdmmax',cdmmax_omp)
-
-!
-!Config Key  = cdhmax
-!Config Desc =
-!Config Def  = 1.1E-3
-!Config Help =
-!
-  cdhmax_omp = 1.1E-3
-  call getin('cdhmax',cdhmax_omp)
-
-!261103
-!
-!Config Key  = ksta
-!Config Desc =
-!Config Def  = 1.0e-10
-!Config Help =
-!
-  ksta_omp = 1.0e-10
-  call getin('ksta',ksta_omp)
-
-!
-!Config Key  = ksta_ter
-!Config Desc =
-!Config Def  = 1.0e-10
-!Config Help =
-!
-  ksta_ter_omp = 1.0e-10
-  call getin('ksta_ter',ksta_ter_omp)
-
-!
-!Config Key  = ok_kzmin
-!Config Desc =
-!Config Def  = .true.
-!Config Help =
-!
-  ok_kzmin_omp = .true.
-  call getin('ok_kzmin',ok_kzmin_omp)
-
-!
-!Config Key  = fmagic
-!Config Desc = additionnal multiplicator factor used for albedo
-!Config Def  = 1.
-!Config Help = additionnal multiplicator factor used in albedo.F
-!
-  fmagic_omp = 1.
-  call getin('fmagic',fmagic_omp)
-
-!
-!Config Key  = pmagic
-!Config Desc = additional factor used for albedo
-!Config Def  = 0.
-!Config Help = additional factor used in albedo.F
-!
-  pmagic_omp = 0.
-  call getin('pmagic',pmagic_omp)
-
-
-!Config Key = ok_lic_melt
-!Config Desc = Prise en compte de la fonte de la calotte dans le bilan d'eau
-!Config Def  = .false.
-!Config Help = mettre a .false. pour assurer la conservation en eau
-  ok_lic_melt_omp = .false.
-  call getin('ok_lic_melt', ok_lic_melt_omp)
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! PARAMETER FOR THE PLANETARY BOUNDARY LAYER
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-!Config Key  = iflag_pbl
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  iflag_pbl_omp = 1
-  call getin('iflag_pbl',iflag_pbl_omp)
-!
-!Config Key  = iflag_thermals
-!Config Desc =
-!Config Def  = 0
-!Config Help =
-!
-  iflag_thermals_omp = 0
-  call getin('iflag_thermals',iflag_thermals_omp)
-!
-!
-!Config Key  = iflag_thermals_ed
-!Config Desc =
-!Config Def  = 0
-!Config Help =
-!
-  iflag_thermals_ed_omp = 0
-  call getin('iflag_thermals_ed',iflag_thermals_ed_omp)
-!
-!
-!Config Key  = iflag_thermals_optflux
-!Config Desc =
-!Config Def  = 0
-!Config Help =
-!
-  iflag_thermals_optflux_omp = 0
-  call getin('iflag_thermals_optflux',iflag_thermals_optflux_omp)
-!
-!
-!Config Key  = nsplit_thermals
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  nsplit_thermals_omp = 1
-  call getin('nsplit_thermals',nsplit_thermals_omp)
-
-!Config Key  = alp_bl_k
-!Config Desc =
-!Config Def  = 0.
-!Config Help =
-!
-  alp_bl_k_omp = 1.
-  call getin('alp_bl_k',alp_bl_k_omp)
-
-!!! nrlmd le 10/04/2012
-
-!Config Key  = iflag_trig_bl
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_trig_bl_omp = 0
-  call getin('iflag_trig_bl',iflag_trig_bl_omp)
-
-!Config Key  = s_trig_bl
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  s_trig_omp = 2e7
-  call getin('s_trig',s_trig_omp)
-
-!Config Key  = tau_trig_shallow
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  tau_trig_shallow_omp = 600
-  call getin('tau_trig_shallow',tau_trig_shallow_omp)
-
-!Config Key  = tau_trig_deep
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  tau_trig_deep_omp = 1800
-  call getin('tau_trig_deep',tau_trig_deep_omp)
-
-!Config Key  = iflag_clos_bl
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_clos_bl_omp = 0
-  call getin('iflag_clos_bl',iflag_clos_bl_omp)
-
-!!! fin nrlmd le 10/04/2012
-
-!
-!Config Key  = tau_thermals
-!Config Desc =
-!Config Def  = 0.
-!Config Help =
-!
-  tau_thermals_omp = 0.
-  call getin('tau_thermals',tau_thermals_omp)
-
-!
-!Config Key  = iflag_coupl
-!Config Desc =
-!Config Def  = 0
-!Config Help =
-!
-  iflag_coupl_omp = 0
-  call getin('iflag_coupl',iflag_coupl_omp)
-
-!
-!Config Key  = iflag_clos
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_clos_omp = 1
-  call getin('iflag_clos',iflag_clos_omp)
-!
-!Config Key  = iflag_cvl_sigd
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_cvl_sigd_omp = 0
-  call getin('iflag_cvl_sigd',iflag_cvl_sigd_omp)
-
-!Config Key  = iflag_wake
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  iflag_wake_omp = 0
-  call getin('iflag_wake',iflag_wake_omp)
-
-!Config Key  = alp_offset
-!Config Desc =  
-!Config Def  = 0
-!Config Help = 
-!
-  alp_offset_omp = 0.
-  call getin('alp_offset',alp_offset_omp)
-
-!
-!Config Key  = lev_histhf
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  lev_histhf_omp = 1
-  call getin('lev_histhf',lev_histhf_omp)
-
-!
-!Config Key  = lev_histday
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  lev_histday_omp = 1
-  call getin('lev_histday',lev_histday_omp)
-
-!
-!Config Key  = lev_histmth
-!Config Desc =
-!Config Def  = 2
-!Config Help =
-!
-  lev_histmth_omp = 2
-  call getin('lev_histmth',lev_histmth_omp)
-!
-!Config Key  = lev_histins
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  lev_histins_omp = 1
-  call getin('lev_histins',lev_histins_omp)
-  !
-!Config Key  = lev_histLES
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  lev_histLES_omp = 1
-  call getin('lev_histLES',lev_histLES_omp)
-! 
-!Config Key  = lev_histdayNMC
-!Config Desc =
-!Config Def  = 8
-!Config Help =
-!
-  lev_histdayNMC_omp = 8
-  call getin('lev_histdayNMC',lev_histdayNMC_omp)
-!
-!Config Key  = levout_histNMC
-!Config Desc =
-!Config Def  = 5
-!Config Help =
-!
-  levout_histNMC_omp(1) = 5
-  levout_histNMC_omp(2) = 5
-  levout_histNMC_omp(3) = 5
-  call getin('levout_histNMC',levout_histNMC_omp)
-!
-!histNMC BEG
-!Config Key  = ok_histNMC
-!Config Desc = ok_histNMC(1) = frequence de sortie fichiers histmthNMC
-!Config Desc = ok_histNMC(2) = frequence de sortie fichiers histdayNMC
-!Config Desc = ok_histNMC(3) = frequence de sortie fichiers histhfNMC
-!Config Def  = n, n, n
-!Config Help =
-!
-  ok_histNMC_omp(1) = .false.
-  ok_histNMC_omp(2) = .false.
-  ok_histNMC_omp(3) = .false.
-  call getin('ok_histNMC',ok_histNMC_omp)
-!
-!Config Key  = freq_outNMC
-!Config Desc = freq_outNMC(1) = frequence de sortie fichiers histmthNMC
-!Config Desc = freq_outNMC(2) = frequence de sortie fichiers histdayNMC
-!Config Desc = freq_outNMC(3) = frequence de sortie fichiers histhfNMC
-!Config Def  = 2592000., 86400., 21600. (1mois, 1jour, 6h) 
-!Config Help =
-!
-  freq_outNMC_omp(1) = mth_len
-  freq_outNMC_omp(2) = 1.
-  freq_outNMC_omp(3) = 1./4.
-  call getin('freq_outNMC',freq_outNMC_omp)
-!
-!Config Key  = freq_calNMC
-!Config Desc = freq_calNMC(1) = frequence de calcul fichiers histmthNMC
-!Config Desc = freq_calNMC(2) = frequence de calcul fichiers histdayNMC
-!Config Desc = freq_calNMC(3) = frequence de calcul fichiers histhfNMC
-!Config Def  = pasphys
-!Config Help =
-!
-  freq_calNMC_omp(1) = pasphys
-  freq_calNMC_omp(2) = pasphys
-  freq_calNMC_omp(3) = pasphys
-  call getin('freq_calNMC',freq_calNMC_omp)
-!
-!Config Key  = type_run
-!Config Desc =
-!Config Def  = 'AMIP'/'CFMIP'  ou 'CLIM'/'ENSP'
-!Config Help =
-!
-  type_run_omp = 'AMIP'
-  call getin('type_run',type_run_omp)
-
-!
-!Config Key  = ok_cosp
-!Config Desc =
-!Config Def  = .false.
-!Config Help =
-!
-  ok_cosp_omp = .false.
-  call getin('ok_cosp',ok_cosp_omp)
-
-!
-!Config Key  = ok_mensuelCOSP
-!Config Desc =
-!Config Def  = .true.
-!Config Help =
-!
-  ok_mensuelCOSP_omp = .true.
-  call getin('ok_mensuelCOSP',ok_mensuelCOSP_omp)
-
-!
-!Config Key  = ok_journeCOSP
-!Config Desc =
-!Config Def  = .true.
-!Config Help = 
-!
-  ok_journeCOSP_omp = .true.
-  call getin('ok_journeCOSP',ok_journeCOSP_omp)
-
-!
-!Config Key  = ok_hfCOSP
-!Config Desc =
-!Config Def  = .false.
-!Config Help =
-!
-  ok_hfCOSP_omp = .false.
-  call getin('ok_hfCOSP',ok_hfCOSP_omp)
-
-!
-! coordonnees (lonmin_ins, lonmax_ins, latmin_ins, latmax_ins) pour la zone 
-! avec sorties instantannees tous les pas de temps de la physique => "histbilKP_ins.nc"
-!
-!Config Key  = lonmin_ins
-!Config Desc = 100.  
-!Config Def  = longitude minimale sorties "bilKP_ins"
-!Config Help = 
-!
-   lonmin_ins_omp = 100.
-   call getin('lonmin_ins',lonmin_ins_omp)
-!
-!Config Key  = lonmax_ins
-!Config Desc = 130. 
-!Config Def  = longitude maximale sorties "bilKP_ins"
-!Config Help =
-!
-   lonmax_ins_omp = 130.
-   call getin('lonmax_ins',lonmax_ins_omp)
-!
-!Config Key  = latmin_ins
-!Config Desc = -20.  
-!Config Def  = latitude minimale sorties "bilKP_ins"
-!Config Help = 
-!
-   latmin_ins_omp = -20.
-   call getin('latmin_ins',latmin_ins_omp)
-!
-!Config Key  = latmax_ins
-!Config Desc = 20. 
-!Config Def  = latitude maximale sorties "bilKP_ins"
-!Config Help =
-!
-   latmax_ins_omp = 20.
-   call getin('latmax_ins',latmax_ins_omp)
-!
-!Config Key  = ecrit_hf
-!Config Desc =
-!Config Def  = 1./8. !toutes les 3h
-!Config Help =
-!
-  ecrit_hf_omp = 1./8.
-  call getin('ecrit_hf',ecrit_hf_omp)
-!
-!Config Key  = ecrit_ins
-!Config Desc =
-!Config Def  = 1./48. ! toutes les 1/2 h
-!Config Help =
-!
-  ecrit_ins_omp = 1./48.
-  call getin('ecrit_ins',ecrit_ins_omp)
-!
-!Config Key  = ecrit_day
-!Config Desc =
-!Config Def  = 1.0 !tous les jours
-!Config Help = nombre de jours pour ecriture fichier histday.nc
-!
-  ecrit_day_omp = 1.0
-  call getin('ecrit_day',ecrit_day_omp)
-!
-!Config Key  = ecrit_mth
-!Config Desc =
-!Config Def  = 30. !tous les 30jours (1 fois par mois)
-!Config Help =
-!
-  ecrit_mth_omp = 30.
-  call getin('ecrit_mth',ecrit_mth_omp)
-!
-!Config Key  = ecrit_tra
-!Config Desc =
-!Config Def  = 30. !tous les 30jours (1 fois par mois)
-!Config Help =
-!
-  ecrit_tra_omp = 0.
-  call getin('ecrit_tra',ecrit_tra_omp)
-!
-!Config Key  = ecrit_reg
-!Config Desc =
-!Config Def  = 0.25  !4 fois par jour
-!Config Help =
-!
-  ecrit_reg_omp = 0.25   !4 fois par jour
-  call getin('ecrit_reg',ecrit_reg_omp)
-!
-!
-!
-! PARAMETRES CDRAG
-!
-!Config Key  = f_cdrag_ter
-!Config Desc =
-!Config Def  = 0.8
-!Config Help =
-!
-  f_cdrag_ter_omp = 0.8
-  call getin('f_cdrag_ter',f_cdrag_ter_omp)
-!
-!Config Key  = f_cdrag_oce
-!Config Desc =
-!Config Def  = 0.8
-!Config Help =
-!
-  f_cdrag_oce_omp = 0.8
-  call getin('f_cdrag_oce',f_cdrag_oce_omp)
-!
-! RUGORO
-!Config Key  = f_rugoro
-!Config Desc =
-!Config Def  = 0.
-!Config Help =
-!
-  f_rugoro_omp = 0.
-  call getin('f_rugoro',f_rugoro_omp)
-
-! PARAMETERS FOR CONVECTIVE INHIBITION BY TROPOS. DRYNESS
-!
-!Config Key  = supcrit1
-!Config Desc =
-!Config Def  = .540
-!Config Help =
-!
-  supcrit1_omp = .540
-  call getin('supcrit1',supcrit1_omp)
-
-!
-!Config Key  = supcrit2
-!Config Desc =
-!Config Def  = .600
-!Config Help =
-!
-  supcrit2_omp = .600
-  call getin('supcrit2',supcrit2_omp)
-
-!
-! PARAMETERS FOR THE MIXING DISTRIBUTION
-! iflag_mix: 0=OLD, 
-!            1=NEW (JYG),            
-!            2=NEW + conv. depth inhib. by tropos. dryness
-! '2' is NOT operationnal and should not be used.
-!
-!Config Key  = iflag_mix
-!Config Desc =
-!Config Def  = 1
-!Config Help =
-!
-  iflag_mix_omp = 1
-  call getin('iflag_mix',iflag_mix_omp)
-
-!
-!Config Key  = scut
-!Config Desc =
-!Config Def  = 0.95
-!Config Help =
-!
-  scut_omp = 0.95
-  call getin('scut',scut_omp)
-
-!
-!Config Key  = qqa1
-!Config Desc =
-!Config Def  = 1.0
-!Config Help =
-!
-  qqa1_omp = 1.0
-  call getin('qqa1',qqa1_omp)
-
-!
-!Config Key  = qqa2
-!Config Desc =
-!Config Def  = 0.0
-!Config Help =
-!
-  qqa2_omp = 0.0
-  call getin('qqa2',qqa2_omp)
-
-!
-!Config Key  = gammas
-!Config Desc =
-!Config Def  = 0.05
-!Config Help =
-!
-  gammas_omp = 0.05
-  call getin('gammas',gammas_omp)
-
-!
-!Config Key  = Fmax
-!Config Desc =
-!Config Def  = 0.65
-!Config Help =
-!
-  Fmax_omp = 0.65
-  call getin('Fmax',Fmax_omp)
-
-!
-!Config Key  = alphas  
-!Config Desc =
-!Config Def  = -5.
-!Config Help =
-!
-  alphas_omp = -5.
-  call getin('alphas',alphas_omp)
-
-!Config key = ok_strato
-!Config  Desc = activation de la version strato
-!Config  Def  = .FALSE.
-!Config  Help = active la version stratosphérique de LMDZ de F. Lott
-
-  ok_strato_omp=.FALSE.
-  CALL getin('ok_strato',ok_strato_omp)
-      
-!Config  key = ok_hines
-!Config  Desc = activation de la parametrisation de hines
-!Config  Def  = .FALSE.
-!Config  Help = Clefs controlant la parametrization de Hines
-!               Et la sponge layer (Runs Stratospheriques)
-
-  ok_hines_omp=.FALSE.
-  CALL getin('ok_hines',ok_hines_omp)
-
-!Config Key  = OK_LES                                               
-!Config Desc = Pour des sorties LES                                 
-!Config Def  = .false.                                              
-!Config Help = Pour creer le fichier histLES contenant les sorties  
-!              LES                                                  
-!                                                                   
-  ok_LES_omp = .false.                                              
-  call getin('OK_LES', ok_LES_omp)                                  
-
-!Config Key  = callstats                                               
-!Config Desc = Pour des sorties callstats                                 
-!Config Def  = .false.                                              
-!Config Help = Pour creer le fichier stats contenant les sorties  
-!              stats                                                  
-!                                                                   
-  callstats_omp = .false.                                              
-  call getin('callstats', callstats_omp)                                  
-!
-!Config Key  = ecrit_LES
-!Config Desc = Frequence d'ecriture des resultats du LES en nombre de jours;
-!              par defaut 1., i.e. 1 jour
-!Config Def  = 1./8.
-!Config Help = ... 
-!
-!
-  ecrit_LES_omp = 1./8.
-  call getin('ecrit_LES', ecrit_LES_omp)
-!
-  read_climoz = 0 ! default value
-  call getin('read_climoz', read_climoz)
-
-  carbon_cycle_tr_omp=.FALSE.
-  CALL getin('carbon_cycle_tr',carbon_cycle_tr_omp)
-
-  carbon_cycle_cpl_omp=.FALSE.
-  CALL getin('carbon_cycle_cpl',carbon_cycle_cpl_omp)
-
-!$OMP END MASTER
-!$OMP BARRIER
+       ok_LES,&
+       callstats,&
+       solarlong0,seuil_inversion, &
+       fact_cldcon, facttemps,ok_newmicro,iflag_radia,&
+       iflag_cldcon, &
+       iflag_ratqs,ratqsbas,ratqshaut,tau_ratqs, &
+       ok_ade, ok_aie, ok_cdnc, aerosol_couple, &
+       flag_aerosol, flag_aerosol_strat, new_aod, &
+       bl95_b0, bl95_b1,&
+       read_climoz, &
+       alp_offset)
+
+    use IOIPSL
+    USE surface_data
+    USE phys_cal_mod
+    USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl
+    use control_mod
+
+    include "conema3.h"
+    include "fisrtilp.h"
+    include "nuage.h"
+    include "YOMCST.h"
+    include "YOMCST2.h"
+
+    include "thermcell.h"
+    include "iniprint.h"
+
+    !IM : on inclut/initialise les taux de CH4, N2O, CFC11 et CFC12
+    include "clesphys.h"
+    include "compbl.h"
+    include "comsoil.h"
+    include "YOEGWD.h"
+    !
+    ! Configuration de la "physique" de LMDZ a l'aide de la fonction
+    ! GETIN de IOIPSL
+    !
+    ! LF 05/2001
+    !
+
+    !
+    ! type_ocean:      type d'ocean (force, slab, couple)
+    ! version_ocean:   version d'ocean (opa8/nemo pour type_ocean=couple ou 
+    !                                   sicOBS pour type_ocean=slab)
+    ! ok_veget:   type de modele de vegetation
+    ! ok_journe:  sorties journalieres
+    ! ok_hf:  sorties haute frequence
+    ! ok_mensuel: sorties mensuelles
+    ! ok_instan:  sorties instantanees
+    ! ok_ade, ok_aie: apply or not aerosol direct and indirect effects
+    ! ok_cdnc, ok cloud droplet number concentration
+    ! flag_aerosol_strat : flag pour les aerosols stratos
+    ! bl95_b*: parameters in the formula to link CDNC to aerosol mass conc 
+    !
+
+
+    ! Sortie:
+    logical              :: ok_newmicro
+    integer              :: iflag_radia
+    logical              :: ok_journe, ok_mensuel, ok_instan, ok_hf
+    logical              :: ok_LES
+    LOGICAL              :: callstats
+    LOGICAL              :: ok_ade, ok_aie, ok_cdnc, aerosol_couple
+    INTEGER              :: flag_aerosol
+    LOGICAL              :: flag_aerosol_strat
+    LOGICAL              :: new_aod
+    REAL                 :: bl95_b0, bl95_b1
+    real                 :: fact_cldcon, facttemps,ratqsbas,ratqshaut,tau_ratqs
+    integer              :: iflag_cldcon
+    integer              :: iflag_ratqs
+
+    character (len = 6),SAVE  :: type_ocean_omp, version_ocean_omp, ocean_omp
+    character (len = 10),SAVE  :: type_veget_omp
+    CHARACTER(len = 8),SAVE   :: aer_type_omp
+    logical,SAVE              :: ok_snow_omp
+    logical,SAVE              :: ok_newmicro_omp
+    logical,SAVE        :: ok_journe_omp, ok_mensuel_omp, ok_instan_omp, ok_hf_omp        
+    logical,SAVE        :: ok_LES_omp   
+    LOGICAL,SAVE        :: callstats_omp
+    LOGICAL,SAVE        :: ok_ade_omp, ok_aie_omp, ok_cdnc_omp, aerosol_couple_omp
+    INTEGER, SAVE       :: flag_aerosol_omp
+    LOGICAL, SAVE       :: flag_aerosol_strat_omp
+    LOGICAL, SAVE       :: new_aod_omp
+    REAL,SAVE           :: bl95_b0_omp, bl95_b1_omp
+    REAL,SAVE           :: freq_ISCCP_omp, ecrit_ISCCP_omp
+    REAL,SAVE           :: freq_COSP_omp
+    real,SAVE           :: fact_cldcon_omp, facttemps_omp,ratqsbas_omp
+    real,SAVE           :: ratqshaut_omp
+    real,SAVE           :: tau_ratqs_omp
+    integer,SAVE        :: iflag_radia_omp
+    integer,SAVE        :: iflag_rrtm_omp
+    integer,SAVE        :: iflag_cldcon_omp, ip_ebil_phy_omp
+    integer,SAVE        :: iflag_ratqs_omp
+
+    Real,SAVE           :: f_cdrag_ter_omp,f_cdrag_oce_omp
+    Real,SAVE           :: f_rugoro_omp   
+
+    ! Local
+    real                 :: zzz
+
+    real :: seuil_inversion
+    real,save :: seuil_inversion_omp
+
+    integer,SAVE :: iflag_thermals_ed_omp,iflag_thermals_optflux_omp
+    integer,SAVE :: iflag_thermals_omp,nsplit_thermals_omp
+    real,save :: tau_thermals_omp,alp_bl_k_omp
+    ! nrlmd le 10/04/2012
+    integer,SAVE :: iflag_trig_bl_omp,iflag_clos_bl_omp
+    integer,SAVE :: tau_trig_shallow_omp,tau_trig_deep_omp
+    real,SAVE    :: s_trig_omp
+    ! fin nrlmd le 10/04/2012
+    real :: alp_offset
+    REAL, SAVE :: alp_offset_omp
+    integer,SAVE :: iflag_coupl_omp,iflag_clos_omp,iflag_wake_omp
+    integer,SAVE :: iflag_cvl_sigd_omp
+    REAL, SAVE :: supcrit1_omp, supcrit2_omp
+    INTEGER, SAVE :: iflag_mix_omp
+    real, save :: scut_omp, qqa1_omp, qqa2_omp, gammas_omp, Fmax_omp, alphas_omp
+
+    REAL,SAVE :: R_ecc_omp,R_peri_omp,R_incl_omp,solaire_omp
+    REAL,SAVE :: co2_ppm_omp, RCO2_omp, co2_ppm_per_omp, RCO2_per_omp
+    REAL,SAVE :: CH4_ppb_omp, RCH4_omp, CH4_ppb_per_omp, RCH4_per_omp
+    REAL,SAVE :: N2O_ppb_omp, RN2O_omp, N2O_ppb_per_omp, RN2O_per_omp
+    REAL,SAVE :: CFC11_ppt_omp,RCFC11_omp,CFC11_ppt_per_omp,RCFC11_per_omp
+    REAL,SAVE :: CFC12_ppt_omp,RCFC12_omp,CFC12_ppt_per_omp,RCFC12_per_omp
+    LOGICAL,SAVE :: ok_4xCO2atm_omp
+    REAL,SAVE :: epmax_omp
+    LOGICAL,SAVE :: ok_adj_ema_omp
+    INTEGER,SAVE :: iflag_clw_omp
+    REAL,SAVE :: cld_lc_lsc_omp,cld_lc_con_omp,cld_tau_lsc_omp,cld_tau_con_omp
+    REAL,SAVE :: ffallv_lsc_omp, ffallv_con_omp,coef_eva_omp
+    LOGICAL,SAVE :: reevap_ice_omp
+    INTEGER,SAVE :: iflag_pdf_omp
+    INTEGER,SAVE :: iflag_ice_thermo_omp
+    REAL,SAVE :: rad_froid_omp, rad_chau1_omp, rad_chau2_omp
+    REAL,SAVE :: t_glace_min_omp, t_glace_max_omp
+    REAL,SAVE :: rei_min_omp, rei_max_omp
+    REAL,SAVE :: inertie_sol_omp,inertie_sno_omp,inertie_ice_omp
+    REAL,SAVE :: qsol0_omp
+    REAL,SAVE :: evap0_omp
+    REAL,SAVE :: albsno0_omp
+    REAL      :: solarlong0
+    REAL,SAVE :: solarlong0_omp
+    INTEGER,SAVE :: top_height_omp,overlap_omp
+    REAL,SAVE :: cdmmax_omp,cdhmax_omp,ksta_omp,ksta_ter_omp
+    LOGICAL,SAVE :: ok_kzmin_omp
+    REAL, SAVE ::  fmagic_omp, pmagic_omp
+    INTEGER,SAVE :: iflag_pbl_omp,lev_histhf_omp,lev_histday_omp,lev_histmth_omp
+    Integer, save :: lev_histins_omp, lev_histLES_omp 
+    INTEGER, SAVE :: lev_histdayNMC_omp
+    INTEGER, SAVE :: levout_histNMC_omp(3)
+    LOGICAL, SAVE :: ok_histNMC_omp(3)
+    REAL, SAVE :: freq_outNMC_omp(3), freq_calNMC_omp(3)
+    CHARACTER*4, SAVE :: type_run_omp
+    LOGICAL,SAVE :: ok_cosp_omp
+    LOGICAL,SAVE :: ok_mensuelCOSP_omp,ok_journeCOSP_omp,ok_hfCOSP_omp
+    REAL,SAVE :: lonmin_ins_omp, lonmax_ins_omp, latmin_ins_omp, latmax_ins_omp
+    REAL,SAVE :: ecrit_hf_omp, ecrit_day_omp, ecrit_mth_omp, ecrit_reg_omp
+    REAL,SAVE :: ecrit_ins_omp
+    REAL,SAVE :: ecrit_LES_omp
+    REAL,SAVE :: ecrit_tra_omp
+    REAL,SAVE :: cvl_corr_omp
+    LOGICAL,SAVE :: ok_lic_melt_omp
+    !
+    LOGICAL,SAVE :: cycle_diurne_omp,soil_model_omp,new_oliq_omp
+    LOGICAL,SAVE :: ok_orodr_omp, ok_orolf_omp, ok_limitvrai_omp
+    INTEGER, SAVE :: nbapp_rad_omp, iflag_con_omp
+    INTEGER, SAVE :: iflag_ener_conserv_omp
+    INTEGER, SAVE :: iflag_fisrtilp_qsat_omp
+    LOGICAL,SAVE :: ok_strato_omp
+    LOGICAL,SAVE :: ok_hines_omp, ok_gwd_rando_omp
+    real, SAVE:: RUWMAX_omp, sat_omp
+    LOGICAL,SAVE      :: carbon_cycle_tr_omp
+    LOGICAL,SAVE      :: carbon_cycle_cpl_omp
+
+    integer, intent(out):: read_climoz ! read ozone climatology, OpenMP shared
+    ! Allowed values are 0, 1 and 2
+    ! 0: do not read an ozone climatology
+    ! 1: read a single ozone climatology that will be used day and night
+    ! 2: read two ozone climatologies, the average day and night
+    ! climatology and the daylight climatology
+
+    !-----------------------------------------------------------------
+
+    !$OMP MASTER 
+    !Config Key  = type_ocean 
+    !Config Desc = Type d'ocean
+    !Config Def  = force
+    !Config Help = Type d'ocean utilise: force, slab,couple
+    !
+    type_ocean_omp = 'force '
+    call getin('type_ocean', type_ocean_omp)
+    !
+    !Config Key  = version_ocean 
+    !Config Desc = Version d'ocean
+    !Config Def  = xxxxxx
+    !Config Help = Version d'ocean utilise: opa8/nemo/sicOBS/xxxxxx
+    !
+    version_ocean_omp = 'xxxxxx'
+    call getin('version_ocean', version_ocean_omp)
+
+    !Config Key  = OCEAN
+    !Config Desc = Old parameter name for type_ocean
+    !Config Def  = yyyyyy
+    !Config Help = This is only for testing purpose
+    !
+    ocean_omp = 'yyyyyy'
+    call getin('OCEAN', ocean_omp)
+    IF (ocean_omp /= 'yyyyyy') THEN
+       WRITE(lunout,*)'ERROR! Old variable name OCEAN used in parmeter file.'
+       WRITE(lunout,*)'Variable OCEAN has been replaced by the variable type_ocean.'
+       WRITE(lunout,*)'You have to update your parameter file physiq.def to succed running'
+       CALL abort_gcm('conf_phys','Variable OCEAN no longer existing, use variable name type_ocean',1)
+    END IF
+
+    !
+    !Config Key  = VEGET 
+    !Config Desc = Type de modele de vegetation
+    !Config Def  = .false.
+    !Config Help = Type de modele de vegetation utilise
+    !
+    type_veget_omp ='orchidee'
+    call getin('VEGET', type_veget_omp)
+    !
+
+    ! Martin
+    !Config Key  = ok_snow
+    !Config Desc = Flag to activate snow model SISVAT
+    !Config Def  = .false.
+    ok_snow_omp = .false.
+    call getin('ok_snow', ok_snow_omp)
+    ! Martin
+
+    !Config Key  = OK_journe
+    !Config Desc = Pour des sorties journalieres 
+    !Config Def  = .false.
+    !Config Help = Pour creer le fichier histday contenant les sorties
+    !              journalieres 
+    !
+    ok_journe_omp = .false.
+    call getin('OK_journe', ok_journe_omp)
+    !
+    !Config Key  = ok_hf
+    !Config Desc = Pour des sorties haute frequence
+    !Config Def  = .false.
+    !Config Help = Pour creer le fichier histhf contenant les sorties
+    !              haute frequence ( 3h ou 6h)
+    !
+    ok_hf_omp = .false.
+    call getin('ok_hf', ok_hf_omp)
+    !
+    !Config Key  = OK_mensuel
+    !Config Desc = Pour des sorties mensuelles 
+    !Config Def  = .true.
+    !Config Help = Pour creer le fichier histmth contenant les sorties
+    !              mensuelles 
+    !
+    ok_mensuel_omp = .true.
+    call getin('OK_mensuel', ok_mensuel_omp)
+    !
+    !Config Key  = OK_instan
+    !Config Desc = Pour des sorties instantanees 
+    !Config Def  = .false.
+    !Config Help = Pour creer le fichier histins contenant les sorties
+    !              instantanees 
+    !
+    ok_instan_omp = .false.
+    call getin('OK_instan', ok_instan_omp)
+    !
+    !Config Key  = ok_ade
+    !Config Desc = Aerosol direct effect or not?
+    !Config Def  = .false.
+    !Config Help = Used in radlwsw.F
+    !
+    ok_ade_omp = .false.
+    call getin('ok_ade', ok_ade_omp)
+
+    !
+    !Config Key  = ok_aie
+    !Config Desc = Aerosol indirect effect or not?
+    !Config Def  = .false.
+    !Config Help = Used in nuage.F and radlwsw.F
+    !
+    ok_aie_omp = .false.
+    call getin('ok_aie', ok_aie_omp)
+
+    !
+    !Config Key  = ok_cdnc
+    !Config Desc = ok cloud droplet number concentration
+    !Config Def  = .false.
+    !Config Help = Used in newmicro.F
+    !
+    ok_cdnc_omp = .false.
+    call getin('ok_cdnc', ok_cdnc_omp)
+    !
+    !Config Key  = aerosol_couple
+    !Config Desc = read aerosol in file or calcul by inca
+    !Config Def  = .false.
+    !Config Help = Used in physiq.F
+    !
+    aerosol_couple_omp = .false.
+    CALL getin('aerosol_couple',aerosol_couple_omp)
+    !
+    !Config Key  = flag_aerosol
+    !Config Desc = which aerosol is use for coupled model
+    !Config Def  = 1
+    !Config Help = Used in physiq.F
+    !
+    ! - flag_aerosol=0 => no aerosol
+    ! - flag_aerosol=1 => so4 only (defaut) 
+    ! - flag_aerosol=2 => bc  only 
+    ! - flag_aerosol=3 => pom only
+    ! - flag_aerosol=4 => seasalt only 
+    ! - flag_aerosol=5 => dust only
+    ! - flag_aerosol=6 => all aerosol
+
+    flag_aerosol_omp = 0
+    CALL getin('flag_aerosol',flag_aerosol_omp)
+    !
+    !Config Key  = flag_aerosol_strat
+    !Config Desc = use stratospheric aerosols T/F
+    !Config Def  = false
+    !Config Help = Used in physiq.F
+    !
+    !
+    flag_aerosol_strat_omp = .false.
+    CALL getin('flag_aerosol_strat',flag_aerosol_strat_omp)
+
+    ! Temporary variable for testing purpose!
+    !Config Key  = new_aod
+    !Config Desc = which calcul of aeropt
+    !Config Def  = false
+    !Config Help = Used in physiq.F
+    !
+    new_aod_omp = .true.
+    CALL getin('new_aod',new_aod_omp)
+
+    ! 
+    !Config Key  = aer_type 
+    !Config Desc = Use a constant field for the aerosols 
+    !Config Def  = scenario 
+    !Config Help = Used in readaerosol.F90 
+    ! 
+    aer_type_omp = 'scenario' 
+    call getin('aer_type', aer_type_omp) 
+
+    !
+    !Config Key  = bl95_b0
+    !Config Desc = Parameter in CDNC-maer link (Boucher&Lohmann 1995)
+    !Config Def  = .false.
+    !Config Help = Used in nuage.F
+    !
+    bl95_b0_omp = 2.
+    call getin('bl95_b0', bl95_b0_omp)
+
+    !Config Key  = bl95_b1
+    !Config Desc = Parameter in CDNC-maer link (Boucher&Lohmann 1995)
+    !Config Def  = .false.
+    !Config Help = Used in nuage.F
+    !
+    bl95_b1_omp = 0.2
+    call getin('bl95_b1', bl95_b1_omp)
+
+    !Config Key  = freq_ISCCP
+    !Config Desc = Frequence d'appel du simulateur ISCCP en secondes;
+    !              par defaut 10800, i.e. 3 heures 
+    !Config Def  = 10800.
+    !Config Help = Used in ini_histISCCP.h
+    !
+    freq_ISCCP_omp = 10800.
+    call getin('freq_ISCCP', freq_ISCCP_omp)
+    !
+    !Config Key  = ecrit_ISCCP
+    !Config Desc = Frequence d'ecriture des resultats du simulateur ISCCP en nombre de jours;
+    !              par defaut 1., i.e. 1 jour
+    !Config Def  = 1.
+    !Config Help = Used in ini_histISCCP.h
+    !
+    !
+    ecrit_ISCCP_omp = 1.
+    call getin('ecrit_ISCCP', ecrit_ISCCP_omp)
+
+    !Config Key  = freq_COSP
+    !Config Desc = Frequence d'appel du simulateur COSP en secondes;
+    !              par defaut 10800, i.e. 3 heures
+    !Config Def  = 10800.
+    !Config Help = Used in ini_histdayCOSP.h
+    !
+    freq_COSP_omp = 10800.
+    call getin('freq_COSP', freq_COSP_omp)
+
+    !
+    !Config Key  = ip_ebil_phy
+    !Config Desc = Niveau de sortie pour les diags bilan d'energie 
+    !Config Def  = 0
+    !Config Help = 
+    !               
+    ip_ebil_phy_omp = 0
+    call getin('ip_ebil_phy', ip_ebil_phy_omp)
+    !
+    !Config Key  = seuil_inversion
+    !Config Desc = Seuil ur dTh pour le choix entre les schemas de CL
+    !Config Def  = -0.1
+    !Config Help = 
+    !               
+    seuil_inversion_omp = -0.1
+    call getin('seuil_inversion', seuil_inversion_omp)
+
+    !
+    ! Constante solaire & Parametres orbitaux & taux gaz effet de serre BEG
+    !
+    !Config Key  = R_ecc
+    !Config Desc = Excentricite
+    !Config Def  = 0.016715
+    !Config Help = 
+    !               
+    !valeur AMIP II
+    R_ecc_omp = 0.016715
+    call getin('R_ecc', R_ecc_omp)
+    !
+    !Config Key  = R_peri
+    !Config Desc = Equinoxe
+    !Config Def  = 
+    !Config Help = 
+    !               
+    !
+    !valeur AMIP II
+    R_peri_omp = 102.7
+    call getin('R_peri', R_peri_omp)
+    !
+    !Config Key  = R_incl
+    !Config Desc = Inclinaison
+    !Config Def  = 
+    !Config Help = 
+    !               
+    !
+    !valeur AMIP II
+    R_incl_omp = 23.441
+    call getin('R_incl', R_incl_omp)
+    !
+    !Config Key  = solaire
+    !Config Desc = Constante solaire en W/m2
+    !Config Def  = 1365.
+    !Config Help = 
+    !               
+    !
+    !valeur AMIP II
+    solaire_omp = 1365.
+    call getin('solaire', solaire_omp)
+    !
+    !Config Key  = co2_ppm
+    !Config Desc = concentration du gaz carbonique en ppmv
+    !Config Def  = 348.
+    !Config Help = 
+    !               
+    !
+    !valeur AMIP II
+    co2_ppm_omp = 348.
+    call getin('co2_ppm', co2_ppm_omp)
+    !
+    !Config Key  = RCO2
+    !Config Desc = Concentration du CO2
+    !Config Def  = co2_ppm * 1.0e-06  * 44.011/28.97
+    !Config Def  = 348. * 1.0e-06  * 44.011/28.97
+    !Config Help = 
+    !               
+    ! RCO2 = 5.286789092164308E-04
+    !ancienne valeur
+    RCO2_omp = co2_ppm_omp * 1.0e-06  * 44.011/28.97 ! pour co2_ppm=348.
+
+    !  call getin('RCO2', RCO2)
+    !
+    !Config Key  = RCH4
+    !Config Desc = Concentration du CH4
+    !Config Def  = 1.65E-06* 16.043/28.97
+    !Config Help = 
+    !               
+    !
+    !valeur AMIP II
+    !OK  RCH4 = 1.65E-06* 16.043/28.97
+    ! RCH4 = 9.137366240938903E-07
+    !
+    !ancienne valeur
+    ! RCH4 = 1.72E-06* 16.043/28.97
+    !OK call getin('RCH4', RCH4)
+    zzz = 1650.
+    call getin('CH4_ppb', zzz)
+    CH4_ppb_omp = zzz
+    RCH4_omp = CH4_ppb_omp * 1.0E-09 * 16.043/28.97
+    !
+    !Config Key  = RN2O
+    !Config Desc = Concentration du N2O
+    !Config Def  = 306.E-09* 44.013/28.97
+    !Config Help = 
+    !               
+    !
+    !valeur AMIP II
+    !OK  RN2O = 306.E-09* 44.013/28.97
+    ! RN2O = 4.648939592682085E-07
+    !
+    !ancienne valeur
+    ! RN2O = 310.E-09* 44.013/28.97
+    !OK  call getin('RN2O', RN2O)
+    zzz=306.
+    call getin('N2O_ppb', zzz)
+    N2O_ppb_omp = zzz
+    RN2O_omp = N2O_ppb_omp * 1.0E-09 * 44.013/28.97
+    !
+    !Config Key  = RCFC11
+    !Config Desc = Concentration du CFC11
+    !Config Def  = 280.E-12* 137.3686/28.97
+    !Config Help = 
+    !               
+    !
+    !OK RCFC11 = 280.E-12* 137.3686/28.97
+    zzz = 280.
+    call getin('CFC11_ppt',zzz)
+    CFC11_ppt_omp = zzz
+    RCFC11_omp=CFC11_ppt_omp* 1.0E-12 * 137.3686/28.97
+    ! RCFC11 = 1.327690990680013E-09
+    !OK call getin('RCFC11', RCFC11)
+    !
+    !Config Key  = RCFC12
+    !Config Desc = Concentration du CFC12
+    !Config Def  = 484.E-12* 120.9140/28.97
+    !Config Help = 
+    !               
+    !
+    !OK RCFC12 = 484.E-12* 120.9140/28.97
+    zzz = 484.
+    call getin('CFC12_ppt',zzz)
+    CFC12_ppt_omp = zzz
+    RCFC12_omp = CFC12_ppt_omp * 1.0E-12 * 120.9140/28.97
+    ! RCFC12 = 2.020102726958923E-09
+    !OK call getin('RCFC12', RCFC12)
+
+    !ajout CFMIP begin
+    !
+    !Config Key  = co2_ppm_per
+    !Config Desc = concentration du co2_ppm_per
+    !Config Def  = 348.
+    !Config Help = 
+    !               
+    co2_ppm_per_omp = co2_ppm_omp
+    call getin('co2_ppm_per', co2_ppm_per_omp)
+    !
+    !Config Key  = RCO2_per
+    !Config Desc = Concentration du CO2_per
+    !Config Def  = co2_ppm_per * 1.0e-06  * 44.011/28.97
+    !Config Def  = 348. * 1.0e-06  * 44.011/28.97
+    !Config Help = 
+    !               
+    RCO2_per_omp = co2_ppm_per_omp * 1.0e-06  * 44.011/28.97
+
+    !Config Key  = ok_4xCO2atm
+    !Config Desc = Calcul ou non effet radiatif 4xco2
+    !Config Def  = .false.
+    !Config Help = 
+
+    ok_4xCO2atm_omp = .false.
+    call getin('ok_4xCO2atm',ok_4xCO2atm_omp)
+
+    !Config Key  = RCH4_per
+    !Config Desc = Concentration du CH4_per
+    !Config Def  = 1.65E-06* 16.043/28.97
+    !Config Help = 
+    !               
+    zzz = CH4_ppb_omp
+    call getin('CH4_ppb_per', zzz)
+    CH4_ppb_per_omp = zzz
+    RCH4_per_omp = CH4_ppb_per_omp * 1.0E-09 * 16.043/28.97
+    !
+    !Config Key  = RN2O_per
+    !Config Desc = Concentration du N2O_per
+    !Config Def  = 306.E-09* 44.013/28.97
+    !Config Help = 
+    !               
+    zzz = N2O_ppb_omp
+    call getin('N2O_ppb_per', zzz)
+    N2O_ppb_per_omp = zzz
+    RN2O_per_omp = N2O_ppb_per_omp * 1.0E-09 * 44.013/28.97
+    !
+    !Config Key  = RCFC11_per
+    !Config Desc = Concentration du CFC11_per
+    !Config Def  = 280.E-12* 137.3686/28.97
+    !Config Help = 
+    !               
+    zzz = CFC11_ppt_omp
+    call getin('CFC11_ppt_per',zzz)
+    CFC11_ppt_per_omp = zzz
+    RCFC11_per_omp=CFC11_ppt_per_omp* 1.0E-12 * 137.3686/28.97
+    !
+    !Config Key  = RCFC12_per
+    !Config Desc = Concentration du CFC12_per
+    !Config Def  = 484.E-12* 120.9140/28.97
+    !Config Help = 
+    !               
+    zzz = CFC12_ppt_omp
+    call getin('CFC12_ppt_per',zzz)
+    CFC12_ppt_per_omp = zzz
+    RCFC12_per_omp = CFC12_ppt_per_omp * 1.0E-12 * 120.9140/28.97
+    !ajout CFMIP end
+
+    !
+    ! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
+    ! Constantes precedemment dans dyn3d/conf_gcm
+
+    !Config  Key  = cycle_diurne
+    !Config  Desc = Cycle ddiurne
+    !Config  Def  = y
+    !Config  Help = Cette option permet d'eteidre le cycle diurne.
+    !Config         Peut etre util pour accelerer le code !
+    cycle_diurne_omp = .TRUE.
+    CALL getin('cycle_diurne',cycle_diurne_omp)
+
+    !Config  Key  = soil_model
+    !Config  Desc = Modele de sol
+    !Config  Def  = y
+    !Config  Help = Choix du modele de sol (Thermique ?)
+    !Config         Option qui pourait un string afin de pouvoir
+    !Config         plus de choix ! Ou meme une liste d'options !
+    soil_model_omp = .TRUE.
+    CALL getin('soil_model',soil_model_omp)
+
+    !Config  Key  = new_oliq
+    !Config  Desc = Nouvelle eau liquide
+    !Config  Def  = y
+    !Config  Help = Permet de mettre en route la
+    !Config         nouvelle parametrisation de l'eau liquide !
+    new_oliq_omp = .TRUE.
+    CALL getin('new_oliq',new_oliq_omp)
+
+    !Config  Key  = ok_orodr
+    !Config  Desc = Orodr ???
+    !Config  Def  = y
+    !Config  Help = Y en a pas comprendre !
+    !Config         
+    ok_orodr_omp = .TRUE.
+    CALL getin('ok_orodr',ok_orodr_omp)
+
+    !Config  Key  =  ok_orolf
+    !Config  Desc = Orolf ??
+    !Config  Def  = y
+    !Config  Help = Connais pas !
+    ok_orolf_omp = .TRUE.
+    CALL getin('ok_orolf', ok_orolf_omp)
+
+    !Config  Key  = ok_limitvrai
+    !Config  Desc = Force la lecture de la bonne annee
+    !Config  Def  = n
+    !Config  Help = On peut forcer le modele a lire le
+    !Config         fichier SST de la bonne annee. C'est une tres bonne
+    !Config         idee, pourquoi ne pas mettre toujours a y ???
+    ok_limitvrai_omp = .FALSE.
+    CALL getin('ok_limitvrai',ok_limitvrai_omp)
+
+    !Config  Key  = nbapp_rad
+    !Config  Desc = Frequence d'appel au rayonnement
+    !Config  Def  = 12
+    !Config  Help = Nombre  d'appels des routines de rayonnements
+    !Config         par jour.
+    nbapp_rad_omp = 12
+    CALL getin('nbapp_rad',nbapp_rad_omp)
+
+    !Config  Key  = iflag_con
+    !Config  Desc = Flag de convection
+    !Config  Def  = 2
+    !Config  Help = Flag  pour la convection les options suivantes existent :
+    !Config         1 pour LMD,
+    !Config         2 pour Tiedtke,
+    !Config         3 pour CCM(NCAR)  
+    iflag_con_omp = 2
+    CALL getin('iflag_con',iflag_con_omp)
+
+    !Config  Key  = iflag_ener_conserv
+    !Config  Desc = Flag de convection
+    !Config  Def  = 1
+    !Config  Help = Flag  pour la convection les options suivantes existent :
+    !Config         -1 pour Kinetic energy correction
+    !Config         1  conservation kinetic and enthalpy
+    iflag_ener_conserv_omp = -1
+    CALL getin('iflag_ener_conserv',iflag_ener_conserv_omp)
+
+    !Config  Key  = iflag_fisrtilp_qsat
+    !Config  Desc = Flag de convection
+    !Config  Def  = 1
+    !Config  Help = Flag  pour la convection les options suivantes existent :
+    !Config         -1 pour Kinetic energy correction
+    !Config         1  conservation kinetic and enthalpy
+    iflag_fisrtilp_qsat_omp = 0
+    CALL getin('iflag_fisrtilp_qsat',iflag_fisrtilp_qsat_omp)
+
+    !
+    !
+    !
+    ! Constante solaire & Parametres orbitaux & taux gaz effet de serre END
+    !
+    ! KE
+    !
+
+    !Config key  = cvl_corr
+    !Config Desc = Facteur multiplication des precip convectives dans KE
+    !Config Def  = 1.00
+    !Config Help = 1.02 pour un moderne ou un pre-ind. A ajuster pour un glaciaire
+    cvl_corr_omp = 1.00
+    CALL getin('cvl_corr', cvl_corr_omp)
+
+
+    !Config Key  = epmax
+    !Config Desc = Efficacite precip
+    !Config Def  = 0.993
+    !Config Help = 
+    !
+    epmax_omp = .993
+    call getin('epmax', epmax_omp)
+    !
+    !Config Key  = ok_adj_ema
+    !Config Desc =  
+    !Config Def  = false
+    !Config Help = 
+    !
+    ok_adj_ema_omp = .false.
+    call getin('ok_adj_ema',ok_adj_ema_omp)
+    !
+    !Config Key  = iflag_clw
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_clw_omp = 0
+    call getin('iflag_clw',iflag_clw_omp)
+    !
+    !Config Key  = cld_lc_lsc 
+    !Config Desc =  
+    !Config Def  = 2.6e-4
+    !Config Help = 
+    !
+    cld_lc_lsc_omp = 2.6e-4
+    call getin('cld_lc_lsc',cld_lc_lsc_omp)
+    !
+    !Config Key  = cld_lc_con
+    !Config Desc =  
+    !Config Def  = 2.6e-4
+    !Config Help = 
+    !
+    cld_lc_con_omp = 2.6e-4
+    call getin('cld_lc_con',cld_lc_con_omp)
+    !
+    !Config Key  = cld_tau_lsc
+    !Config Desc =  
+    !Config Def  = 3600.
+    !Config Help = 
+    !
+    cld_tau_lsc_omp = 3600.
+    call getin('cld_tau_lsc',cld_tau_lsc_omp)
+    !
+    !Config Key  = cld_tau_con
+    !Config Desc =  
+    !Config Def  = 3600.
+    !Config Help = 
+    !
+    cld_tau_con_omp = 3600.
+    call getin('cld_tau_con',cld_tau_con_omp)
+    !
+    !Config Key  = ffallv_lsc
+    !Config Desc =  
+    !Config Def  = 1.
+    !Config Help = 
+    !
+    ffallv_lsc_omp = 1.
+    call getin('ffallv_lsc',ffallv_lsc_omp)
+    !
+    !Config Key  = ffallv_con
+    !Config Desc =  
+    !Config Def  = 1.
+    !Config Help = 
+    !
+    ffallv_con_omp = 1.
+    call getin('ffallv_con',ffallv_con_omp)
+    !
+    !Config Key  = coef_eva
+    !Config Desc =  
+    !Config Def  = 2.e-5
+    !Config Help = 
+    !
+    coef_eva_omp = 2.e-5
+    call getin('coef_eva',coef_eva_omp)
+    !
+    !Config Key  = reevap_ice
+    !Config Desc =  
+    !Config Def  = .false.
+    !Config Help = 
+    !
+    reevap_ice_omp = .false.
+    call getin('reevap_ice',reevap_ice_omp)
+
+    !Config Key  = iflag_ratqs
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    iflag_ratqs_omp = 1
+    call getin('iflag_ratqs',iflag_ratqs_omp)
+
+    !
+    !Config Key  = iflag_radia 
+    !Config Desc =  
+    !Config Def  = 1
+    !Config Help = 
+    !
+    iflag_radia_omp = 1
+    call getin('iflag_radia',iflag_radia_omp)
+
+    !
+    !Config Key  = iflag_rrtm 
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_rrtm_omp = 0
+    call getin('iflag_rrtm',iflag_rrtm_omp)
+
+    !
+    !Config Key  = iflag_cldcon 
+    !Config Desc =  
+    !Config Def  = 1
+    !Config Help = 
+    !
+    iflag_cldcon_omp = 1
+    call getin('iflag_cldcon',iflag_cldcon_omp)
+
+    !
+    !Config Key  = iflag_pdf 
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_pdf_omp = 0
+    call getin('iflag_pdf',iflag_pdf_omp)
+    !
+    !Config Key  = fact_cldcon
+    !Config Desc =  
+    !Config Def  = 0.375
+    !Config Help = 
+    !
+    fact_cldcon_omp = 0.375
+    call getin('fact_cldcon',fact_cldcon_omp)
+
+    !
+    !Config Key  = facttemps
+    !Config Desc =  
+    !Config Def  = 1.e-4
+    !Config Help = 
+    !
+    facttemps_omp = 1.e-4
+    call getin('facttemps',facttemps_omp)
+
+    !
+    !Config Key  = ok_newmicro
+    !Config Desc =  
+    !Config Def  = .true.
+    !Config Help = 
+    !
+    ok_newmicro_omp = .true.
+    call getin('ok_newmicro',ok_newmicro_omp)
+    !
+    !Config Key  = ratqsbas
+    !Config Desc =  
+    !Config Def  = 0.01
+    !Config Help = 
+    !
+    ratqsbas_omp = 0.01
+    call getin('ratqsbas',ratqsbas_omp)
+    !
+    !Config Key  = ratqshaut
+    !Config Desc =  
+    !Config Def  = 0.3
+    !Config Help = 
+    !
+    ratqshaut_omp = 0.3
+    call getin('ratqshaut',ratqshaut_omp)
+
+    !Config Key  = tau_ratqs
+    !Config Desc =  
+    !Config Def  = 1800.
+    !Config Help = 
+    !
+    tau_ratqs_omp = 1800.
+    call getin('tau_ratqs',tau_ratqs_omp)
+
+    !
+    !-----------------------------------------------------------------------
+    ! Longitude solaire pour le calcul de l'ensoleillement en degre
+    ! si on veut imposer la saison. Sinon, solarlong0=-999.999
+    !Config Key  = solarlong0
+    !Config Desc =  
+    !Config Def  = -999.999 
+    !Config Help = 
+    !
+    solarlong0_omp = -999.999
+    call getin('solarlong0',solarlong0_omp)
+    !
+    !-----------------------------------------------------------------------
+    !  Valeur imposee pour configuration idealisees
+    !Config Key  = qsol0 pour le bucket, evap0 pour aquaplanetes, albsno0
+    ! Default value -1 to activate the full computation
+    qsol0_omp = -1.
+    call getin('qsol0',qsol0_omp)
+    evap0_omp = -1.
+    call getin('evap0',evap0_omp)
+    albsno0_omp = -1.
+    call getin('albsno0',albsno0_omp)
+    !
+    !-----------------------------------------------------------------------
+    !
+    !Config Key  = inertie_ice
+    !Config Desc =  
+    !Config Def  = 2000.
+    !Config Help = 
+    !
+    inertie_ice_omp = 2000.
+    call getin('inertie_ice',inertie_ice_omp)
+    !
+    !Config Key  = inertie_sno
+    !Config Desc =  
+    !Config Def  = 2000.
+    !Config Help = 
+    !
+    inertie_sno_omp = 2000.
+    call getin('inertie_sno',inertie_sno_omp)
+    !
+    !Config Key  = inertie_sol
+    !Config Desc =  
+    !Config Def  = 2000.
+    !Config Help = 
+    !
+    inertie_sol_omp = 2000.
+    call getin('inertie_sol',inertie_sol_omp)
+
+    !
+    !Config Key  = rad_froid
+    !Config Desc =  
+    !Config Def  = 35.0
+    !Config Help = 
+    !
+    rad_froid_omp = 35.0
+    call getin('rad_froid',rad_froid_omp)
+
+    !
+    !Config Key  = rad_chau1
+    !Config Desc =  
+    !Config Def  = 13.0
+    !Config Help = 
+    !
+    rad_chau1_omp = 13.0
+    call getin('rad_chau1',rad_chau1_omp)
+
+    !
+    !Config Key  = rad_chau2
+    !Config Desc =  
+    !Config Def  = 9.0
+    !Config Help = 
+    !
+    rad_chau2_omp = 9.0
+    call getin('rad_chau2',rad_chau2_omp)
+
+    !
+    !Config Key  = t_glace_min
+    !Config Desc =  
+    !Config Def  = 258.
+    !Config Help = 
+    !
+    t_glace_min_omp = 258.
+    call getin('t_glace_min',t_glace_min_omp)
+
+    !
+    !Config Key  = t_glace_max
+    !Config Desc =  
+    !Config Def  = 273.13
+    !Config Help = 
+    !
+    t_glace_max_omp = 273.13
+    call getin('t_glace_max',t_glace_max_omp)
+
+    !
+    !Config Key  = iflag_ice_thermo
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_ice_thermo_omp = 0
+    call getin('iflag_ice_thermo',iflag_ice_thermo_omp)
+
+    !Config Key  = rei_min
+    !Config Desc =  
+    !Config Def  = 3.5
+    !Config Help = 
+    !
+    rei_min_omp = 3.5
+    call getin('rei_min',rei_min_omp)
+
+    !
+    !Config Key  = rei_max
+    !Config Desc =  
+    !Config Def  = 61.29
+    !Config Help = 
+    !
+    rei_max_omp = 61.29
+    call getin('rei_max',rei_max_omp)
+
+    !
+    !Config Key  = top_height
+    !Config Desc =
+    !Config Def  = 3
+    !Config Help =
+    !
+    top_height_omp = 3
+    call getin('top_height',top_height_omp)
+
+    !
+    !Config Key  = overlap
+    !Config Desc =
+    !Config Def  = 3
+    !Config Help =
+    !
+    overlap_omp = 3
+    call getin('overlap',overlap_omp)
+
+
+    !
+    !
+    !Config Key  = cdmmax
+    !Config Desc =
+    !Config Def  = 1.3E-3
+    !Config Help =
+    !
+    cdmmax_omp = 1.3E-3
+    call getin('cdmmax',cdmmax_omp)
+
+    !
+    !Config Key  = cdhmax
+    !Config Desc =
+    !Config Def  = 1.1E-3
+    !Config Help =
+    !
+    cdhmax_omp = 1.1E-3
+    call getin('cdhmax',cdhmax_omp)
+
+    !261103
+    !
+    !Config Key  = ksta
+    !Config Desc =
+    !Config Def  = 1.0e-10
+    !Config Help =
+    !
+    ksta_omp = 1.0e-10
+    call getin('ksta',ksta_omp)
+
+    !
+    !Config Key  = ksta_ter
+    !Config Desc =
+    !Config Def  = 1.0e-10
+    !Config Help =
+    !
+    ksta_ter_omp = 1.0e-10
+    call getin('ksta_ter',ksta_ter_omp)
+
+    !
+    !Config Key  = ok_kzmin
+    !Config Desc =
+    !Config Def  = .true.
+    !Config Help =
+    !
+    ok_kzmin_omp = .true.
+    call getin('ok_kzmin',ok_kzmin_omp)
+
+    !
+    !Config Key  = fmagic
+    !Config Desc = additionnal multiplicator factor used for albedo
+    !Config Def  = 1.
+    !Config Help = additionnal multiplicator factor used in albedo.F
+    !
+    fmagic_omp = 1.
+    call getin('fmagic',fmagic_omp)
+
+    !
+    !Config Key  = pmagic
+    !Config Desc = additional factor used for albedo
+    !Config Def  = 0.
+    !Config Help = additional factor used in albedo.F
+    !
+    pmagic_omp = 0.
+    call getin('pmagic',pmagic_omp)
+
+
+    !Config Key = ok_lic_melt
+    !Config Desc = Prise en compte de la fonte de la calotte dans le bilan d'eau
+    !Config Def  = .false.
+    !Config Help = mettre a .false. pour assurer la conservation en eau
+    ok_lic_melt_omp = .false.
+    call getin('ok_lic_melt', ok_lic_melt_omp)
+
+    !
+    ! PARAMETER FOR THE PLANETARY BOUNDARY LAYER
+    !
+
+    !Config Key  = iflag_pbl
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    iflag_pbl_omp = 1
+    call getin('iflag_pbl',iflag_pbl_omp)
+    !
+    !Config Key  = iflag_thermals
+    !Config Desc =
+    !Config Def  = 0
+    !Config Help =
+    !
+    iflag_thermals_omp = 0
+    call getin('iflag_thermals',iflag_thermals_omp)
+    !
+    !
+    !Config Key  = iflag_thermals_ed
+    !Config Desc =
+    !Config Def  = 0
+    !Config Help =
+    !
+    iflag_thermals_ed_omp = 0
+    call getin('iflag_thermals_ed',iflag_thermals_ed_omp)
+    !
+    !
+    !Config Key  = iflag_thermals_optflux
+    !Config Desc =
+    !Config Def  = 0
+    !Config Help =
+    !
+    iflag_thermals_optflux_omp = 0
+    call getin('iflag_thermals_optflux',iflag_thermals_optflux_omp)
+    !
+    !
+    !Config Key  = nsplit_thermals
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    nsplit_thermals_omp = 1
+    call getin('nsplit_thermals',nsplit_thermals_omp)
+
+    !Config Key  = alp_bl_k
+    !Config Desc =
+    !Config Def  = 0.
+    !Config Help =
+    !
+    alp_bl_k_omp = 1.
+    call getin('alp_bl_k',alp_bl_k_omp)
+
+    ! nrlmd le 10/04/2012
+
+    !Config Key  = iflag_trig_bl
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_trig_bl_omp = 0
+    call getin('iflag_trig_bl',iflag_trig_bl_omp)
+
+    !Config Key  = s_trig_bl
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    s_trig_omp = 2e7
+    call getin('s_trig',s_trig_omp)
+
+    !Config Key  = tau_trig_shallow
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    tau_trig_shallow_omp = 600
+    call getin('tau_trig_shallow',tau_trig_shallow_omp)
+
+    !Config Key  = tau_trig_deep
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    tau_trig_deep_omp = 1800
+    call getin('tau_trig_deep',tau_trig_deep_omp)
+
+    !Config Key  = iflag_clos_bl
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_clos_bl_omp = 0
+    call getin('iflag_clos_bl',iflag_clos_bl_omp)
+
+    ! fin nrlmd le 10/04/2012
+
+    !
+    !Config Key  = tau_thermals
+    !Config Desc =
+    !Config Def  = 0.
+    !Config Help =
+    !
+    tau_thermals_omp = 0.
+    call getin('tau_thermals',tau_thermals_omp)
+
+    !
+    !Config Key  = iflag_coupl
+    !Config Desc =
+    !Config Def  = 0
+    !Config Help =
+    !
+    iflag_coupl_omp = 0
+    call getin('iflag_coupl',iflag_coupl_omp)
+
+    !
+    !Config Key  = iflag_clos
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_clos_omp = 1
+    call getin('iflag_clos',iflag_clos_omp)
+    !
+    !Config Key  = iflag_cvl_sigd
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_cvl_sigd_omp = 0
+    call getin('iflag_cvl_sigd',iflag_cvl_sigd_omp)
+
+    !Config Key  = iflag_wake
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    iflag_wake_omp = 0
+    call getin('iflag_wake',iflag_wake_omp)
+
+    !Config Key  = alp_offset
+    !Config Desc =  
+    !Config Def  = 0
+    !Config Help = 
+    !
+    alp_offset_omp = 0.
+    call getin('alp_offset',alp_offset_omp)
+
+    !
+    !Config Key  = lev_histhf
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    lev_histhf_omp = 1
+    call getin('lev_histhf',lev_histhf_omp)
+
+    !
+    !Config Key  = lev_histday
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    lev_histday_omp = 1
+    call getin('lev_histday',lev_histday_omp)
+
+    !
+    !Config Key  = lev_histmth
+    !Config Desc =
+    !Config Def  = 2
+    !Config Help =
+    !
+    lev_histmth_omp = 2
+    call getin('lev_histmth',lev_histmth_omp)
+    !
+    !Config Key  = lev_histins
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    lev_histins_omp = 1
+    call getin('lev_histins',lev_histins_omp)
+    !
+    !Config Key  = lev_histLES
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    lev_histLES_omp = 1
+    call getin('lev_histLES',lev_histLES_omp)
+    ! 
+    !Config Key  = lev_histdayNMC
+    !Config Desc =
+    !Config Def  = 8
+    !Config Help =
+    !
+    lev_histdayNMC_omp = 8
+    call getin('lev_histdayNMC',lev_histdayNMC_omp)
+    !
+    !Config Key  = levout_histNMC
+    !Config Desc =
+    !Config Def  = 5
+    !Config Help =
+    !
+    levout_histNMC_omp(1) = 5
+    levout_histNMC_omp(2) = 5
+    levout_histNMC_omp(3) = 5
+    call getin('levout_histNMC',levout_histNMC_omp)
+    !
+    !histNMC BEG
+    !Config Key  = ok_histNMC
+    !Config Desc = ok_histNMC(1) = frequence de sortie fichiers histmthNMC
+    !Config Desc = ok_histNMC(2) = frequence de sortie fichiers histdayNMC
+    !Config Desc = ok_histNMC(3) = frequence de sortie fichiers histhfNMC
+    !Config Def  = n, n, n
+    !Config Help =
+    !
+    ok_histNMC_omp(1) = .false.
+    ok_histNMC_omp(2) = .false.
+    ok_histNMC_omp(3) = .false.
+    call getin('ok_histNMC',ok_histNMC_omp)
+    !
+    !Config Key  = freq_outNMC
+    !Config Desc = freq_outNMC(1) = frequence de sortie fichiers histmthNMC
+    !Config Desc = freq_outNMC(2) = frequence de sortie fichiers histdayNMC
+    !Config Desc = freq_outNMC(3) = frequence de sortie fichiers histhfNMC
+    !Config Def  = 2592000., 86400., 21600. (1mois, 1jour, 6h) 
+    !Config Help =
+    !
+    freq_outNMC_omp(1) = mth_len
+    freq_outNMC_omp(2) = 1.
+    freq_outNMC_omp(3) = 1./4.
+    call getin('freq_outNMC',freq_outNMC_omp)
+    !
+    !Config Key  = freq_calNMC
+    !Config Desc = freq_calNMC(1) = frequence de calcul fichiers histmthNMC
+    !Config Desc = freq_calNMC(2) = frequence de calcul fichiers histdayNMC
+    !Config Desc = freq_calNMC(3) = frequence de calcul fichiers histhfNMC
+    !Config Def  = pasphys
+    !Config Help =
+    !
+    freq_calNMC_omp(1) = pasphys
+    freq_calNMC_omp(2) = pasphys
+    freq_calNMC_omp(3) = pasphys
+    call getin('freq_calNMC',freq_calNMC_omp)
+    !
+    !Config Key  = type_run
+    !Config Desc =
+    !Config Def  = 'AMIP'/'CFMIP'  ou 'CLIM'/'ENSP'
+    !Config Help =
+    !
+    type_run_omp = 'AMIP'
+    call getin('type_run',type_run_omp)
+
+    !
+    !Config Key  = ok_cosp
+    !Config Desc =
+    !Config Def  = .false.
+    !Config Help =
+    !
+    ok_cosp_omp = .false.
+    call getin('ok_cosp',ok_cosp_omp)
+
+    !
+    !Config Key  = ok_mensuelCOSP
+    !Config Desc =
+    !Config Def  = .true.
+    !Config Help =
+    !
+    ok_mensuelCOSP_omp = .true.
+    call getin('ok_mensuelCOSP',ok_mensuelCOSP_omp)
+
+    !
+    !Config Key  = ok_journeCOSP
+    !Config Desc =
+    !Config Def  = .true.
+    !Config Help = 
+    !
+    ok_journeCOSP_omp = .true.
+    call getin('ok_journeCOSP',ok_journeCOSP_omp)
+
+    !
+    !Config Key  = ok_hfCOSP
+    !Config Desc =
+    !Config Def  = .false.
+    !Config Help =
+    !
+    ok_hfCOSP_omp = .false.
+    call getin('ok_hfCOSP',ok_hfCOSP_omp)
+
+    !
+    ! coordonnees (lonmin_ins, lonmax_ins, latmin_ins, latmax_ins) pour la zone 
+    ! avec sorties instantannees tous les pas de temps de la physique => "histbilKP_ins.nc"
+    !
+    !Config Key  = lonmin_ins
+    !Config Desc = 100.  
+    !Config Def  = longitude minimale sorties "bilKP_ins"
+    !Config Help = 
+    !
+    lonmin_ins_omp = 100.
+    call getin('lonmin_ins',lonmin_ins_omp)
+    !
+    !Config Key  = lonmax_ins
+    !Config Desc = 130. 
+    !Config Def  = longitude maximale sorties "bilKP_ins"
+    !Config Help =
+    !
+    lonmax_ins_omp = 130.
+    call getin('lonmax_ins',lonmax_ins_omp)
+    !
+    !Config Key  = latmin_ins
+    !Config Desc = -20.  
+    !Config Def  = latitude minimale sorties "bilKP_ins"
+    !Config Help = 
+    !
+    latmin_ins_omp = -20.
+    call getin('latmin_ins',latmin_ins_omp)
+    !
+    !Config Key  = latmax_ins
+    !Config Desc = 20. 
+    !Config Def  = latitude maximale sorties "bilKP_ins"
+    !Config Help =
+    !
+    latmax_ins_omp = 20.
+    call getin('latmax_ins',latmax_ins_omp)
+    !
+    !Config Key  = ecrit_hf
+    !Config Desc =
+    !Config Def  = 1./8. !toutes les 3h
+    !Config Help =
+    !
+    ecrit_hf_omp = 1./8.
+    call getin('ecrit_hf',ecrit_hf_omp)
+    !
+    !Config Key  = ecrit_ins
+    !Config Desc =
+    !Config Def  = 1./48. ! toutes les 1/2 h
+    !Config Help =
+    !
+    ecrit_ins_omp = 1./48.
+    call getin('ecrit_ins',ecrit_ins_omp)
+    !
+    !Config Key  = ecrit_day
+    !Config Desc =
+    !Config Def  = 1.0 !tous les jours
+    !Config Help = nombre de jours pour ecriture fichier histday.nc
+    !
+    ecrit_day_omp = 1.0
+    call getin('ecrit_day',ecrit_day_omp)
+    !
+    !Config Key  = ecrit_mth
+    !Config Desc =
+    !Config Def  = 30. !tous les 30jours (1 fois par mois)
+    !Config Help =
+    !
+    ecrit_mth_omp = 30.
+    call getin('ecrit_mth',ecrit_mth_omp)
+    !
+    !Config Key  = ecrit_tra
+    !Config Desc =
+    !Config Def  = 30. !tous les 30jours (1 fois par mois)
+    !Config Help =
+    !
+    ecrit_tra_omp = 0.
+    call getin('ecrit_tra',ecrit_tra_omp)
+    !
+    !Config Key  = ecrit_reg
+    !Config Desc =
+    !Config Def  = 0.25  !4 fois par jour
+    !Config Help =
+    !
+    ecrit_reg_omp = 0.25   !4 fois par jour
+    call getin('ecrit_reg',ecrit_reg_omp)
+    !
+    !
+    !
+    ! PARAMETRES CDRAG
+    !
+    !Config Key  = f_cdrag_ter
+    !Config Desc =
+    !Config Def  = 0.8
+    !Config Help =
+    !
+    f_cdrag_ter_omp = 0.8
+    call getin('f_cdrag_ter',f_cdrag_ter_omp)
+    !
+    !Config Key  = f_cdrag_oce
+    !Config Desc =
+    !Config Def  = 0.8
+    !Config Help =
+    !
+    f_cdrag_oce_omp = 0.8
+    call getin('f_cdrag_oce',f_cdrag_oce_omp)
+    !
+    ! RUGORO
+    !Config Key  = f_rugoro
+    !Config Desc =
+    !Config Def  = 0.
+    !Config Help =
+    !
+    f_rugoro_omp = 0.
+    call getin('f_rugoro',f_rugoro_omp)
+
+    ! PARAMETERS FOR CONVECTIVE INHIBITION BY TROPOS. DRYNESS
+    !
+    !Config Key  = supcrit1
+    !Config Desc =
+    !Config Def  = .540
+    !Config Help =
+    !
+    supcrit1_omp = .540
+    call getin('supcrit1',supcrit1_omp)
+
+    !
+    !Config Key  = supcrit2
+    !Config Desc =
+    !Config Def  = .600
+    !Config Help =
+    !
+    supcrit2_omp = .600
+    call getin('supcrit2',supcrit2_omp)
+
+    !
+    ! PARAMETERS FOR THE MIXING DISTRIBUTION
+    ! iflag_mix: 0=OLD, 
+    !            1=NEW (JYG),            
+    !            2=NEW + conv. depth inhib. by tropos. dryness
+    ! '2' is NOT operationnal and should not be used.
+    !
+    !Config Key  = iflag_mix
+    !Config Desc =
+    !Config Def  = 1
+    !Config Help =
+    !
+    iflag_mix_omp = 1
+    call getin('iflag_mix',iflag_mix_omp)
+
+    !
+    !Config Key  = scut
+    !Config Desc =
+    !Config Def  = 0.95
+    !Config Help =
+    !
+    scut_omp = 0.95
+    call getin('scut',scut_omp)
+
+    !
+    !Config Key  = qqa1
+    !Config Desc =
+    !Config Def  = 1.0
+    !Config Help =
+    !
+    qqa1_omp = 1.0
+    call getin('qqa1',qqa1_omp)
+
+    !
+    !Config Key  = qqa2
+    !Config Desc =
+    !Config Def  = 0.0
+    !Config Help =
+    !
+    qqa2_omp = 0.0
+    call getin('qqa2',qqa2_omp)
+
+    !
+    !Config Key  = gammas
+    !Config Desc =
+    !Config Def  = 0.05
+    !Config Help =
+    !
+    gammas_omp = 0.05
+    call getin('gammas',gammas_omp)
+
+    !
+    !Config Key  = Fmax
+    !Config Desc =
+    !Config Def  = 0.65
+    !Config Help =
+    !
+    Fmax_omp = 0.65
+    call getin('Fmax',Fmax_omp)
+
+    !
+    !Config Key  = alphas  
+    !Config Desc =
+    !Config Def  = -5.
+    !Config Help =
+    !
+    alphas_omp = -5.
+    call getin('alphas',alphas_omp)
+
+    !Config key = ok_strato
+    !Config  Desc = activation de la version strato
+    !Config  Def  = .FALSE.
+    !Config  Help = active la version stratosphérique de LMDZ de F. Lott
+
+    ok_strato_omp=.FALSE.
+    CALL getin('ok_strato',ok_strato_omp)
+
+    !Config  key = ok_hines
+    !Config  Desc = activation de la parametrisation de hines
+    !Config  Def  = .FALSE.
+    !Config  Help = Clefs controlant la parametrization de Hines
+    !               Et la sponge layer (Runs Stratospheriques)
+
+    ok_hines_omp=.FALSE.
+    CALL getin('ok_hines',ok_hines_omp)
+
+    ! Random gravity waves:
+
+    ok_gwd_rando_omp = .FALSE.
+    CALL getin('ok_gwd_rando', ok_gwd_rando_omp)
+
+    RUWMAX_omp = 0.01
+    CALL getin('ruwmax', RUWMAX_omp)
+
+    sat_omp = 0.25
+    CALL getin('sat', sat_omp)
+
+    !Config Key  = OK_LES                                               
+    !Config Desc = Pour des sorties LES                                 
+    !Config Def  = .false.                                              
+    !Config Help = Pour creer le fichier histLES contenant les sorties  
+    !              LES                                                  
+    !                                                                   
+    ok_LES_omp = .false.                                              
+    call getin('OK_LES', ok_LES_omp)                                  
+
+    !Config Key  = callstats                                               
+    !Config Desc = Pour des sorties callstats                                 
+    !Config Def  = .false.                                              
+    !Config Help = Pour creer le fichier stats contenant les sorties  
+    !              stats                                                  
+    !                                                                   
+    callstats_omp = .false.                                              
+    call getin('callstats', callstats_omp)                                  
+    !
+    !Config Key  = ecrit_LES
+    !Config Desc = Frequence d'ecriture des resultats du LES en nombre de jours;
+    !              par defaut 1., i.e. 1 jour
+    !Config Def  = 1./8.
+    !Config Help = ... 
+    !
+    !
+    ecrit_LES_omp = 1./8.
+    call getin('ecrit_LES', ecrit_LES_omp)
+    !
+    read_climoz = 0 ! default value
+    call getin('read_climoz', read_climoz)
+
+    carbon_cycle_tr_omp=.FALSE.
+    CALL getin('carbon_cycle_tr',carbon_cycle_tr_omp)
+
+    carbon_cycle_cpl_omp=.FALSE.
+    CALL getin('carbon_cycle_cpl',carbon_cycle_cpl_omp)
+
+    !$OMP END MASTER
+    !$OMP BARRIER
 
     R_ecc = R_ecc_omp
@@ -1683,5 +1698,5 @@
     RCFC11_per = RCFC11_per_omp
     RCFC12_per = RCFC12_per_omp
-    
+
     cycle_diurne = cycle_diurne_omp
     soil_model = soil_model_omp
@@ -1748,7 +1763,7 @@
     ok_veget=.true.
     type_veget=type_veget_omp
-    if (type_veget=='n' .or. type_veget=='bucket' .or. type_veget=='betaclim' ) &
-         & then
-         ok_veget=.false.
+    if (type_veget=='n' .or. type_veget=='bucket' .or. type_veget=='betaclim') &
+         then
+       ok_veget=.false.
     endif
     ! Martin
@@ -1791,5 +1806,5 @@
     tau_thermals = tau_thermals_omp
     alp_bl_k = alp_bl_k_omp
-!!! nrlmd le 10/04/2012
+    ! nrlmd le 10/04/2012
     iflag_trig_bl = iflag_trig_bl_omp
     s_trig = s_trig_omp
@@ -1797,5 +1812,5 @@
     tau_trig_deep = tau_trig_deep_omp
     iflag_clos_bl = iflag_clos_bl_omp
-!!! fin nrlmd le 10/04/2012
+    ! fin nrlmd le 10/04/2012
     iflag_coupl = iflag_coupl_omp
     iflag_clos = iflag_clos_omp
@@ -1835,4 +1850,7 @@
     ok_strato = ok_strato_omp
     ok_hines = ok_hines_omp
+    ok_gwd_rando = ok_gwd_rando_omp
+    RUWMAX = RUWMAX_omp
+    sat = sat_omp
     ok_LES = ok_LES_omp
     callstats = callstats_omp
@@ -1841,5 +1859,5 @@
     carbon_cycle_cpl = carbon_cycle_cpl_omp
 
-! Test of coherence between type_ocean and version_ocean
+    ! Test of coherence between type_ocean and version_ocean
     IF (type_ocean=='couple' .AND. (version_ocean/='opa8' .AND. version_ocean/='nemo') ) THEN
        WRITE(lunout,*)' ERROR version_ocean=',version_ocean,' not valid in coupled configuration'
@@ -1854,6 +1872,6 @@
     END IF
 
-! Test sur new_aod. Ce flag permet de retrouver les resultats de l'AR4
-! il n'est utilisable que lors du couplage avec le SO4 seul 
+    ! Test sur new_aod. Ce flag permet de retrouver les resultats de l'AR4
+    ! il n'est utilisable que lors du couplage avec le SO4 seul 
     IF (ok_ade .OR. ok_aie) THEN 
        IF ( flag_aerosol .EQ. 0 ) THEN
@@ -1865,164 +1883,167 @@
     END IF
 
-! ok_cdnc must be set to y if ok_aie is activated
+    ! ok_cdnc must be set to y if ok_aie is activated
     IF (ok_aie .AND. .NOT. ok_cdnc) THEN
        CALL abort_gcm('conf_phys', 'ok_cdnc must be set to y if ok_aie is activated',1)
-    ENDIF 
-
-!$OMP MASTER
-
-  write(lunout,*)' ##############################################'
-  write(lunout,*)' Configuration des parametres de la physique: '
-  write(lunout,*)' Type ocean = ', type_ocean
-  write(lunout,*)' Version ocean = ', version_ocean
-  write(lunout,*)' Config veget = ', ok_veget,type_veget
-  write(lunout,*)' Snow model SISVAT : ok_snow = ', ok_snow
-  write(lunout,*)' Sortie journaliere = ', ok_journe
-  write(lunout,*)' Sortie haute frequence = ', ok_hf
-  write(lunout,*)' Sortie mensuelle = ', ok_mensuel
-  write(lunout,*)' Sortie instantanee = ', ok_instan
-  write(lunout,*)' Frequence appel simulateur ISCCP, freq_ISCCP =', freq_ISCCP
-  write(lunout,*)' Frequence appel simulateur ISCCP, ecrit_ISCCP =', ecrit_ISCCP
-  write(lunout,*)' Frequence appel simulateur COSP, freq_COSP =', freq_COSP
-  write(lunout,*)' Sortie bilan d''energie, ip_ebil_phy =', ip_ebil_phy
-  write(lunout,*)' Excentricite = ',R_ecc
-  write(lunout,*)' Equinoxe = ',R_peri
-  write(lunout,*)' Inclinaison =',R_incl
-  write(lunout,*)' Constante solaire =',solaire
-  write(lunout,*)' co2_ppm =',co2_ppm
-  write(lunout,*)' RCO2_act = ',RCO2_act
-  write(lunout,*)' CH4_ppb =',CH4_ppb,' RCH4_act = ',RCH4_act
-  write(lunout,*)' N2O_ppb =',N2O_ppb,' RN2O_act=  ',RN2O_act
-  write(lunout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11_act=  ',RCFC11_act
-  write(lunout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12_act=  ',RCFC12_act
-  write(lunout,*)' ok_4xCO2atm=',ok_4xCO2atm
-  write(lunout,*)' RCO2_per = ',RCO2_per,' RCH4_per = ', RCH4_per
-  write(lunout,*)' RN2O_per = ',RN2O_per,' RCFC11_per = ', RCFC11_per
-  write(lunout,*)' RCFC12_per = ',RCFC12_per
-  write(lunout,*)' cvl_corr=', cvl_corr
-  write(lunout,*)'ok_lic_melt=', ok_lic_melt
-  write(lunout,*)'cycle_diurne=',cycle_diurne
-  write(lunout,*)'soil_model=',soil_model
-  write(lunout,*)'new_oliq=',new_oliq
-  write(lunout,*)'ok_orodr=',ok_orodr
-  write(lunout,*)'ok_orolf=',ok_orolf
-  write(lunout,*)'ok_limitvrai=',ok_limitvrai
-  write(lunout,*)'nbapp_rad=',nbapp_rad
-  write(lunout,*)'iflag_con=',iflag_con
-  write(lunout,*)'iflag_ener_conserv=',iflag_ener_conserv
-  write(lunout,*)'iflag_fisrtilp_qsat=',iflag_fisrtilp_qsat
-  write(lunout,*)' epmax = ', epmax
-  write(lunout,*)' ok_adj_ema = ', ok_adj_ema
-  write(lunout,*)' iflag_clw = ', iflag_clw
-  write(lunout,*)' cld_lc_lsc = ', cld_lc_lsc
-  write(lunout,*)' cld_lc_con = ', cld_lc_con
-  write(lunout,*)' cld_tau_lsc = ', cld_tau_lsc
-  write(lunout,*)' cld_tau_con = ', cld_tau_con
-  write(lunout,*)' ffallv_lsc = ', ffallv_lsc
-  write(lunout,*)' ffallv_con = ', ffallv_con
-  write(lunout,*)' coef_eva = ', coef_eva
-  write(lunout,*)' reevap_ice = ', reevap_ice
-  write(lunout,*)' iflag_pdf = ', iflag_pdf
-  write(lunout,*)' iflag_cldcon = ', iflag_cldcon
-  write(lunout,*)' iflag_radia = ', iflag_radia
-  write(lunout,*)' iflag_rrtm = ', iflag_rrtm
-  write(lunout,*)' iflag_ratqs = ', iflag_ratqs
-  write(lunout,*)' seuil_inversion = ', seuil_inversion
-  write(lunout,*)' fact_cldcon = ', fact_cldcon
-  write(lunout,*)' facttemps = ', facttemps
-  write(lunout,*)' ok_newmicro = ',ok_newmicro 
-  write(lunout,*)' ratqsbas = ',ratqsbas 
-  write(lunout,*)' ratqshaut = ',ratqshaut 
-  write(lunout,*)' tau_ratqs = ',tau_ratqs 
-  write(lunout,*)' top_height = ',top_height 
-  write(lunout,*)' rad_froid = ',rad_froid
-  write(lunout,*)' rad_chau1 = ',rad_chau1
-  write(lunout,*)' rad_chau2 = ',rad_chau2
-  write(lunout,*)' t_glace_min = ',t_glace_min
-  write(lunout,*)' t_glace_max = ',t_glace_max
-  write(lunout,*)' iflag_ice_thermo = ',iflag_ice_thermo
-  write(lunout,*)' rei_min = ',rei_min
-  write(lunout,*)' rei_max = ',rei_max
-  write(lunout,*)' overlap = ',overlap 
-  write(lunout,*)' cdmmax = ',cdmmax 
-  write(lunout,*)' cdhmax = ',cdhmax 
-  write(lunout,*)' ksta = ',ksta 
-  write(lunout,*)' ksta_ter = ',ksta_ter 
-  write(lunout,*)' ok_kzmin = ',ok_kzmin 
-  write(lunout,*)' fmagic = ',fmagic
-  write(lunout,*)' pmagic = ',pmagic
-  write(lunout,*)' ok_ade = ',ok_ade
-  write(lunout,*)' ok_aie = ',ok_aie
-  write(lunout,*)' aerosol_couple = ', aerosol_couple
-  write(lunout,*)' flag_aerosol = ', flag_aerosol
-  write(lunout,*)' flag_aerosol_strat = ', flag_aerosol_strat
-  write(lunout,*)' new_aod = ', new_aod
-  write(lunout,*)' aer_type = ',aer_type
-  write(lunout,*)' bl95_b0 = ',bl95_b0
-  write(lunout,*)' bl95_b1 = ',bl95_b1
-  write(lunout,*)' lev_histhf = ',lev_histhf 
-  write(lunout,*)' lev_histday = ',lev_histday 
-  write(lunout,*)' lev_histmth = ',lev_histmth 
-  write(lunout,*)' lev_histins = ',lev_histins
-  write(lunout,*)' lev_histLES = ',lev_histLES
-  write(lunout,*)' lev_histdayNMC = ',lev_histdayNMC
-  write(lunout,*)' levout_histNMC = ',levout_histNMC
-  write(lunout,*)' ok_histNMC = ',ok_histNMC
-  write(lunout,*)' freq_outNMC = ',freq_outNMC
-  write(lunout,*)' freq_calNMC = ',freq_calNMC
-  write(lunout,*)' iflag_pbl = ', iflag_pbl
-  write(lunout,*)' iflag_thermals = ', iflag_thermals
-  write(lunout,*)' iflag_thermals_ed = ', iflag_thermals_ed
-  write(lunout,*)' iflag_thermals_optflux = ', iflag_thermals_optflux
-  write(lunout,*)' iflag_clos = ', iflag_clos
-  write(lunout,*)' type_run = ',type_run 
-  write(lunout,*)' ok_cosp = ',ok_cosp
-  write(lunout,*)' ok_mensuelCOSP = ',ok_mensuelCOSP
-  write(lunout,*)' ok_journeCOSP = ',ok_journeCOSP
-  write(lunout,*)' ok_hfCOSP =',ok_hfCOSP
-  write(lunout,*)' solarlong0 = ', solarlong0
-  write(lunout,*)' qsol0 = ', qsol0
-  write(lunout,*)' evap0 = ', evap0
-  write(lunout,*)' albsno0 = ', albsno0
-  write(lunout,*)' inertie_sol = ', inertie_sol
-  write(lunout,*)' inertie_ice = ', inertie_ice
-  write(lunout,*)' inertie_sno = ', inertie_sno
-  write(lunout,*)' f_cdrag_ter = ',f_cdrag_ter
-  write(lunout,*)' f_cdrag_oce = ',f_cdrag_oce
-  write(lunout,*)' f_rugoro = ',f_rugoro
-  write(lunout,*)' supcrit1 = ', supcrit1
-  write(lunout,*)' supcrit2 = ', supcrit2
-  write(lunout,*)' iflag_mix = ', iflag_mix
-  write(lunout,*)' scut = ', scut
-  write(lunout,*)' qqa1 = ', qqa1
-  write(lunout,*)' qqa2 = ', qqa2
-  write(lunout,*)' gammas = ', gammas
-  write(lunout,*)' Fmax = ', Fmax
-  write(lunout,*)' alphas = ', alphas
-  write(lunout,*)' iflag_wake = ', iflag_wake
-  write(lunout,*)' alp_offset = ', alp_offset
-!!! nrlmd le 10/04/2012
-  write(lunout,*)' iflag_trig_bl = ', iflag_trig_bl
-  write(lunout,*)' s_trig = ', s_trig
-  write(lunout,*)' tau_trig_shallow = ', tau_trig_shallow
-  write(lunout,*)' tau_trig_deep = ', tau_trig_deep
-  write(lunout,*)' iflag_clos_bl = ', iflag_clos_bl
-!!! fin nrlmd le 10/04/2012
-
-  write(lunout,*)' lonmin lonmax latmin latmax bilKP_ins =',&
-   lonmin_ins, lonmax_ins, latmin_ins, latmax_ins
-  write(lunout,*)' ecrit_ hf, ins, day, mth, reg, tra, ISCCP, LES',&
-   ecrit_hf, ecrit_ins, ecrit_day, ecrit_mth, ecrit_reg, ecrit_tra, ecrit_ISCCP, ecrit_LES
-
-  write(lunout,*) 'ok_strato = ', ok_strato
-  write(lunout,*) 'ok_hines = ',  ok_hines
-  write(lunout,*) 'read_climoz = ', read_climoz
-  write(lunout,*) 'carbon_cycle_tr = ', carbon_cycle_tr
-  write(lunout,*) 'carbon_cycle_cpl = ', carbon_cycle_cpl
-  
-!$OMP END MASTER
-
-  return
-  
+    ENDIF
+
+    !$OMP MASTER
+
+    write(lunout,*)' ##############################################'
+    write(lunout,*)' Configuration des parametres de la physique: '
+    write(lunout,*)' Type ocean = ', type_ocean
+    write(lunout,*)' Version ocean = ', version_ocean
+    write(lunout,*)' Config veget = ', ok_veget,type_veget
+    write(lunout,*)' Snow model SISVAT : ok_snow = ', ok_snow
+    write(lunout,*)' Sortie journaliere = ', ok_journe
+    write(lunout,*)' Sortie haute frequence = ', ok_hf
+    write(lunout,*)' Sortie mensuelle = ', ok_mensuel
+    write(lunout,*)' Sortie instantanee = ', ok_instan
+    write(lunout,*)' Frequence appel simulateur ISCCP, freq_ISCCP =', freq_ISCCP
+    write(lunout,*)' Frequence appel simulateur ISCCP, ecrit_ISCCP =', ecrit_ISCCP
+    write(lunout,*)' Frequence appel simulateur COSP, freq_COSP =', freq_COSP
+    write(lunout,*)' Sortie bilan d''energie, ip_ebil_phy =', ip_ebil_phy
+    write(lunout,*)' Excentricite = ',R_ecc
+    write(lunout,*)' Equinoxe = ',R_peri
+    write(lunout,*)' Inclinaison =',R_incl
+    write(lunout,*)' Constante solaire =',solaire
+    write(lunout,*)' co2_ppm =',co2_ppm
+    write(lunout,*)' RCO2_act = ',RCO2_act
+    write(lunout,*)' CH4_ppb =',CH4_ppb,' RCH4_act = ',RCH4_act
+    write(lunout,*)' N2O_ppb =',N2O_ppb,' RN2O_act=  ',RN2O_act
+    write(lunout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11_act=  ',RCFC11_act
+    write(lunout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12_act=  ',RCFC12_act
+    write(lunout,*)' ok_4xCO2atm=',ok_4xCO2atm
+    write(lunout,*)' RCO2_per = ',RCO2_per,' RCH4_per = ', RCH4_per
+    write(lunout,*)' RN2O_per = ',RN2O_per,' RCFC11_per = ', RCFC11_per
+    write(lunout,*)' RCFC12_per = ',RCFC12_per
+    write(lunout,*)' cvl_corr=', cvl_corr
+    write(lunout,*)'ok_lic_melt=', ok_lic_melt
+    write(lunout,*)'cycle_diurne=',cycle_diurne
+    write(lunout,*)'soil_model=',soil_model
+    write(lunout,*)'new_oliq=',new_oliq
+    write(lunout,*)'ok_orodr=',ok_orodr
+    write(lunout,*)'ok_orolf=',ok_orolf
+    write(lunout,*)'ok_limitvrai=',ok_limitvrai
+    write(lunout,*)'nbapp_rad=',nbapp_rad
+    write(lunout,*)'iflag_con=',iflag_con
+    write(lunout,*)'iflag_ener_conserv=',iflag_ener_conserv
+    write(lunout,*)'iflag_fisrtilp_qsat=',iflag_fisrtilp_qsat
+    write(lunout,*)' epmax = ', epmax
+    write(lunout,*)' ok_adj_ema = ', ok_adj_ema
+    write(lunout,*)' iflag_clw = ', iflag_clw
+    write(lunout,*)' cld_lc_lsc = ', cld_lc_lsc
+    write(lunout,*)' cld_lc_con = ', cld_lc_con
+    write(lunout,*)' cld_tau_lsc = ', cld_tau_lsc
+    write(lunout,*)' cld_tau_con = ', cld_tau_con
+    write(lunout,*)' ffallv_lsc = ', ffallv_lsc
+    write(lunout,*)' ffallv_con = ', ffallv_con
+    write(lunout,*)' coef_eva = ', coef_eva
+    write(lunout,*)' reevap_ice = ', reevap_ice
+    write(lunout,*)' iflag_pdf = ', iflag_pdf
+    write(lunout,*)' iflag_cldcon = ', iflag_cldcon
+    write(lunout,*)' iflag_radia = ', iflag_radia
+    write(lunout,*)' iflag_rrtm = ', iflag_rrtm
+    write(lunout,*)' iflag_ratqs = ', iflag_ratqs
+    write(lunout,*)' seuil_inversion = ', seuil_inversion
+    write(lunout,*)' fact_cldcon = ', fact_cldcon
+    write(lunout,*)' facttemps = ', facttemps
+    write(lunout,*)' ok_newmicro = ',ok_newmicro 
+    write(lunout,*)' ratqsbas = ',ratqsbas 
+    write(lunout,*)' ratqshaut = ',ratqshaut 
+    write(lunout,*)' tau_ratqs = ',tau_ratqs 
+    write(lunout,*)' top_height = ',top_height 
+    write(lunout,*)' rad_froid = ',rad_froid
+    write(lunout,*)' rad_chau1 = ',rad_chau1
+    write(lunout,*)' rad_chau2 = ',rad_chau2
+    write(lunout,*)' t_glace_min = ',t_glace_min
+    write(lunout,*)' t_glace_max = ',t_glace_max
+    write(lunout,*)' iflag_ice_thermo = ',iflag_ice_thermo
+    write(lunout,*)' rei_min = ',rei_min
+    write(lunout,*)' rei_max = ',rei_max
+    write(lunout,*)' overlap = ',overlap 
+    write(lunout,*)' cdmmax = ',cdmmax 
+    write(lunout,*)' cdhmax = ',cdhmax 
+    write(lunout,*)' ksta = ',ksta 
+    write(lunout,*)' ksta_ter = ',ksta_ter 
+    write(lunout,*)' ok_kzmin = ',ok_kzmin 
+    write(lunout,*)' fmagic = ',fmagic
+    write(lunout,*)' pmagic = ',pmagic
+    write(lunout,*)' ok_ade = ',ok_ade
+    write(lunout,*)' ok_aie = ',ok_aie
+    write(lunout,*)' aerosol_couple = ', aerosol_couple
+    write(lunout,*)' flag_aerosol = ', flag_aerosol
+    write(lunout,*)' flag_aerosol_strat = ', flag_aerosol_strat
+    write(lunout,*)' new_aod = ', new_aod
+    write(lunout,*)' aer_type = ',aer_type
+    write(lunout,*)' bl95_b0 = ',bl95_b0
+    write(lunout,*)' bl95_b1 = ',bl95_b1
+    write(lunout,*)' lev_histhf = ',lev_histhf 
+    write(lunout,*)' lev_histday = ',lev_histday 
+    write(lunout,*)' lev_histmth = ',lev_histmth 
+    write(lunout,*)' lev_histins = ',lev_histins
+    write(lunout,*)' lev_histLES = ',lev_histLES
+    write(lunout,*)' lev_histdayNMC = ',lev_histdayNMC
+    write(lunout,*)' levout_histNMC = ',levout_histNMC
+    write(lunout,*)' ok_histNMC = ',ok_histNMC
+    write(lunout,*)' freq_outNMC = ',freq_outNMC
+    write(lunout,*)' freq_calNMC = ',freq_calNMC
+    write(lunout,*)' iflag_pbl = ', iflag_pbl
+    write(lunout,*)' iflag_thermals = ', iflag_thermals
+    write(lunout,*)' iflag_thermals_ed = ', iflag_thermals_ed
+    write(lunout,*)' iflag_thermals_optflux = ', iflag_thermals_optflux
+    write(lunout,*)' iflag_clos = ', iflag_clos
+    write(lunout,*)' type_run = ',type_run 
+    write(lunout,*)' ok_cosp = ',ok_cosp
+    write(lunout,*)' ok_mensuelCOSP = ',ok_mensuelCOSP
+    write(lunout,*)' ok_journeCOSP = ',ok_journeCOSP
+    write(lunout,*)' ok_hfCOSP =',ok_hfCOSP
+    write(lunout,*)' solarlong0 = ', solarlong0
+    write(lunout,*)' qsol0 = ', qsol0
+    write(lunout,*)' evap0 = ', evap0
+    write(lunout,*)' albsno0 = ', albsno0
+    write(lunout,*)' inertie_sol = ', inertie_sol
+    write(lunout,*)' inertie_ice = ', inertie_ice
+    write(lunout,*)' inertie_sno = ', inertie_sno
+    write(lunout,*)' f_cdrag_ter = ',f_cdrag_ter
+    write(lunout,*)' f_cdrag_oce = ',f_cdrag_oce
+    write(lunout,*)' f_rugoro = ',f_rugoro
+    write(lunout,*)' supcrit1 = ', supcrit1
+    write(lunout,*)' supcrit2 = ', supcrit2
+    write(lunout,*)' iflag_mix = ', iflag_mix
+    write(lunout,*)' scut = ', scut
+    write(lunout,*)' qqa1 = ', qqa1
+    write(lunout,*)' qqa2 = ', qqa2
+    write(lunout,*)' gammas = ', gammas
+    write(lunout,*)' Fmax = ', Fmax
+    write(lunout,*)' alphas = ', alphas
+    write(lunout,*)' iflag_wake = ', iflag_wake
+    write(lunout,*)' alp_offset = ', alp_offset
+    ! nrlmd le 10/04/2012
+    write(lunout,*)' iflag_trig_bl = ', iflag_trig_bl
+    write(lunout,*)' s_trig = ', s_trig
+    write(lunout,*)' tau_trig_shallow = ', tau_trig_shallow
+    write(lunout,*)' tau_trig_deep = ', tau_trig_deep
+    write(lunout,*)' iflag_clos_bl = ', iflag_clos_bl
+    ! fin nrlmd le 10/04/2012
+
+    write(lunout,*)' lonmin lonmax latmin latmax bilKP_ins =',&
+         lonmin_ins, lonmax_ins, latmin_ins, latmax_ins
+    write(lunout,*)' ecrit_ hf, ins, day, mth, reg, tra, ISCCP, LES',&
+         ecrit_hf, ecrit_ins, ecrit_day, ecrit_mth, ecrit_reg, ecrit_tra, ecrit_ISCCP, ecrit_LES
+
+    write(lunout,*) 'ok_strato = ', ok_strato
+    write(lunout,*) 'ok_hines = ',  ok_hines
+    write(lunout,*) 'ok_gwd_rando = ',  ok_gwd_rando
+    write(lunout,*) 'RUWMAX = ', RUWMAX
+    write(lunout,*) 'sat = ', sat
+    write(lunout,*) 'read_climoz = ', read_climoz
+    write(lunout,*) 'carbon_cycle_tr = ', carbon_cycle_tr
+    write(lunout,*) 'carbon_cycle_cpl = ', carbon_cycle_cpl
+
+    !$OMP END MASTER
+
+    return
+
   end subroutine conf_phys
 
@@ -2032,37 +2053,37 @@
 !
 
-   subroutine conf_interface(tau_calv)
-
-   use IOIPSL
-   implicit none
-   include "iniprint.h"
-! Configuration de l'interace atm/surf
-!
-! tau_calv:    temps de relaxation pour la fonte des glaciers
+subroutine conf_interface(tau_calv)
+
+  use IOIPSL
+  implicit none
+  include "iniprint.h"
+  ! Configuration de l'interace atm/surf
+  !
+  ! tau_calv:    temps de relaxation pour la fonte des glaciers
 
   REAL          :: tau_calv
   REAL,SAVE     :: tau_calv_omp
 
-!
-!Config Key  = tau_calv
-!Config Desc = temps de relaxation pour fonte des glaciers en jours
-!Config Def  = 1 an 
-!Config Help = 
-!
+  !
+  !Config Key  = tau_calv
+  !Config Desc = temps de relaxation pour fonte des glaciers en jours
+  !Config Def  = 1 an 
+  !Config Help = 
+  !
   tau_calv_omp = 360.*10.
-!$OMP MASTER
+  !$OMP MASTER
   call getin('tau_calv',tau_calv_omp)
-!$OMP END MASTER
-!$OMP BARRIER
+  !$OMP END MASTER
+  !$OMP BARRIER
 
   tau_calv=tau_calv_omp
-  
-!$OMP MASTER
+
+  !$OMP MASTER
   write(lunout,*)' ##############################################'
   WRITE(lunout,*)' Configuration de l''interface atm/surfaces  : '
   WRITE(lunout,*)' tau_calv = ',tau_calv
-!$OMP END MASTER
+  !$OMP END MASTER
 
   return
 
-  end subroutine conf_interface
+end subroutine conf_interface
Index: /LMDZ5/trunk/libf/phylmd/flott_gwd_rando_m.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/flott_gwd_rando_m.F90	(revision 1938)
+++ /LMDZ5/trunk/libf/phylmd/flott_gwd_rando_m.F90	(revision 1938)
@@ -0,0 +1,374 @@
+module FLOTT_GWD_rando_m
+
+  implicit none
+
+contains
+
+  SUBROUTINE FLOTT_GWD_rando(DTIME, pp, tt, uu, vv, prec, zustr, zvstr, d_u, &
+       d_v)
+
+    ! Parametrization of the momentum flux deposition due to a discrete
+    ! number of gravity waves. 
+    ! Author: F. Lott
+    ! July, 12th, 2012
+    ! Gaussian distribution of the source, source is precipitation
+    ! Reference: Lott (JGR, vol 118, page 8897, 2013)
+
+    use dimphy, only: klon, klev
+    use assert_m, only: assert
+
+    include "YOMCST.h"
+    include "clesphys.h"
+    include "YOEGWD.h"
+
+    ! 0. DECLARATIONS:
+
+    ! 0.1 INPUTS
+    REAL, intent(in)::DTIME ! Time step of the Physics
+    REAL, intent(in):: pp(:, :) ! (KLON, KLEV) Pressure at full levels
+    REAL, intent(in):: prec(:) ! (klon) Precipitation (kg/m^2/s) 
+    REAL, intent(in):: TT(:, :) ! (KLON, KLEV) Temp at full levels 
+    REAL, intent(in):: UU(:, :) ! (KLON, KLEV) Zonal wind at full levels
+    REAL, intent(in):: VV(:, :) ! (KLON, KLEV) Merid wind at full levels
+
+    ! 0.2 OUTPUTS
+    REAL, intent(out):: zustr(:), zvstr(:) ! (KLON) Surface Stresses
+
+    REAL, intent(inout):: d_u(:, :), d_v(:, :) 
+    ! (KLON, KLEV) tendencies on winds
+
+    ! O.3 INTERNAL ARRAYS
+    REAL BVLOW(klon)
+
+    INTEGER II, LL
+
+    ! 0.3.0 TIME SCALE OF THE LIFE CYCLE OF THE WAVES PARAMETERIZED
+
+    REAL DELTAT
+
+    ! 0.3.1 GRAVITY-WAVES SPECIFICATIONS
+
+    INTEGER, PARAMETER:: NK = 2, NP = 2, NO = 2, NW = NK * NP * NO
+    INTEGER JK, JP, JO, JW
+    REAL KMIN, KMAX ! Min and Max horizontal wavenumbers
+    REAL CMIN, CMAX ! Min and Max absolute ph. vel.
+    REAL CPHA ! absolute PHASE VELOCITY frequency
+    REAL ZK(NW, KLON) ! Horizontal wavenumber amplitude
+    REAL ZP(NW, KLON) ! Horizontal wavenumber angle 
+    REAL ZO(NW, KLON) ! Absolute frequency !
+
+    ! Waves Intr. freq. at the 1/2 lev surrounding the full level
+    REAL ZOM(NW, KLON), ZOP(NW, KLON)
+
+    ! Wave EP-fluxes at the 2 semi levels surrounding the full level
+    REAL WWM(NW, KLON), WWP(NW, KLON)
+
+    REAL RUW0(NW, KLON) ! Fluxes at launching level
+
+    REAL RUWP(NW, KLON), RVWP(NW, KLON)
+    ! Fluxes X and Y for each waves at 1/2 Levels
+
+    INTEGER LAUNCH, LTROP ! Launching altitude and tropo altitude
+
+    REAL XLAUNCH ! Controle the launching altitude
+    REAL XTROP ! SORT of Tropopause altitude 
+    REAL RUW(KLON, KLEV + 1) ! Flux x at semi levels
+    REAL RVW(KLON, KLEV + 1) ! Flux y at semi levels
+
+    REAL PRMAX ! Maximum value of PREC, and for which our linear formula
+    ! for GWs parameterisation apply
+
+    ! 0.3.2 PARAMETERS OF WAVES DISSIPATIONS
+
+    REAL RDISS, ZOISEC ! COEFF DE DISSIPATION, SECURITY FOR INTRINSIC FREQ
+
+    ! 0.3.3 BACKGROUND FLOW AT 1/2 LEVELS AND VERTICAL COORDINATE
+
+    REAL H0 ! Characteristic Height of the atmosphere
+    REAL DZ ! Characteristic depth of the source!
+    REAL PR, TR ! Reference Pressure and Temperature
+
+    REAL ZH(KLON, KLEV + 1) ! Log-pressure altitude
+
+    REAL UH(KLON, KLEV + 1), VH(KLON, KLEV + 1) ! Winds at 1/2 levels
+    REAL PH(KLON, KLEV + 1) ! Pressure at 1/2 levels
+    REAL PSEC ! Security to avoid division by 0 pressure
+    REAL PHM1(KLON, KLEV + 1) ! 1/Press at 1/2 levels
+    REAL BV(KLON, KLEV + 1) ! Brunt Vaisala freq. (BVF) at 1/2 levels
+    REAL BVSEC ! Security to avoid negative BVF
+
+    !-----------------------------------------------------------------
+
+    ! 1. INITIALISATIONS
+
+    ! 1.1 Basic parameter
+
+    ! Are provided from elsewhere (latent heat of vaporization, dry
+    ! gaz constant for air, gravity constant, heat capacity of dry air
+    ! at constant pressure, earth rotation rate, pi).
+
+    ! 1.2 Tuning parameters of V14
+
+    RDISS = 1. ! Diffusion parameter 
+
+    PRMAX = 20. / 24. /3600.
+    ! maximum of rain for which our theory applies (in kg/m^2/s)
+
+    DZ = 1000. ! Characteristic depth of the source
+    XLAUNCH=0.5 ! Parameter that control launching altitude
+    XTROP=0.2 ! Parameter that control tropopause altitude
+    DELTAT=24.*3600. ! Time scale of the waves (first introduced in 9b)
+
+    KMIN = 2.E-5
+    ! minimum horizontal wavenumber (inverse of the subgrid scale resolution)
+
+    KMAX = 1.E-3 ! Max horizontal wavenumber
+    CMIN = 1. ! Min phase velocity
+    CMAX = 50. ! Max phase speed velocity
+
+    TR = 240. ! Reference Temperature
+    PR = 101300. ! Reference pressure
+    H0 = RD * TR / RG ! Characteristic vertical scale height
+
+    BVSEC = 5.E-3 ! Security to avoid negative BVF 
+    PSEC = 1.E-6 ! Security to avoid division by 0 pressure
+    ZOISEC = 1.E-6 ! Security FOR 0 INTRINSIC FREQ
+
+    call assert(klon == (/size(pp, 1), size(tt, 1), size(uu, 1), &
+         size(vv, 1), size(prec), size(zustr), size(zvstr), size(d_u, 1), &
+         size(d_v, 1)/), "FLOTT_GWD_RANDO klon")
+    call assert(klev == (/size(pp, 2), size(tt, 2), size(uu, 2), &
+         size(vv, 2), size(d_u, 2), size(d_v, 2)/), "FLOTT_GWD_RANDO klev")
+
+    IF(DELTAT < DTIME)THEN
+       PRINT *, 'flott_gwd_rando: deltat < dtime!'
+       STOP 1
+    ENDIF
+
+    IF (KLEV < NW) THEN
+       PRINT *, 'flott_gwd_rando: you will have problem with random numbers'
+       STOP 1
+    ENDIF
+
+    ! 2. EVALUATION OF THE BACKGROUND FLOW AT SEMI-LEVELS
+
+    ! Pressure and Inv of pressure
+    DO LL = 2, KLEV
+       PH(:, LL) = EXP((LOG(PP(:, LL)) + LOG(PP(:, LL - 1))) / 2.)
+       PHM1(:, LL) = 1. / PH(:, LL) 
+    end DO
+
+    PH(:, KLEV + 1) = 0. 
+    PHM1(:, KLEV + 1) = 1. / PSEC
+    PH(:, 1) = 2. * PP(:, 1) - PH(:, 2)
+
+    ! Launching altitude
+
+    LAUNCH=0
+    LTROP =0
+    DO LL = 1, KLEV
+       IF (PH(KLON / 2, LL) / PH(KLON / 2, 1) > XLAUNCH) LAUNCH = LL
+    ENDDO
+    DO LL = 1, KLEV
+       IF (PH(KLON / 2, LL) / PH(KLON / 2, 1) > XTROP) LTROP = LL
+    ENDDO
+
+    ! Log pressure vert. coordinate
+    DO LL = 1, KLEV + 1 
+       ZH(:, LL) = H0 * LOG(PR / (PH(:, LL) + PSEC))
+    end DO
+
+    ! BV frequency
+    DO LL = 2, KLEV
+       ! BVSEC: BV Frequency (UH USED IS AS A TEMPORARY ARRAY DOWN TO WINDS)
+       UH(:, LL) = 0.5 * (TT(:, LL) + TT(:, LL - 1)) &
+            * RD**2 / RCPD / H0**2 + (TT(:, LL) &
+            - TT(:, LL - 1)) / (ZH(:, LL) - ZH(:, LL - 1)) * RD / H0
+    end DO
+    BVLOW = 0.5 * (TT(:, LTROP )+ TT(:, LAUNCH)) &
+         * RD**2 / RCPD / H0**2 + (TT(:, LTROP ) &
+         - TT(:, LAUNCH))/(ZH(:, LTROP )- ZH(:, LAUNCH)) * RD / H0
+
+    UH(:, 1) = UH(:, 2)
+    UH(:, KLEV + 1) = UH(:, KLEV)
+    BV(:, 1) = UH(:, 2)
+    BV(:, KLEV + 1) = UH(:, KLEV)
+    ! SMOOTHING THE BV HELPS
+    DO LL = 2, KLEV
+       BV(:, LL)=(UH(:, LL+1)+2.*UH(:, LL)+UH(:, LL-1))/4.
+    end DO
+
+    BV=MAX(SQRT(MAX(BV, 0.)), BVSEC)
+    BVLOW=MAX(SQRT(MAX(BVLOW, 0.)), BVSEC)
+
+    ! WINDS
+    DO LL = 2, KLEV
+       UH(:, LL) = 0.5 * (UU(:, LL) + UU(:, LL - 1)) ! Zonal wind
+       VH(:, LL) = 0.5 * (VV(:, LL) + VV(:, LL - 1)) ! Meridional wind
+    end DO
+    UH(:, 1) = 0.
+    VH(:, 1) = 0.
+    UH(:, KLEV + 1) = UU(:, KLEV)
+    VH(:, KLEV + 1) = VV(:, KLEV)
+
+    ! 3 WAVES CHARACTERISTICS CHOSEN RANDOMLY AT THE LAUNCH ALTITUDE
+
+    ! The mod functions of weird arguments are used to produce the
+    ! waves characteristics in an almost stochastic way
+
+    JW = 0
+    DO JP = 1, NP
+       DO JK = 1, NK
+          DO JO = 1, NO
+             JW = JW + 1
+             ! Angle
+             DO II = 1, KLON
+                ! Angle (0 or PI so far)
+                ZP(JW, II) = (SIGN(1., 0.5 - MOD(TT(II, JW) * 10., 1.)) + 1.) &
+                     * RPI / 2.
+                ! Horizontal wavenumber amplitude
+                ZK(JW, II) = KMIN + (KMAX - KMIN) * MOD(TT(II, JW) * 100., 1.)
+                ! Horizontal phase speed
+                CPHA = CMIN + (CMAX - CMIN) * MOD(TT(II, JW)**2, 1.)
+                ! Absolute frequency is imposed
+                ZO(JW, II) = CPHA * ZK(JW, II) 
+                ! Intrinsic frequency is imposed
+                ZO(JW, II) = ZO(JW, II) &
+                     + ZK(JW, II) * COS(ZP(JW, II)) * UH(II, LAUNCH) &
+                     + ZK(JW, II) * SIN(ZP(JW, II)) * VH(II, LAUNCH)
+                ! Momentum flux at launch lev 
+                RUW0(JW, II) = RUWMAX
+             ENDDO
+          end DO
+       end DO
+    end DO
+
+    ! 4. COMPUTE THE FLUXES
+
+    ! 4.1 Vertical velocity at launching altitude to ensure 
+    ! the correct value to the imposed fluxes.
+
+    DO JW = 1, NW
+
+       ! Evaluate intrinsic frequency at launching altitude:
+       ZOP(JW, :) = ZO(JW, :) &
+            - ZK(JW, :) * COS(ZP(JW, :)) * UH(:, LAUNCH) &
+            - ZK(JW, :) * SIN(ZP(JW, :)) * VH(:, LAUNCH) 
+
+       ! VERSION WITH CONVECTIVE SOURCE
+
+       ! Vertical velocity at launch level, value to ensure the
+       ! imposed factor related to the convective forcing:
+       ! precipitations.
+
+       ! tanh limitation to values above prmax:
+       WWP(JW, :) = RUW0(JW, :) &
+            * (RD / RCPD / H0 * RLVTT * PRMAX * TANH(PREC / PRMAX))**2
+
+       ! Factor related to the characteristics of the waves:
+       WWP(JW, :) = WWP(JW, :) * ZK(JW, :)**3 / KMIN / BVLOW &
+            / MAX(ABS(ZOP(JW, :)), ZOISEC)**3 
+
+       ! Moderation by the depth of the source (dz here):
+       WWP(JW, :) = WWP(JW, :) &
+            * EXP(- BVLOW**2 / MAX(ABS(ZOP(JW, :)), ZOISEC)**2 * ZK(JW, :)**2 &
+            * DZ**2)
+
+       ! Put the stress in the right direction:
+       RUWP(JW, :) = ZOP(JW, :) / MAX(ABS(ZOP(JW, :)), ZOISEC)**2 &
+            * BV(:, LAUNCH) * COS(ZP(JW, :)) * WWP(JW, :)**2
+       RVWP(JW, :) = ZOP(JW, :) / MAX(ABS(ZOP(JW, :)), ZOISEC)**2 &
+            * BV(:, LAUNCH) * SIN(ZP(JW, :)) * WWP(JW, :)**2
+    end DO
+
+    ! 4.2 Uniform values below the launching altitude
+
+    DO LL = 1, LAUNCH
+       RUW(:, LL) = 0
+       RVW(:, LL) = 0
+       DO JW = 1, NW
+          RUW(:, LL) = RUW(:, LL) + RUWP(JW, :)
+          RVW(:, LL) = RVW(:, LL) + RVWP(JW, :)
+       end DO
+    end DO
+
+    ! 4.3 Loop over altitudes, with passage from one level to the next
+    ! done by i) conserving the EP flux, ii) dissipating a little,
+    ! iii) testing critical levels, and vi) testing the breaking.
+
+    DO LL = LAUNCH, KLEV - 1
+       ! Warning: all the physics is here (passage from one level
+       ! to the next)
+       DO JW = 1, NW
+          ZOM(JW, :) = ZOP(JW, :)
+          WWM(JW, :) = WWP(JW, :)
+          ! Intrinsic Frequency
+          ZOP(JW, :) = ZO(JW, :) - ZK(JW, :) * COS(ZP(JW, :)) * UH(:, LL + 1) &
+               - ZK(JW, :) * SIN(ZP(JW, :)) * VH(:, LL + 1) 
+
+          ! No breaking (Eq.6)
+          ! Dissipation (Eq. 8)
+          WWP(JW, :) = WWM(JW, :) * EXP(- 2. * RDISS * PR / (PH(:, LL + 1) &
+               + PH(:, LL)) * ((BV(:, LL + 1) + BV(:, LL)) / 2.)**3 &
+               / MAX(ABS(ZOP(JW, :) + ZOM(JW, :)) / 2., ZOISEC)**4 &
+               * ZK(JW, :)**3 * (ZH(:, LL + 1) - ZH(:, LL)))
+
+          ! Critical levels (forced to zero if intrinsic frequency changes sign)
+          ! Saturation (Eq. 12)
+          WWP(JW, :) = min(WWP(JW, :), MAX(0., &
+               SIGN(1., ZOP(JW, :) * ZOM(JW, :))) * ABS(ZOP(JW, :))**3 &
+               / BV(:, LL + 1) * EXP(- ZH(:, LL + 1) / H0) * SAT**2 * KMIN**2 &
+               / ZK(JW, :)**4)
+       end DO
+
+       ! Evaluate EP-flux from Eq. 7 and give the right orientation to
+       ! the stress
+
+       DO JW = 1, NW
+          RUWP(JW, :) = SIGN(1., ZOP(JW, :))*COS(ZP(JW, :)) * WWP(JW, :)
+          RVWP(JW, :) = SIGN(1., ZOP(JW, :))*SIN(ZP(JW, :)) * WWP(JW, :)
+       end DO
+
+       RUW(:, LL + 1) = 0.
+       RVW(:, LL + 1) = 0.
+
+       DO JW = 1, NW
+          RUW(:, LL + 1) = RUW(:, LL + 1) + RUWP(JW, :) 
+          RVW(:, LL + 1) = RVW(:, LL + 1) + RVWP(JW, :) 
+       end DO
+    end DO
+
+    ! 5 CALCUL DES TENDANCES:
+
+    ! 5.1 Rectification des flux au sommet et dans les basses couches
+
+    RUW(:, KLEV + 1) = 0.
+    RVW(:, KLEV + 1) = 0.
+    RUW(:, 1) = RUW(:, LAUNCH)
+    RVW(:, 1) = RVW(:, LAUNCH)
+    DO LL = 1, LAUNCH
+       RUW(:, LL) = RUW(:, LAUNCH+1)
+       RVW(:, LL) = RVW(:, LAUNCH+1)
+    end DO
+
+    ! AR-1 RECURSIVE FORMULA (13) IN VERSION 4
+    DO LL = 1, KLEV
+       D_U(:, LL) = (1.-DTIME/DELTAT) * D_U(:, LL) + DTIME/DELTAT/REAL(NW) * &
+            RG * (RUW(:, LL + 1) - RUW(:, LL)) &
+            / (PH(:, LL + 1) - PH(:, LL)) * DTIME
+       D_V(:, LL) = (1.-DTIME/DELTAT) * D_V(:, LL) + DTIME/DELTAT/REAL(NW) * &
+            RG * (RVW(:, LL + 1) - RVW(:, LL)) &
+            / (PH(:, LL + 1) - PH(:, LL)) * DTIME
+    ENDDO
+
+    ! Cosmetic: evaluation of the cumulated stress
+    ZUSTR = 0.
+    ZVSTR = 0.
+    DO LL = 1, KLEV
+       ZUSTR = ZUSTR + D_U(:, LL) / RG * (PH(:, LL + 1) - PH(:, LL))/DTIME
+       ZVSTR = ZVSTR + D_V(:, LL) / RG * (PH(:, LL + 1) - PH(:, LL))/DTIME
+    ENDDO
+
+  END SUBROUTINE FLOTT_GWD_RANDO
+
+end module FLOTT_GWD_rando_m
Index: /LMDZ5/trunk/libf/phylmd/phyetat0.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phyetat0.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/phyetat0.F90	(revision 1938)
@@ -3,19 +3,22 @@
 SUBROUTINE phyetat0 (fichnom, clesphy0, tabcntr0)
 
-  USE dimphy
-  USE mod_grid_phy_lmdz
-  USE mod_phys_lmdz_para
-  USE iophy
+  USE dimphy, only: klon, zmasq, klev
+  USE iophy, ONLY : init_iophy_new
   USE ocean_cpl_mod,    ONLY : ocean_cpl_init
   USE fonte_neige_mod,  ONLY : fonte_neige_init
   USE pbl_surface_mod,  ONLY : pbl_surface_init
   USE surface_data,     ONLY : type_ocean
-  USE phys_state_var_mod
-  USE iostart
-  USE write_field_phy
-  USE infotrac
+  USE phys_state_var_mod, ONLY : ancien_ok, clwcon, detr_therm, dtime, &
+       du_gwd_rando, dv_gwd_rando, entr_therm, f0, falb1, falb2, fm_therm, &
+       ftsol, pbl_tke, pctsrf, q_ancien, radpas, radsol, rain_fall, ratqs, &
+       rlat, rlon, rnebcon, rugoro, sig1, snow_fall, solaire_etat0, sollw, &
+       solsw, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
+       wake_deltat, wake_fip, wake_pe, wake_s, zgam, zmax0, zmea, zpic, zsig, &
+       zstd, zthe, zval
+  USE iostart, ONLY : close_startphy, get_field, get_var, open_startphy
+  USE infotrac, only: nbtr, type_trac, tname, niadv
   USE traclmdz_mod,    ONLY : traclmdz_from_restart
   USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl, co2_send
-  USE indice_sol_mod
+  USE indice_sol_mod, only: nbsrf, is_ter, epsfra, is_lic, is_oce, is_sic
 
   IMPLICIT none
@@ -1028,4 +1031,18 @@
   END IF
 
+  if (ok_gwd_rando) then
+     call get_field("du_gwd_rando", du_gwd_rando, found)
+     if (.not. found) then
+        print *, "du_gwd_rando not found, setting it to 0."
+        du_gwd_rando = 0.
+     end if
+
+     call get_field("dv_gwd_rando", dv_gwd_rando, found)
+     if (.not. found) then
+        print *, "dv_gwd_rando not found, setting it to 0."
+        dv_gwd_rando = 0.
+     end if
+  end if
+
   ! on ferme le fichier
   CALL close_startphy
Index: /LMDZ5/trunk/libf/phylmd/phyredem.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phyredem.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/phyredem.F90	(revision 1938)
@@ -340,4 +340,13 @@
   END IF
 
+  if (ok_gwd_rando) then
+     call put_field("du_gwd_rando", &
+          "tendency on zonal wind due to gravity waves", &
+          du_gwd_rando)
+     call put_field("dv_gwd_rando", &
+          "tendency on meriodional wind due to gravity waves", &
+          dv_gwd_rando)
+  end if
+
   CALL close_restartphy
   !$OMP BARRIER
Index: /LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90	(revision 1938)
@@ -1088,4 +1088,14 @@
     'dthin', 'Hines GWD dT', 'K/s', (/ ('', i=1, 9) /))
 
+  type(ctrl_out), save:: o_du_gwd_rando &
+       = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), 'du_gwd_rando', &
+       "Random gravity waves dU/dt", "m/s2", (/ ('', i=1, 9) /))
+  type(ctrl_out), save:: o_dv_gwd_rando &
+       = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), 'dv_gwd_rando', &
+       "Random gravity waves dV/dt", "m/s2", (/ ('', i=1, 9) /))
+  type(ctrl_out), save:: o_vstr_gwd_rando &
+       = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), 'vstr_gwd_rando', &
+       "meridional wind stress random gravity waves", "Pa", (/ ('', i=1, 9) /))
+
   TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_trac(:)
   TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_trac_cum(:)
Index: /LMDZ5/trunk/libf/phylmd/phys_output_var_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_output_var_mod.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/phys_output_var_mod.F90	(revision 1938)
@@ -2,59 +2,62 @@
 ! phys_local_var_mod.F90 1327 2010-03-17 15:33:56Z idelkadi $
 
-      MODULE phys_output_var_mod
+MODULE phys_output_var_mod
 
-      use dimphy
-! Variables outputs pour les ecritures des sorties
-!======================================================================
-!
-!
-!======================================================================
-! Declaration des variables
+  use dimphy
+  ! Variables outputs pour les ecritures des sorties
+  !======================================================================
+  !
+  !
+  !======================================================================
+  ! Declaration des variables
 
-      REAL, SAVE, ALLOCATABLE :: snow_o(:), zfra_o(:)
-!$OMP THREADPRIVATE(snow_o, zfra_o)
-      INTEGER, SAVE, ALLOCATABLE ::  itau_con(:)       ! Nombre de pas ou rflag <= 1
-!$OMP THREADPRIVATE(itau_con)
-      REAL, ALLOCATABLE :: bils_ec(:) ! Contribution of energy conservation
-      REAL, ALLOCATABLE :: bils_tke(:) ! Contribution of energy conservation
-      REAL, ALLOCATABLE :: bils_diss(:) ! Contribution of energy conservation
-      REAL, ALLOCATABLE :: bils_kinetic(:) ! bilan de chaleur au sol, kinetic
-      REAL, ALLOCATABLE :: bils_enthalp(:) ! bilan de chaleur au sol
-      REAL, ALLOCATABLE :: bils_latent(:) ! bilan de chaleur au sol
-!$OMP THREADPRIVATE(bils_ec,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent)
+  REAL, SAVE, ALLOCATABLE :: snow_o(:), zfra_o(:)
+  !$OMP THREADPRIVATE(snow_o, zfra_o)
+  INTEGER, SAVE, ALLOCATABLE ::  itau_con(:)       ! Nombre de pas ou rflag <= 1
+  !$OMP THREADPRIVATE(itau_con)
+  REAL, ALLOCATABLE :: bils_ec(:) ! Contribution of energy conservation
+  REAL, ALLOCATABLE :: bils_tke(:) ! Contribution of energy conservation
+  REAL, ALLOCATABLE :: bils_diss(:) ! Contribution of energy conservation
+  REAL, ALLOCATABLE :: bils_kinetic(:) ! bilan de chaleur au sol, kinetic
+  REAL, ALLOCATABLE :: bils_enthalp(:) ! bilan de chaleur au sol
+  REAL, ALLOCATABLE :: bils_latent(:) ! bilan de chaleur au sol
+  !$OMP THREADPRIVATE(bils_ec,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent)
 
 
-! ug Plein de variables venues de phys_output_mod
-      INTEGER, PARAMETER                           :: nfiles = 9
-      LOGICAL, DIMENSION(nfiles), SAVE             :: clef_files
-      LOGICAL, DIMENSION(nfiles), SAVE             :: clef_stations
-      INTEGER, DIMENSION(nfiles), SAVE             :: lev_files
-      INTEGER, DIMENSION(nfiles), SAVE             :: nid_files
-      INTEGER, DIMENSION(nfiles), SAVE  :: nnid_files
-!$OMP THREADPRIVATE(clef_files, clef_stations, lev_files,nid_files,nnid_files)
-      INTEGER, DIMENSION(nfiles), SAVE :: nnhorim
+  ! ug Plein de variables venues de phys_output_mod
+  INTEGER, PARAMETER                           :: nfiles = 9
+  LOGICAL, DIMENSION(nfiles), SAVE             :: clef_files
+  LOGICAL, DIMENSION(nfiles), SAVE             :: clef_stations
+  INTEGER, DIMENSION(nfiles), SAVE             :: lev_files
+  INTEGER, DIMENSION(nfiles), SAVE             :: nid_files
+  INTEGER, DIMENSION(nfiles), SAVE  :: nnid_files
+  !$OMP THREADPRIVATE(clef_files, clef_stations, lev_files,nid_files,nnid_files)
+  INTEGER, DIMENSION(nfiles), SAVE :: nnhorim
 
-      INTEGER, DIMENSION(nfiles), SAVE :: nhorim, nvertm
-      INTEGER, DIMENSION(nfiles), SAVE :: nvertap, nvertbp, nvertAlt
-      REAL, DIMENSION(nfiles), SAVE                :: zoutm
-      CHARACTER(LEN=20), DIMENSION(nfiles), SAVE   :: type_ecri
-!$OMP THREADPRIVATE(nnhorim, nhorim, nvertm, zoutm,type_ecri)
-      CHARACTER(LEN=20), DIMENSION(nfiles), SAVE  :: type_ecri_files, phys_out_filetypes
-!$OMP THREADPRIVATE(type_ecri_files, phys_out_filetypes)
-    CHARACTER(LEN=20), DIMENSION(nfiles), SAVE  :: phys_out_filenames
-!$OMP THREADPRIVATE(phys_out_filenames)
+  INTEGER, DIMENSION(nfiles), SAVE :: nhorim, nvertm
+  INTEGER, DIMENSION(nfiles), SAVE :: nvertap, nvertbp, nvertAlt
+  REAL, DIMENSION(nfiles), SAVE                :: zoutm
+  CHARACTER(LEN=20), DIMENSION(nfiles), SAVE   :: type_ecri
+  !$OMP THREADPRIVATE(nnhorim, nhorim, nvertm, zoutm,type_ecri)
+  CHARACTER(LEN=20), DIMENSION(nfiles), SAVE  :: type_ecri_files, phys_out_filetypes
+  !$OMP THREADPRIVATE(type_ecri_files, phys_out_filetypes)
+  CHARACTER(LEN=20), DIMENSION(nfiles), SAVE  :: phys_out_filenames
+  !$OMP THREADPRIVATE(phys_out_filenames)
 
- ! swaero_diag : flag indicates if it is necessary to do calculation for some aerosol diagnostics
-      LOGICAL, SAVE                                :: swaero_diag=.FALSE.
-!$OMP THREADPRIVATE(swaero_diag)
+  ! swaero_diag : flag indicates if it is necessary to do calculation for some aerosol diagnostics
+  LOGICAL, SAVE                                :: swaero_diag=.FALSE.
+  !$OMP THREADPRIVATE(swaero_diag)
 
-      INTEGER, SAVE:: levmin(nfiles) = 1
-      INTEGER, SAVE:: levmax(nfiles)
-!$OMP THREADPRIVATE(levmin, levmax)
+  INTEGER, SAVE:: levmin(nfiles) = 1
+  INTEGER, SAVE:: levmax(nfiles)
+  !$OMP THREADPRIVATE(levmin, levmax)
 
-      REAL, SAVE                :: zdtime_moy
-!$OMP THREADPRIVATE(zdtime_moy)
+  REAL, SAVE                :: zdtime_moy
+  !$OMP THREADPRIVATE(zdtime_moy)
 
-      LOGICAL, SAVE :: vars_defined = .FALSE. ! ug PAS THREADPRIVATE ET C'EST NORMAL
+  LOGICAL, SAVE :: vars_defined = .FALSE. ! ug PAS THREADPRIVATE ET C'EST NORMAL
+
+  REAL, allocatable:: zustr_gwd_rando(:), zvstr_gwd_rando(:) ! (klon)
+  !$OMP THREADPRIVATE(zustr_gwd_rando, zvstr_gwd_rando)
 
   TYPE ctrl_out
@@ -65,27 +68,34 @@
      CHARACTER(len=20),DIMENSION(nfiles)  :: type_ecrit
   END TYPE ctrl_out
+
 CONTAINS
 
-!======================================================================
-SUBROUTINE phys_output_var_init
-use dimphy
+  !======================================================================
+  SUBROUTINE phys_output_var_init
+    use dimphy
 
-IMPLICIT NONE
+    IMPLICIT NONE
 
-      allocate(snow_o(klon), zfra_o(klon))
-      allocate(itau_con(klon))
-      allocate (bils_ec(klon),bils_tke(klon),bils_diss(klon),bils_kinetic(klon),bils_enthalp(klon),bils_latent(klon))
+    include "clesphys.h"
 
-END SUBROUTINE phys_output_var_init
+    !------------------------------------------------
 
-!======================================================================
-SUBROUTINE phys_output_var_end
-use dimphy
-IMPLICIT NONE
+    allocate(snow_o(klon), zfra_o(klon))
+    allocate(itau_con(klon))
+    allocate (bils_ec(klon),bils_tke(klon),bils_diss(klon),bils_kinetic(klon),bils_enthalp(klon),bils_latent(klon))
 
-      deallocate(snow_o,zfra_o,itau_con)
-      deallocate (bils_ec,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent)
+    IF (ok_gwd_rando) allocate(zustr_gwd_rando(klon), zvstr_gwd_rando(klon))
 
-END SUBROUTINE phys_output_var_end
+  END SUBROUTINE phys_output_var_init
+
+  !======================================================================
+  SUBROUTINE phys_output_var_end
+    use dimphy
+    IMPLICIT NONE
+
+    deallocate(snow_o,zfra_o,itau_con)
+    deallocate (bils_ec,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent)
+
+  END SUBROUTINE phys_output_var_end
 
 END MODULE phys_output_var_mod
Index: /LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 1938)
@@ -146,5 +146,6 @@
          o_dtr_insc, o_dtr_bcscav, o_dtr_evapls, &
          o_dtr_ls, o_dtr_trsp, o_dtr_sscav, &
-         o_dtr_sat, o_dtr_uscav, o_trac_cum
+         o_dtr_sat, o_dtr_uscav, o_trac_cum, o_du_gwd_rando, o_dv_gwd_rando, &
+         o_vstr_gwd_rando
 
     USE phys_state_var_mod, only: pctsrf, paire_ter, rain_fall, snow_fall, &
@@ -167,5 +168,5 @@
          vqsumSTD, vTsumSTD, O3daysumSTD, wqsumSTD, &
          vphisumSTD, wTsumSTD, u2sumSTD, v2sumSTD, &
-         T2sumSTD, nlevSTD
+         T2sumSTD, nlevSTD, du_gwd_rando, dv_gwd_rando
 
     USE phys_local_var_mod, only: zxfluxlat, slp, zxtsol, zt2m, &
@@ -216,7 +217,6 @@
 
     USE phys_output_var_mod, only: vars_defined, snow_o, zfra_o, bils_diss, &
-         bils_ec, bils_tke, bils_kinetic, bils_latent, &
-         bils_enthalp, itau_con, nfiles, clef_files, &
-         nid_files
+         bils_ec, bils_tke, bils_kinetic, bils_latent, bils_enthalp, &
+         itau_con, nfiles, clef_files, nid_files, zvstr_gwd_rando
     USE indice_sol_mod, only: nbsrf
     USE infotrac, only: nqtot
@@ -892,11 +892,11 @@
        CALL histwrite_phy(o_rnebcon, rnebcon)
        CALL histwrite_phy(o_rnebls, rneb)
-IF (vars_defined)  THEN
-      DO k=1, klev
-         DO i=1, klon
-            zx_tmp_fi3d(i,k)=cldfra(i,k)*JrNt(i)
-         ENDDO
-      ENDDO
-ENDIF
+       IF (vars_defined)  THEN
+          DO k=1, klev
+             DO i=1, klon
+                zx_tmp_fi3d(i,k)=cldfra(i,k)*JrNt(i)
+             ENDDO
+          ENDDO
+       ENDIF
        CALL histwrite_phy(o_rnebjn, zx_tmp_fi3d)
        CALL histwrite_phy(o_rhum, zx_rh)
@@ -1119,4 +1119,11 @@
           CALL histwrite_phy(o_dthin, zx_tmp_fi3d)
        ENDIF
+
+       IF (ok_gwd_rando) then
+          CALL histwrite_phy(o_du_gwd_rando, du_gwd_rando / pdtphys)
+          CALL histwrite_phy(o_dv_gwd_rando, dv_gwd_rando / pdtphys)
+          CALL histwrite_phy(o_vstr_gwd_rando, zvstr_gwd_rando)
+       end IF
+
        CALL histwrite_phy(o_rsu, swup)
        CALL histwrite_phy(o_rsd, swdn)
Index: /LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90	(revision 1938)
@@ -357,4 +357,8 @@
 !!! fin nrlmd le 10/04/2012
 
+      REAL, ALLOCATABLE, SAVE:: du_gwd_rando(:, :), dv_gwd_rando(:, :)
+      !$OMP THREADPRIVATE(du_gwd_rando, dv_gwd_rando)
+      ! tendencies on wind due to gravity waves
+
 CONTAINS
 
@@ -376,4 +380,5 @@
 ! climatology and the daylight climatology
 
+include "clesphys.h"
       ALLOCATE(rlat(klon), rlon(klon))
       ALLOCATE(pctsrf(klon,nbsrf))
@@ -517,4 +522,6 @@
       ALLOCATE(ale_bl_trig(klon))
 !!! fin nrlmd le 10/04/2012
+      if (ok_gwd_rando) allocate(du_gwd_rando(klon, klev), &
+           dv_gwd_rando(klon, klev))
 
 END SUBROUTINE phys_state_var_init
@@ -526,4 +533,5 @@
 USE indice_sol_mod
 IMPLICIT NONE
+include "clesphys.h"
 
       deallocate(rlat, rlon, pctsrf, ftsol, falb1, falb2)
@@ -624,4 +632,5 @@
       deallocate(tau_aero,piz_aero,cg_aero)
       deallocate(ccm)
+      if (ok_gwd_rando) deallocate(du_gwd_rando, dv_gwd_rando)
        
 !!! nrlmd le 10/04/2012
Index: /LMDZ5/trunk/libf/phylmd/physiq.F90
===================================================================
--- /LMDZ5/trunk/libf/phylmd/physiq.F90	(revision 1937)
+++ /LMDZ5/trunk/libf/phylmd/physiq.F90	(revision 1938)
@@ -55,4 +55,6 @@
   !IM stations CFMIP
   USE CFMIP_point_locations
+  use FLOTT_GWD_rando_m, only: FLOTT_GWD_rando
+
   IMPLICIT none
   !>======================================================================
@@ -614,5 +616,5 @@
 
   ! tendance nulles
-  REAL du0(klon,klev),dv0(klon,klev),dq0(klon,klev),dql0(klon,klev)
+  REAL, dimension(klon,klev):: du0, dv0, dt0, dq0, dql0
 
   !
@@ -1390,4 +1392,5 @@
   du0(:,:)=0.
   dv0(:,:)=0.
+  dt0 = 0.
   dq0(:,:)=0.
   dql0(:,:)=0.
@@ -3251,6 +3254,12 @@
   ENDIF
 
-  !
-  !IM cf. FLott BEG
+  if (ok_gwd_rando) then
+     call FLOTT_GWD_rando(DTIME, pplay, t_seri, u_seri, v_seri, &
+          rain_fall + snow_fall, zustr_gwd_rando, zvstr_gwd_rando, &
+          du_gwd_rando, dv_gwd_rando)
+     CALL add_phys_tend(du_gwd_rando, dv_gwd_rando, dt0, dq0, dql0, &
+          'flott_gwd_rando')
+  end if
+
   ! STRESS NECESSAIRES: TOUTE LA PHYSIQUE
 
