180 likes | 244 Views
This project focuses on comparing different chemical mechanisms using box models to explore sensitivities to changes in NOx and VOC levels. It aims to run various scenarios in different environments and perform sensitivity analyses. The tool, moz2kpp.py, helps translate gas-phase mechanisms accurately and consistently for ease of use. It provides detailed documentation of species and reactions, aiding users in model development and analysis. The program supports both MOZ and KPP formats, making it versatile for different applications.
E N D
moz2kpp.py (includes also a rudimentary kpp2moz routine) Martin Schultz
Motivation • boxmodelintercomparisonofchemicalmechanisms • focus on OH recycling (isoprenechemistry) • useofstandardscenarios („Poppe scenarios“) • exploresensitivitiestochanges in NOxand VOC levels/emissions Boxmodelusedis CAABA/MECCA (Sander et al., 2011) CAABA/MECCA isbased on KPP
Selectionofmechanisms • Goal istorun ~4 different scenarios: • (middle) freetroposphere • clean marine environment • urbanbio (urban plumetransportedover a forest) • clean bio • Thenperformsensitivityvariations (~36 each) • ApplicationforandPEGASOS projects • So far KPP mechanismsavailablefor MOZ3.5, TM5, MECCA • In preparation: ECHAM6-HAMMOZ, MOCAGE
Design goalsof moz2kpp.py • Automatictranslationoffull gas-phase mechanismtoavoiderrors • Useconsistentnamingofspeciesandreaction tags wherepossible • Try todocumentspeciesandreactions (andpreservedocumentation) • Maketool easy touse
Formats: mozpp (2) • Things tobeawareof: • Reactionlabelsandspeciesnamesareused in themodelcode • User-definedreactionsindicatedbysimplyomitting a rate coefficientterm • Reactionproductscan span multiple lines: k-term on firstline(!) • NEW: • Documentationpossible (add „!“ or „#“ ascommentcharacter on anyline)
Formats: kpp (as in CAABA/MECCA) • Twofiles: • spc – definitionofspecies • eqn – definitionofreactions SPC
Formats: kpp (as in CAABA/MECCA) (2) header … EQN
Formats: kpp (as in CAABA/MECCA) (3) • Things tobeawareof: • CAABA/MECCA usescommentfeatures („{…}“) for 4 purposes: • additionof „M“ • labelofreaction type orscope (St, Tr, Cl, …) • uncertaintyspecificationfor Monte-Carlo runs • literaturereference • All reactionsarelabeled in a schematicfashion • user-defined k terms must bedefined in thecode(example „k_HO2_HO2“)
moz2kpp.py • Modules required: • datetime (standard) • re (standard) • numpy (standard) • Main program: • (F5 in Windows shell, or „python moz2kpp.py“)
moz2kpp.py (2) • Arguments andkeywordsofmoz2kppfunction: • inputfile: name of the MOZPP formatted mechanism input file • kppspcfile: name of the KPP formatted output file with species definitions (*.spc) • kppeqnfile: name of the KPP formatted output file with equations (*.eqn) • kppreffile: name of an existing KPP file for equation labels • use_alias: if True, then MOZART species names will be replaced by KPP names • Note: you must have a valid species translation table in species_map.csv
moz2kpp.py (3) • Arguments andkeywordsofkpp2mozfunction: • inputfile: name of the KPP formatted equations file • outputfile: name of the MOZPP formatted output file • use_alias: if True, then KPP species names will be replaced by MOZART names • Notes: • you must have a valid species translation table in species_map.csv • species names will be extracted automatically from reaction list
species_map.csv Translatesspeciesnamesfrom/to KPP/MOZ andprovides „documentation“: Note: molecularcomposition (needed in KPP spcfile) isderivedfrom MOZPP „formula“ in specieslist. Couldbeincluded in csvfileinstead …
moz2kpp.py – Data structureforreactions reactions: listconsistingoftuples (educts, products, kterm, label [rtype], comment) educts: listcontainingstringswithspecies (photohasonlyoneeduct) products: listoftupleswith(yield, species) kterm: string (formatvariesfor MOZ and KPP kterms) label: string rtype (only KPP): stringidentifyingreaction type („St“, „Tr“, …) comment: string Example: write a formattedreactionstring: