Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug setting destination grid object sigma vector passed to MESSy #314

Merged
merged 1 commit into from
Mar 18, 2025

Conversation

lizziel
Copy link
Contributor

@lizziel lizziel commented Mar 17, 2025

Name and Institution (Required)

Name: Lizzie Lundgren
Institution: Harvard University

Describe the update

While investigating differences in CESM output when using HEMCO with different core counts I discovered a bug in vertical regridding using MESSy. The MESSy regridding scheme is used by models that input 3D atmospheric data on a different vertical grid than model grid, e.g. CESM and WRF-GC but not GEOS-Chem Classic or GCHP.

The collapse of the HEMCO grid 3D pressure sigma array into a 1D vector passed to the MESSy regridding scheme is at odds with how it is used within MESSy. Swapping two dimensions of the collapse (lat and lon) fixes the bug. This bug is not part of MESSy (written in 2002) but the interface to MESSy within HEMCO (written in 2014). It has been present since MESSy was originally implemented into HEMCO.

The bug causes the wrong horizontal layout of sigma pressure profiles during vertical regridding. In MPI models, the profiles within a given core are correct but are distributed across the regional grid of that core incorrectly.

Expected changes

This update only affects models which use HEMCO to vertically regrid input data that are not on the model vertical grid, i.e. CESM and WRF-GC. The extent of the impact is dependent on the model decomposition and how many CPUs are used.

To assess the impact I ran a 3-hr CESM run using HEMCO with CAM-chem. All emissions were turned off except for AEIC CO emissions, which were computed and output as a diagnostic every timestep. The following results show the impact of the bug at hour 3 of the run (instantaneous output). All plots show a single level where CO emissions from aviation tracks are visible.

Before and after the fix at 72 cores:
72cores

Before and after the fix at 144 cores:
144cores

72 cores vs 144 cores with the bug present shows the core-dependency:
72_vs_144_prefix

72 cores vs 144 cores with bug fix applied shows that the core-dependency is no longer there:
AEIC_CO__CESM_HCO_CO_lev15_postfix

Reference(s)

None

Related Github Issue

closes #315
ESCOMP/CAM#856

This update only affects models which use HEMCO to vertically regrid
input data that are not on the model vertical grid, i.e. CESM and WRF-GC.
Previously the 3D vertical sigma array was collapsed into a 1D array
passed to MESSy with the wrong ordering of latitudes and longitudes.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
@lizziel lizziel added topic: ESMF or MPI Related to issues in the ESMF and/or MPI environments topic: Regridding or Interpolation Related to issues with time interpolation or horiziontal/vertical regridding category: Bug Fix Fixes a bug that was previously reported labels Mar 17, 2025
@lizziel lizziel added this to the 3.10.3 milestone Mar 17, 2025
@lizziel lizziel self-assigned this Mar 17, 2025
@lizziel lizziel marked this pull request as ready for review March 17, 2025 20:31
@lizziel lizziel requested a review from yantosca March 17, 2025 20:31
Copy link
Contributor

@yantosca yantosca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lizziel. Such a complex bug caused by swapping 2 lines of code! Good to merge.

@lizziel
Copy link
Contributor Author

lizziel commented Mar 18, 2025

I should add that "round psfc" appears in the plot titles because I applied rounding to surface pressure. This is due to a second source of core-dependency differences in 3D emissions, although one with less impact. The current implementation of ESMF regridding from the CAM grid to the HEMCO grid in the HEMCO_CESM interface introduces numerical noise. To get around this I rounded surface pressure post-regrid to achieve identical surface pressure in both the 72 cores and 144 cores runs. To follow progress on that bug see ESCOMP/CAM#856.

@lizziel lizziel changed the base branch from main to dev/3.10.3 March 18, 2025 14:45
@lizziel lizziel merged commit 9db021a into dev/3.10.3 Mar 18, 2025
14 of 15 checks passed
@lizziel lizziel deleted the bugfix/messy_vertical_regrid branch March 25, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Bug Fix Fixes a bug that was previously reported topic: ESMF or MPI Related to issues in the ESMF and/or MPI environments topic: Regridding or Interpolation Related to issues with time interpolation or horiziontal/vertical regridding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in MESSy vertical regridding
2 participants