Index: LMDZ6/branches/cirrus/libf/phylmd/infotrac_phy.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/infotrac_phy.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/infotrac_phy.F90	(revision 5203)
@@ -7,4 +7,5 @@
         delPhase, niso, getKey, isot_type, processIsotopes,  isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, &
         addPhase, iH2O, addKey, isoSelect, testTracersFiles, isoKeys, indexUpdate,  iqWIsoPha, nbIso, ntiso, isoName, isoCheck
+   USE readTracFiles_mod, ONLY: new2oldH2O
    IMPLICIT NONE
 
@@ -16,24 +17,24 @@
    PUBLIC :: nqtot,   nbtr,   nqo,   nqCO2,   nqtottr      !--- Main dimensions
    PUBLIC :: conv_flg, pbl_flg                             !--- Convection & boundary layer activation keys
-#ifdef CPP_StratAer
+   PUBLIC :: new2oldH2O                                    !--- For backwards compatibility in phyetat0
+   PUBLIC :: addPhase, delPhase                            !--- Add/remove the phase from the name of a tracer
+#if defined CPP_StratAer || defined REPROBUS
    PUBLIC :: nbtr_bin, nbtr_sulgas                         !--- Number of aerosols bins and sulfur gases for StratAer model
    PUBLIC :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat
 #endif
 
-   !=== FOR WATER
-   PUBLIC :: ivap, iliq, isol
    !=== FOR ISOTOPES: General
    PUBLIC :: isot_type, nbIso                              !--- Derived type, full isotopes families database + nb of families
    PUBLIC :: isoSelect, ixIso                              !--- Isotopes family selection tool + selected family index
    !=== FOR ISOTOPES: Specific to water
-   PUBLIC :: iH2O                                          !--- H2O isotopes class index
+   PUBLIC :: iH2O                                          !--- Value of "ixIso" for "H2O" isotopes class
+   PUBLIC :: ivap, iliq, isol
    !=== FOR ISOTOPES: Depending on the selected isotopes family
-   PUBLIC :: isotope, isoKeys                              !--- Selected isotopes database + associated keys (cf. getKey)
-   PUBLIC :: isoName, isoZone, isoPhas                     !--- Isotopes and tagging zones names, phases
-   PUBLIC :: niso,    nzone,   nphas,   ntiso              !---  " " numbers + isotopes & tagging tracers number
-   PUBLIC :: itZonIso                                      !--- idx "it" (in "isoName(1:niso)") = function(tagging idx, isotope idx)
-   PUBLIC :: iqIsoPha                                      !--- idx "iq" (in "qx") = function(isotope idx, phase idx) + aliases
-   PUBLIC :: iqWIsoPha                                      !--- Same as iqIsoPha but with normal water phases
-
+   PUBLIC :: isotope                                       !--- Selected isotopes database (argument of getKey)
+   PUBLIC :: isoKeys, isoName, isoZone, isoPhas            !--- Isotopes keys & names, tagging zones names, phases
+   PUBLIC ::    niso,   ntiso,   nzone,   nphas            !--- Number of   "   "
+   PUBLIC :: itZonIso                                      !--- Index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx)
+   PUBLIC :: iqIsoPha                                      !--- Index "iq" in "qx"              = f(isotope idx,   phase idx)
+   PUBLIC :: iqWIsoPha                                     !--- Same as iqIsoPha but with normal water phases
    PUBLIC :: isoCheck                                      !--- Run isotopes checking routines
    !=== FOR BOTH TRACERS AND ISOTOPES
@@ -43,5 +44,5 @@
 !  |--------------------+-----------------------+-----------------+---------------+----------------------------|
 !  | water in different |    water tagging      |  water isotopes | other tracers | additional tracers moments |
-!  | phases: H2O_[gls]  |      isotopes         |                 |               |  for higher order schemes  |
+!  | phases: H2O_[glsrb]|      isotopes         |                 |               |  for higher order schemes  |
 !  |--------------------+-----------------------+-----------------+---------------+----------------------------|
 !  |                    |                       |                 |               |                            |
@@ -68,9 +69,11 @@
 !  |-------------+------------------------------------------------------+-------------+------------------------+
 !  | name        | Name (short)                                         | tname       |                        |
+!  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
 !  | gen0Name    | Name of the 1st generation ancestor                  | /           |                        |
 !  | parent      | Name of the parent                                   | /           |                        |
 !  | longName    | Long name (with adv. scheme suffix) for outputs      | ttext       |                        |
 !  | type        | Type (so far: tracer or tag)                         | /           | tracer,tag             |
-!  | phase       | Phases list ("g"as / "l"iquid / "s"olid)             | /           | [g][l][s]              |
+!  | phase       | Phases list ("g"as / "l"iquid / "s"olid              |             | [g|l|s|r|b]            |
+!  |             |              "r"(cloud) / "b"lowing)                 | /           |                        |
 !  | component   | Name(s) of the merged/cumulated section(s)           | /           | coma-separated names   |
 !  | iGeneration | Generation (>=1)                                     | /           |                        |
@@ -79,7 +82,6 @@
 !  | nqDescen    | Number of the descendants   (all generations)        | nqdesc      | 1:nqtot                |
 !  | nqChildren  | Number of childs            (1st generation only)    | nqfils      | 1:nqtot                |
-!  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
-!  | isAdvected  | advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
-!  | isInPhysics | tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
+!  | isAdvected  | Advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
+!  | isInPhysics | Tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
 !  | iso_iGroup  | Isotopes group index in isotopes(:)                  | /           | 1:nbIso                |
 !  | iso_iName   | Isotope  name  index in isotopes(iso_iGroup)%trac(:) | iso_indnum  | 1:niso                 |
@@ -97,14 +99,18 @@
 !  | trac   | ntiso  | Isotopes + tagging tracers list + number         | / | ntraciso       |                 |
 !  | zone   | nzone  | Geographic tagging zones   list + number         | / | ntraceurs_zone |                 |
-!  | phase  | nphas  | Phases                     list + number         |                    | [g][l][s], 1:3  |
+!  | phase  | nphas  | Phases                     list + number         |                    | [g|l|s|r|b] 1:5 |
 !  | iqIsoPha        | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
-!  | iqWIsoPha       | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
+!  | iqWIsoPha       | Index in "qx"       = f(name(1:ntiso+nqo)),phas) |   /                | 1:nqtot         |
 !  | itZonIso        | Index in "trac(1:ntiso)"= f(zone, name(1:niso))  | index_trac         | 1:ntiso         |
 !  +-----------------+--------------------------------------------------+--------------------+-----------------+
 
+   !=== INDICES FOR WATER
+   INTEGER, SAVE :: ivap, iliq, isol
+!$OMP THREADPRIVATE(ivap, iliq, isol)
+
    !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
-   INTEGER,               SAVE :: nqtot,  &                     !--- Tracers nb in dynamics (incl. higher moments + H2O)
-                                  nbtr,   &                     !--- Tracers nb in physics  (excl. higher moments + H2O)
-                                  nqo,    &                     !--- Number of water phases
+   INTEGER,               SAVE :: nqtot,   &                    !--- Tracers nb in dynamics (incl. higher moments + H2O)
+                                  nbtr,    &                    !--- Tracers nb in physics  (excl. higher moments + H2O)
+                                  nqo,     &                    !--- Number of water phases
                                   nqtottr, &                    !--- Number of tracers passed to phytrac (TO BE DELETED ?)
                                   nqCO2                         !--- Number of tracers of CO2  (ThL)
@@ -112,14 +118,10 @@
 !$OMP THREADPRIVATE(nqtot, nbtr, nqo, nqtottr, nqCO2, type_trac)
 
-   !=== INDICES OF WATER
-   INTEGER,               SAVE :: ivap,iliq,isol ! Indices for vap, liq and ice
-!$OMP THREADPRIVATE(ivap,iliq,isol)
-
    !=== VARIABLES FOR INCA
-   INTEGER,               SAVE, ALLOCATABLE :: conv_flg(:), &   !--- Convection     activation ; needed for INCA        (nbtr)
-                                                pbl_flg(:)      !--- Boundary layer activation ; needed for INCA        (nbtr)
+   INTEGER, DIMENSION(:), SAVE, ALLOCATABLE :: &
+                    conv_flg, pbl_flg                           !--- Convection / boundary layer activation (nbtr)
 !$OMP THREADPRIVATE(conv_flg, pbl_flg)
 
-#ifdef CPP_StratAer
+#if defined CPP_StratAer || defined REPROBUS
   !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB)
   INTEGER, SAVE ::  nbtr_bin, nbtr_sulgas         !--- number of aerosols bins and sulfur gases for StratAer model
@@ -173,15 +175,14 @@
    CHARACTER(LEN=2)      ::   suff(9)                                !--- Suffixes for schemes of order 3 or 4 (Prather)
    CHARACTER(LEN=3)      :: descrq(30)                               !--- Advection scheme description tags
-   CHARACTER(LEN=maxlen) :: msg1, texp, ttp                          !--- String for messages and expanded tracers type
+   CHARACTER(LEN=maxlen) :: msg1, texp, ttp                          !--- Strings for messages and expanded tracers type
    INTEGER :: fType                                                  !--- Tracers description file type ; 0: none
                                                                      !--- 1/2/3: "traceur.def"/"tracer.def"/"tracer_*.def"
    INTEGER :: nqtrue                                                 !--- Tracers nb from tracer.def (no higher order moments)
    INTEGER :: iad                                                    !--- Advection scheme number
-   INTEGER :: iq, jq, nt, im, nm, k                                 !--- Indexes and temporary variables
+   INTEGER :: iq, jq, nt, im, nm                                     !--- Indexes and temporary variables
    LOGICAL :: lerr, lInit
    TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:)
    TYPE(trac_type), POINTER             :: t1, t(:)
-   CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)  !--- Keyword for tracers type(s), parsed version
-   
+   CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)             !--- Keywords for tracers type(s), parsed version
    CHARACTER(LEN=*), PARAMETER :: modname="init_infotrac_phy"
 !------------------------------------------------------------------------------------------------------------------------------
@@ -202,5 +203,4 @@
    ENDIF
 
-   
    CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
    lInit = .NOT.ALLOCATED(tracers)
@@ -243,13 +243,10 @@
 
 !==============================================================================================================================
-! 1) Get the numbers of: true (first order only) tracers "nqtrue", water tracers "nqo" (vapor/liquid/solid)
-!==============================================================================================================================
-   texp = type_trac                                                  !=== EXPANDED VERSION OF "type_trac", WITH "|" SEPARATOR
+! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT
+!==============================================================================================================================
+   texp = type_trac                                                            !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
    IF(texp == 'inco') texp = 'co2i|inca'
    IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp)
-
-   !=== DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE
    IF(testTracersFiles(modname, texp, fType, lInit)) CALL abort_physic(modname, 'problem with tracers file(s)',1)
-
    ttp = type_trac; IF(fType /= 1) ttp = texp
 
@@ -262,8 +259,11 @@
 !##############################################################################################################################
 
-   !---------------------------------------------------------------------------------------------------------------------------
-   IF(fType == 0) CALL abort_physic(modname, 'Missing tracers file: "traceur.def", "tracer.def" or "tracer_<keyword>.def file.',1)
-   !---------------------------------------------------------------------------------------------------------------------------
-   IF(fType == 1 .AND. ANY(['inca','inco']==type_trac) .AND. lInit) THEN  !=== FOUND OLD STYLE INCA "traceur.def"
+!==============================================================================================================================
+! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
+!==============================================================================================================================
+   !---------------------------------------------------------------------------------------------------------------------------
+   IF(fType == 0) CALL abort_physic(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
+   !---------------------------------------------------------------------------------------------------------------------------
+   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac) .AND. lInit) THEN  !=== FOUND OLD STYLE INCA "traceur.def"
    !---------------------------------------------------------------------------------------------------------------------------
 #ifdef INCA
@@ -281,5 +281,5 @@
       ttr(1+nqo:nqCO2+nqo   )%component = 'co2i'
       ttr(1+nqo+nqCO2:nqtrue)%component = 'inca'
-      ttr(1+nqo      :nqtrue)%name      = [('CO2     ', k=1, nqCO2), solsym_inca]
+      ttr(1+nqo      :nqtrue)%name      = [('CO2     ', iq=1, nqCO2), solsym_inca]
       ttr(1+nqo+nqCO2:nqtrue)%parent    = tran0
       ttr(1+nqo+nqCO2:nqtrue)%phase     = 'g'
@@ -302,21 +302,19 @@
    ELSE                                                              !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE)
    !---------------------------------------------------------------------------------------------------------------------------
-      nqo    =        COUNT(delPhase(tracers(:)%name)     == 'H2O' &
-                               .AND. tracers(:)%component == 'lmdz') !--- Number of water phases
-      nqtrue = SIZE(tracers)                                         !--- Total number of "true" tracers
-      nbtr   = nqtrue-COUNT(delPhase(tracers(:)%gen0Name) == 'H2O' &
-                               .AND. tracers(:)%component == 'lmdz') !--- Number of tracers passed to phytrac
+   nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
+   nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
+   nbtr = nqtrue-COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O')     !--- Passed to phytrac
+   nqCO2  =      COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
 #ifdef INCA
-      nqINCA = COUNT(tracers(:)%component == 'inca')
-#endif
-      lerr = getKey('hadv', hadv, ky=tracers(:)%keys)
-      lerr = getKey('vadv', vadv, ky=tracers(:)%keys)
-   !---------------------------------------------------------------------------------------------------------------------------
-   END IF
-   !---------------------------------------------------------------------------------------------------------------------------
-
-   !--- Transfert the number of tracers to Reprobus
+   nqINCA =      COUNT(tracers(:)%component == 'inca')
+#endif
+   IF(getKey('hadv', hadv, ky=tracers(:)%keys)) CALL abort_physic(modname, 'missing key "hadv"', 1)
+   IF(getKey('vadv', vadv, ky=tracers(:)%keys)) CALL abort_physic(modname, 'missing key "vadv"', 1)
+   !---------------------------------------------------------------------------------------------------------------------------
+   END IF
+   !---------------------------------------------------------------------------------------------------------------------------
+
 #ifdef REPROBUS
-   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
+   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)                         !--- Transfert the number of tracers to Reprobus
 #endif
 
@@ -359,9 +357,8 @@
       IF(iad == -1) CALL abort_physic(modname, msg1, 1)
 
-      !--- SET FIELDS %longName, %isAdvected, %isInPhysics
+      !--- SET FIELDS longName, isAdvected, isInPhysics
       t1%longName   = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad)
       t1%isAdvected = iad >= 0
-      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' &
-                          .OR. t1%component /= 'lmdz' !=== OTHER EXCEPTIONS TO BE ADDED: CO2i, SURSATURATED WATER CLOUD...
+      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O
       ttr(iq)       = t1
 
@@ -372,8 +369,10 @@
       IF(nm == 0) CYCLE                                              !--- No higher moments
       ttr(jq+1:jq+nm)             = t1
-      ttr(jq+1:jq+nm)%name        = [(TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
-      ttr(jq+1:jq+nm)%parent      = [(TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
-      ttr(jq+1:jq+nm)%longName    = [(TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
-      ttr(jq+1:jq+nm)%isAdvected  = [(.FALSE., im=1, nm) ]
+      ttr(jq+1:jq+nm)%name        = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
+      ttr(jq+1:jq+nm)%gen0Name    = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
+      ttr(jq+1:jq+nm)%parent      = [ (TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
+      ttr(jq+1:jq+nm)%longName    = [ (TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
+      ttr(jq+1:jq+nm)%isAdvected  = [ (.FALSE., im=1, nm) ]
+      ttr(jq+1:jq+nm)%isInPhysics = [ (.FALSE., im=1, nm) ]
       jq = jq + nm
    END DO
@@ -381,6 +380,6 @@
    CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
 
-   !--- SET FIELDS %iqParent, %nqChildren, %iGeneration, %iqDescen, %nqDescen
-   IF(indexUpdate(tracers)) CALL abort_gcm(modname, 'problem when processing isotopes parameters', 1)
+   !--- SET FIELDS iqParent, iqDescen, nqDescen, nqChildren, iGeneration
+   IF(indexUpdate(tracers)) CALL abort_physic(modname, 'problem with tracers indices update', 1)
 
 !##############################################################################################################################
@@ -404,6 +403,6 @@
 !##############################################################################################################################
    !--- Convection / boundary layer activation for all tracers
-   IF (.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
-   IF (.NOT.ALLOCATED(pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
+   IF(.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
+   IF(.NOT.ALLOCATED( pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
 
    !--- Note: nqtottr can differ from nbtr when nmom/=0
@@ -424,8 +423,9 @@
 #endif
    t => tracers
-   CALL msg('Information stored in infotrac_phy :', modname)
-   IF(dispTable('issssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',      &
-                              'isPh', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],     &
-      cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component, bool2str(t%isInPhysics)),&
+   CALL msg('Information stored in '//TRIM(modname)//': ', modname)
+   IF(dispTable('isssssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',     &
+                       'isPh', 'isAd', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],    &
+      cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component,                          &
+                                                         bool2str(t%isInPhysics), bool2str(t%isAdvected)), &
       cat([(iq, iq=1, nqtot)], t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup,          &
                   t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
Index: LMDZ6/branches/cirrus/libf/phylmd/lmdz_lscp.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/lmdz_lscp.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/lmdz_lscp.F90	(revision 5203)
@@ -1526,8 +1526,4 @@
                 znebprecipcld(i)=0.0
             ENDIF
-        !IF ( ((1-zfice(i))*zoliq(i) .GT. 0.) .AND. (zt(i) .LE. 233.15) ) THEN
-        !print*,'WARNING LEA OLIQ A <-40°C '
-        !print*,'zt,Tbef,oliq,oice,cldfraliq,icefrac,rneb',zt(i),Tbef(i),(1-zfice(i))*zoliq(i),zfice(i)*zoliq(i),cldfraliq(i,k),zfice(i),rneb(i,k)
-        !ENDIF 
         ENDDO
 
Index: LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake.F90	(revision 5203)
@@ -1,5 +1,8 @@
 MODULE lmdz_wake
 
-! $Id$
+  USE lmdz_wake_ini, ONLY: CPPKEY_IOPHYS_WK
+
+  IMPLICIT NONE; PRIVATE
+  PUBLIC wake
 
 CONTAINS
@@ -353,7 +356,5 @@
 !
 IF (first_call) THEN
-!!#define IOPHYS_WK
-#undef IOPHYS_WK
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
   IF (phys_sub) THEN
     call iophys_ini(dtimesub)
@@ -361,5 +362,5 @@
     call iophys_ini(dtime)
   ENDIF
-#endif
+END IF
   first_call = .false.
 ENDIF   !(first_call)
@@ -771,7 +772,7 @@
 
   END DO
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
   IF (.not.phys_sub) CALL iophys_ecrit('wape_a',1,'wape_a','J/kg',wape)
-#endif
+END IF
 
   ! 2.2 Prognostic variable update
@@ -1007,5 +1008,5 @@
 !!--------------------------------------------------------
     ELSEIF (iflag_wk_pop_dyn == 3) THEN
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
     IF (phys_sub) THEN
      CALL iophys_ecrit('ptop',1,'ptop','Pa',ptop)
@@ -1018,5 +1019,5 @@
      CALL iophys_ecrit('irad_wk',1,'irad_wk','m',irad_wk)
     ENDIF
-#endif
+END IF
   !
      CALL wake_popdyn_3 ( klon, klev, phys_sub, wk_adv, dtimesub, wgen, &
@@ -1072,5 +1073,5 @@
 !!--------------------------------------------------------
 
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
     IF (phys_sub) THEN
      CALL iophys_ecrit('wdensa',1,'wdensa','m',wdens)
@@ -1079,5 +1080,5 @@
      CALL iophys_ecrit('asigmawa',1,'asigmawa','m',asigmaw)
     ENDIF
-#endif
+END IF
     ! calcul de la difference de vitesse verticale poche - zone non perturbee
     ! IM 060208 differences par rapport au code initial; init. a 0 dp_deltomg
@@ -1669,5 +1670,5 @@
           END DO
 
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
     IF (phys_sub) THEN
      CALL iophys_ecrit('wdensb',1,'wdensb','m',wdens)
@@ -1702,5 +1703,5 @@
      CALL iophys_ecrit('d_asig_bnd2',1,'d_asig_bnd2','m',d_asig_bnd2)
     ENDIF
-#endif
+END IF
         ENDIF ! (iflag_wk_pop_dyn == 3)
       ENDIF ! (iflag_wk_pop_dyn >= 2)
@@ -1866,7 +1867,7 @@
   !
 
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
     IF (.not.phys_sub) CALL iophys_ecrit('wape_b',1,'wape_b','J/kg',wape)
-#endif
+END IF
   IF (prt_level>=10) THEN
     PRINT *, 'wake-5, sigmaw(igout), cstar(igout), wape(igout), ptop(igout) ', &
@@ -2009,7 +2010,7 @@
     END IF
   END DO
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
   IF (.not.phys_sub) CALL iophys_ecrit('wape2_a',1,'wape2_a','J/kg',wape2)
-#endif
+END IF
 
 
@@ -2041,7 +2042,7 @@
     END DO
   END IF
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
   IF (.not.phys_sub) CALL iophys_ecrit('wape2_b',1,'wape2_b','J/kg',wape2)
-#endif
+END IF
 
 
@@ -2087,7 +2088,7 @@
         gwake(i) = .TRUE.
       END IF
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
   IF (.not.phys_sub) CALL iophys_ecrit('cstar2',1,'cstar2','J/kg',cstar2)
-#endif
+END IF
     END IF  ! (ok_qx_qw(i))
   END DO
@@ -2123,5 +2124,5 @@
   END DO
     IF (iflag_wk_pop_dyn >= 3) THEN
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
       IF (.not.phys_sub) THEN
        CALL iophys_ecrit('fip',1,'fip','J/kg',fip)
@@ -2163,5 +2164,5 @@
        CALL iophys_ecrit('d_asig_bnd2',1,'d_asig_bnd2','m',d_asig_bnd2)
       ENDIF  ! (.not.phys_sub)
-#endif
+END IF
     ENDIF  ! (iflag_wk_pop_dyn >= 3)
   ! Limitation de sigmaw
@@ -2268,7 +2269,7 @@
                       wape(igout),wape2(igout),ktopw(igout),OK_qx_qw(igout)
   ENDIF
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
   IF (.not.phys_sub) CALL iophys_ecrit('wape_c',1,'wape_c','J/kg',wape)
-#endif
+END IF
 
 
@@ -3255,7 +3256,7 @@
           d_sig_spread(i) =  d_sig_spread(i)*dtimesub 
           d_sigmaw(i) =  d_sig_gen(i) + d_sig_death(i) + d_sig_col(i) + d_sig_spread(i)
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
           IF (phys_sub) call iophys_ecrit('d_sigmaw0',1,'d_sigmaw0','',d_sigmaw)
-#endif
+END IF
 
          
@@ -3266,5 +3267,5 @@
           d_sigmaw(i) = d_sigmaw_targ
 !!          d_sigmaw(i) = max(d_sigmaw(i), sigmad-sigmaw(i))
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
           IF (phys_sub) THEN
              call iophys_ecrit('tauwk_inv',1,'tau_wk_inv_min','',tau_wk_inv_min)
@@ -3276,5 +3277,5 @@
              call iophys_ecrit('d_sig_bnd',1,'d_sig_bnd','',d_sig_bnd)
           ENDIF
-#endif
+END IF
           d_asig_death(i) = - asigmaw(i)/tau_prime(i)
           d_asig_aicol(i) = (agfl(i)*iwdens(i) + igfl(i)*awdens(i))*cstar(i)*is_wk(i)
@@ -3287,7 +3288,7 @@
           d_asig_spread(i) =  d_asig_spread(i)*dtimesub 
           d_asigmaw(i) =  d_sig_gen(i) + d_asig_death(i) + d_asig_aicol(i) + d_asig_iicol(i) + d_asig_spread(i)
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
           IF (phys_sub) call iophys_ecrit('d_asigmaw0',1,'d_asigmaw0','',d_asigmaw)
-#endif
+END IF
 
           d_sigmaw_targ = min(max(d_asigmaw(i),-asigmaw(i)), sigmaw(i)-asigmaw(i))
@@ -3295,5 +3296,5 @@
           d_asig_bnd(i) = d_sigmaw_targ - d_asigmaw(i)
           d_asigmaw(i) = d_sigmaw_targ
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
           IF (phys_sub) THEN
              call iophys_ecrit('d_asigmaw',1,'d_asigmaw','',d_asigmaw)
@@ -3304,5 +3305,5 @@
              call iophys_ecrit('d_asig_bnd',1,'d_asig_bnd','',d_asig_bnd)
           ENDIF
-#endif
+END IF
           d_dens_gen(i) = wgen(i)
           d_dens_death(i) = - iwdens(i)*tau_wk_inv_min 
@@ -3318,5 +3319,5 @@
           d_dens_bnd(i) = d_wdens_targ - d_wdens(i)
           d_wdens(i) = d_wdens_targ
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
     IF (phys_sub) THEN 
         call iophys_ecrit('d_wdens',1,'d_wdens','',d_wdens)
@@ -3325,5 +3326,5 @@
         call iophys_ecrit('d_dens_col',1,'d_dens_col','',d_dens_col)
     ENDIF
-#endif
+END IF
 
           d_adens_death(i) = -awdens(i)/tau_prime(i)
@@ -3335,5 +3336,5 @@
           d_adens_acol(i)  =   d_adens_acol(i)*dtimesub
           d_awdens(i) =   d_dens_gen(i) + d_adens_death(i) + d_adens_icol(i) + d_adens_acol(i)     
-#ifdef IOPHYS_WK
+IF (CPPKEY_IOPHYS_WK) THEN
     IF (phys_sub) THEN 
         call iophys_ecrit('d_awdens',1,'d_awdens','',d_awdens)
@@ -3342,5 +3343,5 @@
         call iophys_ecrit('d_adens_acol',1,'d_adens_acol','',d_adens_acol)
     ENDIF
-#endif
+END IF
           d_wdens_targ = min(max(d_awdens(i),-awdens(i)), wdens(i)-awdens(i))
 !!          d_dens_bnd(i) = d_dens_bnd(i) + d_wdens_targ - d_wdens(i)
Index: LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake_ini.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake_ini.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake_ini.F90	(revision 5203)
@@ -81,4 +81,12 @@
   !$OMP THREADPRIVATE(wk_int_delta_t_min)
 
+! CPP key used only in this module for debugging purposes. jyg 09/24
+!!#define IOPHYS_WK
+#ifdef IOPHYS_WK
+  LOGICAL, PARAMETER :: CPPKEY_IOPHYS_WK = .TRUE.
+#else
+  LOGICAL, PARAMETER :: CPPKEY_IOPHYS_WK = .FALSE.
+#endif
+
 
 
Index: LMDZ6/branches/cirrus/libf/phylmd/phyetat0_mod.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/phyetat0_mod.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/phyetat0_mod.F90	(revision 5203)
@@ -33,6 +33,6 @@
   USE geometry_mod,     ONLY: longitude_deg, latitude_deg
   USE iostart,          ONLY: close_startphy, get_field, get_var, open_startphy
-  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers
-  USE readTracFiles_mod,ONLY: maxlen, new2oldH2O
+  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers, new2oldH2O
+  USE strings_mod,      ONLY: maxlen
   USE traclmdz_mod,     ONLY: traclmdz_from_restart
   USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl, carbon_cycle_tr, carbon_cycle_rad, co2_send, RCO2_glo
Index: LMDZ6/branches/cirrus/libf/phylmd/phys_local_var_mod.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/phys_local_var_mod.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/phys_local_var_mod.F90	(revision 5203)
@@ -400,6 +400,6 @@
       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte
 !$OMP THREADPRIVATE(tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte)
-      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxustartlic, zxrhoslic, zxqsaltlic
-!$OMP THREADPRIVATE(zxustartlic, zxrhoslic, zxqsaltlic)
+      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic
+!$OMP THREADPRIVATE(zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic)
       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxfqcalving
 !$OMP THREADPRIVATE(zxfqcalving)
@@ -1051,6 +1051,6 @@
       ALLOCATE(zxrunofflic(klon), runoff_diag(klon))
       runoff_diag(:)=0.
-      ALLOCATE(zxustartlic(klon), zxrhoslic(klon), zxqsaltlic(klon))
-      zxustartlic(:)=0. ; zxrhoslic(:)=0. ; zxqsaltlic(:)=0.
+      ALLOCATE(zxustartlic(klon), zxrhoslic(klon), zxqsaltlic(klon), tempsmoothlic(klon))
+      zxustartlic(:)=0. ; zxrhoslic(:)=0. ; zxqsaltlic(:)=0. ; tempsmoothlic(:)=0.
       ALLOCATE(rain_lsc(klon))
       ALLOCATE(rain_num(klon))
@@ -1480,5 +1480,5 @@
 ! SN runoff_diag
       DEALLOCATE(zxrunofflic, runoff_diag)
-      DEALLOCATE(zxustartlic, zxrhoslic, zxqsaltlic)
+      DEALLOCATE(zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic)
       DEALLOCATE(zxtsol, snow_lsc, zxfqfonte, zxqsurf)
       DEALLOCATE(rain_lsc)
Index: LMDZ6/branches/cirrus/libf/phylmd/physiq_mod.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/physiq_mod.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/physiq_mod.F90	(revision 5203)
@@ -39,6 +39,5 @@
     USE ioipsl_getin_p_mod, ONLY : getin_p
     USE indice_sol_mod
-    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac
-    USE readTracFiles_mod, ONLY: addPhase
+    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, addPhase
     USE strings_mod,  ONLY: strIdx
     USE iophy
@@ -1270,4 +1269,7 @@
     !albedo SB <<<
 
+    !--Lea Raillard qs_ini 
+    REAL, dimension(klon,klev) :: qs_ini
+
     !--OB variables for mass fixer (hard coded for now)
     REAL qql1(klon),qql2(klon),corrqql
@@ -2461,4 +2463,6 @@
        ENDDO
     ENDDO
+    ! Lea Raillard qs_ini for cloud phase param.
+    qs_ini(:,:)=qs_seri(:,:)
     !
     !--OB water mass fixer 
@@ -3858,5 +3862,5 @@
 
     CALL lscp(klon,klev,phys_tstep,missing_val,paprs,pplay, &
-         t_seri, q_seri,qs_ancien,ptconv,ratqs, &
+         t_seri, q_seri,qs_ini,ptconv,ratqs, &
          d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, & 
          pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
Index: LMDZ6/branches/cirrus/libf/phylmd/surf_landice_mod.F90
===================================================================
--- LMDZ6/branches/cirrus/libf/phylmd/surf_landice_mod.F90	(revision 5202)
+++ LMDZ6/branches/cirrus/libf/phylmd/surf_landice_mod.F90	(revision 5203)
@@ -36,5 +36,5 @@
     USE cpl_mod,          ONLY : cpl_send_landice_fields
     USE calcul_fluxs_mod
-    USE phys_local_var_mod, ONLY : zxrhoslic, zxustartlic, zxqsaltlic
+    USE phys_local_var_mod, ONLY : zxrhoslic, zxustartlic, zxqsaltlic, tempsmoothlic
     USE phys_output_var_mod, ONLY : snow_o,zfra_o
 #ifdef ISO   
@@ -185,4 +185,5 @@
 
     REAL,DIMENSION(klon) :: alb1,alb2
+    REAL                 :: time_tempsmooth,coef_tempsmooth
     REAL,DIMENSION(klon) :: precip_totsnow, evap_totsnow
     REAL, DIMENSION (klon,6) :: alb6
@@ -230,4 +231,8 @@
            PRINT*, 'alb_nir_sno_lic',alb_nir_sno_lic
   
+  DO j=1,knon
+       i = knindex(j)
+       tempsmoothlic(i) = temp_air(j)
+  ENDDO
   firstcall=.false.
   ENDIF
@@ -445,5 +450,5 @@
     z0h(1:knon) = z0h_landice
 else
-    ! parameterization of z0=f(T) following measurements in Adelie Land by Amory et al 2018
+    ! parameterization of z0=f(T) following measurements in Adelie Land by Amory et al 2017
     coefa = 0.1658 !0.1862 !Ant
     coefb = -50.3869 !-55.7718 !Ant
@@ -456,12 +461,17 @@
     coefc = log(z03/z02)/(ta3-ta2)
     coefd = log(z03)-coefc*ta3
+    time_tempsmooth=2.*86400.
+    coef_tempsmooth=min(1.,dtime/time_tempsmooth)
+    !coef_tempsmooth=0.
     do j=1,knon 
-      if (temp_air(j) .lt. ta1) then
+      i=knindex(j)
+      tempsmoothlic(i)=temp_air(j)*coef_tempsmooth+tempsmoothlic(i)*(1.-coef_tempsmooth)
+      if (tempsmoothlic(i) .lt. ta1) then
         z0m(j) = z01
-      else if (temp_air(j).ge.ta1 .and. temp_air(j).lt.ta2) then
-        z0m(j) = exp(coefa*temp_air(j) + coefb)
-      else if (temp_air(j).ge.ta2 .and. temp_air(j).lt.ta3) then
+      else if (tempsmoothlic(i).ge.ta1 .and. tempsmoothlic(i).lt.ta2) then
+        z0m(j) = exp(coefa*tempsmoothlic(i) + coefb)
+      else if (tempsmoothlic(i).ge.ta2 .and. tempsmoothlic(i).lt.ta3) then
         ! if st > 0, melting induce smooth surface
-        z0m(j) = exp(coefc*temp_air(j) + coefd)
+        z0m(j) = exp(coefc*tempsmoothlic(i) + coefd)
       else
         z0m(j) = z03
