[4325] | 1 | !$Id: infotrac.F90 4301 2022-10-20 11:57:21Z dcugnet $ |
---|
[5099] | 2 | |
---|
[2320] | 3 | MODULE infotrac_phy |
---|
| 4 | |
---|
[5230] | 5 | USE lmdz_strings, ONLY: msg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strCount, strIdx |
---|
| 6 | USE lmdz_readTracFiles, ONLY: readTracersFiles, maxTableWidth, isot_type, addPhase, addKey, iH2O, & |
---|
| 7 | indexUpdate, trac_type, testTracersFiles, processIsotopes, tracers, delPhase, getKey, tran0, & |
---|
| 8 | isoKeys, isoName, isoZone, isoPhas, isoSelect, itZonIso, nbIso, isotope, & |
---|
| 9 | niso, ntiso, nzone, nphas, iqWIsoPha, iqIsoPha, ixIso, isoCheck, new2oldH2O |
---|
[5098] | 10 | IMPLICIT NONE |
---|
[4046] | 11 | |
---|
[5098] | 12 | PRIVATE |
---|
[2320] | 13 | |
---|
[5098] | 14 | !=== FOR TRACERS: |
---|
| 15 | PUBLIC :: init_infotrac_phy !--- Initialization of the tracers |
---|
| 16 | PUBLIC :: tracers, type_trac !--- Full tracers database, tracers type keyword |
---|
| 17 | PUBLIC :: nqtot, nbtr, nqo, nqCO2, nqtottr !--- Main dimensions |
---|
| 18 | PUBLIC :: conv_flg, pbl_flg !--- Convection & boundary layer activation keys |
---|
[5221] | 19 | PUBLIC :: new2oldH2O !--- For backwards compatibility in phyetat0 |
---|
[5230] | 20 | PUBLIC :: addPhase, delPhase !--- Add/remove the phase from the name of a tracer |
---|
[5098] | 21 | PUBLIC :: nbtr_bin, nbtr_sulgas !--- Number of aerosols bins and sulfur gases for StratAer model |
---|
| 22 | PUBLIC :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat |
---|
[2320] | 23 | |
---|
[5221] | 24 | !=== FOR ISOTOPES: General |
---|
[5098] | 25 | PUBLIC :: isot_type, nbIso !--- Derived type, full isotopes families database + nb of families |
---|
| 26 | PUBLIC :: isoSelect, ixIso !--- Isotopes family selection tool + selected family index |
---|
| 27 | !=== FOR ISOTOPES: Specific to water |
---|
[5221] | 28 | PUBLIC :: iH2O !--- Value of "ixIso" for "H2O" isotopes class |
---|
[5230] | 29 | PUBLIC :: ivap, iliq, isol |
---|
[5098] | 30 | !=== FOR ISOTOPES: Depending on the selected isotopes family |
---|
[5221] | 31 | PUBLIC :: isotope !--- Selected isotopes database (argument of getKey) |
---|
| 32 | PUBLIC :: isoKeys, isoName, isoZone, isoPhas !--- Isotopes keys & names, tagging zones names, phases |
---|
[5230] | 33 | PUBLIC :: niso, ntiso, nzone, nphas!--- Number of " " |
---|
[5221] | 34 | PUBLIC :: itZonIso !--- Index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx) |
---|
| 35 | PUBLIC :: iqIsoPha !--- Index "iq" in "qx" = f(isotope idx, phase idx) |
---|
[5098] | 36 | PUBLIC :: iqWIsoPha !--- Same as iqIsoPha but with normal water phases |
---|
[4984] | 37 | |
---|
[5098] | 38 | PUBLIC :: isoCheck !--- Run isotopes checking routines |
---|
| 39 | !=== FOR BOTH TRACERS AND ISOTOPES |
---|
| 40 | PUBLIC :: getKey !--- Get a key from "tracers" or "isotope" |
---|
[2320] | 41 | |
---|
[5098] | 42 | !=== CONVENTIONS FOR TRACERS NUMBERS: |
---|
| 43 | ! |--------------------+-----------------------+-----------------+---------------+----------------------------| |
---|
| 44 | ! | water in different | water tagging | water isotopes | other tracers | additional tracers moments | |
---|
[5221] | 45 | ! | phases: H2O_[glsrb] | isotopes | | | for higher order schemes | |
---|
[5098] | 46 | ! |--------------------+-----------------------+-----------------+---------------+----------------------------| |
---|
| 47 | ! | | | | | | |
---|
| 48 | ! |<-- nqo -->|<-- nqo*niso* nzone -->|<-- nqo*niso -->|<-- nbtr -->|<-- (nmom) -->| |
---|
| 49 | ! | | | | |
---|
| 50 | ! | |<-- nqo*niso*(nzone+1) = nqo*ntiso -->|<-- nqtottr = nbtr + nmom -->| |
---|
| 51 | ! | = nqtot - nqo*(ntiso+1) | |
---|
| 52 | ! | | |
---|
| 53 | ! |<-- nqtrue = nbtr + nqo*(ntiso+1) -->| | |
---|
| 54 | ! | | |
---|
| 55 | ! |<-- nqtot = nqtrue + nmom -->| |
---|
| 56 | ! | | |
---|
| 57 | ! |-----------------------------------------------------------------------------------------------------------| |
---|
| 58 | ! NOTES FOR THIS TABLE: |
---|
| 59 | ! * Used "niso", "nzone" and "ntiso" are components of "isotopes(ip)" for water (isotopes(ip)%parent == 'H2O'), |
---|
| 60 | ! since water is so far the sole tracers family, except passive CO2, removed from the main tracers table. |
---|
| 61 | ! * For water, "nqo" is equal to the more general field "isotopes(ip)%nphas". |
---|
| 62 | ! * "niso", "nzone", "ntiso", "nphas" are defined for other isotopic tracers families, if any. |
---|
[5099] | 63 | |
---|
[5098] | 64 | !=== DERIVED TYPE EMBEDDING MOST OF THE TRACERS-RELATED QUANTITIES (LENGTH: nqtot) |
---|
| 65 | ! Each entry is accessible using "%" sign. |
---|
| 66 | ! |-------------+------------------------------------------------------+-------------+------------------------+ |
---|
| 67 | ! | entry | Meaning | Former name | Possible values | |
---|
| 68 | ! |-------------+------------------------------------------------------+-------------+------------------------+ |
---|
| 69 | ! | name | Name (short) | tname | | |
---|
[5221] | 70 | ! | keys | key/val pairs accessible with "getKey" routine | / | | |
---|
[5230] | 71 | ! |gen0Name | Name of the 1st generation ancestor | / | | |
---|
[5098] | 72 | ! | parent | Name of the parent | / | | |
---|
| 73 | ! | longName | Long name (with adv. scheme suffix) for outputs | ttext | | |
---|
| 74 | ! | type | Type (so far: tracer or tag) | / | tracer,tag | |
---|
[5221] | 75 | ! | phase | Phases list ("g"as / "l"iquid / "s"olid | | [g|l|s|r|b] | |
---|
[5230] | 76 | ! | | "r"(cloud) / "b"lowing) | / | | |
---|
[5098] | 77 | ! | component | Name(s) of the merged/cumulated section(s) | / | coma-separated names | |
---|
| 78 | ! | iGeneration | Generation (>=1) | / | | |
---|
| 79 | ! | iqParent | Index of the parent tracer | iqpere | 1:nqtot | |
---|
| 80 | ! | iqDescen | Indexes of the childs (all generations) | iqfils | 1:nqtot | |
---|
| 81 | ! | nqDescen | Number of the descendants (all generations) | nqdesc | 1:nqtot | |
---|
| 82 | ! | nqChildren | Number of childs (1st generation only) | nqfils | 1:nqtot | |
---|
[5221] | 83 | |
---|
| 84 | ! | isAdvected | Advected tracers flag (.TRUE. if iadv >= 0) | / | nqtrue .TRUE. values | |
---|
| 85 | ! | isInPhysics | Tracers not extracted from the main table in physics | / | nqtottr .TRUE. values | |
---|
[5098] | 86 | ! | iso_iGroup | Isotopes group index in isotopes(:) | / | 1:nbIso | |
---|
| 87 | ! | iso_iName | Isotope name index in isotopes(iso_iGroup)%trac(:) | iso_indnum | 1:niso | |
---|
| 88 | ! | iso_iZone | Isotope zone index in isotopes(iso_iGroup)%zone(:) | zone_num | 1:nzone | |
---|
| 89 | ! | iso_iPhas | Isotope phase index in isotopes(iso_iGroup)%phas(:) | phase_num | 1:nphas | |
---|
| 90 | ! +-------------+------------------------------------------------------+-------------+------------------------+ |
---|
[5099] | 91 | |
---|
[5098] | 92 | !=== DERIVED TYPE EMBEDDING MOST OF THE ISOTOPES-RELATED QUANTITIES (LENGTH: nbIso, NUMBER OF ISOTOPES FAMILIES) |
---|
| 93 | ! Each entry is accessible using "%" sign. |
---|
| 94 | ! |-----------------+--------------------------------------------------+--------------------+-----------------+ |
---|
| 95 | ! | entry | length | Meaning | Former name | Possible values | |
---|
| 96 | ! |-----------------+--------------------------------------------------+--------------------+-----------------+ |
---|
| 97 | ! | parent | Parent tracer (isotopes family name) | | | |
---|
| 98 | ! | keys | niso | Isotopes keys/values pairs list + number | | | |
---|
| 99 | ! | trac | ntiso | Isotopes + tagging tracers list + number | / | ntraciso | | |
---|
| 100 | ! | zone | nzone | Geographic tagging zones list + number | / | ntraceurs_zone | | |
---|
[5221] | 101 | ! | phase | nphas | Phases list + number | | [g|l|s|r|b] 1:5 | |
---|
[5098] | 102 | ! | iqIsoPha | Index in "qx" = f(name(1:ntiso)),phas) | iqiso | 1:nqtot | |
---|
[5221] | 103 | ! | iqWIsoPha | Index in "qx" = f(name(1:ntiso+nqo)),phas) | / | 1:nqtot | |
---|
[5098] | 104 | ! | itZonIso | Index in "trac(1:ntiso)"= f(zone, name(1:niso)) | index_trac | 1:ntiso | |
---|
| 105 | ! +-----------------+--------------------------------------------------+--------------------+-----------------+ |
---|
[4120] | 106 | |
---|
[5221] | 107 | !=== INDICES FOR WATER |
---|
[5230] | 108 | INTEGER, SAVE :: ivap, iliq, isol |
---|
| 109 | !$OMP THREADPRIVATE(ivap, iliq, isol) |
---|
[5221] | 110 | |
---|
[5230] | 111 | !===DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES |
---|
[5098] | 112 | INTEGER, SAVE :: nqtot, & !--- Tracers nb in dynamics (incl. higher moments + H2O) |
---|
| 113 | nbtr, & !--- Tracers nb in physics (excl. higher moments + H2O) |
---|
| 114 | nqo, & !--- Number of water phases |
---|
| 115 | nqtottr, & !--- Number of tracers passed to phytrac (TO BE DELETED ?) |
---|
| 116 | nqCO2 !--- Number of tracers of CO2 (ThL) |
---|
| 117 | CHARACTER(LEN = maxlen), SAVE :: type_trac !--- Keyword for tracers type(s) |
---|
| 118 | !$OMP THREADPRIVATE(nqtot, nbtr, nqo, nqtottr, nqCO2, type_trac) |
---|
[4170] | 119 | |
---|
[5221] | 120 | !=== VARIABLES FOR INCA |
---|
| 121 | INTEGER, DIMENSION(:), SAVE, ALLOCATABLE :: & |
---|
[5230] | 122 | conv_flg, pbl_flg !--- Convection / boundary layer activation (nbtr) |
---|
[5098] | 123 | !$OMP THREADPRIVATE(conv_flg, pbl_flg) |
---|
[4120] | 124 | |
---|
[4056] | 125 | !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB) |
---|
[5098] | 126 | INTEGER, SAVE :: nbtr_bin, nbtr_sulgas !--- number of aerosols bins and sulfur gases for StratAer model |
---|
| 127 | !$OMP THREADPRIVATE(nbtr_bin, nbtr_sulgas) |
---|
| 128 | INTEGER, SAVE :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat |
---|
| 129 | !$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat) |
---|
[3677] | 130 | |
---|
[4120] | 131 | CONTAINS |
---|
[2320] | 132 | |
---|
[5098] | 133 | SUBROUTINE init_infotrac_phy |
---|
[5112] | 134 | USE lmdz_ioipsl_getin_p, ONLY: getin_p |
---|
[5230] | 135 | USE lmdz_phys_para, ONLY: is_master, is_omp_master |
---|
[5185] | 136 | USE lmdz_reprobus_wrappers, ONLY: Init_chem_rep_trac |
---|
| 137 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INCA, CPPKEY_STRATAER, CPPKEY_REPROBUS |
---|
[5111] | 138 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
[5118] | 139 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
[5128] | 140 | |
---|
[5185] | 141 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
[5098] | 142 | IMPLICIT NONE |
---|
| 143 | !============================================================================================================================== |
---|
[5099] | 144 | |
---|
[5098] | 145 | ! Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
| 146 | ! ------- |
---|
[5099] | 147 | |
---|
[5098] | 148 | ! Modifications: |
---|
| 149 | ! -------------- |
---|
| 150 | ! 05/94: F.Forget Modif special traceur |
---|
| 151 | ! 02/02: M-A Filiberti Lecture de traceur.def |
---|
| 152 | ! 01/22: D. Cugnet Nouveaux tracer.def et tracer_*.def + encapsulation (types trac_type et isot_type) |
---|
[5099] | 153 | |
---|
[5098] | 154 | ! Objet: |
---|
| 155 | ! ------ |
---|
| 156 | ! GCM LMD nouvelle grille |
---|
[5099] | 157 | |
---|
[5098] | 158 | !============================================================================================================================== |
---|
| 159 | ! ... modification de l'integration de q ( 26/04/94 ) .... |
---|
| 160 | !------------------------------------------------------------------------------------------------------------------------------ |
---|
| 161 | ! Declarations: |
---|
[3924] | 162 | |
---|
[5159] | 163 | |
---|
[5098] | 164 | !------------------------------------------------------------------------------------------------------------------------------ |
---|
| 165 | ! Local variables |
---|
| 166 | INTEGER, ALLOCATABLE :: hadv(:), vadv(:) !--- Horizontal/vertical transport scheme number |
---|
| 167 | INTEGER, ALLOCATABLE :: had (:), hadv_inca(:), conv_flg_inca(:), &!--- Variables specific to INCA |
---|
| 168 | vad (:), vadv_inca(:), pbl_flg_inca(:) |
---|
| 169 | CHARACTER(LEN = 8), ALLOCATABLE :: solsym_inca(:) !--- Tracers names for INCA |
---|
| 170 | INTEGER :: nqINCA |
---|
| 171 | CHARACTER(LEN = maxlen), ALLOCATABLE :: tnames(:) |
---|
| 172 | CHARACTER(LEN = 2) :: suff(9) !--- Suffixes for schemes of order 3 or 4 (Prather) |
---|
| 173 | CHARACTER(LEN = 3) :: descrq(30) !--- Advection scheme description tags |
---|
[5221] | 174 | CHARACTER(LEN = maxlen) :: msg1, texp, ttp !--- Strings for messages and expanded tracers type |
---|
[5098] | 175 | INTEGER :: fType !--- Tracers description file type ; 0: none |
---|
| 176 | !--- 1/2/3: "traceur.def"/"tracer.def"/"tracer_*.def" |
---|
| 177 | INTEGER :: nqtrue !--- Tracers nb from tracer.def (no higher order moments) |
---|
| 178 | INTEGER :: iad !--- Advection scheme number |
---|
[5221] | 179 | INTEGER :: iq, jq, nt, im, nm !--- Indexes and temporary variables |
---|
[5098] | 180 | LOGICAL :: lerr, lInit |
---|
| 181 | TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:) |
---|
| 182 | TYPE(trac_type), POINTER :: t1, t(:) |
---|
[5221] | 183 | CHARACTER(LEN = maxlen), ALLOCATABLE :: types_trac(:) !--- Keywords for tracers type(s), parsed version |
---|
[2690] | 184 | |
---|
[5098] | 185 | CHARACTER(LEN = *), PARAMETER :: modname = "init_infotrac_phy" |
---|
| 186 | !------------------------------------------------------------------------------------------------------------------------------ |
---|
| 187 | ! Initialization : |
---|
| 188 | !------------------------------------------------------------------------------------------------------------------------------ |
---|
| 189 | suff = ['x ', 'y ', 'z ', 'xx', 'xy', 'xz', 'yy', 'yz', 'zz'] |
---|
| 190 | descrq(1:30) = ' ' |
---|
| 191 | descrq(1:2) = ['LMV', 'BAK'] |
---|
| 192 | descrq(10:20) = ['VL1', 'VLP', 'FH1', 'FH2', 'VLH', ' ', 'PPM', 'PPS', 'PPP', ' ', 'SLP'] |
---|
| 193 | descrq(30) = 'PRA' |
---|
[4638] | 194 | |
---|
[5098] | 195 | CALL getin_p('type_trac', type_trac) |
---|
[5230] | 196 | CALL msg('type_trac = "' // TRIM(type_trac) // '"', modname, is_master) |
---|
| 197 | IF(strCount(type_trac, '|', nt)) CALL abort_physic(modname, 'Could''nt parse the "type_trac" string with delimiter "|"', 1) |
---|
| 198 | IF(nt >= 3) CALL abort_physic(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1) |
---|
| 199 | IF(strParse(type_trac, '|', types_trac, n = nt)) CALL abort_physic(modname, "couldn't parse " // '"type_trac"', 1) |
---|
| 200 | IF(nt == 2) type_trac = types_trac(2) ! TO BE DELETED SOON |
---|
[5098] | 201 | |
---|
| 202 | CALL msg('type_trac = "' // TRIM(type_trac) // '"', modname) |
---|
| 203 | lInit = .NOT.ALLOCATED(tracers) |
---|
[4325] | 204 | |
---|
[5098] | 205 | !############################################################################################################################## |
---|
[5230] | 206 | IF(lInit .AND. is_master) THEN !=== SKIPED IF ALREADY DONE |
---|
[5098] | 207 | !############################################################################################################################## |
---|
| 208 | !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION |
---|
| 209 | msg1 = 'For type_trac = "' // TRIM(type_trac) // '":' |
---|
| 210 | SELECT CASE(type_trac) |
---|
| 211 | CASE('inca'); CALL msg(TRIM(msg1) // ' coupling with INCA chemistry model', modname) |
---|
| 212 | CASE('inco'); CALL msg(TRIM(msg1) // ' coupling jointly with INCA and CO2 cycle', modname) |
---|
| 213 | CASE('repr'); CALL msg(TRIM(msg1) // ' coupling with REPROBUS chemistry model', modname) |
---|
| 214 | CASE('co2i'); CALL msg(TRIM(msg1) // ' you have chosen to run with CO2 cycle', modname) |
---|
| 215 | CASE('coag'); CALL msg(TRIM(msg1) // ' tracers are treated for COAGULATION tests', modname) |
---|
| 216 | CASE('lmdz'); CALL msg(TRIM(msg1) // ' tracers are treated in LMDZ only', modname) |
---|
| 217 | CASE DEFAULT; CALL abort_physic(modname, 'type_trac=' // TRIM(type_trac) // ' not possible yet.', 1) |
---|
| 218 | END SELECT |
---|
[4325] | 219 | |
---|
[5098] | 220 | !--- COHERENCE TEST BETWEEN "type_trac" AND PREPROCESSING KEYS |
---|
| 221 | SELECT CASE(type_trac) |
---|
[4389] | 222 | CASE('inca', 'inco') |
---|
[5103] | 223 | IF (.NOT. CPPKEY_INCA) THEN |
---|
[5098] | 224 | CALL abort_physic(modname, 'You must add cpp key INCA and compile with INCA code', 1) |
---|
| 225 | END IF |
---|
[4389] | 226 | CASE('repr') |
---|
[5185] | 227 | IF (.NOT. CPPKEY_REPROBUS) THEN |
---|
| 228 | CALL abort_physic(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1) |
---|
| 229 | END IF |
---|
[4389] | 230 | CASE('coag') |
---|
[5098] | 231 | IF (.NOT. CPPKEY_STRATAER) THEN |
---|
| 232 | CALL abort_physic(modname, 'You must add cpp key StratAer and compile with StratAer code', 1) |
---|
| 233 | END IF |
---|
| 234 | END SELECT |
---|
| 235 | !############################################################################################################################## |
---|
| 236 | END IF |
---|
| 237 | !############################################################################################################################## |
---|
[2690] | 238 | |
---|
[4325] | 239 | |
---|
[5230] | 240 | |
---|
[5098] | 241 | !============================================================================================================================== |
---|
[5221] | 242 | ! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT |
---|
[5098] | 243 | !============================================================================================================================== |
---|
[5221] | 244 | texp = type_trac !=== EXPANDED (WITH "|" SEPARATOR) "type_trac" |
---|
[5098] | 245 | IF(texp == 'inco') texp = 'co2i|inca' |
---|
| 246 | IF(texp /= 'lmdz') texp = 'lmdz|' // TRIM(texp) |
---|
[4389] | 247 | |
---|
[5230] | 248 | IF(testTracersFiles(modname, texp, fType, lInit.AND.is_master)) CALL abort_physic(modname, 'problem with tracers file(s)', 1) |
---|
[5221] | 249 | |
---|
[5230] | 250 | ttp = type_trac; IF(fType /= 1) ttp = texp!--------------------------------------------------------------------------------------------------------------------------- |
---|
| 251 | IF(fType == 0) CALL abort_physic(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.', 1) |
---|
| 252 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
| 253 | IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) & !=== FOUND OLD STYLE INCA "traceur.def" |
---|
| 254 | CALL abort_physic(modname, 'retro-compatibility with old-style INCA traceur.def files has been disabled.', 1) |
---|
| 255 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
[4500] | 256 | |
---|
[5098] | 257 | !############################################################################################################################## |
---|
| 258 | IF(lInit) THEN |
---|
| 259 | IF(readTracersFiles(ttp, lRepr = type_trac=='repr')) CALL abort_physic(modname, 'problem with tracers file(s)', 1) |
---|
| 260 | END IF |
---|
[5230] | 261 | CALL msg('No tracers description file(s) reading needed: already done', modname, .NOT.lInit.AND.is_master) |
---|
[5098] | 262 | !############################################################################################################################## |
---|
[4325] | 263 | |
---|
[5221] | 264 | !============================================================================================================================== |
---|
[5230] | 265 | ! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc. |
---|
| 266 | !============================================================================================================================== |
---|
| 267 | nqtrue = SIZE(tracers) !--- "true" tracers |
---|
| 268 | nqo = COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name) == 'H2O') !--- Water phases |
---|
| 269 | nbtr = nqtrue - COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O') !--- Passed to phytrac |
---|
| 270 | nqCO2 = COUNT([type_trac == 'inco', type_trac == 'co2i']) |
---|
| 271 | IF (CPPKEY_INCA) THEN |
---|
| 272 | nqINCA = COUNT(tracers(:)%component == 'inca') |
---|
[5098] | 273 | END IF |
---|
| 274 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
[4325] | 275 | |
---|
[5098] | 276 | !--- Transfert the number of tracers to Reprobus |
---|
[5185] | 277 | IF (CPPKEY_REPROBUS) THEN |
---|
[5223] | 278 | CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name) !--- Transfert the number of tracers to Reprobus |
---|
[5185] | 279 | END IF |
---|
[4325] | 280 | |
---|
[5098] | 281 | !############################################################################################################################## |
---|
| 282 | IF(lInit) THEN !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac #### |
---|
| 283 | !############################################################################################################################## |
---|
[4325] | 284 | |
---|
[5098] | 285 | !============================================================================================================================== |
---|
| 286 | ! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen). |
---|
| 287 | !============================================================================================================================== |
---|
[5230] | 288 | IF(getKey('hadv', hadv, ky = tracers(:)%keys)) CALL abort_physic(modname, 'missing key "hadv"', 1) |
---|
| 289 | IF(getKey('vadv', vadv, ky = tracers(:)%keys)) CALL abort_physic(modname, 'missing key "vadv"', 1) |
---|
| 290 | |
---|
[5098] | 291 | DO iq = 1, nqtrue |
---|
| 292 | IF(hadv(iq)<20 .OR. (ANY(hadv(iq)==[20, 30]) .AND. hadv(iq)==vadv(iq))) CYCLE |
---|
| 293 | WRITE(msg1, '("The choice hadv=",i0,", vadv=",i0,a)')hadv(iq), vadv(iq), ' for "' // TRIM(tracers(iq)%name) // '" is not available' |
---|
| 294 | CALL abort_physic(modname, TRIM(msg1), 1) |
---|
| 295 | END DO |
---|
| 296 | nqtot = COUNT(hadv< 20 .AND. vadv< 20) & !--- No additional tracer |
---|
| 297 | + 4 * COUNT(hadv==20 .AND. vadv==20) & !--- 3 additional tracers |
---|
| 298 | + 10 * COUNT(hadv==30 .AND. vadv==30) !--- 9 additional tracers |
---|
[4325] | 299 | |
---|
[5098] | 300 | !--- More tracers due to the choice of advection scheme => assign total number of tracers |
---|
| 301 | IF(nqtot /= nqtrue) THEN |
---|
| 302 | CALL msg('The choice of advection scheme for one or more tracers makes it necessary to add tracers') |
---|
| 303 | CALL msg('The number of true tracers is ' // TRIM(int2str(nqtrue))) |
---|
| 304 | CALL msg('The total number of tracers needed is ' // TRIM(int2str(nqtot))) |
---|
| 305 | END IF |
---|
[4325] | 306 | |
---|
[5098] | 307 | !============================================================================================================================== |
---|
| 308 | ! 3) Determine the advection scheme ; needed to compute the full tracers list, the long names, nqtot and %isAdvected |
---|
| 309 | !============================================================================================================================== |
---|
| 310 | ALLOCATE(ttr(nqtot)) |
---|
| 311 | jq = nqtrue + 1; tracers(:)%iadv = -1 |
---|
| 312 | DO iq = 1, nqtrue |
---|
| 313 | t1 => tracers(iq) |
---|
[4325] | 314 | |
---|
[5098] | 315 | !--- VERIFY THE CHOICE OF ADVECTION SCHEME |
---|
| 316 | iad = -1 |
---|
| 317 | IF(hadv(iq) == vadv(iq)) iad = hadv(iq) |
---|
| 318 | IF(hadv(iq)==10 .AND. vadv(iq)==16) iad = 11 |
---|
| 319 | WRITE(msg1, '("Bad choice of advection scheme for ",a,": hadv = ",i0,", vadv = ",i0)')TRIM(t1%name), hadv(iq), vadv(iq) |
---|
| 320 | IF(iad == -1) CALL abort_physic(modname, msg1, 1) |
---|
[4325] | 321 | |
---|
[5221] | 322 | !--- SET FIELDS longName, isAdvected, isInPhysics |
---|
[5098] | 323 | t1%longName = t1%name; IF(iad > 0) t1%longName = TRIM(t1%name) // descrq(iad) |
---|
| 324 | t1%isAdvected = iad >= 0 |
---|
[5230] | 325 | t1%isInPhysics = delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O |
---|
[5098] | 326 | ttr(iq) = t1 |
---|
[4325] | 327 | |
---|
[5098] | 328 | !--- DEFINE THE HIGHER ORDER TRACERS, IF ANY |
---|
| 329 | nm = 0 |
---|
| 330 | IF(iad == 20) nm = 3 !--- 2nd order scheme |
---|
| 331 | IF(iad == 30) nm = 9 !--- 3rd order scheme |
---|
| 332 | IF(nm == 0) CYCLE !--- No higher moments |
---|
| 333 | ttr(jq + 1:jq + nm) = t1 |
---|
| 334 | ttr(jq + 1:jq + nm)%name = [(TRIM(t1%name) // '-' // TRIM(suff(im)), im = 1, nm) ] |
---|
[5230] | 335 | ttr(jq + 1:jq + nm)%gen0Name = [ (TRIM(t1%name) // '-' // TRIM(suff(im)), im = 1, nm) ] |
---|
[5098] | 336 | ttr(jq + 1:jq + nm)%parent = [(TRIM(t1%parent) // '-' // TRIM(suff(im)), im = 1, nm) ] |
---|
| 337 | ttr(jq + 1:jq + nm)%longName = [(TRIM(t1%longName) // '-' // TRIM(suff(im)), im = 1, nm) ] |
---|
[5230] | 338 | ttr(jq + 1:jq + nm)%isAdvected = [(.FALSE., im = 1, nm) ] |
---|
| 339 | ttr(jq + 1:jq + nm)%isInPhysics = [ (.FALSE., im = 1, nm) ] |
---|
[5098] | 340 | jq = jq + nm |
---|
| 341 | END DO |
---|
| 342 | DEALLOCATE(hadv, vadv) |
---|
| 343 | CALL MOVE_ALLOC(FROM = ttr, TO = tracers) |
---|
[4325] | 344 | |
---|
[5221] | 345 | !--- SET FIELDS iqParent, iqDescen, nqDescen, nqChildren, iGeneration |
---|
| 346 | IF(indexUpdate(tracers)) CALL abort_physic(modname, 'problem with tracers indices update', 1) |
---|
[4325] | 347 | |
---|
[5098] | 348 | !############################################################################################################################## |
---|
| 349 | END IF |
---|
| 350 | !############################################################################################################################## |
---|
[4325] | 351 | |
---|
[5098] | 352 | !############################################################################################################################## |
---|
| 353 | IF(.NOT.lInit) THEN |
---|
| 354 | !############################################################################################################################## |
---|
| 355 | nqtot = SIZE(tracers) |
---|
| 356 | !############################################################################################################################## |
---|
| 357 | ELSE |
---|
| 358 | !############################################################################################################################## |
---|
[4325] | 359 | |
---|
[5098] | 360 | !=== READ PHYSICAL PARAMETERS FOR ISOTOPES |
---|
| 361 | niso = 0; nzone = 0; nphas = nqo; ntiso = 0; isoCheck = .FALSE. |
---|
| 362 | IF(processIsotopes()) CALL abort_physic(modname, 'Problem when processing isotopes parameters', 1) |
---|
[4325] | 363 | |
---|
[5098] | 364 | !############################################################################################################################## |
---|
| 365 | END IF |
---|
| 366 | !############################################################################################################################## |
---|
| 367 | !--- Convection / boundary layer activation for all tracers |
---|
[5221] | 368 | IF(.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1 |
---|
[5230] | 369 | IF(.NOT.ALLOCATED(pbl_flg)) ALLOCATE(pbl_flg(nbtr)); pbl_flg(1:nbtr) = 1 |
---|
[4325] | 370 | |
---|
[5098] | 371 | !--- Note: nqtottr can differ from nbtr when nmom/=0 |
---|
| 372 | nqtottr = nqtot - COUNT(delPhase(tracers%gen0Name) == 'H2O' .AND. tracers%component == 'lmdz') |
---|
| 373 | IF(COUNT(tracers%iso_iName == 0) - COUNT(delPhase(tracers%name) == 'H2O' .AND. tracers%component == 'lmdz') /= nqtottr) & |
---|
| 374 | CALL abort_physic(modname, 'problem with the computation of nqtottr', 1) |
---|
[4325] | 375 | |
---|
[5098] | 376 | !=== DISPLAY THE RESULTS |
---|
[5230] | 377 | IF(.NOT.is_master) RETURN |
---|
[5098] | 378 | CALL msg('nqo = ' // TRIM(int2str(nqo)), modname) |
---|
| 379 | CALL msg('nbtr = ' // TRIM(int2str(nbtr)), modname) |
---|
| 380 | CALL msg('nqtrue = ' // TRIM(int2str(nqtrue)), modname) |
---|
| 381 | CALL msg('nqtot = ' // TRIM(int2str(nqtot)), modname) |
---|
| 382 | CALL msg('niso = ' // TRIM(int2str(niso)), modname) |
---|
| 383 | CALL msg('ntiso = ' // TRIM(int2str(ntiso)), modname) |
---|
| 384 | IF (CPPKEY_INCA) THEN |
---|
| 385 | CALL msg('nqCO2 = ' // TRIM(int2str(nqCO2)), modname) |
---|
| 386 | CALL msg('nqINCA = ' // TRIM(int2str(nqINCA)), modname) |
---|
| 387 | END IF |
---|
| 388 | t => tracers |
---|
[5230] | 389 | CALL msg('Information stored in ' // TRIM(modname) // ' :', modname) |
---|
[5221] | 390 | IF(dispTable('isssssssssiiiiiiii', ['iq ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp', & |
---|
| 391 | 'isPh', 'isAd', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'], & |
---|
| 392 | cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component, & |
---|
[5230] | 393 | bool2str(t%isInPhysics), bool2str(t%isAdvected)), & |
---|
[5098] | 394 | cat([(iq, iq = 1, nqtot)], t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup, & |
---|
| 395 | t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax = maxTableWidth, nHead = 2, sub = modname)) & |
---|
| 396 | CALL abort_physic(modname, "problem with the tracers table content", 1) |
---|
[5230] | 397 | CALL msg('No isotopes identified.', modname, nbIso == 0) |
---|
| 398 | IF(nbIso == 0) RETURN |
---|
| 399 | CALL msg('For isotopes family "H2O":', modname) |
---|
| 400 | CALL msg(' isoKeys%name = ' // strStack(isoKeys%name), modname) |
---|
| 401 | CALL msg(' isoName = ' // strStack(isoName), modname) |
---|
| 402 | CALL msg(' isoZone = ' // strStack(isoZone), modname) |
---|
| 403 | CALL msg(' isoPhas = ' // TRIM(isoPhas), modname) |
---|
[4325] | 404 | |
---|
[5230] | 405 | |
---|
[4325] | 406 | #ifdef ISOVERIF |
---|
| 407 | CALL msg('iso_iName = '//strStack(int2str(PACK(tracers(:)%iso_iName, MASK=tracers(:)%iso_iGroup==iH2O))), modname) |
---|
| 408 | #endif |
---|
[5098] | 409 | IF (CPPKEY_STRATAER) THEN |
---|
| 410 | IF (type_trac == 'coag') THEN |
---|
| 411 | nbtr_bin = COUNT([(tracers(iq)%name(1:3)=='BIN', iq = 1, nqtot)]) |
---|
| 412 | nbtr_sulgas = COUNT([(tracers(iq)%name(1:3)=='GAS', iq = 1, nqtot)]) |
---|
| 413 | tnames = PACK(tracers(:)%name, MASK = tracers(:)%isInPhysics) |
---|
| 414 | id_BIN01_strat = strIdx(tnames, 'BIN01') |
---|
| 415 | id_OCS_strat = strIdx(tnames, 'GASOCS') |
---|
| 416 | id_SO2_strat = strIdx(tnames, 'GASSO2') |
---|
| 417 | id_H2SO4_strat = strIdx(tnames, 'GASH2SO4') |
---|
| 418 | id_TEST_strat = strIdx(tnames, 'GASTEST') |
---|
| 419 | CALL msg('nbtr_bin =' // TRIM(int2str(nbtr_bin)), modname) |
---|
| 420 | CALL msg('nbtr_sulgas =' // TRIM(int2str(nbtr_sulgas)), modname) |
---|
| 421 | CALL msg('id_BIN01_strat =' // TRIM(int2str(id_BIN01_strat)), modname) |
---|
| 422 | CALL msg('id_OCS_strat =' // TRIM(int2str(id_OCS_strat)), modname) |
---|
| 423 | CALL msg('id_SO2_strat =' // TRIM(int2str(id_SO2_strat)), modname) |
---|
| 424 | CALL msg('id_H2SO4_strat =' // TRIM(int2str(id_H2SO4_strat)), modname) |
---|
| 425 | CALL msg('id_TEST_strat =' // TRIM(int2str(id_TEST_strat)), modname) |
---|
| 426 | END IF |
---|
| 427 | END IF |
---|
[4056] | 428 | |
---|
[5098] | 429 | END SUBROUTINE init_infotrac_phy |
---|
[2320] | 430 | |
---|
| 431 | END MODULE infotrac_phy |
---|