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