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