![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Namespaces | |
| namespace | ueb |
| namespace | ueb_reference |
Classes | |
| struct | ClimateSite |
| class | InfilBank |
| class | MeshSnow |
| Owned mixed degree-day/UEB snow on remaining mesh weather footprints. Geometry area is horizontal m2; cell slope/aspect are degrees. Water accounts are m3, energy kJ, point energy kJ/m2 and rates m/s. One owner serializes all mutation, borrowing and checkpoint/contact calls. Trial advance protects this snow owner, while shared context weather cursors/diagnostics can still change. Physical ground heat, cover-geometry energy and prescribed energy stay distinct. More... | |
| struct | MeshSnowConfig |
| struct | MeshSnowGeometry |
| struct | MeshSnowLedger |
| struct | MeshSnowRow |
| One authored pack selection and optional site/geometry override. Missing optionals inherit lower-precedence scope values; explicit zero is a real override. forest is fraction, drift dimensionless, ground_heat W/m2, extinction_depth metres, slope degrees and aspect degrees clockwise north. pack is an unresolved model name or normalized NONE token. More... | |
| struct | RadiationSource |
| struct | SnowConfig |
| struct | SnowInputs |
| One element's interval weather, with SI point-input units. dt_s is seconds; rain_m/snow_m are interval water-equivalent depths (not rates), Ta_C is Celsius and wind_ms m/s. rh is fraction, Qsi/Qli/Qg incoming W/m2; cosine and horizontal-radiation factors are dimensionless. gamma/ea retain native degree-day F^-1/in-Hg conventions. Individual models may ignore fields. More... | |
| class | SnowModel |
| Polymorphic point and native-batch snow boundary. One owner serializes state mutation and buffer use. Configure compatible model geometry/materials after allocation; a successful allocation alone does not establish physical snowpack parameters. Derived methods define failure and payload validation; this interface supplies no universal rollback/status. More... | |
| struct | SnowOutputs |
| Point snow results: interval depths metres and model-specific thermal state. melt_m can include pack drainage, mixed rainfall and instant plow liquid, not only phase change; throughfall_m is bypass rain. swe_m includes retained snow/ free water, cover_frac is dimensionless. Temperatures C, energy kJ/m2. Derived implementations specify which thermal fields are available/defaulted. More... | |
| struct | SnowpackConfig |
| struct | SolarIntegral |
| class | SourceSnow |
| Per-source-group native/UEB snow ownership and cumulative water balance. Liquid source delivery, stored pack water and atmospheric losses are separate ledgers. Caller supplies a private context/trial and serializes all operations; mutations are immediate and exceptions do not roll back a partially advanced snow owner. SourceWaterDriver provides the enclosing accepted/trial boundary. More... | |
| struct | SourceSnowLedger |
| struct | SurfaceElement |
Typedefs | |
| using | DegreeDaySnow = snow::DegreeDaySnow |
Enumerations | |
| enum class | SnowKind { DegreeDay , Ueb } |
Functions | |
| InfilBank::Factors | infiltrationFactors (const SimulationContext &ctx, double elapsed_s) |
| Resolve monthly global factors at the actual independent surface clock. | |
| std::string | setMeshSnowOption (MeshSnowConfig &config, const std::vector< std::string > &tokens) |
| Apply one mesh SNOWMELT/SNOW_STEP option after validating its token form. | |
| std::string | setMeshSnowRow (MeshSnowConfig &config, const std::vector< std::string > &tokens, bool cell) |
| Parse and replace one unresolved mesh snow assignment row. | |
| std::vector< std::string > | meshSnowOptionRows (const MeshSnowConfig &config) |
| Serialize nondefault mesh snow options without validating them. | |
| std::vector< std::string > | meshSnowRows (const MeshSnowConfig &config, bool cell) |
| Serialize one assignment map in deterministic key/schema order. | |
| MeshSnowRow | resolveMeshSnowRow (const MeshSnowConfig &config, int cell, const std::string &tag) |
| Compose mesh-wide, exact-tag and exact-cell snow overrides. | |
| bool | hasUebSnow (const SimulationContext &context) |
| Detect an enabled authored UEB snowpack assignment without initializing it. | |
| std::array< double, 10 > | nativeSnowResults (const SimulationContext &context, const snow::SnowSoA &state, int subcatch) |
| Assemble SI UEB snow-report fields from accepted native owner snapshots. | |
| double | nativeSnowDepth (const snow::SnowSoA &state, int subcatch) |
| Compute the legacy reported solid-snow depth for a native source. | |
| double | nativeSnowVolume (const snow::SnowSoA &state, int subcatch, double area_ft2) |
| Compute physical solid-plus-free-water inventory over actual source area. | |
| std::string | initializeNativeSnow (SimulationContext &context, snow::SnowSolver &solver) |
| Load native degree-day geometry/history and initialize assigned UEB packs. | |
| std::array< double, 4 > | snowRuntimeForcing (const SimulationContext &context) |
| Read the small runtime override key used to invalidate held predictions. | |
| bool | snowTransientForcing (const SimulationContext &context) |
| Test whether temperature or wind has a transient active runtime override. | |
| std::string | snowModelIdentity (const SimulationContext &context, const snow::SnowSoA &snow) |
| Encode the native snow restart compatibility identity. | |
| std::string | snowForcingIdentity (const SimulationContext &context) |
| Encode configuration and actual weather values controlling held snow predictions. | |
| void | archiveHeldSnow (detail::CompletedSourceArchive &archive, ueb::HeldState &held) |
| Stream and validate accepted/predicted lumped UEB history and consumption clocks. | |
| void | archiveDegreeDaySnow (detail::CompletedSourceArchive &archive, snow::SnowSoA &snow) |
| Stream fixed-layout native degree-day dynamic state and shared report histories. | |
| std::string | saveSnowCheckpoint (const SimulationContext &context, const snow::SnowSoA &snow) |
| Encode native degree-day and UEB accepted/held snow state without owner mutation. | |
| std::string | restoreSnowCheckpoint (SimulationContext &context, snow::SnowSoA &snow, const std::string &bytes, bool apply=true, bool seed=false) |
| Decode native snow into a compatible model, optionally as a new hot start. | |
| std::string | saveCombinedSnowCheckpoint (const SimulationContext &context, const snow::SnowSoA &snow, const MeshSnow *mesh) |
| Encode native snow and, when active, the paired mesh snow owner. | |
| std::string | restoreCombinedSnowCheckpoint (SimulationContext &context, snow::SnowSoA &snow, MeshSnow *mesh, const std::string &bytes, bool apply, bool seed) |
| Validate native and mesh snow together before ordinary publication. | |
| SolarIntegral | solarIntegral (double latitude, double declination, double hour_start, double duration_hours, double slope, double aspect) |
| Integrate the positive solar dot product over one fixed-declination interval. | |
| std::string | setUebOption (SnowConfig &config, const std::vector< std::string > &tokens, bool validate=true) |
| Parse one UEB_OPTIONS row into a candidate configuration then publish it. | |
| std::vector< std::string > | uebOptionRows (const SnowConfig &config) |
| Serialize nondefault UEB_OPTIONS settings in deterministic schema order. | |
| std::optional< std::string > | uebOptionValue (const SnowConfig &config, const std::string &key) |
| Read a scalar UEB option's effective value, including its default. | |
| std::string | setSnowTemperature (SnowConfig &config, const std::vector< std::string > &tokens) |
| Parse one snow-related TEMPERATURE row and publish a copied candidate. | |
| std::string | setSnowpackUeb (SnowConfig &config, int pack, const std::vector< std::string > &tokens) |
| Replace one pack's optional UEB site/model override from authored tokens. | |
|
strong |
| void openswmm::surface::archiveDegreeDaySnow | ( | detail::CompletedSourceArchive & | archive, |
| snow::SnowSoA & | snow ) |
Stream fixed-layout native degree-day dynamic state and shared report histories.
| [in,out] | archive | Native reader/writer; fixed vector extents must already match. |
| [in,out] | snow | Compatible initialized arrays; geometry/material/assignment parameters are not streamed. Dynamic depths retain native feet, age clocks native units and UEB transfer energy its stored units; no unit conversion occurs. Validates finite scalars/arrays and selected nonnegative water/age/flux, removed/ precipitation age and cover bounds. Errors can leave partial archive/array changes; this helper alone neither validates full model identity nor creates a restart. |
| void openswmm::surface::archiveHeldSnow | ( | detail::CompletedSourceArchive & | archive, |
| ueb::HeldState & | held ) |
Stream and validate accepted/predicted lumped UEB history and consumption clocks.
| [in,out] | archive | Matching native reader/writer; partial consumption/emission can precede exceptions. |
| [in,out] | held | Compatible initialized state; reading replaces accepted/begin/ end inventory, flux, 24-hour thermal memories and duration/elapsed seconds. Validates finite fields, nonnegative inventory, cover/point consistency, flux bounds, clocks and pending accepted-water interpolation within 1e-10 m. Does not check every physical/energy interpolation relation or containing model identity. Throws on invalid fields/archive/allocation; validate into a copy for rollback. |
| bool openswmm::surface::hasUebSnow | ( | const SimulationContext & | context | ) |
Detect an enabled authored UEB snowpack assignment without initializing it.
| context | Borrowed subcatchment pack assignments and snow model configuration. |
| InfilBank::Factors openswmm::surface::infiltrationFactors | ( | const SimulationContext & | ctx, |
| double | elapsed_s ) |
Resolve monthly global factors at the actual independent surface clock.
Global monthly factors at the mesh evaluation time. The runoff climate cache may already describe a later runoff interval.
| ctx | Compatible initialized options, twelve hydcon adjustments and optional resolved recovery-pattern factor rows; borrowed without changing climate cache. |
| elapsed_s | Finite elapsed simulation seconds yielding a supported calendar month when added to start_date. No separate finite/range validation here. |
| std::string openswmm::surface::initializeNativeSnow | ( | SimulationContext & | context, |
| snow::SnowSolver & | solver ) |
Load native degree-day geometry/history and initialize assigned UEB packs.
| [in,out] | context | Compatible initialized model/options with valid project unit enum, aligned source arrays and physically qualified snowpack parameter/removal rows. Updates UEB runtime through initializeSubcatchments(), then source snow_depth on success. Does not advance context clocks or gate all native loading on ignore-snow. |
| [in,out] | solver | Resized/reset per-source arrays, then receives global tipm/rnm/ ADC curves, converted degree-day parameters, surface fractions, initial SWE/free water and resolved plowing targets. Free water caps at FWF*initial SWE; zero-area surfaces zero water/SI. init retains some global fields such as removed/season/ age tracking flags, so caller owns fresh/global initialization as appropriate. |
| std::vector< std::string > openswmm::surface::meshSnowOptionRows | ( | const MeshSnowConfig & | config | ) |
Serialize nondefault mesh snow options without validating them.
| config | Coherent authored mode/step configuration. |
| std::vector< std::string > openswmm::surface::meshSnowRows | ( | const MeshSnowConfig & | config, |
| bool | cell ) |
Serialize one assignment map in deterministic key/schema order.
| config | Parser-qualified names/cell keys and finite override values; no escaping or validation of manually inserted quotes/invalid indices occurs here. |
| cell | True writes CELL and one-based numeric IDs in ascending order; false writes quoted tag keys in lexical map order, without a TAG prefix. |
| double openswmm::surface::nativeSnowDepth | ( | const snow::SnowSoA & | state, |
| int | subcatch ) |
Compute the legacy reported solid-snow depth for a native source.
| state | Qualified aligned three-subarea SWE and fractional-area arrays. |
| subcatch | Valid original source index, unchecked. |
| std::array< double, 10 > openswmm::surface::nativeSnowResults | ( | const SimulationContext & | context, |
| const snow::SnowSoA & | state, | ||
| int | subcatch ) |
Assemble SI UEB snow-report fields from accepted native owner snapshots.
| context | Matching UEB runtime columns/last flux/sample arrays and parameters. |
| state | Matching initialized native SnowSoA with valid aligned external, area-fraction and liquid-output arrays; ownership must be stable during reading. |
| subcatch | Zero-based source index; invalid, degree-day-owned or insufficient runtime columns returns ten NaNs. Other runtime array extents are caller-qualified. |
| double openswmm::surface::nativeSnowVolume | ( | const snow::SnowSoA & | state, |
| int | subcatch, | ||
| double | area_ft2 ) |
Compute physical solid-plus-free-water inventory over actual source area.
| state | Qualified aligned three-subarea wsnow/fw/fArea arrays. |
| subcatch | Valid original source index, unchecked. |
| area_ft2 | Finite nonnegative actual non-LID footprint ft2, excluding LIDs. |
| MeshSnowRow openswmm::surface::resolveMeshSnowRow | ( | const MeshSnowConfig & | config, |
| int | cell, | ||
| const std::string & | tag ) |
Compose mesh-wide, exact-tag and exact-cell snow overrides.
| config | Borrowed authored maps; no runtime mutation or qualification. |
| cell | Zero-based lookup key; no mesh-bound validation, absent cell just skips. |
| tag | Exact case-sensitive tag string; no normalization or mesh membership lookup. |
| std::string openswmm::surface::restoreCombinedSnowCheckpoint | ( | SimulationContext & | context, |
| snow::SnowSoA & | snow, | ||
| MeshSnow * | mesh, | ||
| const std::string & | bytes, | ||
| bool | apply, | ||
| bool | seed ) |
Validate native and mesh snow together before ordinary publication.
| [in,out] | context | Matching initialized model/forcing and correctly sized report/runtime arrays; apply can replace runtime, reports and append a warning. |
| [in,out] | snow | Compatible current native geometry/parameter arrays; dynamic inventory is replaced only when apply is true. |
| [in,out] | mesh | Optional initialized owner. Nonempty mesh bytes require an active compatible owner; null uses a private inactive validator. |
| bytes | Combined-version-one, standalone native version-two, or empty archive. An absent mesh part clears/seeds configured mesh cells, retaining assignments. | |
| apply | False fully validates private candidates without publication/warnings; true restores native first, then publishes the mesh candidate. | |
| seed | True keeps accepted inventory but discards held predictions, clears clocks/cumulative fluxes and rebases initial inventories for a new hot start. |
| std::string openswmm::surface::restoreSnowCheckpoint | ( | SimulationContext & | context, |
| snow::SnowSoA & | snow, | ||
| const std::string & | bytes, | ||
| bool | apply = true, | ||
| bool | seed = false ) |
Decode native snow into a compatible model, optionally as a new hot start.
| [in,out] | context | Matching initialized snow/forcing identity and runtime/report array extents. Publication changes runtime and current snow depths in native feet; seed also updates old depths. Report depth includes solid plus free water. |
| [in,out] | snow | Initialized geometry/parameter/assignment arrays; nonempty archive is decoded into a private copy before dynamic-state replacement. |
| bytes | Exact native version-two bytes or empty for bare snow initialization. Nonempty requires full archive consumption, identity/layout/finite/clock checks and agreement between external report and accepted UEB water within 1e-10 m. | |
| apply | False performs nonempty decode/seed validation without publication; empty bytes simply succeed. True installs state, or clears live snow for empty bytes. | |
| seed | True retains accepted water/thermal inventory and histories, closes future predictions, resets clocks/flux/cumulative ledgers and rebases whole non-LID UEB m3/kJ initial inventory. Runtime override key and precipitation-age tracking remain. |
| std::string openswmm::surface::saveCombinedSnowCheckpoint | ( | const SimulationContext & | context, |
| const snow::SnowSoA & | snow, | ||
| const MeshSnow * | mesh ) |
Encode native snow and, when active, the paired mesh snow owner.
| context | Initialized model/forcing identity and compatible native runtime; any nonnegative subcatchment pack assignment triggers native serialization even when global snow processing is ignored. Borrowed without mutation. |
| snow | Compatible initialized degree-day/native report arrays. |
| mesh | Optional borrowed mesh owner; null/inactive adds no mesh wrapper. |
| std::string openswmm::surface::saveSnowCheckpoint | ( | const SimulationContext & | context, |
| const snow::SnowSoA & | snow ) |
Encode native degree-day and UEB accepted/held snow state without owner mutation.
| context | Compatible initialized model/runtime, resolved forcing and report layout. |
| snow | Compatible initialized native geometry, parameters and dynamic arrays. |
| std::string openswmm::surface::setMeshSnowOption | ( | MeshSnowConfig & | config, |
| const std::vector< std::string > & | tokens ) |
Apply one mesh SNOWMELT/SNOW_STEP option after validating its token form.
| [in,out] | config | Owned authored options, mutated on accepted value only. Does not clear assignments, rebuild runtime columns or change global SnowConfig. |
| tokens | Exactly two section-excluded tokens. SNOWMELT accepts AUTO/YES/NO; SNOW_STEP accepts DEFAULT (stores zero/inherit) or shared strict seconds/clock syntax with total [1,21600] seconds. Keywords are case insensitive. |
| std::string openswmm::surface::setMeshSnowRow | ( | MeshSnowConfig & | config, |
| const std::vector< std::string > & | tokens, | ||
| bool | cell ) |
Parse and replace one unresolved mesh snow assignment row.
| [in,out] | config | Maps updated after successful row parsing; same-key assignment replaces the whole prior row, so omitted options on that row are discarded. |
| tokens | Optional CELL/TAG prefix (matching cell selector), key, SNOWPACK and nonempty pack name, then unique key/value pairs. Cell keys are finite integral one-based IDs in [1,INT_MAX], stored zero-based; tag keys are case-sensitive and may be * for mesh-wide fallback. Tags/pack names cannot contain CR/LF/double quote; caller tokenizes quoted text before this API. NONE is normalized case-insensitively. Overrides: FC fraction[0,1], F drift>=0, QG signed W/m2, AEP positive metres, SLOPE degrees[0,90), ASPECT degrees[0,360]; all finite and slope/aspect must occur together. | |
| cell | True targets numeric cell map, false exact tag/default map. |
| std::string openswmm::surface::setSnowpackUeb | ( | SnowConfig & | config, |
| int | pack, | ||
| const std::vector< std::string > & | tokens ) |
Replace one pack's optional UEB site/model override from authored tokens.
| [in,out] | config | Per-pack map updated only after normal parsing/range success. |
| pack | Nonnegative integer key; existence in a model snowpack registry is not checked here. Replaces any earlier override rather than merging fields. | |
| tokens | Fc forest fraction[0,1], F drift>=0, Qg ground heat W/m2 (signed), aep positive extinction metres, optional finite U0 point energy kJ/m2, optional MODEL DEGREE_DAY/UEB. Exactly these trailing fields; keywords case insensitive. Default new override model is UEB even if global model is degree-day; omitted site fields are not inherited from an earlier override. No native unit conversion. |
| std::string openswmm::surface::setSnowTemperature | ( | SnowConfig & | config, |
| const std::vector< std::string > & | tokens ) |
Parse one snow-related TEMPERATURE row and publish a copied candidate.
| [in,out] | config | Current configuration, retained on normal refusal. Runtime weather/solver caches are not rebuilt by this setter. |
| tokens | Section-excluded exact row: SITE(lat[-90,90],lon east[-180,180],UTC hours[-14,14],elevation metres[-500,10000]); SNOWMELT_MODEL(DEGREE_DAY/UEB); SNOW_STEP(seconds or hh:mm[:ss], total[1,21600]); MET_FILE(nonempty token path); or SHORTWAVE/LONGWAVE(COMPUTED,FILE,TIMESERIES name). Keywords case insensitive. Numeric SITE/step values must be finite; clock hours/minutes are nonnegative integers, minutes/seconds below60, fractional seconds allowed. Plain seconds can be fractional. SNOW_STEP updates both step and Parameters.max_step. Path/series names are retained as tokens without file existence/name/coverage checks. |
| std::string openswmm::surface::setUebOption | ( | SnowConfig & | config, |
| const std::vector< std::string > & | tokens, | ||
| bool | validate = true ) |
Parse one UEB_OPTIONS row into a candidate configuration then publish it.
| [in,out] | config | Current coherent configuration; normal rejection retains it. Caller serializes updates with runtime initialization/forcing and applies any required runtime invalidation separately. |
| tokens | Section-excluded token list: key/value exactly, except BC_MONTHLY requires integer month1..12 and a finite temperature range in (0,100] C. Keywords are case insensitive; whitespace/quotes have already been tokenized by caller. SURFACE_TEMP accepts EQUILIBRIUM/MODIFIED_FORCE_RESTORE; PRECIP_SPLIT accepts UEB/DIVT. Numeric parameter keys are Z0,ZM,KS,KSAT,LC,DE,RHO_S,RHO_G,CG,LAMBDA_S, LAMBDA_G,OMEGA_LF,R,FSTAB,TR,TB,ABG,ALPHA_VO,ALPHA_IRO,EPSILON,DNEWS,R3,CV,CIR, plus BC_A/BC_C. Values use the native Parameters units without conversion. | |
| validate | True validates the full candidate Parameters; false permits transient physical parameter combinations during multi-row input assembly, which must be qualified before use. Bristow-Campbell comparisons always enforce BC_A in (0,1] and BC_C>0 for coherent finite input configuration. |
| std::string openswmm::surface::snowForcingIdentity | ( | const SimulationContext & | context | ) |
Encode configuration and actual weather values controlling held snow predictions.
| context | Initialized snow/heat/weather configuration and resolved tables; valid table indices or missing-index sentinels are required. |
| std::string openswmm::surface::snowModelIdentity | ( | const SimulationContext & | context, |
| const snow::SnowSoA & | snow ) |
Encode the native snow restart compatibility identity.
| context | Initialized named subcatchments/packs, geometry, snow configuration and resolved weather/series values; borrowed without advancing lookup cursors. |
| snow | Compatible native fraction/external-owner/ADC and degree-day parameters. |
| std::array< double, 4 > openswmm::surface::snowRuntimeForcing | ( | const SimulationContext & | context | ) |
Read the small runtime override key used to invalidate held predictions.
| context | Borrowed forcing state; no mutation. |
| bool openswmm::surface::snowTransientForcing | ( | const SimulationContext & | context | ) |
Test whether temperature or wind has a transient active runtime override.
| context | Borrowed forcing state. |
| SolarIntegral openswmm::surface::solarIntegral | ( | double | latitude, |
| double | declination, | ||
| double | hour_start, | ||
| double | duration_hours, | ||
| double | slope, | ||
| double | aspect ) |
Integrate the positive solar dot product over one fixed-declination interval.
| latitude | Finite site latitude in degrees north, [-90,90]. |
| declination | Finite solar declination degrees, [-90,90], held fixed for the interval. |
| hour_start | Finite starting solar hour angle in degrees, zero at noon and positive afternoon; wraps by remainder modulo 360. |
| duration_hours | Finite interval length in (0,24] hours. |
| slope | Finite plane inclination degrees in [0,90); vertical planes are rejected. |
| aspect | Finite plane aspect degrees clockwise from north, periodic modulo 360. |
| std::invalid_argument | Nonfinite inputs or rejected angle/duration range. Allocations may throw; no model state or clock is modified. |
| std::vector< std::string > openswmm::surface::uebOptionRows | ( | const SnowConfig & | config | ) |
Serialize nondefault UEB_OPTIONS settings in deterministic schema order.
| config | Qualified source configuration; no value/enum validation here. |
| std::optional< std::string > openswmm::surface::uebOptionValue | ( | const SnowConfig & | config, |
| const std::string & | key ) |
Read a scalar UEB option's effective value, including its default.
| config | Qualified configuration; borrowed without mutation. |
| key | Case-insensitive exact option keyword; no trimming/section parsing. |