![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Runtime heat state shared by the engines (phase H1). More...
#include <HeatData.hpp>
Public Member Functions | |
| void | resize (int n_nodes, int n_links, double initial_temp) |
| Replace network heat arrays and reset current forcing caches. | |
| void | resizeWatershed (int n_subcatch, double initial_temp) |
| Replace subcatchment heat arrays and their three-subarea histories. | |
| bool | watershedSized (int n_subcatch) const noexcept |
| Check the length of the subarea temperature vector only. | |
| void | clear () |
| Release all network/watershed heat state and restore cache sentinels. | |
Public Attributes | |
| std::vector< unsigned char > | mesh_contact_link |
| Empty in prescribed compatibility mode. | |
| std::vector< double > | node_temp_vol_in |
| std::vector< double > | node_lid_drain_temp_vol_in |
| std::vector< double > | node_temp |
| [node], °C | |
| std::vector< double > | link_temp |
| [link], °C | |
| bool | legacy_seeded = false |
| The LEGACY mirror seeds INITIAL_STATE on its first step. | |
| double | shortwave_now = -1.0 |
| double | cloud_now = 0.0 |
| Cloud fraction at the current step, C ∈ [0,1]. 0 = clear. | |
| std::vector< double > | subarea_temp |
| [subcatch * kNSubArea + subarea], °C — ponded surface temperature. | |
| std::vector< double > | subarea_vol_prev |
| std::vector< double > | subcatch_runoff_temp |
| [subcatch], °C — temperature the subcatchment's runoff leaves at. | |
| std::vector< double > | subcatch_runon_temp_vol_in |
| std::vector< double > | subcatch_runon_temp_rate |
| std::vector< double > | subcatch_outfall_temp_vol |
| std::vector< double > | subcatch_lid_drain_temp_cfs |
Static Public Attributes | |
| static constexpr int | kNSubArea = static_cast<int>(HeatSubArea::COUNT_) |
Runtime heat state shared by the engines (phase H1).
node_temp_vol_in is a RATE (°C·ft³/s) — loaders add q · T and the engine integrates it over its substeps, exactly as node_age_vol_in does for age. node_temp/link_temp are the PUBLISHED temperatures (°C) the reports and gates read.
|
inline |
Release all network/watershed heat state and restore cache sentinels.
Restores default HeatState including shortwave_now=-1, cloud_now=0 and legacy_seeded=false; releases the mesh-contact mask and invalidates borrowed vector elements.
|
inline |
Replace network heat arrays and reset current forcing caches.
Zeroes node temperature-volume input rates, sets temperatures, resets legacy_seeded=false, shortwave_now=-1 and cloud_now=0. Preserves mesh_contact_link ownership mask and all watershed arrays. Allocation failure may leave a partially replaced state.
| [in] | n_nodes | Nonnegative node count; unchecked conversion to size_t. |
| [in] | n_links | Nonnegative link count. |
| [in] | initial_temp | Initial published node/link temperature in degC; no finite/range validation. |
|
inline |
Replace subcatchment heat arrays and their three-subarea histories.
Seeds temperature arrays, zeroes prior ft3 volumes and pending run-on/outfall/drain accumulators. Does not alter network heat arrays or global forcing cache; no transactional allocation rollback.
| [in] | n_subcatch | Nonnegative subcatchment count; product with kNSubArea must fit size_t. |
| [in] | initial_temp | Initial runoff/subarea temperature in degC. |
|
inlinenoexcept |
Check the length of the subarea temperature vector only.
| [in] | n_subcatch | Nonnegative expected subcatchment count; unchecked conversion/multiplication. |
| double openswmm::HeatState::cloud_now = 0.0 |
Cloud fraction at the current step, C ∈ [0,1]. 0 = clear.
|
staticconstexpr |
| bool openswmm::HeatState::legacy_seeded = false |
The LEGACY mirror seeds INITIAL_STATE on its first step.
| std::vector<double> openswmm::HeatState::link_temp |
[link], °C
| std::vector<unsigned char> openswmm::HeatState::mesh_contact_link |
Empty in prescribed compatibility mode.
| std::vector<double> openswmm::HeatState::node_lid_drain_temp_vol_in |
[node], °C·ft³/s arriving through LID underdrains, accumulated in the runoff step beside nodes.lid_drain_qual_vol and consumed by the wet-weather loader on that same per-runoff-step cadence — the twin of WaterAgeState::node_lid_drain_age_vol_in. Until this existed the drain-to-node loader handed the drain the RAINFALL temperature, so H5b's storage-layer temperature reached run-on receivers but never a node (LID fix round, 2026-08-30).
| std::vector<double> openswmm::HeatState::node_temp |
[node], °C
| std::vector<double> openswmm::HeatState::node_temp_vol_in |
[node], °C·ft³/s
| double openswmm::HeatState::shortwave_now = -1.0 |
Incoming shortwave at the current step, W/m², cloud already applied.
NEGATIVE means "not yet resolved this run", and that is load-bearing, not decorative. radiativeFluxOut passes this straight into netRadiativeFluxOut's jin_wm2, whose documented sentinel for "use the configured constant" is a negative value. A 0.0 default would make that sentinel unreachable from the production path, so any call landing before the step's updateSolarForcing would silently drop the shortwave term to zero instead of falling back on RadiativeConfig::shortwave_wm2. updateSolarForcing never writes a negative (it ends in max(0.0, ...)), so the sentinel cannot be confused with a resolved night-time 0.
| std::vector<double> openswmm::HeatState::subarea_temp |
[subcatch * kNSubArea + subarea], °C — ponded surface temperature.
| std::vector<double> openswmm::HeatState::subarea_vol_prev |
[subcatch * kNSubArea + subarea], ft³ — that subarea's stored water at the END of the previous step. The solver overwrites its depths in place, so the old volume is otherwise gone by the time this runs.
| std::vector<double> openswmm::HeatState::subcatch_lid_drain_temp_cfs |
LID underdrain water sent to a subcatchment: cfs x temperature, accumulated when the units run and handed to the run-on assembly at the start of the NEXT runoff step beside the drain's cfs (subcatches.lid_drain_runon_cfs) — the run-on assembly is where every contributor's flow and temperature are booked together.
| std::vector<double> openswmm::HeatState::subcatch_outfall_temp_vol |
[subcatch], °C·ft³ — outfall-return temperature-volume, accumulated on the ROUTING clock beside subcatches.outfall_runon_vol and consumed on the RUNOFF clock. A volume, not a rate, for exactly the reason its age counterpart is: the two clocks differ, so the producer cannot know the interval the consumer will divide by.
| std::vector<double> openswmm::HeatState::subcatch_runoff_temp |
[subcatch], °C — temperature the subcatchment's runoff leaves at.
| std::vector<double> openswmm::HeatState::subcatch_runon_temp_rate |
[subcatch], ft³/s — the run-on rate whose temperature is KNOWN, i.e. the flow actually represented in subcatch_runon_temp_vol_in.
This is the pair that keeps A3's defect from recurring. subcatches.runon_inflow has THREE contributors (the subcatchment cascade, the LID underdrain return, and the outfall return); A3 filled its age numerator from one of them and divided by all three, so the arriving age was dragged toward zero — measured at 3.834 h under a 4 h rain, younger than anything entering the model.
Carrying the rate alongside the numerator makes the ratio a true mean of whatever was counted, whether that is one contributor or three. H5a counts the cascade and the outfall return; the LID underdrain arrives with H5b, because a drain's temperature is a per-layer quantity that does not exist until the LID layer species row does. Until then the omission biases nothing — it simply averages over less water, which is the difference between an incomplete answer and a wrong one.
| std::vector<double> openswmm::HeatState::subcatch_runon_temp_vol_in |
[subcatch], °C·ft³/s — per-step RATE accumulator for arriving run-on, following the node_temp_vol_in convention: donors accumulate q · T, and it is zeroed once consumed.