[4482] | 1 | !$Id: infotrac.F90 4301 2022-10-20 11:57:21Z dcugnet $ |
---|
| 2 | ! |
---|
[2320] | 3 | MODULE infotrac_phy |
---|
| 4 | |
---|
[4482] | 5 | USE strings_mod, ONLY: msg, fmsg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strIdx |
---|
[4488] | 6 | USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers, setGeneration, itZonIso, nzone, tran0, isoZone, & |
---|
| 7 | delPhase, niso, getKey, isot_type, readIsotopesFile, isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, & |
---|
| 8 | addPhase, iH2O, addKey, isoSelect, testTracersFiles, isoKeys, indexUpdate, isoCheck, nbIso, ntiso, isoName |
---|
[4120] | 9 | IMPLICIT NONE |
---|
[4046] | 10 | |
---|
[4120] | 11 | PRIVATE |
---|
[2320] | 12 | |
---|
[4120] | 13 | !=== FOR TRACERS: |
---|
| 14 | PUBLIC :: init_infotrac_phy !--- Initialization of the tracers |
---|
[4482] | 15 | PUBLIC :: tracers, type_trac !--- Full tracers database, tracers type keyword |
---|
[4120] | 16 | PUBLIC :: nqtot, nbtr, nqo, nqCO2, nqtottr !--- Main dimensions |
---|
[4124] | 17 | PUBLIC :: conv_flg, pbl_flg !--- Convection & boundary layer activation keys |
---|
[4482] | 18 | #ifdef CPP_StratAer |
---|
| 19 | PUBLIC :: nbtr_bin, nbtr_sulgas !--- Number of aerosols bins and sulfur gases for StratAer model |
---|
| 20 | PUBLIC :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat |
---|
| 21 | #endif |
---|
[4727] | 22 | #ifdef REPROBUS |
---|
| 23 | PUBLIC :: nbtr_bin, nbtr_sulgas |
---|
| 24 | PUBLIC :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, & |
---|
| 25 | id_TEST_strat |
---|
| 26 | #endif |
---|
[2320] | 27 | |
---|
[4120] | 28 | !=== FOR ISOTOPES: General |
---|
[4482] | 29 | PUBLIC :: isot_type, nbIso !--- Derived type, full isotopes families database + nb of families |
---|
[4120] | 30 | PUBLIC :: isoSelect, ixIso !--- Isotopes family selection tool + selected family index |
---|
| 31 | !=== FOR ISOTOPES: Specific to water |
---|
[4488] | 32 | PUBLIC :: iH2O !--- H2O isotopes class index |
---|
[4120] | 33 | !=== FOR ISOTOPES: Depending on the selected isotopes family |
---|
| 34 | PUBLIC :: isotope, isoKeys !--- Selected isotopes database + associated keys (cf. getKey) |
---|
| 35 | PUBLIC :: isoName, isoZone, isoPhas !--- Isotopes and tagging zones names, phases |
---|
| 36 | PUBLIC :: niso, nzone, nphas, ntiso !--- " " numbers + isotopes & tagging tracers number |
---|
[4482] | 37 | PUBLIC :: itZonIso !--- idx "it" (in "isoName(1:niso)") = function(tagging idx, isotope idx) |
---|
| 38 | PUBLIC :: iqIsoPha !--- idx "iq" (in "qx") = function(isotope idx, phase idx) + aliases |
---|
[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 | |
---|
| 46 | ! | phases: H2O_[gls] | isotopes | | | for higher order schemes | |
---|
| 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: |
---|
| 60 | ! * Used "niso", "nzone" and "ntiso" are components of "isotopes(ip)" for water (isotopes(ip)%parent == 'H2O'), |
---|
| 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 | | |
---|
| 71 | ! | gen0Name | Name of the 1st generation ancestor | / | | |
---|
| 72 | ! | parent | Name of the parent | / | | |
---|
| 73 | ! | longName | Long name (with adv. scheme suffix) for outputs | ttext | | |
---|
| 74 | ! | type | Type (so far: tracer or tag) | / | tracer,tag | |
---|
[4727] | 75 | ! | phase | Phases list ("g"as / "l"iquid / "s"olid / "b"lowing) | / | [g][l][s][b] | |
---|
[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 | |
---|
[4482] | 81 | ! | nqChildren | Number of childs (1st generation only) | nqfils | 1:nqtot | |
---|
| 82 | ! | keys | key/val pairs accessible with "getKey" routine | / | | |
---|
[4488] | 83 | ! | isAdvected | advected tracers flag (.TRUE. if iadv >= 0) | / | nqtrue .TRUE. values | |
---|
| 84 | ! | isInPhysics | tracers not extracted from the main table in physics | / | nqtottr .TRUE. values | |
---|
[4120] | 85 | ! | iso_iGroup | Isotopes group index in isotopes(:) | / | 1:nbIso | |
---|
| 86 | ! | iso_iName | Isotope name index in isotopes(iso_iGroup)%trac(:) | iso_indnum | 1:niso | |
---|
| 87 | ! | iso_iZone | Isotope zone index in isotopes(iso_iGroup)%zone(:) | zone_num | 1:nzone | |
---|
| 88 | ! | iso_iPhas | Isotope phase index in isotopes(iso_iGroup)%phas(:) | phase_num | 1:nphas | |
---|
| 89 | ! +-------------+------------------------------------------------------+-------------+------------------------+ |
---|
| 90 | ! |
---|
| 91 | !=== DERIVED TYPE EMBEDDING MOST OF THE ISOTOPES-RELATED QUANTITIES (LENGTH: nbIso, NUMBER OF ISOTOPES FAMILIES) |
---|
| 92 | ! Each entry is accessible using "%" sign. |
---|
| 93 | ! |-----------------+--------------------------------------------------+--------------------+-----------------+ |
---|
| 94 | ! | entry | length | Meaning | Former name | Possible values | |
---|
| 95 | ! |-----------------+--------------------------------------------------+--------------------+-----------------+ |
---|
| 96 | ! | parent | Parent tracer (isotopes family name) | | | |
---|
| 97 | ! | keys | niso | Isotopes keys/values pairs list + number | | | |
---|
| 98 | ! | trac | ntiso | Isotopes + tagging tracers list + number | / | ntraciso | | |
---|
| 99 | ! | zone | nzone | Geographic tagging zones list + number | / | ntraceurs_zone | | |
---|
[4727] | 100 | ! | phase | nphas | Phases list + number | |[g][l][s][b] 1:4 | |
---|
[4143] | 101 | ! | iqIsoPha | Index in "qx" = f(name(1:ntiso)),phas) | iqiso | 1:nqtot | |
---|
[4120] | 102 | ! | itZonIso | Index in "trac(1:ntiso)"= f(zone, name(1:niso)) | index_trac | 1:ntiso | |
---|
| 103 | ! +-----------------+--------------------------------------------------+--------------------+-----------------+ |
---|
| 104 | |
---|
| 105 | !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES |
---|
[4482] | 106 | INTEGER, SAVE :: nqtot, & !--- Tracers nb in dynamics (incl. higher moments + H2O) |
---|
| 107 | nbtr, & !--- Tracers nb in physics (excl. higher moments + H2O) |
---|
| 108 | nqo, & !--- Number of water phases |
---|
| 109 | nqtottr, & !--- Number of tracers passed to phytrac (TO BE DELETED ?) |
---|
| 110 | nqCO2 !--- Number of tracers of CO2 (ThL) |
---|
| 111 | CHARACTER(LEN=maxlen), SAVE :: type_trac !--- Keyword for tracers type(s) |
---|
| 112 | !$OMP THREADPRIVATE(nqtot, nbtr, nqo, nqtottr, nqCO2, type_trac) |
---|
[4170] | 113 | |
---|
[4482] | 114 | !=== VARIABLES FOR INCA |
---|
| 115 | INTEGER, SAVE, ALLOCATABLE :: conv_flg(:), & !--- Convection activation ; needed for INCA (nbtr) |
---|
| 116 | pbl_flg(:) !--- Boundary layer activation ; needed for INCA (nbtr) |
---|
[4124] | 117 | !$OMP THREADPRIVATE(conv_flg, pbl_flg) |
---|
[4120] | 118 | |
---|
[3677] | 119 | #ifdef CPP_StratAer |
---|
[4056] | 120 | !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB) |
---|
| 121 | INTEGER, SAVE :: nbtr_bin, nbtr_sulgas !--- number of aerosols bins and sulfur gases for StratAer model |
---|
| 122 | !$OMP THREADPRIVATE(nbtr_bin, nbtr_sulgas) |
---|
| 123 | INTEGER, SAVE :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat |
---|
| 124 | !$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat) |
---|
[3677] | 125 | #endif |
---|
[4727] | 126 | #ifdef REPROBUS |
---|
| 127 | INTEGER, SAVE :: nbtr_bin, nbtr_sulgas |
---|
| 128 | !$OMP THREADPRIVATE(nbtr_bin, nbtr_sulgas) |
---|
| 129 | INTEGER, SAVE :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat,& |
---|
| 130 | id_TEST_strat |
---|
| 131 | !$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat) |
---|
| 132 | !$OMP THREADPRIVATE(id_TEST_strat) |
---|
| 133 | #endif |
---|
[3677] | 134 | |
---|
[4120] | 135 | CONTAINS |
---|
[2320] | 136 | |
---|
[4482] | 137 | SUBROUTINE init_infotrac_phy |
---|
| 138 | USE ioipsl_getin_p_mod, ONLY: getin_p |
---|
| 139 | #ifdef REPROBUS |
---|
| 140 | USE CHEM_REP, ONLY: Init_chem_rep_trac |
---|
| 141 | #endif |
---|
[4120] | 142 | IMPLICIT NONE |
---|
[4482] | 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 | |
---|
[4482] | 165 | !------------------------------------------------------------------------------------------------------------------------------ |
---|
| 166 | ! Local variables |
---|
| 167 | INTEGER, ALLOCATABLE :: hadv(:), vadv(:) !--- Horizontal/vertical transport scheme number |
---|
| 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 |
---|
[4482] | 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 |
---|
| 179 | CHARACTER(LEN=maxlen) :: msg1, texp, ttp !--- String for messages and expanded tracers type |
---|
| 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 |
---|
| 184 | INTEGER :: ic, iq, jq, it, nt, im, nm, iz, k !--- Indexes and temporary variables |
---|
| 185 | LOGICAL :: lerr, ll, lInit |
---|
| 186 | CHARACTER(LEN=1) :: p |
---|
| 187 | TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:) |
---|
| 188 | TYPE(trac_type), POINTER :: t1, t(:) |
---|
| 189 | INTEGER :: ierr |
---|
[4727] | 190 | CHARACTER(LEN=maxlen), ALLOCATABLE :: types_trac(:) !--- Keyword for tracers type(s), parsed version |
---|
| 191 | |
---|
[4482] | 192 | CHARACTER(LEN=*), PARAMETER :: modname="init_infotrac_phy" |
---|
| 193 | !------------------------------------------------------------------------------------------------------------------------------ |
---|
| 194 | ! Initialization : |
---|
| 195 | !------------------------------------------------------------------------------------------------------------------------------ |
---|
| 196 | suff = ['x ','y ','z ','xx','xy','xz','yy','yz','zz'] |
---|
| 197 | descrq( 1:30) = ' ' |
---|
| 198 | descrq( 1: 2) = ['LMV','BAK'] |
---|
| 199 | descrq(10:20) = ['VL1','VLP','FH1','FH2','VLH',' ','PPM','PPS','PPP',' ','SLP'] |
---|
| 200 | descrq(30) = 'PRA' |
---|
[2690] | 201 | |
---|
[4482] | 202 | CALL getin_p('type_trac',type_trac) |
---|
[4727] | 203 | |
---|
| 204 | lerr=strParse(type_trac, '|', types_trac, n=nt) |
---|
| 205 | IF (nt .GT. 1) THEN |
---|
| 206 | IF (nt .GT. 2) CALL abort_physic(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1) |
---|
| 207 | IF (nt .EQ. 2) type_trac=types_trac(2) |
---|
| 208 | ENDIF |
---|
| 209 | |
---|
| 210 | |
---|
[4482] | 211 | CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname) |
---|
| 212 | lInit = .NOT.ALLOCATED(tracers) |
---|
| 213 | |
---|
| 214 | !############################################################################################################################## |
---|
| 215 | IF(lInit) THEN !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac #### |
---|
| 216 | !############################################################################################################################## |
---|
| 217 | !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION |
---|
| 218 | msg1 = 'For type_trac = "'//TRIM(type_trac)//'":' |
---|
| 219 | SELECT CASE(type_trac) |
---|
| 220 | CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model', modname) |
---|
| 221 | CASE('inco'); CALL msg(TRIM(msg1)//' coupling jointly with INCA and CO2 cycle', modname) |
---|
| 222 | CASE('repr'); CALL msg(TRIM(msg1)//' coupling with REPROBUS chemistry model', modname) |
---|
| 223 | CASE('co2i'); CALL msg(TRIM(msg1)//' you have chosen to run with CO2 cycle', modname) |
---|
| 224 | CASE('coag'); CALL msg(TRIM(msg1)//' tracers are treated for COAGULATION tests', modname) |
---|
| 225 | CASE('lmdz'); CALL msg(TRIM(msg1)//' tracers are treated in LMDZ only', modname) |
---|
[4727] | 226 | CASE DEFAULT; CALL abort_physic(modname,'type_trac='//TRIM(type_trac)//' not possible yet.',1) |
---|
[4482] | 227 | END SELECT |
---|
| 228 | |
---|
| 229 | !--- COHERENCE TEST BETWEEN "type_trac" AND PREPROCESSING KEYS |
---|
| 230 | SELECT CASE(type_trac) |
---|
| 231 | CASE('inca', 'inco') |
---|
| 232 | #ifndef INCA |
---|
[4727] | 233 | CALL abort_physic(modname, 'You must add cpp key INCA and compile with INCA code', 1) |
---|
[4482] | 234 | #endif |
---|
| 235 | CASE('repr') |
---|
| 236 | #ifndef REPROBUS |
---|
[4727] | 237 | CALL abort_physic(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1) |
---|
[4482] | 238 | #endif |
---|
| 239 | CASE('coag') |
---|
| 240 | #ifndef CPP_StratAer |
---|
[4727] | 241 | CALL abort_physic(modname, 'You must add cpp key StratAer and compile with StratAer code', 1) |
---|
[4482] | 242 | #endif |
---|
| 243 | END SELECT |
---|
| 244 | !############################################################################################################################## |
---|
[4120] | 245 | END IF |
---|
[4482] | 246 | !############################################################################################################################## |
---|
[2690] | 247 | |
---|
[4482] | 248 | nqCO2 = COUNT( [type_trac == 'inco', type_trac == 'co2i'] ) |
---|
| 249 | |
---|
| 250 | !============================================================================================================================== |
---|
| 251 | ! 1) Get the numbers of: true (first order only) tracers "nqtrue", water tracers "nqo" (vapor/liquid/solid) |
---|
| 252 | !============================================================================================================================== |
---|
| 253 | texp = type_trac !=== EXPANDED VERSION OF "type_trac", WITH "|" SEPARATOR |
---|
| 254 | IF(texp == 'inco') texp = 'co2i|inca' |
---|
| 255 | IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp) |
---|
| 256 | |
---|
| 257 | !=== DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE |
---|
[4727] | 258 | IF(testTracersFiles(modname, texp, fType, lInit)) CALL abort_physic(modname, 'problem with tracers file(s)',1) |
---|
| 259 | |
---|
[4482] | 260 | ttp = type_trac; IF(fType /= 1) ttp = texp |
---|
| 261 | |
---|
| 262 | !############################################################################################################################## |
---|
| 263 | IF(lInit) THEN |
---|
[4727] | 264 | IF(readTracersFiles(ttp, type_trac == 'repr')) CALL abort_physic(modname, 'problem with tracers file(s)',1) |
---|
[4482] | 265 | ELSE |
---|
| 266 | CALL msg('No tracers description file(s) reading needed: already done in the dynamics', modname) |
---|
| 267 | END IF |
---|
| 268 | !############################################################################################################################## |
---|
| 269 | |
---|
| 270 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
[4727] | 271 | IF(fType == 0) CALL abort_physic(modname, 'Missing tracers file: "traceur.def", "tracer.def" or "tracer_<keyword>.def file.',1) |
---|
[4482] | 272 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
[4488] | 273 | IF(fType == 1 .AND. ANY(['inca','inco']==type_trac) .AND. lInit) THEN !=== FOUND OLD STYLE INCA "traceur.def" |
---|
[4482] | 274 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
| 275 | #ifdef INCA |
---|
| 276 | nqo = SIZE(tracers) - nqCO2 |
---|
| 277 | CALL Init_chem_inca_trac(nqINCA) !--- Get nqINCA from INCA |
---|
| 278 | nbtr = nqINCA + nqCO2 !--- Number of tracers passed to phytrac |
---|
| 279 | nqtrue = nbtr + nqo !--- Total number of "true" tracers |
---|
[4727] | 280 | IF(ALL([2,3] /= nqo)) CALL abort_physic(modname, 'Only 2 or 3 water phases allowed ; found nqo='//TRIM(int2str(nqo)), 1) |
---|
[4482] | 281 | ALLOCATE(hadv(nqtrue), hadv_inca(nqINCA), conv_flg_inca(nqINCA), solsym_inca(nqINCA)) |
---|
| 282 | ALLOCATE(vadv(nqtrue), vadv_inca(nqINCA), pbl_flg_inca(nqINCA)) |
---|
| 283 | CALL init_transport(solsym_inca, conv_flg_inca, pbl_flg_inca, hadv_inca, vadv_inca) |
---|
| 284 | ALLOCATE(ttr(nqtrue)) |
---|
| 285 | ttr(1:nqo+nqCO2) = tracers |
---|
| 286 | ttr(1 : nqo )%component = 'lmdz' |
---|
| 287 | ttr(1+nqo:nqCO2+nqo )%component = 'co2i' |
---|
| 288 | ttr(1+nqo+nqCO2:nqtrue)%component = 'inca' |
---|
| 289 | ttr(1+nqo :nqtrue)%name = [('CO2 ', k=1, nqCO2), solsym_inca] |
---|
| 290 | ttr(1+nqo+nqCO2:nqtrue)%parent = tran0 |
---|
| 291 | ttr(1+nqo+nqCO2:nqtrue)%phase = 'g' |
---|
| 292 | lerr = getKey('hadv', had, ky=tracers(:)%keys) |
---|
| 293 | lerr = getKey('vadv', vad, ky=tracers(:)%keys) |
---|
| 294 | hadv(1:nqo+nqCO2) = had(:); hadv(1+nqo+nqCO2:nqtrue) = hadv_inca |
---|
| 295 | vadv(1:nqo+nqCO2) = vad(:); vadv(1+nqo+nqCO2:nqtrue) = vadv_inca |
---|
| 296 | CALL MOVE_ALLOC(FROM=ttr, TO=tracers) |
---|
| 297 | DO iq = 1, nqtrue |
---|
| 298 | t1 => tracers(iq) |
---|
| 299 | CALL addKey('name', t1%name, t1%keys) |
---|
| 300 | CALL addKey('component', t1%component, t1%keys) |
---|
| 301 | CALL addKey('parent', t1%parent, t1%keys) |
---|
| 302 | CALL addKey('phase', t1%phase, t1%keys) |
---|
| 303 | END DO |
---|
[4727] | 304 | IF(setGeneration(tracers)) CALL abort_physic(modname,'See below',1) !- SET FIELDS %iGeneration, %gen0Name |
---|
[4482] | 305 | DEALLOCATE(had, hadv_inca, vad, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca) |
---|
| 306 | #endif |
---|
| 307 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
| 308 | ELSE !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE) |
---|
| 309 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
| 310 | nqo = COUNT(delPhase(tracers(:)%name) == 'H2O' & |
---|
| 311 | .AND. tracers(:)%component == 'lmdz') !--- Number of water phases |
---|
| 312 | nqtrue = SIZE(tracers) !--- Total number of "true" tracers |
---|
| 313 | nbtr = nqtrue-COUNT(delPhase(tracers(:)%gen0Name) == 'H2O' & |
---|
| 314 | .AND. tracers(:)%component == 'lmdz') !--- Number of tracers passed to phytrac |
---|
| 315 | #ifdef INCA |
---|
| 316 | nqINCA = COUNT(tracers(:)%component == 'inca') |
---|
| 317 | #endif |
---|
| 318 | lerr = getKey('hadv', hadv, ky=tracers(:)%keys) |
---|
| 319 | lerr = getKey('vadv', vadv, ky=tracers(:)%keys) |
---|
| 320 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
| 321 | END IF |
---|
| 322 | !--------------------------------------------------------------------------------------------------------------------------- |
---|
| 323 | |
---|
| 324 | !--- Transfert the number of tracers to Reprobus |
---|
| 325 | #ifdef REPROBUS |
---|
| 326 | CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name) |
---|
| 327 | #endif |
---|
| 328 | |
---|
| 329 | !############################################################################################################################## |
---|
| 330 | IF(lInit) THEN !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac #### |
---|
| 331 | !############################################################################################################################## |
---|
| 332 | |
---|
| 333 | !============================================================================================================================== |
---|
| 334 | ! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen). |
---|
| 335 | !============================================================================================================================== |
---|
| 336 | DO iq = 1, nqtrue |
---|
| 337 | IF( hadv(iq)<20 .OR. (ANY(hadv(iq)==[20,30]) .AND. hadv(iq)==vadv(iq)) ) CYCLE |
---|
| 338 | WRITE(msg1,'("The choice hadv=",i0,", vadv=",i0,a)')hadv(iq),vadv(iq),' for "'//TRIM(tracers(iq)%name)//'" is not available' |
---|
[4727] | 339 | CALL abort_physic(modname, TRIM(msg1), 1) |
---|
[4482] | 340 | END DO |
---|
| 341 | nqtot = COUNT( hadv< 20 .AND. vadv< 20 ) & !--- No additional tracer |
---|
| 342 | + 4*COUNT( hadv==20 .AND. vadv==20 ) & !--- 3 additional tracers |
---|
| 343 | + 10*COUNT( hadv==30 .AND. vadv==30 ) !--- 9 additional tracers |
---|
| 344 | |
---|
| 345 | !--- More tracers due to the choice of advection scheme => assign total number of tracers |
---|
| 346 | IF( nqtot /= nqtrue ) THEN |
---|
| 347 | CALL msg('The choice of advection scheme for one or more tracers makes it necessary to add tracers') |
---|
| 348 | CALL msg('The number of true tracers is '//TRIM(int2str(nqtrue))) |
---|
| 349 | CALL msg('The total number of tracers needed is '//TRIM(int2str(nqtot))) |
---|
| 350 | END IF |
---|
| 351 | |
---|
| 352 | !============================================================================================================================== |
---|
[4488] | 353 | ! 3) Determine the advection scheme ; needed to compute the full tracers list, the long names, nqtot and %isAdvected |
---|
[4482] | 354 | !============================================================================================================================== |
---|
| 355 | ALLOCATE(ttr(nqtot)) |
---|
| 356 | jq = nqtrue+1; tracers(:)%iadv = -1 |
---|
| 357 | DO iq = 1, nqtrue |
---|
| 358 | t1 => tracers(iq) |
---|
| 359 | |
---|
| 360 | !--- VERIFY THE CHOICE OF ADVECTION SCHEME |
---|
| 361 | iad = -1 |
---|
| 362 | IF(hadv(iq) == vadv(iq) ) iad = hadv(iq) |
---|
| 363 | IF(hadv(iq)==10 .AND. vadv(iq)==16) iad = 11 |
---|
| 364 | WRITE(msg1,'("Bad choice of advection scheme for ",a,": hadv = ",i0,", vadv = ",i0)')TRIM(t1%name), hadv(iq), vadv(iq) |
---|
[4727] | 365 | IF(iad == -1) CALL abort_physic(modname, msg1, 1) |
---|
[4482] | 366 | |
---|
[4488] | 367 | !--- SET FIELDS %longName, %isAdvected, %isInPhysics |
---|
[4482] | 368 | t1%longName = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad) |
---|
[4488] | 369 | t1%isAdvected = iad >= 0 |
---|
[4482] | 370 | t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' & |
---|
| 371 | .OR. t1%component /= 'lmdz' !=== OTHER EXCEPTIONS TO BE ADDED: CO2i, SURSATURATED WATER CLOUD... |
---|
| 372 | ttr(iq) = t1 |
---|
| 373 | |
---|
| 374 | !--- DEFINE THE HIGHER ORDER TRACERS, IF ANY |
---|
| 375 | nm = 0 |
---|
| 376 | IF(iad == 20) nm = 3 !--- 2nd order scheme |
---|
| 377 | IF(iad == 30) nm = 9 !--- 3rd order scheme |
---|
| 378 | IF(nm == 0) CYCLE !--- No higher moments |
---|
| 379 | ttr(jq+1:jq+nm) = t1 |
---|
| 380 | ttr(jq+1:jq+nm)%name = [(TRIM(t1%name) //'-'//TRIM(suff(im)), im=1, nm) ] |
---|
| 381 | ttr(jq+1:jq+nm)%parent = [(TRIM(t1%parent) //'-'//TRIM(suff(im)), im=1, nm) ] |
---|
| 382 | ttr(jq+1:jq+nm)%longName = [(TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ] |
---|
[4488] | 383 | ttr(jq+1:jq+nm)%isAdvected = [(.FALSE., im=1, nm) ] |
---|
[4482] | 384 | jq = jq + nm |
---|
| 385 | END DO |
---|
| 386 | DEALLOCATE(hadv, vadv) |
---|
| 387 | CALL MOVE_ALLOC(FROM=ttr, TO=tracers) |
---|
| 388 | |
---|
| 389 | !--- SET FIELDS %iqParent, %nqChildren, %iGeneration, %iqDescen, %nqDescen |
---|
| 390 | CALL indexUpdate(tracers) |
---|
| 391 | |
---|
| 392 | !############################################################################################################################## |
---|
| 393 | END IF |
---|
| 394 | !############################################################################################################################## |
---|
| 395 | |
---|
| 396 | !############################################################################################################################## |
---|
| 397 | IF(.NOT.lInit) THEN |
---|
| 398 | !############################################################################################################################## |
---|
| 399 | nqtot = SIZE(tracers) |
---|
| 400 | !############################################################################################################################## |
---|
| 401 | ELSE |
---|
| 402 | !############################################################################################################################## |
---|
| 403 | |
---|
| 404 | !=== READ PHYSICAL PARAMETERS FOR ISOTOPES |
---|
| 405 | niso = 0; nzone = 0; nphas = nqo; ntiso = 0; isoCheck = .FALSE. |
---|
[4727] | 406 | IF(readIsotopesFile()) CALL abort_physic(modname, 'Problem when reading isotopes parameters', 1) |
---|
[4482] | 407 | |
---|
| 408 | !############################################################################################################################## |
---|
| 409 | END IF |
---|
| 410 | !############################################################################################################################## |
---|
| 411 | !--- Convection / boundary layer activation for all tracers |
---|
[4727] | 412 | IF (.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1 |
---|
| 413 | IF (.NOT.ALLOCATED(pbl_flg)) ALLOCATE( pbl_flg(nbtr)); pbl_flg(1:nbtr) = 1 |
---|
[4482] | 414 | |
---|
| 415 | !--- Note: nqtottr can differ from nbtr when nmom/=0 |
---|
| 416 | nqtottr = nqtot - COUNT(delPhase(tracers%gen0Name) == 'H2O' .AND. tracers%component == 'lmdz') |
---|
| 417 | IF(COUNT(tracers%iso_iName == 0) - COUNT(delPhase(tracers%name) == 'H2O' .AND. tracers%component == 'lmdz') /= nqtottr) & |
---|
[4727] | 418 | CALL abort_physic(modname, 'pb dans le calcul de nqtottr', 1) |
---|
[4482] | 419 | |
---|
| 420 | !=== DISPLAY THE RESULTS |
---|
| 421 | CALL msg('nqo = '//TRIM(int2str(nqo)), modname) |
---|
| 422 | CALL msg('nbtr = '//TRIM(int2str(nbtr)), modname) |
---|
| 423 | CALL msg('nqtrue = '//TRIM(int2str(nqtrue)), modname) |
---|
| 424 | CALL msg('nqtot = '//TRIM(int2str(nqtot)), modname) |
---|
| 425 | CALL msg('niso = '//TRIM(int2str(niso)), modname) |
---|
| 426 | CALL msg('ntiso = '//TRIM(int2str(ntiso)), modname) |
---|
| 427 | #ifdef INCA |
---|
| 428 | CALL msg('nqCO2 = '//TRIM(int2str(nqCO2)), modname) |
---|
| 429 | CALL msg('nqINCA = '//TRIM(int2str(nqINCA)), modname) |
---|
| 430 | #endif |
---|
| 431 | t => tracers |
---|
| 432 | CALL msg('Information stored in infotrac_phy :', modname) |
---|
| 433 | IF(dispTable('issssssssiiiiiiii', & |
---|
| 434 | ['iq ', 'name ', 'lName ', 'gen0N ', 'parent', 'type ', 'phase ', 'compon', 'isPhy ', & |
---|
| 435 | 'iGen ', 'iqPar ', 'nqDes ', 'nqChld', 'iGroup', 'iName ', 'iZone ', 'iPhase'], & |
---|
| 436 | cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component, bool2str(t%isInPhysics)),& |
---|
| 437 | cat([(iq, iq=1, nqtot)], t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup, & |
---|
| 438 | t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname)) & |
---|
[4727] | 439 | CALL abort_physic(modname, "problem with the tracers table content", 1) |
---|
[4482] | 440 | IF(niso > 0) THEN |
---|
| 441 | CALL msg('Where, for isotopes family "'//TRIM(isotope%parent)//'":', modname) |
---|
| 442 | CALL msg(' isoKeys%name = '//strStack(isoKeys%name), modname) |
---|
| 443 | CALL msg(' isoName = '//strStack(isoName), modname) |
---|
| 444 | CALL msg(' isoZone = '//strStack(isoZone), modname) |
---|
| 445 | CALL msg(' isoPhas = '//TRIM(isoPhas), modname) |
---|
| 446 | ELSE |
---|
| 447 | CALL msg('No isotopes identified.', modname) |
---|
| 448 | END IF |
---|
| 449 | |
---|
| 450 | #ifdef ISOVERIF |
---|
| 451 | CALL msg('iso_iName = '//strStack(int2str(PACK(tracers(:)%iso_iName, MASK=tracers(:)%iso_iGroup==iH2O))), modname) |
---|
| 452 | #endif |
---|
[3677] | 453 | #ifdef CPP_StratAer |
---|
[4482] | 454 | IF (type_trac == 'coag') THEN |
---|
[4056] | 455 | nbtr_bin = COUNT([(tracers(iq)%name(1:3)=='BIN', iq=1, nqtot)]) |
---|
| 456 | nbtr_sulgas = COUNT([(tracers(iq)%name(1:3)=='GAS', iq=1, nqtot)]) |
---|
[4071] | 457 | tnames = PACK(tracers(:)%name, MASK=tracers(:)%isInPhysics) |
---|
[4056] | 458 | id_BIN01_strat = strIdx(tnames, 'BIN01' ) |
---|
[4482] | 459 | id_OCS_strat = strIdx(tnames, 'GASOCS' ) |
---|
[4056] | 460 | id_SO2_strat = strIdx(tnames, 'GASSO2' ) |
---|
| 461 | id_H2SO4_strat = strIdx(tnames, 'GASH2SO4') |
---|
| 462 | id_TEST_strat = strIdx(tnames, 'GASTEST' ) |
---|
[4120] | 463 | CALL msg('nbtr_bin ='//TRIM(int2str(nbtr_bin )), modname) |
---|
| 464 | CALL msg('nbtr_sulgas ='//TRIM(int2str(nbtr_sulgas )), modname) |
---|
| 465 | CALL msg('id_BIN01_strat ='//TRIM(int2str(id_BIN01_strat)), modname) |
---|
| 466 | CALL msg('id_OCS_strat ='//TRIM(int2str(id_OCS_strat )), modname) |
---|
| 467 | CALL msg('id_SO2_strat ='//TRIM(int2str(id_SO2_strat )), modname) |
---|
| 468 | CALL msg('id_H2SO4_strat ='//TRIM(int2str(id_H2SO4_strat)), modname) |
---|
| 469 | CALL msg('id_TEST_strat ='//TRIM(int2str(id_TEST_strat )), modname) |
---|
| 470 | END IF |
---|
[3677] | 471 | #endif |
---|
[4482] | 472 | CALL msg('end', modname) |
---|
[4056] | 473 | |
---|
[4120] | 474 | END SUBROUTINE init_infotrac_phy |
---|
[2320] | 475 | |
---|
| 476 | END MODULE infotrac_phy |
---|