# Generate MPAS-CMAQ input files

**URL:** <https://forum.cmascenter.org/t/generate-mpas-cmaq-input-files/5524>\
**Category:** MPAS-CMAQ\
**Created:** [January 17, 2025, 2:43pm UTC](https://forum.cmascenter.org/t/generate-mpas-cmaq-input-files/5524 "2025-01-17T14:43:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.cmascenter.org/u/penguin)\
**Post date:** [January 17, 2025, 2:43pm UTC](https://forum.cmascenter.org/t/generate-mpas-cmaq-input-files/5524/1 "2025-01-17T14:43:08Z")

</div>

Hello! I have successfully installed and tested MPAS-CMAQ on my server, and now it’s time to run the model. Since I have never worked with MPAS before, I am a bit confused about preparing the initial input files. The test case provides many files, and I would like to know if the soilndg, ozone, sfc\_update, fdda, and restart files are all necessary in the MPAS part, or is it sufficient to have just the init file? If these files are necessary, I assume the init and sfc\_update files are generated by the `init_atmosphere_model`, but how are the other four files generated?

In the CMAQ part, I previously had a tool for processing emission inventories, but it generated emission inventories for rectangular grids. Since MPAS changes the data storage method (from 2D to 1D) and grid shape, I feel like it’s not just a matter of converting from a rectangular grid to a hexagonal grid when handling emissions.

Emission file for rectangular grid：

 ![faaf8d30220e433b2b9042526fc6d64](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/c/cff378f92b5406b01a42632038218bee4e6b4f7a.png)  
Emission files provided in the MPAS-CMAQ test case：  
 ![1bc071d6908170e5c54d574af592171](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/0/0f29f170c8f3b724dfec89b837c5062de677a062.png)  
Could you provide me with some ideas on how to modify the tool? For example, in the case of a 120km uniform grid, are emissions written sequentially starting from a specific grid?  
Looking forward to your reply!

Best regards,  
Pan

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [January 17, 2025, 2:59pm UTC](https://forum.cmascenter.org/t/generate-mpas-cmaq-input-files/5524/2 "2025-01-17T14:59:39Z")

</div>

From [https://cjcoats.github.io/ioapi/MODMPASFIO.html#notes](https://cjcoats.github.io/ioapi/MODMPASFIO.html#notes): here is the MPAS-netcdf file format specification: [https://mpas-dev.github.io/files/documents/MPAS-MeshSpec.pdf](https://mpas-dev.github.io/files/documents/MPAS-MeshSpec.pdf)

> Note that MPAS-netCDF-format files are quite complex…

Also note the emissions-units difference between the two: CMAQ-emissions are in non-MKS (and non-interpolatable) units mass per (implicit) grid cell per (implicit) time step, whereas your MPAS file’s emissions units are (interpolatable MKS) moles/sec/m^2 mass per area per time… [This last means that M3Tools program [_ **mpastom3** _](https://cjcoats.github.io/ioapi/MPASTOM3.html) cannot be used directly to interpolate MPAS emissions to CMAS emissions.]

---

<div class="post-metadata">

**Author:** ![james.beidler](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@james.beidler](https://forum.cmascenter.org/u/james.beidler)\
**Post date:** [January 17, 2025, 5:58pm UTC](https://forum.cmascenter.org/t/generate-mpas-cmaq-input-files/5524/3 "2025-01-17T17:58:35Z")

</div>

You can determine the index order, location, shape, and area of each cell by referencing the dimensions, variables, and global attributes (names are defined in the specification link provided in the previous post) in an existing 120 km uniform mesh MPAS netCDF. Note that the shape of the cells may not be hexagonal, with polygons on the 120x120 mesh having up to 10 sides.

Interpolating to a mesh, even a relatively coarse one, is computationally expensive. For the global emissions in the test cases we pre-computed a matrix to allocate emissions from the HTAP 0.1x0.1 degree grid to the target mesh. However, over the CONUS we developed spatial surrogates for SMOKE that allowed us to directly allocate emissions from county-level inventories to the mesh. The SMOKE option is preferred if you have the surrogate data and inventories to support it.

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [January 17, 2025, 6:31pm UTC](https://forum.cmascenter.org/t/generate-mpas-cmaq-input-files/5524/4 "2025-01-17T18:31:58Z")

</div>

> Interpolating to a mesh, even a relatively coarse one, is computationally expensive…

But see I/O API [`MODULE MODMPASFIO`](https://cjcoats.github.io/ioapi/MODMPASFIO.html) 2017-vintage routine [`MPINTERP()`](https://cjcoats.github.io/ioapi/MODMPASFIO.html#interp), which does this task quite efficiently.

Note also that this routine resolves the array-transpose issue between the two formats, where gridded CMAQ subscripting is `(...,LAYER)` whereas MPAS subscripting is `(LAYER,...)`
