Skip to content

Fix spurious restart writes caused by incorrect stop_alarm ring time#414

Merged
alperaltuntas merged 2 commits into
NCAR:dev/ncarfrom
alperaltuntas:rpointer_fix
Apr 2, 2026
Merged

Fix spurious restart writes caused by incorrect stop_alarm ring time#414
alperaltuntas merged 2 commits into
NCAR:dev/ncarfrom
alperaltuntas:rpointer_fix

Conversation

@alperaltuntas
Copy link
Copy Markdown
Member

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)

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.
Copy link
Copy Markdown
Collaborator

@mnlevy1981 mnlevy1981 left a comment

Choose a reason for hiding this comment

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

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

@alperaltuntas alperaltuntas merged commit d2279c8 into NCAR:dev/ncar Apr 2, 2026
52 checks passed
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.

Multiple ocean rpointers in latest runs

3 participants