Skip to content

Global moving nests: Fix coarse-to-fine updates - #1917

Open
J-Lentz wants to merge 7 commits into
NOAA-GFDL:mainfrom
J-Lentz:fix_c2f_updates
Open

J-Lentz wants to merge 7 commits into
NOAA-GFDL:mainfrom
J-Lentz:fix_c2f_updates

Conversation

@J-Lentz

@J-Lentz J-Lentz commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description
In compute_overlap_coarse_to_fine, which determines overlaps for coarse-to-fine updates, the existing tile->tile coordinate transforms do not work when a nest's west or south halo overhangs across the coarse grid's tile boundary. This has been resolved by rewriting the coordinate transforms. The two existing coordinate transform functions, convert_index_to_nest and convert_index_to_coarse, have been replaced with a unified convert_index function.

While the old coordinate transforms assumed that data being transferred from a coarse PE to a fine PE would come either from the east (in the case of a horizontal overhang) or from the north (in the case of a vertical overhang), the new transforms allow data to be transferred from any adjacent tile on the coarse grid. However, large overhangs which extend beyond adjacent tiles are no longer supported.

How Has This Been Tested?
Existing unit tests pass, with one modification. Namely, in test_mpp_nesting.sh, there is a case where a nest spans two full tiles in the horizontal direction: the size of this nest has been reduced so that its overhang no longer extends beyond the adjacent tile.

Coarse-to-fine update results seem to be correct for nests at tile edges and in corners. However, new unit tests are needed for these cases (TODO).

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

Jesse Lentz added 4 commits September 8, 2026 11:54
Rewrite the tile->tile coordinate transforms in mpp_define_nest_domains.
Replace `convert_index_to_nest` and `convert_index_to_coarse` with a
single generalized `convert_index` function. The old coordinate
transforms assumed that data being transferred from a coarse PE to a
fine PE would come either from the east (in the case of a horizontal
overhang) or from the north (in the case of a vertical overhang). The
old transforms did not allow data to be transferred from the south or
from the west. The new transforms allow data to be transferred to the
nest from any adjacent coarse-grid tile; however, large overhangs which
span multiple tiles are no longer supported.
The test_mpp_nesting unit test currently has a test case where a nest
spans two full tiles in the horizontal direction. This case is no longer
supported, as the new coordinate transforms can only pull data from
adjacent tiles. Therefore, the size of the nest has been reduced so that
its overhang doesn't extend beyond the adjacent tile.
`compute_overlap_coarse_to_fine` seems to erroneously use `shalo` and
`nhalo` respectively to adjust the size of the north and south halo
buffers in the horizontal dimension, rather than `ehalo` and `whalo` as
one would expect. This bug has no effect in the normal scenario where
all halo sizes are the same, but it would produce incorrect halo regions
if non-equal halo sizes were used.
Modify coordinates using ishift and jshift before, rather than after,
coordiante transforms are performed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant