MICM Chemistry

A unique chemistry module that can be implemented in any atmosphere model used at NCAR.
https://github.com/ncar/micm

Category: Atmosphere
Sub Category: Atmospheric Chemistry and Aerosol

Keywords

atmospheric-chemistry atmospheric-modeling atmospheric-science cuda gpu gpu-acceleration hpc ode-solver

Keywords from Contributors

climate hydrology climate-model climate-science e3sm snl-applications

Last synced: about 17 hours ago
JSON representation

Repository metadata

A model-independent chemistry module for atmosphere models

README.md

MICM Chemistry

Model Independent Chemical Module. MICM can be used to configure and solve atmospheric chemistry systems.

GitHub Releases
License
Docker builds
Windows
Mac
Ubuntu
codecov
DOI
FAIR checklist badge
Try it on Compiler Explorer

Note
MICM 3.x.x is part of a refactor and may include breaking changes across minor revision numbers
and partially implemented features

Getting Started

Installing MICM locally

To build and install MICM locally, you must have CMake installed on your machine.

Open a terminal window, navigate to a folder where you would like the MICM files to exist,
and run the following commands:

git clone https://github.com/NCAR/micm.git
cd micm
mkdir build
cd build
ccmake ..
sudo make install -j 8

To run the tests:

make test

If you would later like to uninstall MICM, you can run
sudo make uninstall from the build/ directory.

Options

There are multiple options for running micm. You can use our
solvers on CPUs, cuda-based solvers to solve chemistry on GPUs,
or Kokkos-based solvers for performance portability across CPUs and GPUs
(-DMICM_ENABLE_KOKKOS=ON; see the
Kokkos guide).
Please read our docs
to learn how to enable these options.

Third-party components fetched at build time (Kokkos, GoogleTest) are listed in
NOTICE along with their licenses.

Running a MICM Docker container

You must have Docker Desktop installed and running.
With Docker Desktop running, open a terminal window.
To build the latest MICM release, run the following command to start the MICM container:

docker run -it ghcr.io/ncar/micm:release bash

To build the latest pre-release version of MICM, instead run:

git clone https://github.com/NCAR/micm.git
cd micm
docker build -t micm -f docker/Dockerfile .
docker run -it micm bash

Inside the container, you can run the MICM tests from the /build/ folder:

cd /build/
make test

Using the MICM API

The following example solves the fictitious chemical system:

foo       --k1--> 0.8 bar + 0.2 baz
foo + bar --k2--> baz

The k1 and k2 rate constants are for Arrhenius reactions. See the MICM documentation for details on the types of reactions available in MICM and how to configure them.

To solve this system save the following code in a file named foo_chem.cpp:

#include <micm/process/chemical_reaction_builder.hpp>
#include <micm/process/rate_constant/arrhenius_rate_constant.hpp>
#include <micm/solver/rosenbrock.hpp>
#include <micm/solver/solver_builder.hpp>

#include <iomanip>
#include <iostream>

using namespace micm;

int main(const int argc, const char *argv[])
{
  auto foo = Species{ "Foo" };
  auto bar = Species{ "Bar" };
  auto baz = Species{ "Baz" };

  Phase gas_phase{ "gas", std::vector<PhaseSpecies>{ foo, bar, baz } };

  System chemical_system{ gas_phase };

  Process r1 = ChemicalReactionBuilder()
                   .SetReactants({ foo })
                   .SetProducts({ StoichSpecies(bar, 0.8), StoichSpecies(baz, 0.2) })
                   .SetRateConstant(ArrheniusRateConstantParameters{ .A_ = 1.0e-3 })
                   .SetPhase(gas_phase)
                   .Build();

  Process r2 = ChemicalReactionBuilder()
                   .SetReactants({ foo, bar })
                   .SetProducts({ StoichSpecies(baz, 1) })
                   .SetRateConstant(ArrheniusRateConstantParameters{ .A_ = 1.0e-5, .C_ = 110.0 })
                   .SetPhase(gas_phase)
                   .Build();

  std::vector<Process> reactions{ r1, r2 };

  auto solver = micm::CpuSolverBuilder<micm::RosenbrockSolverParameters>(micm::RosenbrockSolverParameters::ThreeStageRosenbrockParameters())
                    .SetSystem(chemical_system)
                    .SetReactions(reactions)
                    .Build();

  State state = solver.GetState();

  state.conditions_[0].temperature_ = 287.45;  // K
  state.conditions_[0].pressure_ = 101319.9;   // Pa
  state.conditions_[0].CalculateIdealAirDensity();
  state[foo] = 20.0;                           // mol m-3

  state.PrintHeader();
  for (int i = 0; i < 10; ++i)
  {
    solver.UpdateStateParameters(state);
    auto result = solver.Solve(500.0, state);
    state.PrintState(i * 500);
  }

  return 0;
}

You can also run this example on Compiler Explorer.

To build and run the example using GNU (assuming the default install location):

g++ -o foo_chem foo_chem.cpp -I/usr/local/micm-3.13.0/include -std=c++20
./foo_chem

Output:

 time,        Foo,        Bar,        Baz
    0,   1.18e+01,   5.90e+00,   1.91e+00
  500,   6.79e+00,   9.05e+00,   3.32e+00
 1000,   3.83e+00,   1.07e+01,   4.21e+00
 1500,   2.14e+00,   1.17e+01,   4.74e+00
 2000,   1.19e+00,   1.22e+01,   5.04e+00
 2500,   6.58e-01,   1.24e+01,   5.21e+00
 3000,   3.64e-01,   1.26e+01,   5.31e+00
 3500,   2.01e-01,   1.27e+01,   5.36e+00
 4000,   1.11e-01,   1.27e+01,   5.39e+00
 4500,   6.13e-02,   1.28e+01,   5.41e+00

Performance

Every push to main records the benchmark and publishes the history as a chart.
Instruction counts come from callgrind and are deterministic, so they show a
hot-path change even when the wall-clock time is noisy.

Two mechanisms run. Chapman has 7 reactions and shows per-call overhead. TS1 has
547 reactions and shows how the solver scales with mechanism size.

chart mechanism backend grid cells steps machine
Instruction counts Chapman CPU 2000 5 ubuntu-latest
Wall-clock timing Chapman CPU 10000 30 ubuntu-latest
Instruction counts TS1 CPU 2000 5 ubuntu-latest
Wall-clock timing TS1 CPU 10000 30 ubuntu-latest
Wall-clock timing Chapman and TS1 CUDA 10000 30 CIRRUS a10 GPU runner
Wall-clock timing Chapman and TS1 Kokkos 10000 30 CIRRUS a10 GPU runner

Every step advances the solver by 30 s. The callgrind charts use a smaller
grid and fewer steps, because valgrind runs far slower than a native run. The
vector128 ordering pads its last group, so it solves 2048 cells rather than
2000, and 10112 rather than 10000.

Each pull request also gets a commit comment that compares its Chapman numbers
against the latest main values. See docs/performance.md
to run the benchmark yourself.

Citation

MICM is part of the MUSICA project and can be cited by reference to the MUSICA vision paper. The BibTeX entry below can be used to generate a citation for this.

@Article { acom.software.musica-vision,
    author = "Gabriele G. Pfister and Sebastian D. Eastham and Avelino F. Arellano and Bernard Aumont and Kelley C. Barsanti and Mary C. Barth and Andrew Conley and Nicholas A. Davis and Louisa K. Emmons and Jerome D. Fast and Arlene M. Fiore and Benjamin Gaubert and Steve Goldhaber and Claire Granier and Georg A. Grell and Marc Guevara and Daven K. Henze and Alma Hodzic and Xiaohong Liu and Daniel R. Marsh and John J. Orlando and John M. C. Plane and Lorenzo M. Polvani and Karen H. Rosenlof and Allison L. Steiner and Daniel J. Jacob and Guy P. Brasseur",
    title = "The Multi-Scale Infrastructure for Chemistry and Aerosols (MUSICA)",
    journal = "Bulletin of the American Meteorological Society",
    year = "2020",
    publisher = "American Meteorological Society",
    address = "Boston MA, USA",
    volume = "101",
    number = "10",
    doi = "10.1175/BAMS-D-19-0331.1",
    pages= "E1743 - E1760",
    url = "https://journals.ametsoc.org/view/journals/bams/101/10/bamsD190331.xml"
}

Community and contributions

We welcome contributions and feedback from anyone, everything from updating
the content or appearance of the documentation to new and
cutting edge science.

  • Collaboration

  • Contributor's guide

    • Before submiitting a PR, please thouroughly read this to you understand our expectations. We reserve the right to reject any PR not meeting our guidelines.

Documentation

Please see the MICM documentation for detailed
installation and usage instructions.

License

Copyright (C) 2018-2026 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: Model Independent Chemistry Module (MICM)
version: v3.13.0
doi: "10.5281/zenodo.10472189"
authors:
  - family-names: Dawson
    given-names: Matthew
  - family-names: Sun
    given-names: Jian
  - family-names: Shores
    given-names: Kyle
  - family-names: Fillmore
    given-names: David
  - family-names: Tan
    given-names: Qina
  - family-names: Craig
    given-names: Cheryl
  - family-names: Gim
    given-names: Jiwon
  - family-names: Waxmonsky
    given-names: Michael
  - family-names: Vitt
    given-names: Francis
  - family-names: Conley
    given-names: Andrew
  - family-names: Karsenti
    given-names: Aharon
license: Apache-2.0
url: "https://github.com/NCAR/micm"

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 1,501
Total Committers: 20
Avg Commits per committer: 75.05
Development Distribution Score (DDS): 0.704

Commits in past year: 152
Committers in past year: 9
Avg Commits per committer in past year: 16.889
Development Distribution Score (DDS) in past year: 0.678

Name Email Commits
Kyle Shores k****4@g****m 444
Matt Dawson m****n@u****u 193
David Fillmore f****e@u****u 189
github-actions[bot] 4****] 178
Qina Tan q****n@h****m 147
Jiwon Gim 5****e 122
Cheryl Craig c****g@u****u 74
Jian Sun s****n@u****u 68
Francis Vitt f****t@u****u 22
GitHub Actions a****s@g****m 17
Andrew Conley a****y@m****u 11
AndrewJConley a****y@u****u 10
mwaxmonsky 1****y 10
Montek Thind m****d@u****u 5
Copilot 1****t 3
David Fillmore 5****e 3
Angela Pak 3****k 2
Barry Baker b****a 1
Cheryl Craig c****g@m****u 1
aharon karsenti a****9@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 321
Total pull requests: 739
Average time to close issues: about 2 months
Average time to close pull requests: 3 days
Total issue authors: 11
Total pull request authors: 14
Average comments per issue: 0.55
Average comments per pull request: 0.88
Merged pull request: 652
Bot issues: 3
Bot pull requests: 239

Past year issues: 43
Past year pull requests: 85
Past year average time to close issues: 26 days
Past year average time to close pull requests: 4 days
Past year issue authors: 5
Past year pull request authors: 9
Past year average comments per issue: 0.28
Past year average comments per pull request: 1.27
Past year merged pull request: 72
Past year bot issues: 0
Past year bot pull requests: 25

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/ncar/micm

Top Issue Authors

  • mattldawson (105)
  • K20shores (90)
  • sjsprecious (50)
  • boulderdaze (38)
  • dwfncar (17)
  • mwaxmonsky (14)
  • github-actions[bot] (3)
  • mahboobctwd (1)
  • angelapak (1)
  • davidfillmore (1)
  • uncleJim21 (1)

Top Pull Request Authors

  • github-actions[bot] (239)
  • K20shores (167)
  • mattldawson (102)
  • sjsprecious (94)
  • boulderdaze (79)
  • mwaxmonsky (20)
  • dwfncar (13)
  • montythind (10)
  • qinatan (6)
  • angelapak (4)
  • Copilot (2)
  • davidfillmore (1)
  • leandrohstein (1)
  • bbakernoaa (1)

Top Issue Labels

  • enhancement (109)
  • bug (27)
  • good first issue (16)
  • question (15)
  • documentation (13)
  • Stale (6)
  • list issue (4)
  • invalid (1)
  • help wanted (1)

Top Pull Request Labels

  • enhancement (90)
  • bug (25)
  • documentation (2)

Package metadata

proxy.golang.org: github.com/NCAR/micm

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/NCAR/micm#section-documentation
  • Licenses: apache-2.0
  • Latest release: v3.13.0+incompatible (published 3 months ago)
  • Last Synced: 2026-10-04T15:04:03.248Z (1 day ago)
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 5.395%
    • Average: 5.576%
    • Dependent repos count: 5.758%
proxy.golang.org: github.com/ncar/micm

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/ncar/micm#section-documentation
  • Licenses: apache-2.0
  • Latest release: v3.13.0+incompatible (published 3 months ago)
  • Last Synced: 2026-10-04T15:04:02.566Z (1 day ago)
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 5.395%
    • Average: 5.576%
    • Dependent repos count: 5.758%

Dependencies

.github/workflows/clang-tidy.yml actions
  • actions/checkout v4 composite
.github/workflows/clang_format_non_inline.yml actions
  • actions/checkout v4 composite
.github/workflows/close_stale_issues.yml actions
  • actions/stale v9 composite
.github/workflows/runner.yml actions
  • actions/checkout v4 composite
.github/workflows/ubuntu.yml actions
  • actions/checkout v4 composite
docker/Dockerfile docker
  • fedora latest build
.github/workflows/docker_and_coverage.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v5 composite
.github/workflows/mac.yml actions
  • actions/checkout v4 composite
  • maxim-lobanov/setup-xcode v1 composite
.github/workflows/windows.yml actions
  • actions/checkout v4 composite
  • egor-tensin/setup-mingw v2 composite
environment.yml conda
  • cmake
  • doxygen
  • graphviz
  • pip
  • python 3.12
.github/workflows/publish-package.yml actions
  • actions/checkout v4 composite
  • docker/build-push-action v5 composite
  • docker/login-action v2 composite
  • docker/metadata-action 98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 composite
  • docker/setup-buildx-action v2 composite
.github/workflows/readme_example.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
.github/workflows/clang_format.yml actions
  • actions/checkout v3 composite
  • peter-evans/create-pull-request v3 composite
docs/requirements.txt pypi
  • breathe *
  • sphinx *
  • sphinx-book-theme *
  • sphinx-design *
.github/workflows/gpu-bench-comment.yml actions
  • actions/checkout v5 composite
  • actions/download-artifact v7 composite
  • benchmark-action/github-action-benchmark v1 composite
.github/workflows/runner.kokkos.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • benchmark-action/github-action-benchmark v1 composite
.github/workflows/perf-regression.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • benchmark-action/github-action-benchmark v1 composite
.github/workflows/benchmark-charts.yml actions
  • actions/checkout v4 composite
  • benchmark-action/github-action-benchmark v1 composite

Score: -Infinity