Skip to content

Conversation

stephenprice
Copy link
Contributor

@stephenprice stephenprice commented Jul 11, 2025

Fix logic around g2x and x2g coupler vector index calculation.

This PR corrects the "first_time" logic around the calculation of indices for the glc
coupling vectors g2x and x2g. Because the calls to x2g and g2x happen in budgets1
and budgets2, respectively, both sets of indices need to be calculated at the same time
if the first_time logic is to be used so that these calculations only happen once. This fix
has been tested and confirmed working.

Calculate all g2x and x2g indices at the same time based on first_time
logic, which is necessary when x2g and g2x calculations are split between
calls to budgets1 and budgets2.
@stephenprice stephenprice added mpas-albany-landice Coupler Related to code in driver-mct or driver-moab or component connections to the coupler. labels Jul 11, 2025
Copy link
Contributor

@matthewhoffman matthewhoffman left a comment

Choose a reason for hiding this comment

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

Approving based on inspection and previous discussion. The previous implementation meant that the first_time operations would only be done for one or the other coupling direction, which is obviously fragile. It looks like some other components do things the new way in this PR to avoid that, but atm, lnd, ocn, and ice do it the old way. They must be avoiding this error just be chance of how their seq_diag_*_mct routines are called.

@rljacob, cc'ing you so that's on your radar.

@stephenprice
Copy link
Contributor Author

I noticed that sea ice also splits between budgets1 and budgets2, and they get around this issue by simply re-calculating indices every time in budgets1 (the first_time logic is only employed for budgets2).

jonbob added a commit that referenced this pull request Jul 15, 2025
…xt (PR #7505)

Fix logic around g2x and x2g vector index calculation

This PR corrects the "first_time" logic around the calculation of
indices for the glc coupling vectors g2x and x2g. Because the calls to
x2g and g2x happen in budgets1 and budgets2, respectively, both sets of
indices need to be calculated at the same time if the first_time logic
is to be used so that these calculations only happen once. This fix has
been tested and confirmed working.

[BFB]
@jonbob
Copy link
Contributor

jonbob commented Jul 15, 2025

Passes:

  • e3sm_landice_developer using gnu on chrysalis

merged to next

Copy link
Contributor

@jonbob jonbob left a comment

Choose a reason for hiding this comment

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

Approved based on visual inspection and testing

@jonbob jonbob added the BFB PR leaves answers BFB label Jul 16, 2025
@jonbob jonbob merged commit 371f126 into E3SM-Project:master Jul 16, 2025
7 checks passed
@jonbob
Copy link
Contributor

jonbob commented Jul 16, 2025

merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB Coupler Related to code in driver-mct or driver-moab or component connections to the coupler. mpas-albany-landice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants