Fix spurious restart writes caused by incorrect stop_alarm ring time#414
Merged
Conversation
In ModelSetRunClock, the stop_alarm was created using the driver clock's stopTime, which is just one coupling step ahead (currTime + driver_timestep), not the end of the simulation. This caused the alarm to ring on the first ocean coupling step, triggering spurious restart and rpointer file writes whenever write_restart_at_endofrun was enabled. The bug manifests in fully coupled (B) cases where the driver timestep (set by the fastest component, e.g., atmosphere at 1800s) differs from the ocean coupling interval (3600s). Fix: For CESM-coupled runs, use the model clock's stopTime (captured before ModelSetRunClock overwrites it), which holds the NUOPC-initialized end-of-run time. The non-CESM path is left unchanged for NOAA-EMC to address independently, preferably by removing the cesm_coupled branching this commit adds.
gustavo-marques
approved these changes
Mar 27, 2026
mnlevy1981
approved these changes
Apr 2, 2026
Collaborator
mnlevy1981
left a comment
There was a problem hiding this comment.
LGTM - I'm trusting the testing done by @alperaltuntas and @gustavo-marques, but I like the if (cesm_coupled) block to ensure we don't change behavior in other models that rely on the NUOPC cap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In ModelSetRunClock, the stop_alarm was created using the driver clock's stopTime, which is just one coupling step ahead (currTime + driver_timestep), not the end of the simulation. This caused the alarm to ring on the first ocean coupling step, triggering spurious restart and rpointer file writes whenever write_restart_at_endofrun was enabled.
The bug manifests in fully coupled (B) cases where the driver timestep (set by the fastest component, e.g., atmosphere at 1800s) differs from the ocean coupling interval (3600s).
Fix: For CESM-coupled runs, use the model clock's stopTime (captured before ModelSetRunClock overwrites it), which holds the NUOPC-initialized end-of-run time. The non-CESM path is left unchanged for NOAA-EMC to address independently, preferably by removing the cesm_coupled branching this commit adds.
Fixes: #341
Testing: fast_mom.derecho (b4b)