ESCOMP / CAM

Community Atmosphere Model
71 stars 133 forks source link

Implementation of HEMCO in CESM/CAM #504

Open jimmielin opened 2 years ago

jimmielin commented 2 years ago

This issue is being posted to open discussions about the eventual implementation of HEMCO, the Harmonized Emissions Component (original implementation Keller et al., 2014, implementation in CESM Lin et al., 2021) in the CESM.

Intro

HEMCO is a versatile emissions and data component with the primary purpose of processing emissions data online with inventory selection, masking, and scaling functionality performed as described by a configuration file (see Lin et al., 2021 Figure 2). Emissions data is ingested from individual netCDF files of different inventories and combined into a collection of 3-D emissions containers for each chemical species. HEMCO also is capable of processing generic data containers that are used to provide data (e.g., UV albedo) for GEOS-Chem chemistry within CESM (working PR: https://github.com/ESCOMP/CAM/pull/484).

Motivation to implement HEMCO as an online emissions data source is to remove the need for re-processing offline emission datasets for simulations, instead allowing users to select on-the-fly emission inventories to use, their hierarchy/precedence and effective geographical region, and apply scale factors on-line. The original netCDF input data does not need to be modified, sub-setting and regridding are performed by HEMCO automatically to the target simulation domain.

In its current implementation, HEMCO within CESM can provide emissions and data to GEOS-Chem chemistry (#484) and CAM-chem chemistry (through source mods available here: https://github.com/jimmielin/HEMCO_CESM/tree/development/SourceMods to mo_extfrc.F90 and mo_srf_emissions.F90).

High level code description

The HEMCO-to-CESM interface (HEMCO_CESM) has been implemented as a module within CAM residing under src/hemco. The most recent version of the code is available at: https://github.com/jimmielin/HEMCO_CESM but will eventually be hosted under ESCOMP/HEMCO_CESM. It includes:

HEMCO in CESM runs on its own separate grid and MPI decomposition (as initialized by hco_esmf_grid), currently limited to a rectilinear latitude-longitude grid (see limitations), and regrids its computed data to the CAM grid as described by cam_physics_mesh in recent versions of CAM.

3-D emissions can be computed. ESMF regridding is layer-by-layer, and vertical regridding is only performed when files are read into HEMCO_CESM.

Emissions and data computed are written into the CAM physics buffer (prefixed by HCO_) and retrieved by whatever component within CAM that requires this data.

Requirements

Apart from the main HEMCO source code, the following things were required:

Limitations and points of discussion

End notes and implementation roadmap

Presently, changes required for HEMCO to operate within CAM and GEOS-Chem are included as part of the GEOS-Chem PR (#484) but can be separated if needed. The sourcemods for CAM-chem are available, but not included by default (they're renamed to .G90 extension so kept part of the repository, but they need to be manually moved to sourcemods for use).

Please refer to a preliminary target branch here: https://github.com/CESM-GC/CAM/tree/HEMCO-CESM_rebased_on_cam6_3_045 based off cam6_3_045. Changes are minimal:

I hope this issue can initiate discussion of a roadmap to implement HEMCO within CESM. We suggest implementing it in phases, first bringing HEMCO into CESM so GEOS-Chem can be operational, then implementing a transitional period for CAM-chem users to possibly use HEMCO, finally moving all CAM-chem compsets to full HEMCO usage.

Thank you for your help and please do not hesitate to provide any feedback.

lkemmons commented 2 years ago

Current plan is to implement HEMCO in CESM on its own, prior to implementation of GEOS-Chem in CESM.

jimmielin commented 2 years ago

Build instructions (work in progress)

Reference case, data, and results are WIP. I'll update here as soon as possible. Below please find building instructions for a test case with CAM-chem support:

Work is ongoing to make reference output match CAM-chem output that should be using the same emission inventory (CEDS) at /glade/scratch/hplin/camchem_run_202203/run

Notes

Note that -hemco defaults to 1 in config_files/definition.xml for testing only and should be changed to 0 before merge:

<entry id="hemco" valid_values="0,1" value="1">
Switch to turn on Harmonized Emissions Component (HEMCO): 0 => no, 1 => yes.
WARNING THIS IS ON BY DEFAULT FOR DEVELOPMENT - DO NOT SUBMIT THIS TO PRODUCTION CODE
</entry>

It is set to 1 for testing all compsets with HEMCO enabled without manually making a compset. CAM-chem with HEMCO compsets will need to be created in the future.