Ignore:
Timestamp:
Sep 10, 2024, 5:14:23 PM (10 months ago)
Author:
dcugnet
Message:
  • Remove INCA retro-compatibility with "traceur.def" (containing only water tracers but getting chemical species from an internal INCA routine).
  • The "trac_type" derived type internal to "readTracFiles_mod" is removed because a generic "keys_type" is enough: no explicit key ("%" operator) is needed, even %name.
  • The "trac_type" and "isot_type" derived types are now defined locally in "infotrac" and "infotrac_phy" (and more generally in each context: dynamic, lmdz dynamics, lmdz physics, etc.). The "readTracFiles_mod" module is now only used in these two routines:
    • few internal routines/variables (addPhase, delPhase, new2oldH2O, newHNO3, oldHNO3) are made available through "infotrac" and "infotrac_phy".
    • the "getKey" routine is only used in these two routines to define the explicit keys ("%" operator) of the local derived types "trac_type" and "isot_type". It could be in principle used outside this scope to get tracers parameters (read from "tracer.def") or isotopic parameters (read from "isotopes_params.def" - disabled for now).
  • The fortran parameters file "iso_params_mod.F90" is introduced so that "tnat" and "alpha_ideal" are defined in a single place but used in several. "ltnat1" is no longer hardcoded but defined with the *.def files parameter "tnat1"
  • Few minor changes:
    • use "infotrac_phy" instead of "infotrac" in calfis* because "tracers(:)%isAdvected" is defined in physics only.
    • "isotopes_mod" now ready for several isotopes classes (currently: only H2O)
    • isotopes class name (the name of the parent of the isotopes) is now %name and no longer %parent.
    • improvement of "getKey"
Location:
LMDZ6/trunk/libf/phylmd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/infotrac_phy.F90

    r5003 r5183  
    33MODULE infotrac_phy
    44
    5    USE       strings_mod, ONLY: msg, fmsg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strIdx
    6    USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers, setGeneration, itZonIso, nzone, tran0, isoZone, &
    7         delPhase, niso, getKey, isot_type, processIsotopes,  isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, &
    8         addPhase, iH2O, addKey, isoSelect, testTracersFiles, isoKeys, indexUpdate,  iqWIsoPha, nbIso, ntiso, isoName, isoCheck
     5   USE       strings_mod, ONLY: msg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strCount, strIdx
     6   USE readTracFiles_mod, ONLY: readTracersFiles, maxTableWidth,  tisot=>isot_type, addPhase, addKey, iH2O, &
     7        indexUpdate, keys_type, testTracersFiles, processIsotopes, trac=>tracers,   delPhase, getKey, tran0
     8   USE readTracFiles_mod, ONLY: new2oldH2O
     9
    910   IMPLICIT NONE
    1011
     
    1617   PUBLIC :: nqtot,   nbtr,   nqo,   nqCO2,   nqtottr      !--- Main dimensions
    1718   PUBLIC :: conv_flg, pbl_flg                             !--- Convection & boundary layer activation keys
    18 #ifdef CPP_StratAer
     19   PUBLIC :: new2oldH2O                                    !--- For backwards compatibility in phyetat0
     20   PUBLIC :: addPhase, delPhase                            !--- Add/remove the phase from the name of a tracer
     21#if defined CPP_StratAer || defined REPROBUS
    1922   PUBLIC :: nbtr_bin, nbtr_sulgas                         !--- Number of aerosols bins and sulfur gases for StratAer model
    2023   PUBLIC :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat
    2124#endif
    2225
    23    !=== FOR WATER
    24    PUBLIC :: ivap, iliq, isol
    2526   !=== FOR ISOTOPES: General
    2627   PUBLIC :: isot_type, nbIso                              !--- Derived type, full isotopes families database + nb of families
    27    PUBLIC :: isoSelect, ixIso                              !--- Isotopes family selection tool + selected family index
     28   PUBLIC :: isoSelect, ixIso, isoFamilies                 !--- Isotopes families selection tool + selected index + list
    2829   !=== FOR ISOTOPES: Specific to water
    29    PUBLIC :: iH2O                                          !--- H2O isotopes class index
     30   PUBLIC :: iH2O                                          !--- Value of "ixIso" for "H2O" isotopes class
     31   PUBLIC :: ivap, iliq, isol
    3032   !=== FOR ISOTOPES: Depending on the selected isotopes family
    31    PUBLIC :: isotope, isoKeys                              !--- Selected isotopes database + associated keys (cf. getKey)
    32    PUBLIC :: isoName, isoZone, isoPhas                     !--- Isotopes and tagging zones names, phases
    33    PUBLIC :: niso,    nzone,   nphas,   ntiso              !---  " " numbers + isotopes & tagging tracers number
    34    PUBLIC :: itZonIso                                      !--- idx "it" (in "isoName(1:niso)") = function(tagging idx, isotope idx)
    35    PUBLIC :: iqIsoPha                                      !--- idx "iq" (in "qx") = function(isotope idx, phase idx) + aliases
    36    PUBLIC :: iqWIsoPha                                      !--- Same as iqIsoPha but with normal water phases
    37 
     33   PUBLIC :: isotope                                       !--- Selected isotopes database (argument of getKey)
     34   PUBLIC :: isoKeys, isoName, isoZone, isoPhas            !--- Isotopes keys & names, tagging zones names, phases
     35   PUBLIC ::    niso,   ntiso,   nzone,   nphas            !--- Number of   "   "
     36   PUBLIC :: itZonIso                                      !--- index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx)
     37   PUBLIC :: iqIsoPha                                      !--- index "iq" in "qx"              = f(isotope idx,   phase idx)
     38   PUBLIC :: iqWIsoPha                                     !--- Same as iqIsoPha but with normal water phases
    3839   PUBLIC :: isoCheck                                      !--- Run isotopes checking routines
    3940   !=== FOR BOTH TRACERS AND ISOTOPES
     
    4344!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
    4445!  | water in different |    water tagging      |  water isotopes | other tracers | additional tracers moments |
    45 !  | phases: H2O_[gls|      isotopes         |                 |               |  for higher order schemes  |
     46!  | phases: H2O_[glsrb]|      isotopes         |                 |               |  for higher order schemes  |
    4647!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
    4748!  |                    |                       |                 |               |                            |
     
    5758!  |-----------------------------------------------------------------------------------------------------------|
    5859!  NOTES FOR THIS TABLE:
    59 !  * Used "niso", "nzone" and "ntiso" are components of "isotopes(ip)" for water (isotopes(ip)%parent == 'H2O'),
     60!  * Used "niso", "nzone" and "ntiso" are components of "isotopes(ip)" for water (isotopes(ip)%name == 'H2O'),
    6061!    since water is so far the sole tracers family, except passive CO2, removed from the main tracers table.
    6162!  * For water, "nqo" is equal to the more general field "isotopes(ip)%nphas".
    6263!  * "niso", "nzone", "ntiso", "nphas" are defined for other isotopic tracers families, if any.
     64!  * If you deal with an isotopes family other than "H2O" ("Sulf" in the example), a good practice is to keep
     65!    track of the isotopes class (of its index) before switching to it at the beginning of the dedicated code:
     66!  - first time (use selection by name and compute the corresponding index iSulf) :
     67!  i0=ixIso; IF(.NOT.isoSelect('Sulf')) CALL abort_physic("Can't select isotopes class", modname, 1); iS=ixIso
     68!  - next times (use selection by index - "iS" has been computed at first call):
     69!  i0=ixIso; IF(.NOT.isoSelect(iS))     CALL abort_physic("Can't select isotopes class", modname, 1)
     70!    and to switch back to the original category when you're done with "Sulf":
     71!            IF(.NOT.isoSelect(i0))     CALL abort_physic("Can't select isotopes class", modname, 1)
     72!    to restore the original isotopes category (before dealing with "Sulf" (most of the time "H2O").
    6373!
    6474!=== DERIVED TYPE EMBEDDING MOST OF THE TRACERS-RELATED QUANTITIES (LENGTH: nqtot)
     
    6878!  |-------------+------------------------------------------------------+-------------+------------------------+
    6979!  | name        | Name (short)                                         | tname       |                        |
     80!  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
    7081!  | gen0Name    | Name of the 1st generation ancestor                  | /           |                        |
    7182!  | parent      | Name of the parent                                   | /           |                        |
    7283!  | longName    | Long name (with adv. scheme suffix) for outputs      | ttext       |                        |
    7384!  | type        | Type (so far: tracer or tag)                         | /           | tracer,tag             |
    74 !  | phase       | Phases list ("g"as / "l"iquid / "s"olid)             | /           | [g][l][s]              |
     85!  | phase       | Phases list ("g"as / "l"iquid / "s"olid              |             | [g|l|s|r|b]            |
     86!  |             |              "r"(cloud) / "b"lowing)                 | /           |                        |
    7587!  | component   | Name(s) of the merged/cumulated section(s)           | /           | coma-separated names   |
    7688!  | iGeneration | Generation (>=1)                                     | /           |                        |
     
    7991!  | nqDescen    | Number of the descendants   (all generations)        | nqdesc      | 1:nqtot                |
    8092!  | nqChildren  | Number of childs            (1st generation only)    | nqfils      | 1:nqtot                |
    81 !  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
    82 !  | isAdvected  | advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
    83 !  | isInPhysics | tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
     93!  | isAdvected  | Advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
     94!  | isInPhysics | Tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
    8495!  | iso_iGroup  | Isotopes group index in isotopes(:)                  | /           | 1:nbIso                |
    8596!  | iso_iName   | Isotope  name  index in isotopes(iso_iGroup)%trac(:) | iso_indnum  | 1:niso                 |
     
    93104!  |  entry | length | Meaning                                          |    Former name     | Possible values |
    94105!  |-----------------+--------------------------------------------------+--------------------+-----------------+
    95 !  | parent          | Parent tracer (isotopes family name)             |                    |                 |
     106!  | name            | Name of the isotopes class (family)              |                    |                 |
    96107!  | keys   | niso   | Isotopes keys/values pairs list + number         |                    |                 |
    97108!  | trac   | ntiso  | Isotopes + tagging tracers list + number         | / | ntraciso       |                 |
    98109!  | zone   | nzone  | Geographic tagging zones   list + number         | / | ntraceurs_zone |                 |
    99 !  | phase  | nphas  | Phases                     list + number         |                    | [g][l][s], 1:3 |
     110!  | phase  | nphas  | Phases                     list + number         |                    | [g|l|s|r|b] 1:5 |
    100111!  | iqIsoPha        | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
    101 !  | iqWIsoPha       | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
     112!  | iqWIsoPha       | Index in "qx"       = f(name(1:ntiso+nqo)),phas) |   ?                | 1:nqtot         |
    102113!  | itZonIso        | Index in "trac(1:ntiso)"= f(zone, name(1:niso))  | index_trac         | 1:ntiso         |
    103114!  +-----------------+--------------------------------------------------+--------------------+-----------------+
    104115
     116!------------------------------------------------------------------------------------------------------------------------------
     117   TYPE :: trac_type                                            !=== TYPE FOR A SINGLE TRACER NAMED "name"
     118     CHARACTER(LEN=maxlen) :: name        = ''                  !--- Name of the tracer
     119     TYPE(keys_type)       :: keys                              !--- <key>=<val> pairs vector (general container)
     120     CHARACTER(LEN=maxlen) :: gen0Name    = ''                  !--- First generation ancestor name
     121     CHARACTER(LEN=maxlen) :: parent      = ''                  !--- Parent name
     122     CHARACTER(LEN=maxlen) :: longName    = ''                  !--- Long name (with advection scheme suffix)
     123     CHARACTER(LEN=maxlen) :: type        = 'tracer'            !--- Type  (so far: 'tracer' / 'tag')
     124     CHARACTER(LEN=maxlen) :: phase       = 'g'                 !--- Phase ('g'as / 'l'iquid / 's'olid)
     125     CHARACTER(LEN=maxlen) :: component   = ''                  !--- Coma-separated list of components (Ex: lmdz,inca)
     126     INTEGER               :: iGeneration = -1                  !--- Generation number (>=0)
     127     INTEGER               :: iqParent    = 0                   !--- Parent index
     128     INTEGER,  ALLOCATABLE :: iqDescen(:)                       !--- Descendants index (in growing generation order)
     129     INTEGER               :: nqDescen    = 0                   !--- Number of descendants (all generations)
     130     INTEGER               :: nqChildren  = 0                   !--- Number of children  (first generation)
     131     LOGICAL               :: isAdvected  = .FALSE.             !--- "true" tracers: iadv > 0.   COUNT(isAdvected )=nqtrue
     132     LOGICAL               :: isInPhysics = .TRUE.              !--- "true" tracers: in tr_seri. COUNT(isInPhysics)=nqtottr
     133     INTEGER               :: iso_iGroup  = 0                   !--- Isotopes group index in isotopes(:)
     134     INTEGER               :: iso_iName   = 0                   !--- Isotope  name  index in isotopes(iso_iGroup)%trac(:)
     135     INTEGER               :: iso_iZone   = 0                   !--- Isotope  zone  index in isotopes(iso_iGroup)%zone(:)
     136     INTEGER               :: iso_iPhase  = 0                   !--- Isotope  phase index in isotopes(iso_iGroup)%phase
     137   END TYPE trac_type
     138!------------------------------------------------------------------------------------------------------------------------------
     139  TYPE :: isot_type                                             !=== TYPE FOR THE ISOTOPES FAMILY DESCENDING ON TRACER "name"
     140    CHARACTER(LEN=maxlen)              :: name                  !--- Isotopes family name (ex: H2O)
     141    TYPE(keys_type),       ALLOCATABLE :: keys(:)               !--- Isotopes keys/values pairs list     (length: niso)
     142    LOGICAL                            :: check=.FALSE.         !--- Flag for checking routines triggering
     143    CHARACTER(LEN=maxlen), ALLOCATABLE :: trac(:)               !--- Isotopes + tagging tracers list     (length: ntiso)
     144    CHARACTER(LEN=maxlen), ALLOCATABLE :: zone(:)               !--- Geographic tagging zones names list (length: nzone)
     145    CHARACTER(LEN=maxlen)              :: phase = 'g'           !--- Phases list: [g|l|s|r|b]            (length: nphas)
     146    INTEGER                            :: niso  = 0             !--- Number of isotopes, excluding tagging tracers
     147    INTEGER                            :: ntiso = 0             !--- Number of isotopes, including tagging tracers
     148    INTEGER                            :: nzone = 0             !--- Number of geographic tagging zones
     149    INTEGER                            :: nphas = 0             !--- Number of phases
     150    INTEGER,               ALLOCATABLE :: iqIsoPha(:,:)         !--- Idx in "tracers(1:nqtot)" = f(     name(1:ntiso) ,phas)
     151    INTEGER,               ALLOCATABLE :: iqWIsoPha(:,:)        !--- Idx in "tracers(1:nqtot)" = f([H2O,name(1:ntiso)],phas)
     152    INTEGER,               ALLOCATABLE :: itZonIso(:,:)         !--- Idx in "trac(1:ntiso)"    = f(zone,name(1:niso))
     153  END TYPE isot_type
     154!------------------------------------------------------------------------------------------------------------------------------
     155  INTERFACE isoSelect; MODULE PROCEDURE isoSelectByIndex, isoSelectByName; END INTERFACE isoSelect
     156!------------------------------------------------------------------------------------------------------------------------------
     157
     158   !=== INDICES FOR WATER
     159   INTEGER, SAVE :: ivap, iliq, isol
     160!$OMP THREADPRIVATE(ivap, iliq, isol)
     161
    105162   !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
    106    INTEGER,               SAVE :: nqtot,  &                     !--- Tracers nb in dynamics (incl. higher moments + H2O)
    107                                   nbtr,   &                     !--- Tracers nb in physics  (excl. higher moments + H2O)
    108                                   nqo,    &                     !--- Number of water phases
     163   INTEGER,               SAVE :: nqtot,   &                    !--- Tracers nb in dynamics (incl. higher moments + H2O)
     164                                  nbtr,    &                    !--- Tracers nb in physics  (excl. higher moments + H2O)
     165                                  nqo,     &                    !--- Number of water phases
    109166                                  nqtottr, &                    !--- Number of tracers passed to phytrac (TO BE DELETED ?)
    110167                                  nqCO2                         !--- Number of tracers of CO2  (ThL)
     
    112169!$OMP THREADPRIVATE(nqtot, nbtr, nqo, nqtottr, nqCO2, type_trac)
    113170
    114    !=== INDICES OF WATER
    115    INTEGER,               SAVE :: ivap,iliq,isol ! Indices for vap, liq and ice
    116 !$OMP THREADPRIVATE(ivap,iliq,isol)
     171   !=== NUMBER AND LIST OF DEFINED ISOTOPES FAMILIES
     172   INTEGER,               SAVE              :: nbIso            !--- Number of defined isotopes classes
     173   CHARACTER(LEN=maxlen), SAVE, ALLOCATABLE :: isoFamilies(:)   !--- Generation 0 tracer name for each isotopes family (nbIso)
     174!$OMP THREADPRIVATE(isoFamilies)
     175
     176   !=== QUANTITIES RELATED TO THE CURRENTLY SELECTED ISOTOPES CLASS (USUALLY H2O)
     177   TYPE(isot_type),       SAVE, POINTER :: isotope              !--- Selected isotopes database (=isotopes(ixIso))
     178   TYPE(keys_type),       SAVE, POINTER :: isoKeys(:)           !--- Database to get isotopes keys using "getKey"       (niso)
     179   CHARACTER(LEN=maxlen), SAVE, POINTER :: isoName(:),      &   !--- Isotopes list including tagging tracers, no phase (ntiso)
     180                                           isoZone(:),      &   !--- Geographic tagging zones list                     (nzone)
     181                                           isoPhas              !--- Used phases names ([g|l|s|r|b])                   (nphas)
     182   INTEGER,               SAVE, POINTER :: itZonIso(:,:),   &   !--- Idx "it" in isoName(1:niso) = f(tagging idx, isotope idx)
     183                                           iqIsoPha(:,:),   &   !--- Idx "iq" in qx              = f(isotope idx,   phase idx)
     184                                           iqWIsoPha(:,:)       !--- Idx "iq" in qx = f([parent trac,isotope idx],  phase idx)
     185   INTEGER,               SAVE          :: ixIso,           &   !--- Idx in "isoFamilies" of currently selectd class
     186                                           niso,            &   !--- Number of isotopes
     187                                           ntiso,           &   !--- Number of isotopes + tagging tracers
     188                                           nzone,           &   !--- Number of tagging zones
     189                                           nphas                !--- Number of phases
     190   LOGICAL,               SAVE          :: isoCheck             !--- Isotopes checking routines triggering flag
     191!$OMP THREADPRIVATE(isotope, isoKeys, isoName, isoZone, isoPhas, itZonIso, iqIsoPha, iqWIsoPha, niso, ntiso, nzone, nphas, isoCheck)
    117192
    118193   !=== VARIABLES FOR INCA
    119    INTEGER,               SAVE, ALLOCATABLE :: conv_flg(:), &   !--- Convection     activation ; needed for INCA        (nbtr)
    120                                                 pbl_flg(:)      !--- Boundary layer activation ; needed for INCA        (nbtr)
     194   INTEGER, DIMENSION(:), SAVE, ALLOCATABLE :: &
     195                    conv_flg, pbl_flg                           !--- Convection / boundary layer activation (nbtr)
    121196!$OMP THREADPRIVATE(conv_flg, pbl_flg)
    122197
    123 #ifdef CPP_StratAer
     198   !=== TRACERS/ISOTOPES DESCRIPTORS: EFFECTIVE STORAGE (LOCAL DERIVED TYPES)
     199   TYPE(trac_type), SAVE, ALLOCATABLE, TARGET ::  tracers(:)
     200   TYPE(isot_type), SAVE, ALLOCATABLE, TARGET :: isotopes(:)
     201!$OMP THREADPRIVATE(tracers, isotopes)
     202
     203#if defined CPP_StratAer || defined REPROBUS
    124204  !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB)
    125205  INTEGER, SAVE ::  nbtr_bin, nbtr_sulgas         !--- number of aerosols bins and sulfur gases for StratAer model
     
    133213SUBROUTINE init_infotrac_phy
    134214   USE ioipsl_getin_p_mod, ONLY: getin_p
     215   USE mod_phys_lmdz_para, ONLY: is_master, is_omp_master
    135216#ifdef REPROBUS
    136217   USE CHEM_REP, ONLY: Init_chem_rep_trac
     
    161242!------------------------------------------------------------------------------------------------------------------------------
    162243! Local variables
    163    INTEGER, ALLOCATABLE :: hadv(:), vadv(:)                          !--- Horizontal/vertical transport scheme number
     244   INTEGER, ALLOCATABLE :: hadv(:), vadv(:), itmp(:)                 !--- Horizontal/vertical transport scheme number
    164245#ifdef INCA
    165246   INTEGER, ALLOCATABLE :: had (:), hadv_inca(:), conv_flg_inca(:), &!--- Variables specific to INCA
     
    173254   CHARACTER(LEN=2)      ::   suff(9)                                !--- Suffixes for schemes of order 3 or 4 (Prather)
    174255   CHARACTER(LEN=3)      :: descrq(30)                               !--- Advection scheme description tags
    175    CHARACTER(LEN=maxlen) :: msg1, texp, ttp                          !--- String for messages and expanded tracers type
     256   CHARACTER(LEN=maxlen) :: msg1, texp, ttp, ky                      !--- Strings for messages and expanded tracers type
    176257   INTEGER :: fType                                                  !--- Tracers description file type ; 0: none
    177258                                                                     !--- 1/2/3: "traceur.def"/"tracer.def"/"tracer_*.def"
    178259   INTEGER :: nqtrue                                                 !--- Tracers nb from tracer.def (no higher order moments)
    179260   INTEGER :: iad                                                    !--- Advection scheme number
    180    INTEGER :: iq, jq, nt, im, nm, k                                 !--- Indexes and temporary variables
     261   INTEGER :: iq, jq, it, nt, im, nm                                 !--- Indexes and temporary variables
    181262   LOGICAL :: lerr, lInit
     263   TYPE(keys_type), ALLOCATABLE, TARGET :: tra(:)                    !--- Tracers  descriptor as in readTracFiles_mod
     264   TYPE(tisot),     ALLOCATABLE         :: iso(:)                    !--- Isotopes descriptor as in readTracFiles_mod
    182265   TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:)
    183    TYPE(trac_type), POINTER             :: t1, t(:)
    184    CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)  !--- Keyword for tracers type(s), parsed version
    185    
     266   TYPE(trac_type), POINTER             :: t(:), t1
     267   TYPE(keys_type), POINTER             :: k(:)
     268   CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)             !--- Keywords for tracers type(s), parsed version
    186269   CHARACTER(LEN=*), PARAMETER :: modname="init_infotrac_phy"
    187270!------------------------------------------------------------------------------------------------------------------------------
     
    195278
    196279   CALL getin_p('type_trac',type_trac)
    197 
    198    lerr=strParse(type_trac, '|', types_trac, n=nt)
    199    IF (nt .GT. 1) THEN
    200       IF (nt .GT. 2) CALL abort_physic(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
    201       IF (nt .EQ. 2) type_trac=types_trac(2)
    202    ENDIF
    203 
    204    
    205    CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
    206    lInit = .NOT.ALLOCATED(tracers)
     280   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname, is_master)
     281   IF(strCount(type_trac, '|', nt)) CALL abort_physic(modname, 'Could''nt parse the "type_trac" string with delimiter "|"', 1)
     282   IF(nt >= 3) CALL abort_physic(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
     283   IF(strParse(type_trac, '|', types_trac, n=nt)) CALL abort_physic(modname, "couldn't parse "//'"type_trac"', 1)
     284   IF(nt == 2) type_trac = types_trac(2) ! TO BE DELETED SOON
     285
     286   lInit = .NOT.ALLOCATED(trac)
    207287
    208288!##############################################################################################################################
    209    IF(lInit) THEN                                                    !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
     289   IF(lInit .AND. is_master) THEN                                    !=== SKIPED IF ALREADY DONE
    210290!##############################################################################################################################
    211291   !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION
     
    240320!##############################################################################################################################
    241321
    242    nqCO2 = COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
    243 
    244 !==============================================================================================================================
    245 ! 1) Get the numbers of: true (first order only) tracers "nqtrue", water tracers "nqo" (vapor/liquid/solid)
    246 !==============================================================================================================================
    247    texp = type_trac                                                  !=== EXPANDED VERSION OF "type_trac", WITH "|" SEPARATOR
     322!==============================================================================================================================
     323! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT ; TRANSFER THE NEEDED QUANTITIES TO LOCAL "tracers".
     324!==============================================================================================================================
     325   texp = type_trac                                                            !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
    248326   IF(texp == 'inco') texp = 'co2i|inca'
    249327   IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp)
    250 
    251    !=== DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE
    252    IF(testTracersFiles(modname, texp, fType, lInit)) CALL abort_physic(modname, 'problem with tracers file(s)',1)
    253 
     328   IF(testTracersFiles(modname, texp, fType, lInit.AND.is_master)) CALL abort_physic(modname, 'problem with tracers file(s)',1)
    254329   ttp = type_trac; IF(fType /= 1) ttp = texp
     330   !---------------------------------------------------------------------------------------------------------------------------
     331   IF(fType == 0) CALL abort_physic(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
     332   !---------------------------------------------------------------------------------------------------------------------------
     333   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) &                   !=== FOUND OLD STYLE INCA "traceur.def"
     334      CALL abort_physic(modname, 'retro-compatibility with old-style INCA traceur.def files has been disabled.', 1)
     335   !---------------------------------------------------------------------------------------------------------------------------
    255336
    256337!##############################################################################################################################
    257    IF(lInit) THEN
    258       IF(readTracersFiles(ttp, lRepr=type_trac=='repr')) CALL abort_physic(modname, 'problem with tracers file(s)',1)
     338   IF(lInit .AND. is_omp_master) THEN
     339      IF(readTracersFiles(ttp, tra, type_trac == 'repr')) CALL abort_physic(modname, 'problem with tracers file(s)',1)
    259340   ELSE
    260       CALL msg('No tracers description file(s) reading needed: already done in the dynamics', modname)
    261    END IF
     341      tra = trac
     342   END IF
     343   CALL msg('No tracers description file(s) reading needed: already done', modname, .NOT.lInit.AND.is_master)
    262344!##############################################################################################################################
    263345
    264    !---------------------------------------------------------------------------------------------------------------------------
    265    IF(fType == 0) CALL abort_physic(modname, 'Missing tracers file: "traceur.def", "tracer.def" or "tracer_<keyword>.def file.',1)
    266    !---------------------------------------------------------------------------------------------------------------------------
    267    IF(fType == 1 .AND. ANY(['inca','inco']==type_trac) .AND. lInit) THEN  !=== FOUND OLD STYLE INCA "traceur.def"
    268    !---------------------------------------------------------------------------------------------------------------------------
     346   !--- POPULATE SOME EXPLICIT (ACCESSIBLE THROUGH "%") KEYS OF THE LOCAL TRACERS DESCRIPTION DERIVED TYPE
     347   !    To be defined: iqParent, iq/nqDescen, nqChildren (in indexUpdate), longName, iso_i*, isAdvected, isInPhysics (later)
     348   ALLOCATE(tracers(SIZE(tra)))
     349   DO iq = 1, SIZE(tra); t1 => tracers(iq)
     350      t1%keys = tra(iq)
     351      msg1 = '" for tracer nr. '//TRIM(int2str(iq))
     352      ky='name       '; IF(getKey(ky, t1%name,        iq, tra)) CALL abort_physic(modname, 'No key "'//TRIM(ky)//TRIM(msg1), 1)
     353      msg1 = '" for "'//TRIM(t1%name)//'"'
     354      ky='gen0Name   '; IF(getKey(ky, t1%gen0Name,    iq, tra)) CALL abort_physic(modname, 'No key "'//TRIM(ky)//TRIM(msg1), 1)
     355      ky='parent     '; IF(getKey(ky, t1%parent,      iq, tra)) CALL abort_physic(modname, 'No key "'//TRIM(ky)//TRIM(msg1), 1)
     356      ky='type       '; IF(getKey(ky, t1%type,        iq, tra)) CALL abort_physic(modname, 'No key "'//TRIM(ky)//TRIM(msg1), 1)
     357      ky='phase      '; IF(getKey(ky, t1%phase,       iq, tra)) CALL abort_physic(modname, 'No key "'//TRIM(ky)//TRIM(msg1), 1)
     358      ky='component  '; IF(getKey(ky, t1%component,   iq, tra)) CALL abort_physic(modname, 'No key "'//TRIM(ky)//TRIM(msg1), 1)
     359      ky='iGeneration'; IF(getKey(ky, t1%iGeneration, iq, tra)) CALL abort_physic(modname, 'No key "'//TRIM(ky)//TRIM(msg1), 1)
     360   END DO
     361
     362!==============================================================================================================================
     363! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
     364!==============================================================================================================================
     365   nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
     366   nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
     367   nbtr = nqtrue-COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O')     !--- Passed to phytrac
     368   nqCO2  =      COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
    269369#ifdef INCA
    270       nqo = SIZE(tracers) - nqCO2
    271       CALL Init_chem_inca_trac(nqINCA)                               !--- Get nqINCA from INCA
    272       nbtr = nqINCA + nqCO2                                          !--- Number of tracers passed to phytrac
    273       nqtrue = nbtr + nqo                                            !--- Total number of "true" tracers
    274       IF(ALL([2,3] /= nqo)) CALL abort_physic(modname, 'Only 2 or 3 water phases allowed ; found nqo='//TRIM(int2str(nqo)), 1)
    275       ALLOCATE(hadv(nqtrue), hadv_inca(nqINCA), conv_flg_inca(nqINCA), solsym_inca(nqINCA))
    276       ALLOCATE(vadv(nqtrue), vadv_inca(nqINCA),  pbl_flg_inca(nqINCA))
    277       CALL init_transport(solsym_inca, conv_flg_inca, pbl_flg_inca, hadv_inca, vadv_inca)
    278       ALLOCATE(ttr(nqtrue))
    279       ttr(1:nqo+nqCO2)                  = tracers
    280       ttr(1    :      nqo   )%component = 'lmdz'
    281       ttr(1+nqo:nqCO2+nqo   )%component = 'co2i'
    282       ttr(1+nqo+nqCO2:nqtrue)%component = 'inca'
    283       ttr(1+nqo      :nqtrue)%name      = [('CO2     ', k=1, nqCO2), solsym_inca]
    284       ttr(1+nqo+nqCO2:nqtrue)%parent    = tran0
    285       ttr(1+nqo+nqCO2:nqtrue)%phase     = 'g'
    286       lerr = getKey('hadv', had, ky=tracers(:)%keys)
    287       lerr = getKey('vadv', vad, ky=tracers(:)%keys)
    288       hadv(1:nqo+nqCO2) = had(:); hadv(1+nqo+nqCO2:nqtrue) = hadv_inca
    289       vadv(1:nqo+nqCO2) = vad(:); vadv(1+nqo+nqCO2:nqtrue) = vadv_inca
    290       CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
    291       DO iq = 1, nqtrue
    292          t1 => tracers(iq)
    293          CALL addKey('name',      t1%name,      t1%keys)
    294          CALL addKey('component', t1%component, t1%keys)
    295          CALL addKey('parent',    t1%parent,    t1%keys)
    296          CALL addKey('phase',     t1%phase,     t1%keys)
    297       END DO
    298       IF(setGeneration(tracers)) CALL abort_physic(modname,'See below',1) !- SET FIELDS %iGeneration, %gen0Name
    299       DEALLOCATE(had, hadv_inca, vad, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca)
    300 #endif
    301    !---------------------------------------------------------------------------------------------------------------------------
    302    ELSE                                                              !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE)
    303    !---------------------------------------------------------------------------------------------------------------------------
    304       nqo    =        COUNT(delPhase(tracers(:)%name)     == 'H2O' &
    305                                .AND. tracers(:)%component == 'lmdz') !--- Number of water phases
    306       nqtrue = SIZE(tracers)                                         !--- Total number of "true" tracers
    307       nbtr   = nqtrue-COUNT(delPhase(tracers(:)%gen0Name) == 'H2O' &
    308                                .AND. tracers(:)%component == 'lmdz') !--- Number of tracers passed to phytrac
    309 #ifdef INCA
    310       nqINCA = COUNT(tracers(:)%component == 'inca')
    311 #endif
    312       lerr = getKey('hadv', hadv, ky=tracers(:)%keys)
    313       lerr = getKey('vadv', vadv, ky=tracers(:)%keys)
    314    !---------------------------------------------------------------------------------------------------------------------------
    315    END IF
    316    !---------------------------------------------------------------------------------------------------------------------------
    317 
    318    !--- Transfert the number of tracers to Reprobus
     370   nqINCA =      COUNT(tracers(:)%component == 'inca')
     371#endif
    319372#ifdef REPROBUS
    320    CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
    321 #endif
    322 
    323 !##############################################################################################################################
    324    IF(lInit) THEN                                                    !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
    325 !##############################################################################################################################
     373   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)                         !--- Transfert the number of tracers to Reprobus
     374#endif
    326375
    327376!==============================================================================================================================
    328377! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
    329378!==============================================================================================================================
     379   IF(getKey('hadv', hadv, ky=tra)) CALL abort_physic(modname, 'missing key "hadv"', 1)
     380   IF(getKey('vadv', vadv, ky=tra)) CALL abort_physic(modname, 'missing key "vadv"', 1)
    330381   DO iq = 1, nqtrue
    331382      IF( hadv(iq)<20 .OR. (ANY(hadv(iq)==[20,30]) .AND. hadv(iq)==vadv(iq)) ) CYCLE
     
    348399!==============================================================================================================================
    349400   ALLOCATE(ttr(nqtot))
    350    jq = nqtrue+1; tracers(:)%iadv = -1
     401   jq = nqtrue+1
    351402   DO iq = 1, nqtrue
    352403      t1 => tracers(iq)
     
    359410      IF(iad == -1) CALL abort_physic(modname, msg1, 1)
    360411
    361       !--- SET FIELDS %longName, %isAdvected, %isInPhysics
     412      !--- SET FIELDS longName, isAdvected, isInPhysics
    362413      t1%longName   = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad)
    363414      t1%isAdvected = iad >= 0
    364       t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' &
    365                           .OR. t1%component /= 'lmdz' !=== OTHER EXCEPTIONS TO BE ADDED: CO2i, SURSATURATED WATER CLOUD...
     415      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O
    366416      ttr(iq)       = t1
    367417
     
    372422      IF(nm == 0) CYCLE                                              !--- No higher moments
    373423      ttr(jq+1:jq+nm)             = t1
    374       ttr(jq+1:jq+nm)%name        = [(TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
    375       ttr(jq+1:jq+nm)%parent      = [(TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
    376       ttr(jq+1:jq+nm)%longName    = [(TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
    377       ttr(jq+1:jq+nm)%isAdvected  = [(.FALSE., im=1, nm) ]
     424      ttr(jq+1:jq+nm)%name        = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
     425      ttr(jq+1:jq+nm)%gen0Name    = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
     426      ttr(jq+1:jq+nm)%parent      = [ (TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
     427      ttr(jq+1:jq+nm)%longName    = [ (TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
     428      ttr(jq+1:jq+nm)%isAdvected  = [ (.FALSE., im=1, nm) ]
     429      ttr(jq+1:jq+nm)%isInPhysics = [ (.FALSE., im=1, nm) ]
    378430      jq = jq + nm
    379431   END DO
     
    381433   CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
    382434
    383    !--- SET FIELDS %iqParent, %nqChildren, %iGeneration, %iqDescen, %nqDescen
    384    IF(indexUpdate(tracers)) CALL abort_gcm(modname, 'problem when processing isotopes parameters', 1)
    385 
    386 !##############################################################################################################################
    387    END IF
    388 !##############################################################################################################################
    389 
    390 !##############################################################################################################################
    391    IF(.NOT.lInit) THEN
    392 !##############################################################################################################################
    393      nqtot = SIZE(tracers)
    394 !##############################################################################################################################
    395    ELSE
    396 !##############################################################################################################################
    397 
    398    !=== READ PHYSICAL PARAMETERS FOR ISOTOPES
    399    niso = 0; nzone = 0; nphas = nqo; ntiso = 0; isoCheck = .FALSE.
    400    IF(processIsotopes()) CALL abort_physic(modname, 'Problem when processing isotopes parameters', 1)
    401 
    402 !##############################################################################################################################
    403    END IF
    404 !##############################################################################################################################
     435   !--- SET FIELDS iqParent, iqDescen, nqDescen, nqChildren
     436   IF(indexUpdate(tracers%keys)) CALL abort_physic(modname, 'problem with tracers indices update', 1)
     437   k => tracers(:)%keys
     438   DO iq = 1, SIZE(tracers); t1 => tracers(iq); msg1 = '" for "'//TRIM(t1%name)//'"'
     439      ky='iqParent  '; IF(getKey(ky, t1%iqParent,   iq, k)) CALL abort_physic(modname, 'missing key "'//TRIM(ky)//TRIM(msg1), 1)
     440      ky='iqDescen  '; IF(getKey(ky, t1%iqDescen,   iq, k)) CALL abort_physic(modname, 'missing key "'//TRIM(ky)//TRIM(msg1), 1)
     441      ky='nqDescen  '; IF(getKey(ky, t1%nqDescen,   iq, k)) CALL abort_physic(modname, 'missing key "'//TRIM(ky)//TRIM(msg1), 1)
     442      ky='nqChildren'; IF(getKey(ky, t1%nqChildren, iq, k)) CALL abort_physic(modname, 'missing key "'//TRIM(ky)//TRIM(msg1), 1)
     443   END DO
     444
     445   !=== DETERMINE ISOTOPES RELATED PARAMETERS ; DEFINE THE EXPLICIT KEYS iso_i*
     446   IF(processIsotopes(tracers%keys, iso)) CALL abort_physic(modname, 'problem while processing isotopes parameters', 1)
     447
     448   !--- POPULATE SOME EXPLICIT (ACCESSIBLE THROUGH "%") KEYS OF THE LOCAL ISOTOPES DESCRIPTION DERIVED TYPE
     449   nbIso = SIZE(iso)
     450   ALLOCATE(isotopes(nbIso))
     451   IF(nbIso /= 0) THEN
     452      k => tracers(:)%keys
     453      IF(getKey('iso_iGroup', itmp, ky=k)) CALL abort_physic(modname, 'missing key "iso_iGroup"', 1); tracers%iso_iGroup = itmp
     454      IF(getKey('iso_iName',  itmp, ky=k)) CALL abort_physic(modname, 'missing key "iso_iName"',  1); tracers%iso_iName  = itmp
     455      IF(getKey('iso_iZone',  itmp, ky=k)) CALL abort_physic(modname, 'missing key "iso_iZone"',  1); tracers%iso_iZone  = itmp
     456      IF(getKey('iso_iPhas',  itmp, ky=k)) CALL abort_physic(modname, 'missing key "iso_iPhas"',  1); tracers%iso_iPhase = itmp
     457      isotopes(:)%name  = iso(:)%name                           !--- Isotopes family name (ex: H2O)
     458      isotopes(:)%phase = iso(:)%phase                          !--- Phases list: [g][l][s]              (length: nphas)
     459      isotopes(:)%niso  = iso(:)%niso                           !--- Number of isotopes, excluding tagging tracers
     460      isotopes(:)%ntiso = iso(:)%ntiso                          !--- Number of isotopes, including tagging tracers
     461      isotopes(:)%nzone = iso(:)%nzone                          !--- Number of geographic tagging zones
     462      isotopes(:)%nphas = iso(:)%nphas                          !--- Number of phases
     463      isotopes(:)%check = .FALSE.                               !--- Flag for checking routines triggering
     464      CALL getin_p('ok_iso_verif', isotopes(:)%check)
     465      DO it = 1, nbIso
     466         isotopes(it)%keys     = iso(it)%keys                   !--- Isotopes keys/values pairs list     (length: niso)
     467         isotopes(it)%trac     = iso(it)%trac                   !--- Isotopes + tagging tracers list     (length: ntiso)
     468         isotopes(it)%zone     = iso(it)%zone                   !--- Geographic tagging zones names list (length: nzone)
     469         isotopes(it)%iqIsoPha = iso(it)%iqIsoPha(:,:)          !--- Idx in "tracers(1:nqtot)" = f(name(1:ntiso)),phas)
     470         isotopes(it)%iqWIsoPha= iso(it)%iqWIsoPha(:,:)         !--- Idx in "tracers(1:nqtot)" = f([trPrnt,name(1:ntiso)],phas)
     471         isotopes(it)%itZonIso = iso(it)%itZonIso(:,:)          !--- Idx in "tracers(1:ntiso)" = f(  zone,name(1:niso))
     472      END DO
     473      IF(isoSelect(1, .TRUE.)) CALL abort_physic(modname, "Can't select the first isotopes family", 1)
     474      IF(.NOT.isoSelect('H2O', .TRUE.)) iH2O = ixIso
     475   END IF
     476   isoFamilies = isotopes(:)%name
     477
    405478   !--- Convection / boundary layer activation for all tracers
    406    IF (.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
    407    IF (.NOT.ALLOCATED(pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
     479   IF(.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
     480   IF(.NOT.ALLOCATED( pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
    408481
    409482   !--- Note: nqtottr can differ from nbtr when nmom/=0
     
    413486
    414487   !=== DISPLAY THE RESULTS
     488   IF(.NOT.is_master) RETURN
    415489   CALL msg('nqo    = '//TRIM(int2str(nqo)),    modname)
    416490   CALL msg('nbtr   = '//TRIM(int2str(nbtr)),   modname)
     
    424498#endif
    425499   t => tracers
    426    CALL msg('Information stored in infotrac_phy :', modname)
    427    IF(dispTable('issssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',      &
    428                               'isPh', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],     &
    429       cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component, bool2str(t%isInPhysics)),&
     500   CALL msg('Information stored in '//TRIM(modname)//': ', modname)
     501   IF(dispTable('isssssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',     &
     502                       'isPh', 'isAd', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],    &
     503      cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component,                          &
     504                                                         bool2str(t%isInPhysics), bool2str(t%isAdvected)), &
    430505      cat([(iq, iq=1, nqtot)], t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup,          &
    431506                  t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
    432507      CALL abort_physic(modname, "problem with the tracers table content", 1)
    433    IF(niso > 0) THEN
    434       CALL msg('Where, for isotopes family "'//TRIM(isotope%parent)//'":', modname)
    435       CALL msg('  isoKeys%name = '//strStack(isoKeys%name), modname)
    436       CALL msg('  isoName = '//strStack(isoName),      modname)
    437       CALL msg('  isoZone = '//strStack(isoZone),      modname)
    438       CALL msg('  isoPhas = '//TRIM(isoPhas),          modname)
    439    ELSE
    440       CALL msg('No isotopes identified.', modname)
    441    END IF
    442 
    443 #ifdef ISOVERIF
    444    CALL msg('iso_iName = '//strStack(int2str(PACK(tracers(:)%iso_iName, MASK=tracers(:)%iso_iGroup==iH2O))), modname)
    445 #endif
    446508#ifdef CPP_StratAer
    447509   IF (type_trac == 'coag') THEN
     
    463525   END IF
    464526#endif
    465    CALL msg('end', modname)
     527   CALL msg('No isotopes identified.', modname, nbIso == 0)
     528   IF(nbIso == 0) RETURN
     529   DO it = 1, nbIso
     530      IF(isoSelect(it, .TRUE.)) CALL abort_physic(modname, 'Problem when selecting isotopes class', 1)
     531      CALL msg('For isotopes family "'//TRIM(isoFamilies(it))//'":', modname)
     532      CALL msg('  isoName = '//strStack(isotope%trac),  modname)
     533      CALL msg('  isoZone = '//strStack(isotope%zone),  modname)
     534      CALL msg('  isoPhas = '//    TRIM(isotope%phase), modname)
     535   END DO
     536   IF(isoSelect('H2O', .TRUE.)) THEN
     537      IF(isoSelect(1,  .TRUE.)) CALL abort_physic(modname, 'Problem when selecting isotopes class', 1)
     538   ELSE
     539      iH2O = ixIso
     540   END IF
     541   IF(ALLOCATED(isotope%keys(ixIso)%key)) &
     542      CALL msg('  isoKeys('//TRIM(int2str(ixIso))//') = '//TRIM(strStack(isotope%keys(ixIso)%key)), modname)
     543#ifdef ISOVERIF
     544   CALL msg('iso_iName(H2O) = '//TRIM(strStack(int2str(PACK(tracers%iso_iName, MASK=tracers%iso_iGroup==iH2O)))),modname)
     545#endif
    466546
    467547END SUBROUTINE init_infotrac_phy
    468548
     549!==============================================================================================================================
     550LOGICAL FUNCTION isoSelectByName(iClass, lVerbose) RESULT(lerr)
     551   IMPLICIT NONE
     552   CHARACTER(LEN=*),  INTENT(IN) :: iClass
     553   LOGICAL, OPTIONAL, INTENT(IN) :: lVerbose
     554   INTEGER :: iIso
     555   LOGICAL :: lV
     556   lV = .FALSE.; IF(PRESENT(lVerbose)) lV = lVerbose
     557   iIso = strIdx(isotopes(:)%name, iClass)
     558   lerr = iIso == 0
     559   IF(lerr) THEN
     560      niso = 0; ntiso = 0; nzone = 0; nphas = 0; isoCheck=.FALSE.
     561      CALL msg('no isotope family named "'//TRIM(iClass)//'"', ll=lV)
     562      RETURN
     563   END IF
     564   lerr = isoSelectByIndex(iIso, lV)
     565END FUNCTION isoSelectByName
     566!==============================================================================================================================
     567LOGICAL FUNCTION isoSelectByIndex(iIso, lVerbose) RESULT(lerr)
     568   IMPLICIT NONE
     569   INTEGER,           INTENT(IN) :: iIso
     570   LOGICAL, OPTIONAL, INTENT(IN) :: lVerbose
     571   LOGICAL :: lV
     572   lV = .FALSE.;  IF(PRESENT(lVerbose)) lV = lVerbose
     573   lerr = .FALSE.
     574   IF(iIso == ixIso) RETURN                                          !--- Nothing to do if the index is already OK
     575   lerr = iIso<=0 .OR. iIso>SIZE(isotopes)
     576   CALL msg('Inconsistent isotopes family index '//TRIM(int2str(iIso))//': should be > 0 and <= '&
     577          //TRIM(int2str(SIZE(isotopes)))//'"', ll = lerr .AND. lV)
     578   IF(lerr) RETURN
     579   ixIso = iIso                                                      !--- Update currently selected family index
     580   isotope  => isotopes(ixIso)                                       !--- Select corresponding component
     581   isoKeys  => isotope%keys;     niso     = isotope%niso
     582   isoName  => isotope%trac;     ntiso    = isotope%ntiso
     583   isoZone  => isotope%zone;     nzone    = isotope%nzone
     584   isoPhas  => isotope%phase;    nphas    = isotope%nphas
     585   itZonIso => isotope%itZonIso; isoCheck = isotope%check
     586   iqIsoPha => isotope%iqIsoPha
     587   iqWIsoPha=> isotope%iqWIsoPha
     588END FUNCTION isoSelectByIndex
     589!==============================================================================================================================
     590
    469591END MODULE infotrac_phy
  • LMDZ6/trunk/libf/phylmd/phyetat0_mod.F90

    r5084 r5183  
    3232  USE geometry_mod,     ONLY: longitude_deg, latitude_deg
    3333  USE iostart,          ONLY: close_startphy, get_field, get_var, open_startphy
    34   USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers
    35   USE readTracFiles_mod,ONLY: maxlen, new2oldH2O
     34  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers, new2oldH2O
     35  USE strings_mod,      ONLY: maxlen
    3636  USE traclmdz_mod,     ONLY: traclmdz_from_restart
    3737  USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl, carbon_cycle_tr, carbon_cycle_rad, co2_send, RCO2_glo
  • LMDZ6/trunk/libf/phylmd/physiq_mod.F90

    r5169 r5183  
    3939    USE ioipsl_getin_p_mod, ONLY : getin_p
    4040    USE indice_sol_mod
    41     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac
    42     USE readTracFiles_mod, ONLY: addPhase
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, addPhase
    4342    USE strings_mod,  ONLY: strIdx
    4443    USE iophy
Note: See TracChangeset for help on using the changeset viewer.