acom-music-box

A box/column model using MICM chemistry

https://github.com/ncar/music-box

Science Score: 85.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    6 of 15 committers (40.0%) from academic institutions
  • Institutional organization owner
    Organization ncar has institutional domain (ncar.ucar.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords from Contributors

ode-solver atmospheric-chemistry atmospheric-modeling atmospheric-science standardization interpretability quantum-computing pde correlation hack
Last synced: 6 months ago · JSON representation ·

Repository

A box/column model using MICM chemistry

Basic Info
Statistics
  • Stars: 35
  • Watchers: 9
  • Forks: 15
  • Open Issues: 17
  • Releases: 33
Created over 5 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

MusicBox

MusicBox: A MUSICA model for boxes and columns.

License CI Status codecov PyPI version DOI Binder

Copyright (C) 2020 National Science Foundation - National Center for Atmospheric Research

Installation

pip install acom_music_box

If you would like GPU support, you must first add the NVIDIA pypi index and then you can specify the gpu install option for music box.

pip install --upgrade setuptools pip wheel pip install nvidia-pyindex pip install acom_music_box[gpu]

Using the MusicBox API

MusicBox makes its chemical mechanism analysis and visualization available through a Python API. The following example works through solving a simple chemistry system. Please refer to the official documentation for further tutorials and examples. ```python

Import MusicBox, MusicBox conditions, and Musica mechanisms:

from acommusicbox import MusicBox, Conditions import musica.mechanism_configuration as mc

Define the chemical system of interest

MusicBox uses Musica (https://ncar.github.io/musica/index.html) to create specific chemical species and phases of interest for chemical mechanisms.

A = mc.Species(name="A") B = mc.Species(name="B") C = mc.Species(name="C")

species = {"A":A, "B":B, "C":C}

gas = mc.Phase(name="gas", species=list(species.values()))

Define a mechanism of interest

Through Musica, several different mechanisms can be explored to define reaction rates. Here, we use the Arrhenius equation as a simple example.

arr1 = mc.Arrhenius(name="A->B", A=4.0e-3, C=50,reactants=[species["A"]], products=[species["B"]], gas_phase=gas)

arr2 = mc.Arrhenius(name="B->C", A=1.2e-4, B=2.5, C=75, D=50, E=0.5, reactants=[species["B"]], products=[species["C"]], gas_phase=gas)

mechanism = mc.Mechanism(name="test_mechanism", species=list(species.values()),phases=[gas], reactions=[arr1, arr2])

Create a box model

To create a box model, including its mechanisms, conditions, length, time, and step times:

boxmodel = MusicBox() boxmodel.load_mechanism(mechanism)

In the box model, the initial set of conditions represent the starting environment for the reactions.

Both initial and evolving conditions are typically created alongside the creation of the box model:

boxmodel.initialconditions = Conditions(temperature=300.0, pressure=101000.0, species_concentrations={ "A": 1.0, "B": 3.0, "C": 5.0})

Evolving conditions represent a set of environmental and species values or rate constants that the box model should use at a specific time step.

The following adds an evolving condition to the model, the first float represents the time when the condition evolves:

boxmodel.addevolvingcondition(300.0,Conditions(temperature=290.0, pressure=100200.0, speciesconcentrations={"A": 1.0, "B": 3.0, "C": 10.0}))

boxmodel.boxmodeloptions.simulationlength = 20 # total simulation time boxmodel.boxmodeloptions.chemsteptime = 1 # time step for chemical reaction boxmodel.boxmodeloptions.outputsteptime = 4 # time step between each output

Solve your newly-created box model and view results:

df = box_model.solve() print(df)

To visualize specific results:

import matplotlib.pyplot as plt

df.plot(x='time.s', y=['CONC.A.mol m-3', 'CONC.B.mol m-3', 'CONC.C.mol m-3'], title='Concentration over time', ylabel='Concentration (mol m-3)', xlabel='Time (s)') plt.show()

```

Command line tool

MusicBox provides a command line tool that can run configurations as well as some pre-configured examples. Basic plotting can be done with matplotlib.

Checkout the command line options

music_box -h

Run an example. Notice that the output, in csv format, is printed to the terminal.

music_box -e Chapman

Output can be saved to a csv file (the default format) and printed to the terminal.

music_box -e Chapman -o output

Output can be saved to a csv file by specifying the .csv extension for Comma-Separated Values.

music_box -e Chapman -o output.csv

Output can be saved to a file as netcdf file by specifying the .nc file extension.

music_box -e Chapman -o output.nc

Output can be saved to a file in csv format when a filename is not specified. In this case a timestamped csv file is made.

music_box -e Chapman

You may also specify multiple output files with different formats, using the file extension.

music_box -e Analytical -o results.csv -o results.nc

You can also run your own configuration

music_box -c my_config.json

Plotting

Some basic plots can be made to show concentrations throughout the simulation using matplotlib.

music_box -e Chapman -o output.csv --plot O1D

You can also make multiple plots by specifying groupings of species

music_box -e TS1 --plot O3 --plot PAN,HF

Note that the windows may overlap each other

By default all plot units are in mol m-3. You can see a list of unit options to specify with --plot-output-unit

music_box -h

It is used like this

music_box -e TS1 --plot O3 --plot-output-unit "ppb"

Development and Contributing

For local development, install music-box as an editable installation:

pip install -e '.[dev]'

Tests

pytest

Owner

  • Name: NSF National Center for Atmospheric Research
  • Login: NCAR
  • Kind: organization
  • Location: Boulder, CO

NSF NCAR is sponsored by the U.S. National Science Foundation and managed by the University Corporation for Atmospheric Research.

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite it as below.
title: MusicBox
version: v2.9.1
authors:
  - family-names: Dawson
    given-names: Matthew
  - family-names: Shores
    given-names: Kyle
  - family-names: Conley
    given-names: Andrew
  - family-names: De la Garza
    given-names: Evan
  - family-names: Drury
    given-names: Walker
  - family-names: Garza
    given-names: Alexander
  - family-names: Fattig
    given-names: Brendan
  - family-names: Drews
    given-names: Carl
  - family-names: Thind
    given-names: Montek
  - family-names: Kiran
    given-names: Aditya
  - family-names: Winney
    given-names: Aidan
  - family-names: Pak
    given-names: Angela
license: Apache-2.0
url: "https://github.com/NCAR/music-box"

GitHub Events

Total
  • Create event: 62
  • Release event: 4
  • Issues event: 67
  • Watch event: 27
  • Delete event: 56
  • Member event: 4
  • Issue comment event: 162
  • Push event: 337
  • Pull request review comment event: 190
  • Pull request event: 119
  • Pull request review event: 241
  • Fork event: 5
Last Year
  • Create event: 62
  • Release event: 4
  • Issues event: 67
  • Watch event: 27
  • Delete event: 56
  • Member event: 4
  • Issue comment event: 162
  • Push event: 337
  • Pull request review comment event: 190
  • Pull request event: 119
  • Pull request review event: 241
  • Fork event: 5

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 362
  • Total Committers: 15
  • Avg Commits per committer: 24.133
  • Development Distribution Score (DDS): 0.646
Past Year
  • Commits: 134
  • Committers: 10
  • Avg Commits per committer: 13.4
  • Development Distribution Score (DDS): 0.493
Top Committers
Name Email Commits
Matthew Dawson m****n@u****u 128
Kyle Shores k****4@g****m 94
s-omas 4****s 66
github-actions[bot] 4****] 31
Carl Drews d****s@u****u 12
alexjamesgarza 1****a 6
Andrew Conley a****y@u****u 5
Montek Thind m****d@u****u 5
Jiwon Gim j****m@u****u 5
matchaSamurai 9****3 3
GitHub Actions a****s@g****m 3
Mudassir Chapra 3****0 1
Evan De la Garza 1****2 1
AshayV04 1****4 1
Matthew Dawson m****n@m****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 137
  • Total pull requests: 219
  • Average time to close issues: 11 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 13
  • Total pull request authors: 18
  • Average comments per issue: 0.76
  • Average comments per pull request: 0.8
  • Merged pull requests: 181
  • Bot issues: 0
  • Bot pull requests: 39
Past Year
  • Issues: 52
  • Pull requests: 120
  • Average time to close issues: 17 days
  • Average time to close pull requests: 2 days
  • Issue authors: 9
  • Pull request authors: 12
  • Average comments per issue: 0.58
  • Average comments per pull request: 1.1
  • Merged pull requests: 93
  • Bot issues: 0
  • Bot pull requests: 29
Top Authors
Issue Authors
  • mattldawson (51)
  • K20shores (33)
  • AndrewJConley (16)
  • boulderdaze (10)
  • angelapak (7)
  • carl-drews (6)
  • aidan-winney (5)
  • marybarthbrock (2)
  • adityakiran1423 (2)
  • SancyW (2)
  • kkowalsk (1)
  • sjsprecious (1)
  • jolsolsen (1)
Pull Request Authors
  • K20shores (58)
  • mattldawson (44)
  • github-actions[bot] (39)
  • carl-drews (14)
  • aidan-winney (11)
  • s-omas (11)
  • angelapak (10)
  • montythind (6)
  • alexjamesgarza (6)
  • boulderdaze (6)
  • adityakiran1423 (3)
  • AndrewJConley (3)
  • DeeGrant (2)
  • AshayV04 (2)
  • eadlg2 (1)
Top Labels
Issue Labels
enhancement (46) documentation (19) bug (18) good first issue (7) question (5) help wanted (1) Stale (1) blocked (1)
Pull Request Labels
documentation (15) bug (4) enhancement (2) good first issue (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 410 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 27
  • Total maintainers: 3
pypi.org: acom-music-box

An atmospheric chemistry box model. Powered by MUSICA.

  • Versions: 27
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 410 Last month
Rankings
Dependent packages count: 9.6%
Average: 36.4%
Dependent repos count: 63.2%
Maintainers (3)
Last synced: 6 months ago

Dependencies

.github/workflows/test.yml actions
  • actions/checkout v2 composite
Dockerfile docker
  • fedora 35 build
.github/workflows/publish-package.yml actions
  • actions/checkout v2 composite
  • docker/build-push-action v5 composite
  • docker/login-action f054a8b539a109f9f41c372932f1ae047eff08c9 composite
  • docker/metadata-action 98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 composite