Index: trunk/LMDZ.COMMON/libf/dyn3d/conf_gcm.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/conf_gcm.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d/conf_gcm.F90	(revision 1650)
@@ -25,5 +25,5 @@
   USE logic_mod, ONLY: tidal,purmats,ok_guide,read_start,iflag_phys,		&
 		iflag_trac,ok_strato,ok_gradsfile,ok_limit,ok_etat0,		&
-		moyzon_mu,moyzon_ch,ok_strato,fxyhypb,ysinus
+		moyzon_mu,moyzon_ch,ok_strato,fxyhypb,ysinus,read_orop
   USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy,		&
 		alphax,alphay,taux,tauy
@@ -53,9 +53,7 @@
 !   ------
 
-  CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
   REAL clonn,clatt,grossismxx,grossismyy
   REAL dzoomxx,dzoomyy, tauxx,tauyy
   LOGICAL  fxyhypbb, ysinuss
-  INTEGER i
   LOGICAL use_filtre_fft
 !
@@ -549,5 +547,5 @@
   IF (use_filtre_fft) THEN
     write(lunout,*)'STOP !!!'
-    write(lunout,*)'use_filtre_fft n est pas implemente dans dyn3d'
+    write(lunout,*)'use_filtre_fft not implemented in dyn3d'
     STOP 1
   ENDIF
@@ -597,4 +595,12 @@
   ok_etat0 = .TRUE.
   CALL getin('ok_etat0',ok_etat0)
+
+!Config  Key  = read_orop
+!Config  Desc = lecture du fichier de params orographiques sous maille
+!Config  Def  = f
+!Config  Help = lecture fichier plutot que grid_noro
+
+  read_orop = .FALSE.
+  CALL getin('read_orop',read_orop)
 
 !----------------------------------------
@@ -954,4 +960,5 @@
  write(lunout,*)' ok_limit = ', ok_limit
  write(lunout,*)' ok_etat0 = ', ok_etat0
+ write(lunout,*)' read_orop = ', read_orop
  if (planet_type=="titan") then
    write(lunout,*)' moyzon_mu = ', moyzon_mu
Index: trunk/LMDZ.COMMON/libf/dyn3d/guide_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/guide_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d/guide_mod.F90	(revision 1650)
@@ -13,5 +13,4 @@
   use netcdf, only: nf90_nowrite, nf90_open, nf90_inq_varid, nf90_close
   use pres2lev_mod
-  USE serre_mod, ONLY: grossismx
 
   IMPLICIT NONE
@@ -39,5 +38,5 @@
 
   REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE     :: alpha_u,alpha_v 
-  REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE     :: alpha_T,alpha_Q 
+  REAL, ALLOCATABLE, DIMENSION(:, :), PRIVATE, SAVE     :: alpha_T,alpha_Q 
   REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE     :: alpha_P,alpha_pcor
   
@@ -64,5 +63,6 @@
   SUBROUTINE guide_init
 
-    USE control_mod
+    USE control_mod, ONLY: day_step
+    USE serre_mod, ONLY: grossismx
 
     IMPLICIT NONE
@@ -108,5 +108,5 @@
     CALL getpar('gamma4',.false.,gamma4,'Zone sans rappel elargie')
     CALL getpar('guide_BL',.true.,guide_BL,'guidage dans C.Lim')
-    
+
 ! Sauvegarde du for�age
     CALL getpar('guide_sav',.false.,guide_sav,'sauvegarde guidage')
@@ -147,5 +147,5 @@
 
     call fin_getparam
-
+    
 ! ---------------------------------------------
 ! Determination du nombre de niveaux verticaux
@@ -222,7 +222,7 @@
     ALLOCATE(alpha_v(ip1jm), stat = error)
     IF (error /= 0) CALL abort_gcm(modname,abort_message,1)
-    ALLOCATE(alpha_T(ip1jmp1), stat = error)
+    ALLOCATE(alpha_T(iip1, jjp1), stat = error)
     IF (error /= 0) CALL abort_gcm(modname,abort_message,1)
-    ALLOCATE(alpha_Q(ip1jmp1), stat = error)
+    ALLOCATE(alpha_Q(iip1, jjp1), stat = error)
     IF (error /= 0) CALL abort_gcm(modname,abort_message,1)
     ALLOCATE(alpha_P(ip1jmp1), stat = error)
@@ -312,7 +312,7 @@
   SUBROUTINE guide_main(itau,ucov,vcov,teta,q,masse,ps)
 
-    USE control_mod
-    USE comvert_mod, ONLY: ap,bp,preff,presnivs
-    USE comconst_mod, ONLY: daysec,dtvr
+    USE control_mod, ONLY: day_step, iperiod
+    USE comconst_mod, ONLY: dtvr, daysec
+    USE comvert_mod, ONLY: ap, bp, preff, presnivs
  
     IMPLICIT NONE
@@ -541,5 +541,5 @@
 
     USE comconst_mod, ONLY: pi
-
+    
     IMPLICIT NONE
 
@@ -606,7 +606,6 @@
   use exner_hyb_m, only: exner_hyb
   use exner_milieu_m, only: exner_milieu
-  USE comvert_mod, ONLY: ap,bp,preff,pressure_exner
-  USE comconst_mod, ONLY: cpp,kappa
-
+  use comconst_mod, only: kappa, cpp
+  use comvert_mod, only: preff, pressure_exner, bp, ap
   IMPLICIT NONE
 
@@ -777,15 +776,15 @@
             do j=1,jjp1
                 IF (guide_teta) THEN
-		    do i=1,iim
-			ij=(j-1)*iip1+i
-			tgui1(ij,l)=zu1(i,j,l)
-			tgui2(ij,l)=zu2(i,j,l)
-		    enddo
+                    do i=1,iim
+                        ij=(j-1)*iip1+i
+                        tgui1(ij,l)=zu1(i,j,l)
+                        tgui2(ij,l)=zu2(i,j,l)
+                    enddo
                 ELSE
-		    do i=1,iim
-			ij=(j-1)*iip1+i
-			tgui1(ij,l)=zu1(i,j,l)*cpp/pk(i,j,l)
-			tgui2(ij,l)=zu2(i,j,l)*cpp/pk(i,j,l)
-		    enddo
+                    do i=1,iim
+                        ij=(j-1)*iip1+i
+                        tgui1(ij,l)=zu1(i,j,l)*cpp/pk(i,j,l)
+                        tgui2(ij,l)=zu2(i,j,l)*cpp/pk(i,j,l)
+                    enddo
                 ENDIF
                 tgui1(j*iip1,l)=tgui1((j-1)*iip1+1,l)    
@@ -855,7 +854,7 @@
 ! Calcul des constantes de rappel alpha (=1/tau)
 
-    USE comconst_mod, ONLY: pi
-    USE serre_mod, ONLY: clon,clat,grossismy
-
+    use comconst_mod, only: pi
+    use serre_mod, only: clon, clat, grossismx, grossismy
+    
     implicit none
 
@@ -1517,7 +1516,9 @@
   SUBROUTINE guide_out(varname,hsize,vsize,field)
 
+    USE comconst_mod, ONLY: pi
     USE comvert_mod, ONLY: presnivs
-    USE comconst_mod, ONLY: pi
-
+    use netcdf95, only: nf95_def_var, nf95_put_var
+    use netcdf, only: nf90_float
+    
     IMPLICIT NONE
 
@@ -1537,5 +1538,5 @@
     INTEGER       :: nid, id_lonu, id_lonv, id_latu, id_latv, id_tim, id_lev
     INTEGER       :: vid_lonu,vid_lonv,vid_latu,vid_latv,vid_cu,vid_cv,vid_lev
-    INTEGER       :: vid_au,vid_av
+    INTEGER       :: vid_au,vid_av, varid_alpha_t, varid_alpha_q
     INTEGER, DIMENSION (3) :: dim3
     INTEGER, DIMENSION (4) :: dim4,count,start
@@ -1568,4 +1569,8 @@
         ierr=NF_DEF_VAR(nid,"cv",NF_FLOAT,2,(/id_lonv,id_latv/),vid_cv)
         ierr=NF_DEF_VAR(nid,"av",NF_FLOAT,2,(/id_lonv,id_latv/),vid_av)
+        call nf95_def_var(nid, "alpha_T", nf90_float, (/id_lonv, id_latu/), &
+             varid_alpha_t)
+        call nf95_def_var(nid, "alpha_q", nf90_float, (/id_lonv, id_latu/), &
+             varid_alpha_q)
         
         ierr=NF_ENDDEF(nid)
@@ -1593,4 +1598,6 @@
         ierr = NF_PUT_VAR_REAL(nid,vid_av,alpha_v)
 #endif
+        call nf95_put_var(nid, varid_alpha_t, alpha_t)
+        call nf95_put_var(nid, varid_alpha_q, alpha_q)
 ! --------------------------------------------------------------------
 ! Cr�ation des variables sauvegard�es
Index: trunk/LMDZ.COMMON/libf/dyn3d/logic_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/logic_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d/logic_mod.F90	(revision 1650)
@@ -3,13 +3,34 @@
 IMPLICIT NONE  
 
-      LOGICAL purmats,forward,leapf,apphys,statcl,conser,               &
-     & apdiss,apdelq,saison,ecripar,fxyhypb,ysinus                      &
-     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
-     &  ,ok_limit,ok_etat0
-      logical hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
-                     ! (only used if disvert_type==2)
-      logical moyzon_mu,moyzon_ch ! used for zonal averages in Titan
+  LOGICAL purmats ! true if time stepping is purely Matsuno scheme
+                  ! false implies Matsuno-Leapfrog time stepping scheme
+  LOGICAL forward ! true if during forward phase of Matsuno step
+  LOGICAL leapf ! true if during a leapfrog time stepping step
+  LOGICAL apphys ! true if during a time step when physics will be called
+  LOGICAL statcl
+  LOGICAL conser
+  LOGICAL apdiss ! true if during a time step when dissipation will be called
+  LOGICAL apdelq
+  LOGICAL saison
+  LOGICAL ecripar
+  LOGICAL fxyhypb ! true if using hyperbolic function discretization
+                  ! for latitudinal grid 
+  LOGICAL ysinus ! true if using sine function discretiation
+                 ! for latitudinal grid
+  LOGICAL read_start ! true if reading a start.nc file to initialize fields
+  LOGICAL ok_guide ! true if nudging
+  LOGICAL ok_strato
+  LOGICAL tidal  ! true if adding tidal forces (for Titan)
+  LOGICAL ok_gradsfile
+  LOGICAL ok_limit  ! true for boundary conditions file creation (limit.nc)
+  LOGICAL ok_etat0  ! true for initial states creation (start.nc, startphy.nc)
+  LOGICAL read_orop ! true for sub-cell scales orographic params read in file
+  LOGICAL hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
+                 ! (only used if disvert_type==2)
+  LOGICAL moyzon_mu,moyzon_ch ! used for zonal averages in Titan
 
-      integer iflag_phys,iflag_trac
+  INTEGER iflag_phys ! type of physics to call: 0 none, 1: phy*** package,
+                     ! 2: Held & Suarez, 101-200: aquaplanets & terraplanets
+  INTEGER iflag_trac
 
 END MODULE logic_mod
Index: trunk/LMDZ.COMMON/libf/dyn3d/temps_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/temps_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d/temps_mod.F90	(revision 1650)
@@ -3,9 +3,7 @@
 IMPLICIT NONE  
 
-! jD_ref = jour julien de la date de reference (lancement de l'experience)
-! hD_ref = "heure" julienne de la date de reference
-
       INTEGER   itaufin ! total number of dynamical steps for the run
-      INTEGER   itau_dyn, itau_phy
+      INTEGER   itau_dyn
+      INTEGER   itau_phy
       INTEGER   day_ini ! initial day # of simulation sequence
       INTEGER   day_end ! final day # ; i.e. day # when this simulation ends
@@ -13,6 +11,8 @@
       INTEGER   day_ref
       REAL      dt ! (dynamics) time step (changes if doing Matsuno or LF step)
-      REAL      jD_ref, jH_ref, start_time
-      CHARACTER (len=10) :: calend
+      REAL      jD_ref ! reference julian day date (beginning of experiment)
+      REAL      jH_ref ! reference julian "hour" of reference julian date
+      REAL      start_time
+      CHARACTER (len=10) :: calend ! calendar type
 
       ! Additionnal Mars stuff:
Index: trunk/LMDZ.COMMON/libf/dyn3d_common/comconst_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d_common/comconst_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d_common/comconst_mod.F90	(revision 1650)
@@ -12,6 +12,6 @@
       REAL r ! Reduced Gas constant r=R/mu
              ! with R=8.31.. J.K-1.mol-1, mu: mol mass of atmosphere (kg/mol)
-      REAL cpp   ! Cp
-      REAL kappa ! kappa=R/Cp 
+      REAL cpp   ! Specific heat Cp (J.kg-1.K-1)
+      REAL kappa ! kappa=r/Cp 
       REAL cotot
       REAL unsim ! = 1./iim
@@ -23,8 +23,11 @@
       REAL dissip_fac_mid,dissip_fac_up,dissip_deltaz,dissip_hdelta
       REAL dissip_pupstart
-      INTEGER iflag_top_bound,mode_top_bound
+! top_bound sponge:
+      INTEGER iflag_top_bound ! sponge type
       INTEGER ngroup ! parameter to group points (along longitude) near poles
-      REAL tau_top_bound
+      INTEGER mode_top_bound  ! sponge mode
+      REAL tau_top_bound ! inverse of sponge characteristic time scale (Hz)
       REAL daylen ! length of solar day, in 'standard' day length
+      REAL year_day ! Number of standard days in a year
       REAL molmass ! (g/mol) molar mass of the atmosphere
 
Index: trunk/LMDZ.COMMON/libf/dyn3d_common/comvert_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d_common/comvert_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d_common/comvert_mod.F90	(revision 1650)
@@ -3,16 +3,33 @@
 IMPLICIT NONE  
 
-include "dimensions.h"
-include "paramet.h"
+PRIVATE
+INCLUDE "dimensions.h"
 
-REAL ap(llm+1),bp(llm+1),presnivs(llm),dpres(llm),pa,preff,	&
-     	nivsigs(llm),nivsig(llm+1),scaleheight
-! Mars Ce qui suit vient de gcm
-REAL sig(llm+1),ds(llm),aps(llm),bps(llm),pseudoalt(llm)
+PUBLIC :: ap,bp,presnivs,dpres,sig,ds,pa,preff,nivsigs,nivsig, &
+          aps,bps,scaleheight,pseudoalt,disvert_type, pressure_exner
+
+REAL ap(llm+1) ! hybrid pressure contribution at interlayers
+REAL bp (llm+1) ! hybrid sigma contribution at interlayer
+REAL presnivs(llm) ! (reference) pressure at mid-layers
+REAL dpres(llm)
+REAL sig(llm+1)
+REAL ds(llm)
+REAL pa ! reference pressure (Pa) at which hybrid coordinates
+        ! become purely pressure (more or less)
+REAL preff  ! reference surface pressure (Pa)
+REAL nivsigs(llm)
+REAL nivsig(llm+1)
+REAL aps(llm) ! hybrid pressure contribution at mid-layers
+REAL bps(llm) ! hybrid sigma contribution at mid-layers
+REAL scaleheight ! atmospheric (reference) scale height (km)
+REAL pseudoalt(llm) ! pseudo-altitude of model levels (km), based on presnivs(),
+                     ! preff and scaleheight
+
 INTEGER disvert_type ! type of vertical discretization:
-                           ! 1: Earth (default for planet_type==earth),
-                           !     automatic generation
-                           ! 2: Planets (default for planet_type!=earth),
-                           !     using 'z2sig.def' (or 'esasig.def) file
+                     ! 1: Earth (default for planet_type==earth),
+                     !     automatic generation
+                     ! 2: Planets (default for planet_type!=earth),
+                     !     using 'z2sig.def' (or 'esasig.def) file
+
 LOGICAL pressure_exner
 !     compute pressure inside layers using Exner function, else use mean
Index: trunk/LMDZ.COMMON/libf/dyn3d_common/conf_planete.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d_common/conf_planete.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d_common/conf_planete.F90	(revision 1650)
@@ -10,6 +10,7 @@
 USE ioipsl_getincom
 #endif
-USE comvert_mod, ONLY: preff,pa
-USE comconst_mod, ONLY: daysec,daylen,kappa,cpp,omeg,rad,g,ihf,pi,molmass
+USE comconst_mod, ONLY: pi, g, molmass, kappa, cpp, omeg, rad, &
+                        year_day, daylen, daysec, ihf
+USE comvert_mod, ONLY: preff, pa
 IMPLICIT NONE
 !
@@ -17,10 +18,8 @@
 !   Declarations :
 !   --------------
-#include "dimensions.h"
+
 !
 !   local:
 !   ------
-
-real :: year_day_dyn
 
 ! ---------------------------------------------
@@ -59,18 +58,14 @@
 CALL getin('daylen',daylen)
 ! Number of days (standard) per year:
-year_day_dyn = 365.25
-CALL getin('year_day',year_day_dyn)
+year_day = 365.25
+CALL getin('year_day',year_day)
 ! Omega
 ! omeg=2.*pi/86400.
-omeg=2.*pi/daysec*(1./daylen+1./year_day_dyn)
+omeg=2.*pi/daysec*(1./daylen+1./year_day)
 CALL getin('omeg',omeg)
 
-! Intrinsic heat flux [default is none]
-! Aymeric -- for giant planets
-! [matters only if planet_type="giant"]
+! Intrinsic heat flux (default: none) (only used if planet_type="giant")
 ihf = 0.
-CALL getin('ihf',ihf)
-
-
+call getin('ihf',ihf)
 
 END SUBROUTINE conf_planete
Index: trunk/LMDZ.COMMON/libf/dyn3d_common/infotrac.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d_common/infotrac.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3d_common/infotrac.F90	(revision 1650)
@@ -45,5 +45,5 @@
     INTEGER :: niso_possibles   
     PARAMETER ( niso_possibles=5) ! 5 possible water isotopes
-    real, DIMENSION (niso_possibles),SAVE :: tnat,alpha_ideal
+    REAL, DIMENSION (niso_possibles),SAVE :: tnat,alpha_ideal
     LOGICAL, DIMENSION(niso_possibles),SAVE ::  use_iso
     INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE ::  iqiso ! donne indice iq en fn de (ixt,phase) 
@@ -55,4 +55,15 @@
     INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE ::  index_trac ! numéro ixt en fn izone, indnum entre 1 et niso
     INTEGER,SAVE :: niso,ntraceurs_zone,ntraciso
+
+#ifdef CPP_StratAer
+!--CK/OB for stratospheric aerosols
+  INTEGER, SAVE :: nbtr_bin
+  INTEGER, SAVE :: nbtr_sulgas
+  INTEGER, SAVE :: id_OCS_strat
+  INTEGER, SAVE :: id_SO2_strat
+  INTEGER, SAVE :: id_H2SO4_strat
+  INTEGER, SAVE :: id_BIN01_strat
+  INTEGER, SAVE :: id_TEST_strat
+#endif
 
 CONTAINS
@@ -143,4 +154,10 @@
        CALL abort_gcm('infotrac_init','You must compile with cpp key REPROBUS',1)
 #endif
+    ELSE IF (type_trac == 'coag') THEN
+       WRITE(lunout,*) 'Tracers are treated for COAGULATION tests : type_trac=', type_trac
+#ifndef CPP_StratAer
+       WRITE(lunout,*) 'To run this option you must add cpp key StratAer and compile with StratAer code'
+       CALL abort_gcm('infotrac_init','You must compile with cpp key StratAer',1)
+#endif
      ELSE IF (type_trac == 'lmdz') THEN
        WRITE(lunout,*) 'Tracers are treated in LMDZ only : type_trac=', type_trac
@@ -166,5 +183,5 @@
 !-----------------------------------------------------------------------
     IF (planet_type=='earth') THEN
-     IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
+     IF (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac == 'coag') THEN
        OPEN(90,file='traceur.def',form='formatted',status='old', iostat=ierr)
        IF(ierr.EQ.0) THEN
@@ -272,5 +289,5 @@
 !---------------------------------------------------------------------
     IF (planet_type=='earth') THEN
-     IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
+     IF (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac == 'coag') THEN
        IF(ierr.EQ.0) THEN
           ! Continue to read tracer.def
@@ -352,13 +369,58 @@
        END DO
 
+!       IF ( planet_type=='earth') THEN
          !CR: nombre de traceurs de l eau
-         if (tnom_0(3) == 'H2Oi') then
+         IF (tnom_0(3) == 'H2Oi') then
             nqo=3
-         else
+         ELSE
             nqo=2
-         endif
+         ENDIF
          ! For Earth, water vapour & liquid tracers are not in the physics
          nbtr=nqtrue-nqo
-     ENDIF  ! (type_trac == 'lmdz' .OR. type_trac == 'repr')
+!       ELSE
+!         ! Other planets (for now); we have the same number of tracers
+!         ! in the dynamics than in the physics
+!         nbtr=nqtrue
+!       ENDIF
+
+#ifdef CPP_StratAer
+       IF (type_trac == 'coag') THEN
+         nbtr_bin=0
+         nbtr_sulgas=0
+         DO iq=1,nqtrue
+           IF (tnom_0(iq)(1:3)=='BIN') THEN !check if tracer name contains 'BIN'
+             nbtr_bin=nbtr_bin+1
+           ENDIF
+           IF (tnom_0(iq)(1:3)=='GAS') THEN !check if tracer name contains 'GAS'
+             nbtr_sulgas=nbtr_sulgas+1
+           ENDIF
+         ENDDO
+         print*,'nbtr_bin=',nbtr_bin
+         print*,'nbtr_sulgas=',nbtr_sulgas
+         DO iq=1,nqtrue
+           IF (tnom_0(iq)=='GASOCS') THEN
+             id_OCS_strat=iq-nqo
+           ENDIF
+           IF (tnom_0(iq)=='GASSO2') THEN
+             id_SO2_strat=iq-nqo
+           ENDIF
+           IF (tnom_0(iq)=='GASH2SO4') THEN
+             id_H2SO4_strat=iq-nqo
+           ENDIF
+           IF (tnom_0(iq)=='BIN01') THEN
+             id_BIN01_strat=iq-nqo
+           ENDIF
+           IF (tnom_0(iq)=='GASTEST') THEN
+             id_TEST_strat=iq-nqo
+           ENDIF
+         ENDDO
+         print*,'id_OCS_strat  =',id_OCS_strat
+         print*,'id_SO2_strat  =',id_SO2_strat
+         print*,'id_H2SO4_strat=',id_H2SO4_strat
+         print*,'id_BIN01_strat=',id_BIN01_strat
+       ENDIF
+#endif
+
+     ENDIF  ! (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac = 'coag')
 !jyg<
 !
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/conf_gcm.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/conf_gcm.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/conf_gcm.F90	(revision 1650)
@@ -24,5 +24,5 @@
   USE logic_mod, ONLY: tidal,purmats,ok_guide,read_start,iflag_phys,iflag_trac,	&
 		ok_strato,ok_gradsfile,ok_limit,ok_etat0,moyzon_mu,moyzon_ch,	&
-		fxyhypb,ysinus
+		fxyhypb,ysinus,read_orop
   USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy,		&
 		alphax,alphay,taux,tauy
@@ -53,9 +53,7 @@
 !   ------
 
-  CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
   REAL clonn,clatt,grossismxx,grossismyy
   REAL dzoomxx,dzoomyy, tauxx,tauyy
   LOGICAL  fxyhypbb, ysinuss
-  INTEGER i
   character(len=*),parameter :: modname="conf_gcm"
   character (len=80) :: abort_message
@@ -638,4 +636,12 @@
   ok_etat0 = .TRUE.
   CALL getin('ok_etat0',ok_etat0)
+
+!Config  Key  = read_orop
+!Config  Desc = lecture du fichier de params orographiques sous maille
+!Config  Def  = f
+!Config  Help = lecture fichier plutot que grid_noro
+
+  read_orop = .FALSE.
+  CALL getin('read_orop',read_orop)
 
 !----------------------------------------
@@ -995,4 +1001,5 @@
       write(lunout,*)' ok_limit = ', ok_limit
       write(lunout,*)' ok_etat0 = ', ok_etat0
+      write(lunout,*)' read_orop = ', read_orop
       if (planet_type=="titan") then
        write(lunout,*)' moyzon_mu = ', moyzon_mu
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/guide_p_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/guide_p_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/guide_p_mod.F90	(revision 1650)
@@ -38,5 +38,5 @@
 
   REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE     :: alpha_u,alpha_v 
-  REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE     :: alpha_T,alpha_Q 
+  REAL, ALLOCATABLE, DIMENSION(:, :), PRIVATE, SAVE     :: alpha_T,alpha_Q 
   REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE     :: alpha_P,alpha_pcor
   
@@ -68,5 +68,5 @@
   SUBROUTINE guide_init
 
-    USE control_mod
+    USE control_mod, ONLY: day_step
     USE serre_mod, ONLY: grossismx
 
@@ -237,7 +237,7 @@
     ALLOCATE(alpha_v(ip1jm), stat = error)
     IF (error /= 0) CALL abort_gcm(modname,abort_message,1)
-    ALLOCATE(alpha_T(ip1jmp1), stat = error)
+    ALLOCATE(alpha_T(iip1, jjp1), stat = error)
     IF (error /= 0) CALL abort_gcm(modname,abort_message,1)
-    ALLOCATE(alpha_Q(ip1jmp1), stat = error)
+    ALLOCATE(alpha_Q(iip1, jjp1), stat = error)
     IF (error /= 0) CALL abort_gcm(modname,abort_message,1)
     ALLOCATE(alpha_P(ip1jmp1), stat = error)
@@ -339,6 +339,6 @@
     USE parallel_lmdz
     USE control_mod
-    USE comvert_mod, ONLY: ap,bp,preff,presnivs,pressure_exner
-    USE comconst_mod, ONLY: daysec,dtvr,kappa,cpp
+    USE comconst_mod, ONLY: daysec, dtvr, cpp, kappa
+    USE comvert_mod, ONLY: ap, bp, preff, presnivs, pressure_exner
     
     IMPLICIT NONE
@@ -618,5 +618,5 @@
 
     USE comconst_mod, ONLY: pi
-
+    
     IMPLICIT NONE
 
@@ -706,6 +706,6 @@
   USE mod_hallo
   USE Bands
-  USE comvert_mod, ONLY: ap,bp,preff,pressure_exner
-  USE comconst_mod, ONLY: kappa,cpp
+  USE comconst_mod, ONLY: cpp, kappa
+  USE comvert_mod, ONLY: preff, pressure_exner, bp, ap
   IMPLICIT NONE
 
@@ -1098,7 +1098,7 @@
 ! Calcul des constantes de rappel alpha (=1/tau)
 
-    USE comconst_mod, ONLY: pi
-    USE serre_mod, ONLY: clon,clat,grossismx,grossismy
-
+    use comconst_mod, only: pi
+    use serre_mod, only: clat, clon, grossismx, grossismy
+    
     implicit none
 
@@ -1813,6 +1813,9 @@
   SUBROUTINE guide_out(varname,hsize,vsize,field,factt)
     USE parallel_lmdz
+    USE comconst_mod, ONLY: pi
     USE comvert_mod, ONLY: presnivs
-    USE comconst_mod, ONLY: pi
+    use netcdf95, only: nf95_def_var, nf95_put_var
+    use netcdf, only: nf90_float
+
     IMPLICIT NONE
 
@@ -1833,5 +1836,5 @@
     INTEGER       :: nid, id_lonu, id_lonv, id_latu, id_latv, id_tim, id_lev
     INTEGER       :: vid_lonu,vid_lonv,vid_latu,vid_latv,vid_cu,vid_cv,vid_lev
-    INTEGER       :: vid_au,vid_av
+    INTEGER       :: vid_au,vid_av, varid_alpha_t, varid_alpha_q
     INTEGER       :: l
     INTEGER, DIMENSION (3) :: dim3
@@ -1871,4 +1874,8 @@
         ierr=NF_DEF_VAR(nid,"au",NF_FLOAT,2,(/id_lonu,id_latu/),vid_au)
         ierr=NF_DEF_VAR(nid,"av",NF_FLOAT,2,(/id_lonv,id_latv/),vid_av)
+        call nf95_def_var(nid, "alpha_T", nf90_float, (/id_lonv, id_latu/), &
+             varid_alpha_t)
+        call nf95_def_var(nid, "alpha_q", nf90_float, (/id_lonv, id_latu/), &
+             varid_alpha_q)
         
         ierr=NF_ENDDEF(nid)
@@ -1898,4 +1905,6 @@
         ierr = NF_PUT_VAR_REAL(nid,vid_av,alpha_v)
 #endif
+        call nf95_put_var(nid, varid_alpha_t, alpha_t)
+        call nf95_put_var(nid, varid_alpha_q, alpha_q)
 ! --------------------------------------------------------------------
 ! Cr�ation des variables sauvegard�es
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/logic_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/logic_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/logic_mod.F90	(revision 1650)
@@ -1,24 +1,49 @@
+!
+! $Id: $
+!
 MODULE logic_mod
 
 IMPLICIT NONE  
 
-      LOGICAL purmats,forward,leapf,apphys,statcl,conser,               &
-     & apdiss,apdelq,saison,ecripar,fxyhypb,ysinus                      &
-     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
-     &  ,ok_limit,ok_etat0
-      logical hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
-                     ! (only used if disvert_type==2)
-      logical moyzon_mu,moyzon_ch ! used for zonal averages in Titan
+  LOGICAL purmats ! true if time stepping is purely Matsuno scheme
+                  ! false implies Matsuno-Leapfrog time stepping scheme
+  LOGICAL forward ! true if during forward phase of Matsuno step
+  LOGICAL leapf ! true if during a leapfrog time stepping step
+  LOGICAL apphys ! true if during a time step when physics will be called
+  LOGICAL statcl
+  LOGICAL conser
+  LOGICAL apdiss ! true if during a time step when dissipation will be called
+  LOGICAL apdelq
+  LOGICAL saison
+  LOGICAL ecripar
+  LOGICAL fxyhypb ! true if using hyperbolic function discretization
+                  ! for latitudinal grid 
+  LOGICAL ysinus ! true if using sine function discretiation
+                 ! for latitudinal grid
+  LOGICAL read_start ! true if reading a start.nc file to initialize fields
+  LOGICAL ok_guide ! true if nudging
+  LOGICAL ok_strato
+  LOGICAL tidal  ! true if adding tidal forces (for Titan)
+  LOGICAL ok_gradsfile
+  LOGICAL ok_limit  ! true for boundary conditions file creation (limit.nc)
+  LOGICAL ok_etat0  ! true for initial states creation (start.nc, startphy.nc)
+  LOGICAL read_orop ! true for sub-cell scales orographic params read in file
+  LOGICAL hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
+                 ! (only used if disvert_type==2)
+  LOGICAL moyzon_mu,moyzon_ch ! used for zonal averages in Titan
 
-      integer iflag_phys,iflag_trac
+  INTEGER iflag_phys ! type of physics to call: 0 none, 1: phy*** package,
+                     ! 2: Held & Suarez, 101-200: aquaplanets & terraplanets
+  INTEGER iflag_trac
 
 !$OMP THREADPRIVATE(purmats,forward,leapf,apphys,statcl,conser,       &
-  !$OMP     apdiss,apdelq,saison,ecripar,fxyhypb,ysinus,              &
-  !$OMP     read_start,ok_guide,ok_strato,tidal,ok_gradsfile,         &
-  !$OMP     ok_limit,ok_etat0)
+!$OMP     apdiss,apdelq,saison,ecripar,fxyhypb,ysinus,              &
+!$OMP     read_start,ok_guide,ok_strato,tidal,ok_gradsfile,         &
+!$OMP     ok_limit,ok_etat0,hybrid,moyzon_mu,moyzon_ch)
 !$OMP THREADPRIVATE(iflag_phys,iflag_trac)
 
-!BE CAREFUL: when adding a threadprivate variable in this module
-!	do not forget to add it to copyin clause of gcm.F (before CALL leapfrog_p)
+!WARNING: when adding a threadprivate variable in this module
+!        do not forget to add it to the copyin clause when opening an OpenMP
+!        parallel section. e.g. in gcm before call leapfrog_loc 
 
 END MODULE logic_mod
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/temps_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/temps_mod.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/temps_mod.F90	(revision 1650)
@@ -3,26 +3,28 @@
 IMPLICIT NONE  
 
-! jD_ref = jour julien de la date de reference (lancement de l'experience)
-! hD_ref = "heure" julienne de la date de reference
+  INTEGER   itaufin ! total number of dynamical steps for the run
+  INTEGER   itau_dyn
+  INTEGER   itau_phy
+  INTEGER   day_ini ! initial day # of simulation sequence
+  INTEGER   day_end ! final day # ; i.e. day # when this simulation ends
+  INTEGER   annee_ref
+  INTEGER   day_ref
+  REAL      dt ! (dynamics) time step (changes if doing Matsuno or LF step)
+  REAL      jD_ref ! reference julian day date (beginning of experiment)
+  REAL      jH_ref ! reference julian "hour" of reference julian date
+  REAL      start_time
+  CHARACTER (len=10) :: calend ! calendar type
 
-      INTEGER   itaufin ! total number of dynamical steps for the run
-      INTEGER   itau_dyn, itau_phy
-      INTEGER   day_ini ! initial day # of simulation sequence
-      INTEGER   day_end ! final day # ; i.e. day # when this simulation ends
-      INTEGER   annee_ref
-      INTEGER   day_ref
-      REAL      dt ! (dynamics) time step (changes if doing Matsuno or LF step)
-      REAL      jD_ref, jH_ref, start_time
-      CHARACTER (len=10) :: calend
+  ! Additionnal Mars stuff:
+  REAL hour_ini ! initial fraction of day of simulation sequence (0=<hour_ini<1)
 
-      ! Additionnal Mars stuff:
-      real hour_ini ! initial fraction of day of simulation sequence (0=<hour_ini<1)
+!$OMP THREADPRIVATE(dt,jD_ref,jH_ref,start_time,hour_ini,                        &
+!$OMP                day_ini,day_end,annee_ref,day_ref,itau_dyn,itau_phy,itaufin,&
+!$OMP                calend)        
 
-!$OMP THREADPRIVATE(dt,jD_ref,jH_ref,start_time,hour_ini,			&
-  !$OMP		day_ini,day_end,annee_ref,day_ref,itau_dyn,itau_phy,itaufin,	&
-  !$OMP		calend)	
-
-!BE CAREFUL: when adding a threadprivate variable in this module
-!	do not forget to add it to copyin clause of gcm.F (before CALL leapfrog_p)
+!WARNING: when adding a threadprivate variable in this module
+!        do not forget to add it to the copyin clause when opening an OpenMP
+!        parallel section. e.g. in gcm before call leapfrog_loc and/or
+!        possibly in iniphysiq
 
 END MODULE temps_mod
Index: trunk/LMDZ.COMMON/libf/misc/wxios.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/misc/wxios.F90	(revision 1644)
+++ trunk/LMDZ.COMMON/libf/misc/wxios.F90	(revision 1650)
@@ -25,4 +25,8 @@
 !$OMP THREADPRIVATE(missing_val)
 
+#ifdef XIOS1
+#error "XIOS v1 no longer supported, use XIOS v2."
+#endif
+
     CONTAINS
     
@@ -33,9 +37,5 @@
     SUBROUTINE reformadate(odate, ndate)
         CHARACTER(len=*), INTENT(IN) :: odate
-#ifdef XIOS1
-        CHARACTER(len=100), INTENT(OUT) :: ndate
-#else
         TYPE(xios_duration) :: ndate
-#endif
         
         INTEGER :: i = 0
@@ -52,27 +52,15 @@
         i = INDEX(odate, "day")
         IF (i > 0) THEN
-#ifdef XIOS1
-            ndate = odate(1:i-1)//"d"
-#else
             read(odate(1:i-1),*) ndate%day
-#endif
         END IF
 
         i = INDEX(odate, "hr")
         IF (i > 0) THEN
-#ifdef XIOS1
-            ndate = odate(1:i-1)//"h"
-#else
             read(odate(1:i-1),*) ndate%hour
-#endif
         END IF
 
         i = INDEX(odate, "mth")
         IF (i > 0) THEN
-#ifdef XIOS1
-            ndate = odate(1:i-1)//"mo"
-#else
             read(odate(1:i-1),*) ndate%month
-#endif
         END IF
         
@@ -197,34 +185,10 @@
      
      !Variables pour xios:
-#ifdef XIOS1
-     TYPE(xios_time) :: mdtime
-#else
      TYPE(xios_duration) :: mdtime
-#endif
      !REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0
      
-#ifdef XIOS1
-        mdtime = xios_time(0, 0, 0, 0, 0, pasdetemps)
-#else
         mdtime%second=pasdetemps
-#endif
 
         !Réglage du calendrier:
-#ifdef XIOS1
-        SELECT CASE (calendrier)
-            CASE('earth_360d')
-                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "D360")
-                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 360 jours/an'
-            CASE('earth_365d')
-                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "NoLeap")
-                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 365 jours/an'
-            CASE('gregorian')
-                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "Gregorian")
-                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier gregorien'
-            CASE DEFAULT
-                abort_message = 'wxios_set_cal: Mauvais choix de calendrier'
-                CALL abort_gcm('Gcm:Xios',abort_message,1)
-        END SELECT
-#else
         SELECT CASE (calendrier)
             CASE('earth_360d')
@@ -241,5 +205,4 @@
                 CALL abort_gcm('Gcm:Xios',abort_message,1)
         END SELECT
-#endif
         
         !Formatage de la date d'origine:
@@ -247,9 +210,5 @@
         
         IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Time origin: ", date
-#ifdef XIOS1
-        CALL xios_set_context_attr_hdl(g_ctx, time_origin = date)
-#else
         CALL xios_set_time_origin(xios_date(annee,mois,jour,int(heure),0,0))
-#endif
 
         !Formatage de la date de debut:
@@ -259,9 +218,5 @@
         IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Start date: ", date
         
-#ifdef XIOS1
-        CALL xios_set_context_attr_hdl(g_ctx, start_date = date)
-#else
         CALL xios_set_start_date(xios_date(ini_an,ini_mois,ini_jour,int(ini_heure),0,0))
-#endif
         
         !Et enfin,le pas de temps:
@@ -272,13 +227,7 @@
     SUBROUTINE wxios_set_timestep(ts)
         REAL, INTENT(IN) :: ts
-#ifdef XIOS1
-        TYPE(xios_time) :: mdtime     
-
-        mdtime = xios_time(0, 0, 0, 0, 0, ts)
-#else
         TYPE(xios_duration) :: mdtime     
 
         mdtime%timestep = ts
-#endif
 
         CALL xios_set_timestep(mdtime)
@@ -334,13 +283,7 @@
         
         !On parametrise le domaine:
-#ifdef XIOS1
-        CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin, ni=ni)
-        CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin, nj=nj, data_dim=2)
-        CALL xios_set_domain_attr_hdl(dom, lonvalue=io_lon(ibegin:iend), latvalue=io_lat(jbegin:jend))
-#else
         CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin-1, ni=ni, type="rectilinear")
         CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin-1, nj=nj, data_dim=2)
         CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(ibegin:iend), latvalue_1d=io_lat(jbegin:jend))
-#endif
         IF (.NOT.is_sequential) THEN
             mask(:,:)=.TRUE.
@@ -353,9 +296,5 @@
               WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,nj)=",mask(:,nj)
             ENDIF
-#ifdef XIOS1
-            CALL xios_set_domain_attr_hdl(dom, mask=mask)
-#else
             CALL xios_set_domain_attr_hdl(dom, mask_2d=mask)
-#endif
         END IF
 
@@ -401,9 +340,6 @@
         
         ! Ehouarn: New way to declare axis, without axis_group:
-#ifdef XIOS1
-        CALL xios_set_axis_attr(trim(axis_id),size=axis_size,value=axis_value)
-#else
         CALL xios_set_axis_attr(trim(axis_id),n_glo=axis_size,value=axis_value)
-#endif        
+
         !Vérification:
         IF (xios_is_valid_axis(TRIM(ADJUSTL(axis_id)))) THEN
@@ -429,9 +365,5 @@
         TYPE(xios_file) :: x_file
         TYPE(xios_filegroup) :: x_fg
-#ifdef XIOS1
-        CHARACTER(len=100) :: nffreq
-#else
         TYPE(xios_duration) :: nffreq
-#endif
         
         !On regarde si le fichier n'est pas défini par XML:
@@ -445,28 +377,15 @@
         
             !On configure:
-#ifdef XIOS1
-            CALL xios_set_file_attr_hdl(x_file, name="X"//fname,&
-                output_freq=TRIM(ADJUSTL(nffreq)), output_level=flvl, enabled=.TRUE.)
-#else
             CALL xios_set_file_attr_hdl(x_file, name="X"//fname,&
                 output_freq=nffreq, output_level=flvl, enabled=.TRUE.)
-#endif
        
             IF (xios_is_valid_file("X"//fname)) THEN
                 IF (prt_level >= 10) THEN
                   WRITE(lunout,*) "wxios_add_file: New file: ", "X"//fname
-#ifdef XIOS1
-                  WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
-#else
                   WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl
-#endif
                 ENDIF
             ELSE
                 WRITE(lunout,*) "wxios_add_file: Error, invalid file: ", "X"//trim(fname)
-#ifdef XIOS1
-                WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
-#else
                 WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl
-#endif
             END IF
         ELSE
@@ -538,7 +457,6 @@
         TYPE(xios_field) :: field
         TYPE(xios_fieldgroup) :: fieldgroup
-#ifndef XIOS1
         TYPE(xios_duration) :: freq_op
-#endif
+
         LOGICAL :: bool=.FALSE.
         INTEGER :: lvl =0
@@ -599,10 +517,6 @@
             
             !L'operation, sa frequence:
-#ifdef XIOS1
-            CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op="1ts", prec=4)
-#else
             freq_op%timestep=1
             CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op=freq_op, prec=4)
-#endif
 
             
