41#ifndef OPENSWMM_FORCING_DATA_HPP
42#define OPENSWMM_FORCING_DATA_HPP
179 if (
mode.size() == n)
return;
181 value.assign(n, 0.0);
185 double apply(
int i,
double base)
const noexcept {
186 if (i < 0)
return base;
187 const auto u =
static_cast<std::size_t
>(i);
193 for (std::size_t i = 0; i <
mode.size(); ++i)
216 return (s < 0) ? base :
elem_air_temp[s].apply(e.index, base);
220 return (s < 0) ? base :
elem_humidity[s].apply(e.index, base);
224 return (s < 0) ? base :
elem_wind[s].apply(e.index, base);
246 void resize(
int n_nodes,
int n_links,
int n_subcatches,
247 int n_gages,
int n_pollutants) {
254 auto un =
static_cast<std::size_t
>(n_nodes);
255 auto ul =
static_cast<std::size_t
>(n_links);
256 auto us =
static_cast<std::size_t
>(n_subcatches);
257 auto ug =
static_cast<std::size_t
>(n_gages);
258 auto unp =
static_cast<std::size_t
>(n_nodes) *
259 static_cast<std::size_t
>(n_pollutants);
289 auto ulp =
static_cast<std::size_t
>(n_links) *
290 static_cast<std::size_t
>(n_pollutants);
316 auto set_none = [](
auto& mode_vec) {
344 auto clear_resets = [](
auto& mode_vec,
const auto& persist_vec) {
345 for (std::size_t i = 0; i < mode_vec.size(); ++i) {
375 for (
int k = 0; k < 2; ++k) {
393 default:
return broadcast;
407 default:
return broadcast;
427 default:
return gage_rainfall;
441 default:
return broadcast;
460 default:
return gage_snowfall;
485 default:
return broadcast_rate;
Plan PE — per-element radiative and bed attributes.
@ NONE
Definition SimulationContext.hpp:180
Definition NodeCoupling.cpp:16
ForcingPersist
Definition ForcingData.hpp:61
@ PERSIST
Keep until explicitly cleared.
Definition ForcingData.hpp:63
@ RESET
Auto-clear after each timestep.
Definition ForcingData.hpp:62
HeatElemKind
What kind of element a flux is being evaluated for (D-PE1).
Definition HeatOverrideData.hpp:75
@ NODE
Definition HeatOverrideData.hpp:76
@ LINK
Definition HeatOverrideData.hpp:77
ForcingMode
Definition ForcingData.hpp:55
@ OVERRIDE
Replace computed value with user value.
Definition ForcingData.hpp:57
@ ADD
Add user value to computed value.
Definition ForcingData.hpp:58
@ NONE
Use model-computed value (no forcing)
Definition ForcingData.hpp:56
Definition ForcingData.hpp:173
void resetPerStep()
Definition ForcingData.hpp:192
std::vector< ForcingPersist > persist
Definition ForcingData.hpp:176
double apply(int i, double base) const noexcept
Apply this channel at i to base; base when unset.
Definition ForcingData.hpp:185
std::vector< ForcingMode > mode
Definition ForcingData.hpp:174
void clear()
Definition ForcingData.hpp:197
std::vector< double > value
Definition ForcingData.hpp:175
void ensure(std::size_t n)
Definition ForcingData.hpp:178
Definition ForcingData.hpp:70
ElemClimateChannel elem_air_temp[2]
deg F
Definition ForcingData.hpp:202
void clear_reset_entries()
Clear only RESET-persistence entries (called at end of each step).
Definition ForcingData.hpp:343
std::vector< double > subcatch_rainfall_value
user units (in/hr or mm/hr)
Definition ForcingData.hpp:117
std::vector< ForcingMode > node_lat_inflow_mode
Definition ForcingData.hpp:74
double effective_wind(double broadcast) const noexcept
Resolve the effective wind speed (mph internal).
Definition ForcingData.hpp:403
std::vector< double > node_temperature_value
Definition ForcingData.hpp:93
ForcingMode climate_evap_mode
Definition ForcingData.hpp:144
void resize(int n_nodes, int n_links, int n_subcatches, int n_gages, int n_pollutants)
Allocate all arrays and initialise to NONE / 0 / RESET.
Definition ForcingData.hpp:246
double climate_evap_value
ft/sec (internal; converted from in/day or mm/day at the C API boundary)
Definition ForcingData.hpp:145
std::vector< double > link_setting_value
0.0–1.0 for pump/orifice/weir
Definition ForcingData.hpp:107
std::vector< ForcingMode > gage_rainfall_mode
Definition ForcingData.hpp:130
int n_pollutants_
Definition ForcingData.hpp:237
std::vector< ForcingPersist > subcatch_evap_persist
Definition ForcingData.hpp:122
std::vector< ForcingMode > link_quality_mode
flattened link × pollutant
Definition ForcingData.hpp:110
void clear_all()
Reset ALL forcing modes to NONE (called on simulation restart).
Definition ForcingData.hpp:315
std::vector< ForcingMode > subcatch_snowfall_mode
Definition ForcingData.hpp:124
int n_links_
Definition ForcingData.hpp:234
std::vector< double > node_age_value
Definition ForcingData.hpp:97
ForcingMode climate_wind_mode
Definition ForcingData.hpp:140
std::vector< double > node_lat_inflow_value
Definition ForcingData.hpp:75
std::vector< ForcingMode > subcatch_rainfall_mode
Definition ForcingData.hpp:116
std::vector< double > link_quality_value
OVERRIDE: concentration; ADD: mass rate (mass/sec)
Definition ForcingData.hpp:111
std::vector< double > subcatch_evap_value
prescribed PET rate, ft/sec (internal units; converted from in/day or mm/day at the C API boundary)
Definition ForcingData.hpp:121
int n_subcatches_
Definition ForcingData.hpp:235
double climate_temperature_value
deg F (internal; converted from deg C at the C API boundary for SI)
Definition ForcingData.hpp:137
double effective_temperature(double broadcast) const noexcept
Resolve the effective air temperature (deg F internal).
Definition ForcingData.hpp:389
ElemClimateChannel elem_wind[2]
mph
Definition ForcingData.hpp:204
static int elemSlot(HeatElemKind k) noexcept
-1 for a kind that carries no per-element climate (SUBCATCH, LID).
Definition ForcingData.hpp:208
std::vector< ForcingMode > link_setting_mode
Definition ForcingData.hpp:106
double effective_snowfall(std::size_t ui, double gage_snowfall) const noexcept
Resolve the effective snowfall for a subcatchment (ft/sec).
Definition ForcingData.hpp:455
std::vector< ForcingMode > node_quality_mode
Definition ForcingData.hpp:83
double elementShortwave(const HeatElement &e, double base) const noexcept
Definition ForcingData.hpp:226
std::vector< ForcingPersist > subcatch_snowfall_persist
Definition ForcingData.hpp:126
ElemClimateChannel elem_humidity[2]
%
Definition ForcingData.hpp:203
double climate_wind_value
mph (internal; converted from km/hr at the C API boundary for SI)
Definition ForcingData.hpp:141
std::vector< double > subcatch_snowfall_value
ft/sec (internal; converted from in/hr or mm/hr at the C API boundary)
Definition ForcingData.hpp:125
std::vector< double > gage_rainfall_value
user units (in/hr or mm/hr)
Definition ForcingData.hpp:131
std::vector< ForcingPersist > gage_rainfall_persist
Definition ForcingData.hpp:132
double elementWindMph(const HeatElement &e, double base) const noexcept
Definition ForcingData.hpp:222
double effective_rainfall(std::size_t ui, double gage_rainfall) const noexcept
Resolve the effective rainfall for a subcatchment.
Definition ForcingData.hpp:422
ElemClimateChannel elem_shortwave[2]
W/m2.
Definition ForcingData.hpp:205
std::vector< ForcingPersist > link_quality_persist
Definition ForcingData.hpp:112
std::vector< ForcingPersist > link_flow_persist
Definition ForcingData.hpp:104
ForcingPersist climate_wind_persist
Definition ForcingData.hpp:142
ForcingMode climate_temperature_mode
Definition ForcingData.hpp:136
std::vector< double > link_flow_value
Definition ForcingData.hpp:103
std::vector< ForcingPersist > node_lat_inflow_persist
Definition ForcingData.hpp:76
double effective_climate_evap(double broadcast) const noexcept
Resolve the effective system-wide evaporation rate (ft/sec).
Definition ForcingData.hpp:437
std::vector< ForcingMode > link_flow_mode
Definition ForcingData.hpp:102
ForcingPersist climate_temperature_persist
Definition ForcingData.hpp:138
std::vector< ForcingMode > node_head_boundary_mode
Definition ForcingData.hpp:78
std::vector< ForcingPersist > node_age_persist
Definition ForcingData.hpp:98
std::vector< ForcingPersist > node_quality_persist
Definition ForcingData.hpp:85
std::vector< ForcingMode > node_temperature_mode
Definition ForcingData.hpp:92
std::vector< ForcingPersist > subcatch_rainfall_persist
Definition ForcingData.hpp:118
double effective_evap_rate(std::size_t ui, double broadcast_rate) const noexcept
Resolve the effective evaporation rate for a subcatchment.
Definition ForcingData.hpp:477
std::vector< ForcingPersist > node_head_boundary_persist
Definition ForcingData.hpp:80
ForcingPersist climate_evap_persist
Definition ForcingData.hpp:146
std::vector< ForcingPersist > link_setting_persist
Definition ForcingData.hpp:108
double elementAirTempF(const HeatElement &e, double base) const noexcept
Definition ForcingData.hpp:214
std::vector< double > node_head_boundary_value
Definition ForcingData.hpp:79
int n_gages_
Definition ForcingData.hpp:236
std::vector< ForcingMode > subcatch_evap_mode
Definition ForcingData.hpp:120
double elementHumidity(const HeatElement &e, double base) const noexcept
Definition ForcingData.hpp:218
std::vector< ForcingMode > node_age_mode
Definition ForcingData.hpp:96
std::vector< ForcingPersist > node_temperature_persist
Definition ForcingData.hpp:94
int n_nodes_
Definition ForcingData.hpp:233
std::vector< double > node_quality_value
mass rate (mass/sec)
Definition ForcingData.hpp:84
Which element a flux evaluator is being called for.
Definition HeatOverrideData.hpp:96