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