Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/infotrac_phy.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/infotrac_phy.F90	(revision 3852)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/infotrac_phy.F90	(revision 3891)
@@ -3,5 +3,5 @@
   USE       strings_mod, ONLY: msg, fmsg, test, strIdx, int2str
 
-  USE readTracFiles_mod, ONLY: getKey_init, getKey, indexUpdate
+  USE readTracFiles_mod, ONLY: getKey_init, getKey, indexUpdate, delPhase
 
   USE trac_types_mod,    ONLY: tra, iso, kys
@@ -75,4 +75,5 @@
 !  | type       | Type (so far: tracer or tag)                    | /           | tracer,tag             |
 !  | phas       | Phases list ("g"as / "l"iquid / "s"olid)        | /           | [g][l][s]              |
+!  | comp       | Name(s) of the merged/cumulated section(s)      | /           | coma-separated names   |
 !  | iadv       | Advection scheme number                         | iadv        | 1-20,30 exc. 3-9,15,19 |
 !  | igen       | Generation (>=1)                                | /           |                        |
@@ -108,4 +109,5 @@
                               nbIso                        !--- Number of available isotopes family
   CHARACTER(LEN=256), SAVE :: type_trac                    !--- Keyword for tracers type
+!$OMP THREADPRIVATE(nqtot, nbtr, nqo, nbIso, type_trac)
 
   !=== DERIVED TYPES EMBEDDING MOST INFORMATIONS ABOUT TRACERS AND ISOTOPES FAMILIES
@@ -115,15 +117,15 @@
 
   !=== ALIASES FOR CURRENTLY SELECTED ISOTOPES FAMILY OF VARIABLES EMBEDDED IN THE VECTOR "isotopes"
-  TYPE(iso),          SAVE, POINTER :: isotope             !--- CURRENTLY SELECTED ISOTOPES FAMILY DESCRIPTOR
-  INTEGER,            SAVE          :: ixIso, iH2O         !--- Index of the selected isotopes family and H2O family
-  LOGICAL,            SAVE, POINTER :: isoCheck            !--- Flag to trigger the checking routines
-  TYPE(kys),          SAVE, POINTER :: isoKeys(:)          !--- ONE SET OF KEYS FOR EACH ISOTOPE (LISTED IN isoName)
-  CHARACTER(LEN=256), SAVE, POINTER :: isoName(:),       & !--- ISOTOPES NAMES FOR THE CURRENTLY SELECTED FAMILY
-                                       isoZone(:),       & !--- TAGGING ZONES  FOR THE CURRENTLY SELECTED FAMILY
-                                       isoPhas             !--- USED PHASES    FOR THE CURRENTLY SELECTED FAMILY
-  INTEGER,            SAVE          :: niso, nzon, npha, & !--- NUMBER OF ISOTOPES, TAGGING ZONES AND PHASES
-                                       nitr                !--- NUMBER OF ISOTOPES + ISOTOPIC TAGGING TRACERS
-  INTEGER,            SAVE, POINTER :: iZonIso(:,:)        !--- INDEX IN "isoTrac" AS f(tagging zone, isotope)
-  INTEGER,            SAVE, POINTER :: iTraPha(:,:)        !=== INDEX IN "isoTrac" AS f(isotopic tracer, phase)
+  TYPE(iso),          SAVE, POINTER     :: isotope         !--- CURRENTLY SELECTED ISOTOPES FAMILY DESCRIPTOR
+  INTEGER,            SAVE              :: ixIso, iH2O     !--- Index of the selected isotopes family and H2O family
+  LOGICAL,            SAVE              :: isoCheck        !--- Flag to trigger the checking routines
+  TYPE(kys),          SAVE, POINTER     :: isoKeys(:)      !--- ONE SET OF KEYS FOR EACH ISOTOPE (LISTED IN isoName)
+  CHARACTER(LEN=256), SAVE, POINTER     :: isoName(:),   & !--- ISOTOPES NAMES FOR THE CURRENTLY SELECTED FAMILY
+                                           isoZone(:),   & !--- TAGGING ZONES  FOR THE CURRENTLY SELECTED FAMILY
+                                           isoPhas         !--- USED PHASES    FOR THE CURRENTLY SELECTED FAMILY
+  INTEGER,            SAVE              :: niso, nzon,   & !--- NUMBER OF ISOTOPES, TAGGING ZONES AND PHASES
+                                           npha, nitr      !--- NUMBER OF PHASES AND ISOTOPES + ISOTOPIC TAGGING TRACERS
+  INTEGER,            SAVE, POINTER     :: iZonIso(:,:)    !--- INDEX IN "isoTrac" AS f(tagging zone, isotope)
+  INTEGER,            SAVE, POINTER     :: iTraPha(:,:)    !--- INDEX IN "isoTrac" AS f(isotopic tracer, phase)
 !$OMP THREADPRIVATE(isotope, ixIso,iH2O, isoCheck, isoKeys, isoName,isoZone,isoPhas, niso,nzon,npha,nitr, iZonIso,iTraPha)
 
@@ -132,9 +134,9 @@
                                         alpha_ideal(:)     !--- Ideal fractionning coefficient (for initial state) (niso)
   INTEGER,            SAVE, ALLOCATABLE :: conv_flg(:),  & !--- Convection     activation ; needed for INCA        (nbtr)
-                                            pbl_flg(:)     !---  Boundary layer activation ; needed for INCA        (nbtr)
-  INTEGER,            SAVE, ALLOCATABLE ::    niadv(:),  &
-                                         itr_indice(:)     !--- Indexes of the tracers passed to phytrac        (nqtottr)
-  CHARACTER(LEN=256), SAVE, ALLOCATABLE ::   solsym(:)     !--- Names from INCA                                    (nbtr)
-!OMP THREADPRIVATE(tnat, alpha_ideal, conv_flg, pbl_flg, niadv, itr_indice, solsym)
+                                            pbl_flg(:),  & !--- Boundary layer activation ; needed for INCA        (nbtr)
+                                         itr_indice(:),  & !--- Indexes of the tracers passed to phytrac        (nqtottr)
+                                              niadv(:)     !--- Indexes of true tracers  (<=nqtot, such that iadv(idx)>0)
+  CHARACTER(LEN=8),   SAVE, ALLOCATABLE ::   solsym(:)     !--- Names from INCA                                    (nbtr)
+!OMP THREADPRIVATE(tnat, alpha_ideal, conv_flg, pbl_flg, itr_indice, niadv, solsym)
 
 #ifdef CPP_StratAer
@@ -163,4 +165,5 @@
   solsym    = solsym_
   nqtot     = SIZE(tracers_)
+  nqo       = COUNT(delPhase(tracers%name)=='H2O' .AND. tracers%igen==1)
   nbtr      = nbtr_
   niadv     = niadv_
@@ -169,18 +172,17 @@
   conv_flg = conv_flg_
 
+  CALL msg('nqtot = '//TRIM(int2str(nqtot)))
+  CALL msg('nbtr  = '//TRIM(int2str(nbtr)))
+  CALL msg('nqo   = '//TRIM(int2str(nqo)))
+
   !=== Specific to water
   CALL getKey_init(tracers, isotopes)
   IF(.NOT.isoSelect('H2O')) THEN
     iH2O = ixIso
-    lerr = getKey('tnat' ,tnat,        isoName)
-    lerr = getKey('alpha',alpha_ideal, isoName)
-    nqo  = isotope%npha
+    lerr = getKey('tnat' ,tnat,        isoName(1:isotope%niso))
+    lerr = getKey('alpha',alpha_ideal, isoName(1:isotope%niso))
   END IF
-  IF(prt_level > 1) WRITE(lunout,*) TRIM(modname)//": nqtot, nqo, nbtr = ",nqtot, nqo, nbtr
   itr_indice = PACK(tracers(:)%itr, MASK = tracers(:)%itr/=0)
-print*,'66'
-
-  !? conv_flg, pbl_flg, solsym
-  !? isoInit
+  !? CDC isoInit => A VOIR !!
 
 #ifdef CPP_StratAer
@@ -196,5 +198,5 @@
         CASE('GASSO2');   id_SO2_strat   = iq - nqo; CALL msg('id_SO2_strat  =', id_SO2_strat)
         CASE('GASH2SO4'); id_H2SO4_strat = iq - nqo; CALL msg('id_H2SO4_strat=', id_H2SO4_strat)
-        CASE('GASTEST');  id_TEST_strat  = iq - nqo; CALL msg('id_TEST_strat=' , id_TEST_strat)
+        CASE('GASTEST');  id_TEST_strat  = iq - nqo; CALL msg('id_TEST_strat =', id_TEST_strat)
       END SELECT
     END DO
@@ -209,26 +211,40 @@
 !==============================================================================================================================
 !=== THE ROUTINE isoSelect IS USED TO SWITCH FROM AN ISOTOPE FAMILY TO ANOTHER: ISOTOPES DEPENDENT PARAMETERS ARE UPDATED
-!     Singe generic "isoSelect" routine, using the predefined parent index (fast version) or its name (first time).
-!==============================================================================================================================
-LOGICAL FUNCTION isoSelectByName(iName) RESULT(lerr)
-  CHARACTER(LEN=*), INTENT(IN)  :: iName
+!     Singe generic "isoSelect" routine, using the predefined parent index (fast version) or its name (first call).
+!==============================================================================================================================
+LOGICAL FUNCTION isoSelectByName(iName, lVerbose) RESULT(lerr)
+  IMPLICIT NONE
+  CHARACTER(LEN=*),  INTENT(IN)  :: iName
+  LOGICAL, OPTIONAL, INTENT(IN) :: lVerbose
   INTEGER :: iIso
+  LOGICAL :: lV
+  lV = .FALSE.; IF(PRESENT(lVerbose)) lV = lVerbose
   iIso = strIdx(isotopes(:)%prnt, iName)
-  IF(test(fmsg(iIso == 0,'no isotope family named "'//TRIM(iName)//'"'),lerr)) RETURN
-  IF(isoSelectByIndex(iIso)) RETURN
+  lerr = iIso == 0
+  CALL msg(lerr .AND. lV, 'no isotope family named "'//TRIM(iName)//'"')
+  IF(lerr) RETURN
+  lerr = isoSelectByIndex(iIso)
 END FUNCTION isoSelectByName
 !==============================================================================================================================
-LOGICAL FUNCTION isoSelectByIndex(iIso) RESULT(lerr)
-  INTEGER, INTENT(IN) :: iIso
+LOGICAL FUNCTION isoSelectByIndex(iIso, lVerbose) RESULT(lerr)
+  IMPLICIT NONE
+  INTEGER,           INTENT(IN) :: iIso
+  LOGICAL, OPTIONAL, INTENT(IN) :: lVerbose
+  LOGICAL :: lv
+  lv = .FALSE.; IF(PRESENT(lVerbose)) lv = lVerbose
   lerr = .FALSE.
   IF(iIso == ixIso) RETURN                                      !--- Nothing to do if the index is already OK
-  IF(test(fmsg(iIso<=0 .OR. iIso>=nbIso,'Inconsistent isotopes family index '//TRIM(int2str(iIso))),lerr)) RETURN
+  lerr = iIso<=0 .OR. iIso>nbIso
+  CALL msg(lerr .AND. lV, 'Inconsistent isotopes family index '//TRIM(int2str(iIso))//': should be > 0 and <= ' &
+                                                               //TRIM(int2str(nbIso))//'"')
+  IF(lerr) RETURN
   ixIso = iIso                                                  !--- Update currently selected family index
   isotope => isotopes(ixIso)                                    !--- Select corresponding component
-  !--- VARIOUS ALIASES
-  isoKeys => isotope%keys; niso = isotope%niso
-  isoName => isotope%trac; nitr = isotope%nitr; isoCheck => isotope%check
-  isoZone => isotope%zone; nzon = isotope%nzon; iZonIso  => isotope%iZonIso
-  isoPhas => isotope%phas; npha = isotope%npha; iTraPha  => isotope%iTraPha
+  isoKeys => isotope%keys;    niso     = isotope%niso
+  isoName => isotope%trac;    nitr     = isotope%nitr
+  isoZone => isotope%zone;    nzon     = isotope%nzon
+  isoPhas => isotope%phas;    npha     = isotope%npha
+  iZonIso => isotope%iZonIso; isoCheck = isotope%check
+  iTraPha => isotope%iTraPha
 END FUNCTION isoSelectByIndex
 !==============================================================================================================================
Index: LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyetat0.F90
===================================================================
--- LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyetat0.F90	(revision 3852)
+++ LMDZ6/branches/LMDZ-tracers/libf/phylmd/phyetat0.F90	(revision 3891)
@@ -443,6 +443,6 @@
 !!        iiq=niadv(it+2)                                                           ! jyg
         iiq=niadv(it+nqo)                                                           ! jyg
-        found=phyetat0_get(1,trs(:,it),"trs_"//tracers(iiq)%name, &
-              "Surf trac"//tracers(iiq)%name,0.)
+        found=phyetat0_get(1,trs(:,it),"trs_"//TRIM(tracers(iiq)%name), &
+              "Surf trac"//TRIM(tracers(iiq)%name),0.)
      ENDDO
      CALL traclmdz_from_restart(trs)
@@ -591,9 +591,9 @@
    CALL get_field(name, field, found)
    IF (.NOT. found) THEN
-     WRITE(lunout,*) "phyetat0: Le champ <",name,"> est absent"
+     WRITE(lunout,*) "phyetat0: Le champ <",TRIM(name),"> est absent"
      WRITE(lunout,*) "Depart legerement fausse. Mais je continue"
      field(:,:)=default
    ENDIF
-   WRITE(lunout,*) name, descr, MINval(field),MAXval(field)
+   WRITE(lunout,*) TRIM(name), descr, MINval(field),MAXval(field)
    phyetat0_get=found
 
