Index: LMDZ6/trunk/libf/dyn3d_common/infotrac.F90
===================================================================
--- LMDZ6/trunk/libf/dyn3d_common/infotrac.F90	(revision 5214)
+++ LMDZ6/trunk/libf/dyn3d_common/infotrac.F90	(revision 5216)
@@ -3,9 +3,11 @@
 MODULE infotrac
 
-   USE       strings_mod, ONLY: msg, fmsg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse
-   USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers, setGeneration, itZonIso, nzone, tran0, isoZone, &
-        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       strings_mod, ONLY: msg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strCount
+   USE readTracFiles_mod, ONLY: readTracersFiles, maxTableWidth, isot_type, addPhase, addKey, iH2O, &
+        indexUpdate, trac_type, testTracersFiles, processIsotopes, tracers, delPhase, getKey, tran0, &
+        isoKeys, isoName, isoZone, isoPhas, isoSelect, itZonIso, nbIso, isotope, &  
+           niso,   ntiso,   nzone,   nphas,            iqIsoPha, ixIso, isoCheck
    USE readTracFiles_mod, ONLY: new2oldH2O, newHNO3, oldHNO3
+
    IMPLICIT NONE
 
@@ -30,6 +32,6 @@
    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 :: itZonIso                                      !--- Index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx)
+   PUBLIC :: iqIsoPha                                      !--- Index "iq" in "qx"              = f(isotope idx,   phase idx)
    PUBLIC :: isoCheck                                      !--- Run isotopes checking routines
    !=== FOR BOTH TRACERS AND ISOTOPES
@@ -118,4 +120,7 @@
 SUBROUTINE init_infotrac
    USE control_mod, ONLY: planet_type
+#ifdef CPP_PARA
+   USE parallel_lmdz, ONLY: is_master
+#endif
 #ifdef REPROBUS
    USE CHEM_REP, ONLY: Init_chem_rep_trac
@@ -153,12 +158,15 @@
    INTEGER :: nqINCA
 #endif
+#ifndef CPP_PARA
+   LOGICAL               :: is_master=.TRUE.
+#endif
    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                          !--- Strings for messages and expanded tracers type
+   CHARACTER(LEN=maxlen) :: msg1, texp, ttp, nam, val                !--- 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                                     !--- Indexes and temporary variables
+   INTEGER :: iq, jq, nt, im, nm, ig                                 !--- Indexes and temporary variables
    LOGICAL :: lerr, ll
    TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:)
@@ -175,13 +183,15 @@
    descrq(30)    =  'PRA'
 
-   lerr=strParse(type_trac, '|', types_trac, n=nt)
-   IF (nt .GT. 1) THEN
-      IF (nt .GT. 2) CALL abort_gcm(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
-      IF (nt .EQ. 2) type_trac=types_trac(2)
-   ENDIF
+   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname, is_master)
+   IF(strCount(type_trac, '|', nt)) CALL abort_gcm(modname, 'Could''nt parse the "type_trac" string with delimiter "|"', 1)
+   IF(nt >= 3) CALL abort_gcm(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
+   IF(strParse(type_trac, '|', types_trac, n=nt)) CALL abort_gcm(modname, "couldn't parse "//'"type_trac"', 1)
+   IF(nt == 2) type_trac = types_trac(2) ! TO BE DELETED SOON
 
    CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
 
-   
+!##############################################################################################################################
+   IF(is_master) THEN                                                !=== SKIPED IF ALREADY DONE
+!##############################################################################################################################
    !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION
    msg1 = 'For type_trac = "'//TRIM(type_trac)//'":'
@@ -211,6 +221,7 @@
 #endif
    END SELECT
-
-   nqCO2 = COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
+!##############################################################################################################################
+   END IF
+!##############################################################################################################################
 
 !==============================================================================================================================
@@ -222,49 +233,16 @@
    IF(testTracersFiles(modname, texp, fType, .TRUE.)) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
    ttp = type_trac; IF(fType /= 1) ttp = texp
-   IF(readTracersFiles(ttp, lRepr=type_trac=='repr')) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
-
-!==============================================================================================================================
-! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
-!==============================================================================================================================
    !---------------------------------------------------------------------------------------------------------------------------
    IF(fType == 0) CALL abort_gcm(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
    !---------------------------------------------------------------------------------------------------------------------------
-   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) THEN      !=== FOUND OLD STYLE INCA "traceur.def"
+   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) &                   !=== FOUND OLD STYLE INCA "traceur.def"
+      CALL abort_gcm(modname, 'retro-compatibility with old-style INCA traceur.def files has been disabled.', 1)
    !---------------------------------------------------------------------------------------------------------------------------
-#ifdef INCA
-      nqo = SIZE(tracers) - nqCO2
-      CALL Init_chem_inca_trac(nqINCA)                               !--- Get nqINCA from INCA
-      nbtr = nqINCA + nqCO2                                          !--- Number of tracers passed to phytrac
-      nqtrue = nbtr + nqo                                            !--- Total number of "true" tracers
-      IF(ALL([2,3] /= nqo)) CALL abort_gcm(modname, 'Only 2 or 3 water phases allowed ; found nqo='//TRIM(int2str(nqo)), 1)
-      ALLOCATE(hadv(nqtrue), hadv_inca(nqINCA), conv_flg_inca(nqINCA), solsym_inca(nqINCA))
-      ALLOCATE(vadv(nqtrue), vadv_inca(nqINCA),  pbl_flg_inca(nqINCA))
-      CALL init_transport(solsym_inca, conv_flg_inca, pbl_flg_inca, hadv_inca, vadv_inca)
-      ALLOCATE(ttr(nqtrue))
-      ttr(1:nqo+nqCO2)                  = tracers
-      ttr(1    :      nqo   )%component = 'lmdz'
-      ttr(1+nqo:nqCO2+nqo   )%component = 'co2i'
-      ttr(1+nqo+nqCO2:nqtrue)%component = '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'
-      lerr = getKey('hadv', had, ky=tracers(:)%keys)
-      lerr = getKey('vadv', vad, ky=tracers(:)%keys)
-      hadv(1:nqo+nqCO2) = had(:); hadv(1+nqo+nqCO2:nqtrue) = hadv_inca
-      vadv(1:nqo+nqCO2) = vad(:); vadv(1+nqo+nqCO2:nqtrue) = vadv_inca
-      CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
-      DO iq = 1, nqtrue
-         t1 => tracers(iq)
-         CALL addKey('name',      t1%name,      t1%keys)
-         CALL addKey('component', t1%component, t1%keys)
-         CALL addKey('parent',    t1%parent,    t1%keys)
-         CALL addKey('phase',     t1%phase,     t1%keys)
-      END DO
-      IF(setGeneration(tracers)) CALL abort_gcm(modname,'See above',1) !- SET FIELDS %iGeneration, %gen0Name
-      DEALLOCATE(had, hadv_inca, vad, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca)
-#endif
-   !---------------------------------------------------------------------------------------------------------------------------
-   ELSE                                                              !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE)
-   !---------------------------------------------------------------------------------------------------------------------------
+
+   IF(readTracersFiles(ttp, lRepr=type_trac == 'repr')) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
+
+!==============================================================================================================================
+! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
+!==============================================================================================================================
    nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
    nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
@@ -274,17 +252,13 @@
    nqINCA =      COUNT(tracers(:)%component == 'inca')
 #endif
+#ifdef REPROBUS
+   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)                         !--- Transfert the number of tracers to Reprobus
+#endif
+
+!==============================================================================================================================
+! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
+!==============================================================================================================================
    IF(getKey('hadv', hadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "hadv"', 1)
    IF(getKey('vadv', vadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "vadv"', 1)
-   !---------------------------------------------------------------------------------------------------------------------------
-   END IF
-   !---------------------------------------------------------------------------------------------------------------------------
-
-#ifdef REPROBUS
-   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
-#endif
-
-!==============================================================================================================================
-! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
-!==============================================================================================================================
    DO iq = 1, nqtrue
       IF( hadv(iq)<20 .OR. (ANY(hadv(iq)==[20,30]) .AND. hadv(iq)==vadv(iq)) ) CYCLE
@@ -361,22 +335,22 @@
 
    !=== TEST ADVECTION SCHEME
-   DO iq = 1, nqtot ; t1 => tracers(iq); iad = t1%iadv
+   DO iq = 1, nqtot ; t1 => tracers(iq)
+      iad = t1%iadv
+      ig  = t1%iGeneration
+      nam = t1%name
+      val = 'iadv='//TRIM(int2str(iad))
 
       !--- ONLY TESTED VALUES FOR TRACERS FOR NOW:               iadv = 14, 10 (and 0 for non-transported tracers)
-      IF(ALL([10,14,0] /= iad)) &
-         CALL abort_gcm(modname, 'Not tested for iadv='//TRIM(int2str(iad))//' ; 10 or 14 only are allowed !', 1)
-
-      !--- ONLY TESTED VALUES FOR PARENTS HAVING CHILDS FOR NOW: iadv = 14, 10 (PARENTS: TRACERS OF GENERATION 1)
-      IF(ALL([10,14] /= iad) .AND. t1%iGeneration == 1 .AND. ANY(tracers(:)%iGeneration > 1)) &
-         CALL abort_gcm(modname, 'iadv='//TRIM(int2str(iad))//' not implemented for parents ; 10 or 14 only are allowed !', 1)
-
-      !--- ONLY TESTED VALUES FOR CHILDS FOR NOW:                iadv = 10     (CHILDS:  TRACERS OF GENERATION GREATER THAN 1)
-      IF(fmsg('WARNING ! iadv='//TRIM(int2str(iad))//' not implemented for childs. Setting iadv=10 for "'//TRIM(t1%name)//'"',&
-         modname, iad /= 10 .AND. t1%iGeneration > 1)) t1%iadv = 10
-
-      !--- ONLY VALID SCHEME NUMBER FOR WATER VAPOUR:            iadv = 14
-      ll = t1%name /= addPhase('H2O','g')
-      IF(fmsg('WARNING ! iadv=14 is valid for water vapour only. Setting iadv=10 for "'//TRIM(t1%name)//'".', &
-         modname, iad == 14 .AND. ll))                 t1%iadv = 10
+      IF(ALL([10,14,0] /= iad)) CALL abort_gcm(modname, TRIM(val)//' has not been tested yet ; 10 or 14 only are allowed !', 1)
+
+      !--- ONLY TESTED VALUES SO FAR FOR PARENTS HAVING CHILDREN: iadv = 14, 10 (PARENTS: TRACERS OF GENERATION 0)
+      IF(ALL([10,14] /= iad) .AND. ig == 0 .AND. ANY(tracers(:)%parent==nam)) &
+         CALL abort_gcm(modname, TRIM(val)//' is not implemented for parents ; 10 or 14 only are allowed !', 1)
+
+      !--- ONLY TESTED VALUES SO FAR FOR DESCENDANTS (TRACERS OF GENERATION > 0): iadv = 10 ; WATER VAPOUR: iadv = 14
+      lerr = iad /= 10 .AND. ig > 0;                     IF(lerr) tracers(iq)%iadv = 10
+      CALL msg('WARNING! '//TRIM(val)//  ' not implemented for children. Setting iadv=10 for "'//TRIM(nam)//'"', modname, lerr)
+      lerr = iad == 14 .AND. nam /= addPhase('H2O','g'); IF(lerr) tracers(iq)%iadv = 10
+      CALL msg('WARNING! '//TRIM(val)//' is valid for water vapour only. Setting iadv=10 for "'//TRIM(nam)//'"', modname, lerr)
    END DO
 
@@ -386,6 +360,6 @@
 
    !--- Convection / boundary layer activation for all tracers
-   ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
-   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
@@ -395,4 +369,5 @@
 
    !=== DISPLAY THE RESULTS
+   IF(.NOT.is_master) RETURN
    CALL msg('nqo    = '//TRIM(int2str(nqo)),    modname)
    CALL msg('nbtr   = '//TRIM(int2str(nbtr)),   modname)
@@ -413,14 +388,11 @@
                   t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
       CALL abort_gcm(modname, "problem with the tracers table content", 1)
-   IF(niso > 0) THEN
-      CALL msg('Where, for isotopes family "'//TRIM(isotope%parent)//'":', modname)
+   CALL msg('No isotopes identified.', modname, nbIso == 0)
+   IF(nbIso == 0) RETURN
+      CALL msg('For isotopes family "H2O":', modname)
       CALL msg('  isoKeys%name = '//strStack(isoKeys%name), modname)
-      CALL msg('  isoName = '//strStack(isoName),      modname)
-      CALL msg('  isoZone = '//strStack(isoZone),      modname)
-      CALL msg('  isoPhas = '//TRIM(isoPhas),          modname)
-   ELSE
-      CALL msg('No isotopes identified.', modname)
-   END IF
-   CALL msg('end', modname)
+      CALL msg('  isoName = '//strStack(isoName),  modname)
+      CALL msg('  isoZone = '//strStack(isoZone),  modname)
+      CALL msg('  isoPhas = '//    TRIM(isoPhas),  modname)
 
 END SUBROUTINE init_infotrac
