Add standalone restart support#61
Open
peterlafollette wants to merge 2 commits into
Open
Conversation
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.
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.
This PR adds save/load support for CASAM in standalone mode.
Standalone runs now write restart states for:
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
Testing checklist
Target Environment support
Accessibility
Other