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