Skip to content

Add standalone restart support#61

Open
peterlafollette wants to merge 2 commits into
NOAA-OWP:masterfrom
peterlafollette:PTL_standalone_init_from_saved_state
Open

Add standalone restart support#61
peterlafollette wants to merge 2 commits into
NOAA-OWP:masterfrom
peterlafollette:PTL_standalone_init_from_saved_state

Conversation

@peterlafollette

@peterlafollette peterlafollette commented May 14, 2026

Copy link
Copy Markdown
Contributor

This PR adds save/load support for CASAM in standalone mode.

Standalone runs now write restart states for:

  • wetting fronts
  • CASAM variables that are not wetting fronts but are necessary for a restart
  • the GIUH runoff queue

After running a standalone simulation, setting the following paths

init_state_path=...
init_non_vadose_state_path=...
init_giuh_state_path=...

in the config should initialize the model. Initialization reads the last saved data row from each file.

Wetting front restart state is saved in model-native units (cm for length, h for time) using round-trip double precision. The model previously wrote variables with length units in mm rather than cm.

Saved wetting front fields are depth_cm, theta, layer_num, front_num, to_bottom, psi_cm, and dzdt_cm_per_h.
Non-vadose restart state includes conceptual reservoir storage, ponded/surface memory needed for wetting front creation, and flux-cache state.
GIUH restart state includes the saved runoff queue.
If allow_flux_caching=false, saved flux-cache fields are ignored on load.
If an invalid soil type is specified, restart files are ignored because CASAM returns precipitation directly as discharge in that mode.
configs/README.md now documents the restart config keys, saved variables, and current standalone-mode restart file writing behavior.

Note that nonzero ponded_depth_max will generally not work until PR #58 is approved. Also I have not added time_s or timesteps to saved states.

Additions

-capability for restart in standalone mode

Removals

Changes

Testing

Ran the Bushland simulation, then ran it again with paths to the saved states in the config, and ensured that the states at the end of the first run matched the states at the start of the second run. Additionally tested to make sure it works with and without flux caching, that it correctly can create a new wetting front on the first time step from loaded states, and that a restart does not affect subsequent simulation results.

Screenshots

Notes

Todos

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Target Environment support

  • Windows
  • Linux
  • Browser

Accessibility

  • Keyboard friendly
  • Screen reader friendly

Other

  • Is useable without CSS
  • Is useable without JS
  • Flexible from small to large screens
  • No linting errors or warnings
  • JavaScript tests are passing

Write standalone restart files for wetting fronts, non-vadose state, and GIUH queue. Load restart state from the last data row of configured restart files. Save wetting front state in model-native units with round-trip double precision, preserving depth, theta, layer/front numbers, to_bottom, psi, and dzdt for each wetting front. Restore conceptual reservoir storage, ponded/surface memory, flux cache state, and GIUH queue. Ignore restart files for invalid soil types and ignore saved cache fields when flux caching is disabled. Document restart config keys, saved variables, standalone-only writing, and restart behavior.
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