OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SnowResults.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
13#include <array>
14#include <vector>
15namespace openswmm {
16// One catalogue for immutable output snapshots and live clients. All quantities
17// are SI, independent of project display units. Unassigned/unsupported values
18// are NaN; the model code is -1 unassigned, 0 degree-day, 1 UEB.
20 const char* name;
21 const char* label;
22 const char* units;
23};
24inline constexpr std::array<SnowResultField, 23> meshSnowFields{
25 {{"Mesh2_face_snow_model", "snow model (-1 unassigned, 0 degree-day, 1 UEB)", "1"},
26 {"Mesh2_face_snow_completed", "snow state time since start", "s"},
27 {"Mesh2_face_snow_swe", "snow water equivalent", "m"},
28 {"Mesh2_face_snow_cover", "snow covered fraction", "1"},
29 {"Mesh2_face_snow_melt", "snowpack liquid outflow rate", "m s-1"},
30 {"Mesh2_face_snow_surface_input", "snow liquid input to surface (including throughfall)",
31 "m s-1"},
32 {"Mesh2_face_snow_sublimation", "snow sublimation rate", "m s-1"},
33 {"Mesh2_face_snow_energy", "snow energy relative to ice at zero degrees C", "kJ m-2"},
34 {"Mesh2_face_snow_surface_temperature", "snow surface temperature", "degC"},
35 {"Mesh2_face_snow_bulk_temperature", "snow bulk temperature", "degC"},
36 {"Mesh2_face_snow_albedo", "snow albedo", "1"},
37 {"Mesh2_face_snow_surface_age", "snow dimensionless surface age", "1"},
38 {"Mesh2_face_snow_initial", "initial snow water inventory", "m3"},
39 {"Mesh2_face_snow_raw_precipitation", "cumulative precipitation before snow catch correction",
40 "m3"},
41 {"Mesh2_face_snow_precipitation", "cumulative precipitation after snow catch correction",
42 "m3"},
43 {"Mesh2_face_snow_liquid_cum", "cumulative snow liquid input to surface", "m3"},
44 {"Mesh2_face_snow_sublimation_cum", "cumulative snow sublimation", "m3"},
45 {"Mesh2_face_snow_storage", "stored snow water inventory", "m3"},
46 {"Mesh2_face_snow_residual", "snow water continuity residual", "m3"},
47 {"Mesh2_face_snow_net_energy", "cumulative net snow energy input", "kJ"},
48 {"Mesh2_face_snow_initial_energy", "initial snow/ground energy", "kJ"},
49 {"Mesh2_face_snow_stored_energy", "stored snow/ground energy", "kJ"},
50 {"Mesh2_face_snow_energy_residual", "snow/ground energy continuity residual", "kJ"}}};
51using MeshSnowSnapshot = std::array<std::vector<double>, meshSnowFields.size()>;
61template <class State, class Ledger>
62inline std::array<double, meshSnowFields.size()> meshSnowValues(const State& s, const Ledger& b) {
63 return {double(s.model),
64 b.completed_s,
65 s.swe_m,
66 s.cover_fraction,
67 s.melt_ms,
68 s.surface_input_ms,
69 s.sublimation_ms,
70 s.energy_kjm2,
71 s.surface_temperature_c,
72 s.bulk_temperature_c,
73 s.albedo,
74 s.surface_age,
75 b.initial_m3,
76 b.raw_precipitation_m3,
77 b.precipitation_m3,
78 b.liquid_m3,
79 b.sublimation_m3,
80 b.stored_m3,
81 b.residual_m3,
82 b.net_energy_kj,
83 b.initial_energy_kj,
84 b.stored_energy_kj,
85 b.energy_residual_kj};
86}
87} // namespace openswmm
Definition ExchangeLaw.hpp:60
constexpr std::array< SnowResultField, 23 > meshSnowFields
Definition SnowResults.hpp:24
std::array< double, meshSnowFields.size()> meshSnowValues(const State &s, const Ledger &b)
Copy one accepted mesh snow state/ledger into the shared 23-field result order.
Definition SnowResults.hpp:62
std::array< std::vector< double >, meshSnowFields.size()> MeshSnowSnapshot
Definition SnowResults.hpp:51
Definition SnowResults.hpp:19
const char * name
Definition SnowResults.hpp:20
const char * units
Definition SnowResults.hpp:22
const char * label
Definition SnowResults.hpp:21