It could be useful to have the possibility of stopping and restarting a simulation at an arbitrary time.
The goal of the hot-start file is not to create a portable simulation file, but rather to be able to restart in the same environment a simulation that has been stopped. Therefore, it will not include all input data files.
Creating the hotstart file
The hot-start file format would be a ZIP file containing:
- As JSON:
- Creation time
- itzi version
- hotstart file version number
- original provider types
- SimulationConfig
- DomainData (north, south, east, west, rows, cols, crs_wkt)
- Time state: sim_time, dt of all models, next_ts, nextstep, time_steps_counters
- Infiltration model state: cumulative infiltration (for Green-Ampt) or equivalent state for other models - It might be worth adding the cumulative infiltration array to RasterDomain instead of treating it separately
- Accumulation tracking: accum_update_time, old_domain_volume
- RasterDomain, including mask with numpy.savez
- SWMM own hot-start file
Possible hotstart
hotstart_file:
├── metadata/
│ ├── creation_time
│ ├── itzi version
│ ├── hotstart_version
│ ├── original_provider_types
│ └── SimulationConfig
│ └── domain_data (north, south, east, west, rows, cols, crs_wkt)
├── time_state/
│ ├── sim_time
│ ├── dt
│ ├── next_ts
│ └── time_steps_counters
├── domain/
│ ├── all raster_domain arrays
│ └── arr_mask
├── accumulation_tracking/
│ ├── accum_update_time
│ └── old_domain_volume
└── models/
└── swmm_hotstart_path (if applicable)
This would require to:
- Add a function to create and save the hotstart file to disk
- Add a factory function to create a simulation from a hotstart file
What CAN change safely:
- Output providers (different output format is fine)
- Reporting frequency (record_step)
- End time (can extend simulation)
- Output map names
What CANNOT change:
- Grid dimensions/resolution/extent
- Infiltration model type
- Surface flow parameters that affect numerical scheme
- Presence/absence of drainage coupling
Steps for loading the hotstart:
- Load DomainData from hotstart file
- Get DomainData from new provider
- Validate they match exactly (tolerance for floating point: ~1e-6)
- Validate arr_mask matches
- Check configuration compatibility
- Only then proceed to restore simulation state
To do:
Nice to have
It could be useful to have the possibility of stopping and restarting a simulation at an arbitrary time.
The goal of the hot-start file is not to create a portable simulation file, but rather to be able to restart in the same environment a simulation that has been stopped. Therefore, it will not include all input data files.
Creating the hotstart file
The hot-start file format would be a ZIP file containing:
Possible hotstart
This would require to:
What CAN change safely:
What CANNOT change:
Steps for loading the hotstart:
To do:
.npzsim_time,dt,next_ts, counters, continuity state)record_stepchangesInputRasterProviderNice to have
original_provider_typesto hotstart metadata if still considered useful