Skip to content

NCAR/miem

Repository files navigation

MIEM

Model Independent Emissions Module. MIEM can be used to configure and apply atmospheric emissions in host models.

Docker builds Windows Mac Ubuntu

Copyright (C) 2026 University Corporation for Atmospheric Research

Getting Started

Installing MIEM locally

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

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

git clone https://github.com/NCAR/miem.git
cd miem
mkdir build
cd build
cmake ..
sudo make install

To run the tests:

make test

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

Running a MIEM Docker container

You must have Docker Desktop installed and running. With Docker Desktop running, open a terminal window and run:

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

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

cd /build/
make test

Using the MIEM API

The following example configures a single anthropogenic emissions source and runs one model timestep.

Species mapping and inventory translation are handled upstream by MechanismConfiguration and musica::Translate(). By the time MIEMConfig is constructed here, species are already resolved.

To run this example save the following code in a file named miem_example.cpp:

#include <miem/config.hpp>
#include <miem/emissions.hpp>
#include <miem/emissions_state.hpp>

#include <iostream>

using namespace miem;

int main()
{
  SourceConfig cams_anthro{
    .name_                   = "CAMS anthropogenic",
    .mode_                   = SourceMode::Offline,
    .type_                   = SourceType::Anthropogenic,
    .file_pattern_           = "/path/to/CAMS-GLOB-ANT_{YYYY}-{MM}.nc",
    .temporal_interpolation_ = TemporalInterpolation::Linear,
    .vertical_injection_     = VerticalInjection::Surface,
    .category_               = 0,
    .hierarchy_              = 1,
    .scaling_factor_         = 1.0,
    .sector_                 = "anthropogenic",
  };

  MIEMConfig cfg{
    .sources_ = { cams_anthro },
  };

  Emissions emissions(cfg, /*n_cells=*/163842, /*n_vert_levels=*/60);

  EmissionsState state = emissions.Run(
    86400.0 * 180.0,  // sim_time_sec: day 180
    600.0             // dt_sec: 10 minutes
  );

  std::cout << "NO surface flux at cell 0: "
            << state.surface_flux_(0, "NO")
            << " kg m-2 s-1" << std::endl;

  return 0;
}

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

g++ -o miem_example miem_example.cpp -I./include -std=c++20
./miem_example

Output:

NO surface flux at cell 0: 0 kg m-2 s-1

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.

Documentation

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

License

About

Model Independent Emissions Module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors