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