Skip to content

Restart writing in CAM-SIMA#514

Open
peverwhee wants to merge 23 commits into
ESCOMP:developmentfrom
peverwhee:sima-restarts
Open

Restart writing in CAM-SIMA#514
peverwhee wants to merge 23 commits into
ESCOMP:developmentfrom
peverwhee:sima-restarts

Conversation

@peverwhee

@peverwhee peverwhee commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Tag name (required for release branches): TBD
Originator(s): peverwhee
AI tools used: None

PR for initializing and writing restart files (.r. file, rpointer file, and any .rhX. files, as needed)

Addresses #382

Top-level restart module: src/control/cam_restarts.F90

🟠RESTART PHYSICS🟠

  • Variables labeled with restart=true in the registry are candidates for the restart file
  • New code generates bld/atm/obj/phys_restart/restart_physics.F90, which contains "restart_physics_init", "restart_physics_write", and "restart_physics_read" (currently empty)
    • Mods to cime_config python scripts, and a new python script src/data/write_restart_physics.py enable this

🟢RESTART DYNAMICS🟢

  • New restart_dynamics.F90 in both SE and MPAS (src/dynamics/<dycore>/restart_dynamics.F90)
    • SE restart dynamics are basically identical to CAM
    • MPAS uses @kuanchihwang 's refactored subdriver to trim the write routine down to one line!

🟣RESTART HISTORY🟣

  • A static set of variables are written to the restart file (.r.) to indicate the history configuration (this is where we greatly diverge from CAM in terms of variable names!)
  • If there are accumulated history fields on a given file (and we haven't JUST written to the file), then a .rhX. file is created.

And finally, a very crude diagram!
Restart writes drawio (1)

Describe any changes made to build system:

M   cime_config/buildlib
- Build new phys_restart directory

Describe any changes made to the namelist: n/a

List any changes to the defaults for the input datasets (e.g. boundary datasets): n/a

List all files eliminated and why: n/a

List all files added and what they do:

A   src/control/cam_restart.F90
- Top-level restart API. Called from cam_timestep_final; calls necessary subroutines to write the restart file (all pieces)

A   src/data/write_restart_physics.py
- Generated code to write variables identified in registry as restart variables - RESTART PHYSICS

A   src/dynamics/mpas/restart_dynamics.F90
A   src/dynamics/se/restart_dynamics.F90
- RESTART DYNAMICS
- note: MPAS init and write are combined so the init phase is a no-op

A   src/history/cam_hist_restart.F90
- RESTART HISTORY
- handles history fields written to overall restart file; the history-specific (rhX) files are handled in cam_hist_file.F90

List all existing files that have been modified, and describe the changes:
(Helpful git command: git diff --name-status development...<your_branch_name>)

M   .gitmodules
M   src/history/buffers
- updated history external (including new interfaces needed for restarts)

M   cime_config/cam_autogen.py
M   cime_config/cam_build_cache.py
M   cime_config/cam_config.py
M   src/data/registry.xml
M   src/data/registry_v1_0.xsd
M   src/data/generate_registry_data.py
- modifications for physics restarts

M   src/history/cam_hist_file.F90
M   src/history/cam_history.F90
M   src/history/cam_history_support.F90
- modifications for history restarts
- reorganization of write routines in cam_hist_file so code can be shared between history writes and restart writes (and eventually initial conditions file, hopefully).

M   src/control/cam_comp.F90
M   src/cpl/nuopc/atm_comp_nuopc.F90
- Move restart from cam_run4 to timestep_final

M   src/utils/cam_grid_support.F90
- Add 1D integer writing (used for writing sample array)

If there are new failures (compared to the test/existing-test-failures.txt file),
have them OK'd by the gatekeeper, note them here, and add them to the file.
If there are baseline differences, include the test and the reason for the
diff. What is the nature of the change? Roundoff?

derecho/intel/aux_sima: TBD

derecho/gnu/aux_sima: TBD

derecho/nvhpc/aux_sima (test is run via Github workflow. Only run the test manually if we need to save new baselines): TBD

If this changes climate describe any run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced:

CAM-SIMA date used for the baseline comparison tests if different than latest:

@peverwhee peverwhee requested a review from nusbaume June 23, 2026 22:21
@peverwhee peverwhee self-assigned this Jun 23, 2026
@peverwhee peverwhee requested a deployment to CI-tests-on-CIRRUS June 30, 2026 16:15 — with GitHub Actions Waiting
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