36#ifndef OPENSWMM_RDII_HPP
37#define OPENSWMM_RDII_HPP
42#include <unordered_map>
104 past_rain.assign(
static_cast<std::size_t
>(n), 0.0);
105 past_month.assign(
static_cast<std::size_t
>(n), 0);
142double updateIA_exp(
const UnitHydParams& uh, UHResponseData& rd,
const ExpDecayParams& dp,
143 int month,
int response,
double rainDepth,
double dt_sec,
211 using UhNameMap = std::unordered_map<std::string, int, CiHash, CiEqual>;
256 const std::vector<double>&
nodeFlows()
const {
return node_rdii_flow_; }
284 std::vector<double> node_rdii_flow_;
287 double grid_step_ = 0.0;
288 double next_tick_ = 0.0;
289 std::vector<int> grid_node_;
290 std::vector<float> grid_flows_;
312 double uhOrdinate(
const UnitHydParams& uh,
int month,
int response,
double t)
const;
Case-insensitive string helpers matching legacy SWMM name semantics.
Mutable strict-grid UH convolution, rainfall queues and node-flow history. Configure validated UH/dec...
Definition RDII.hpp:181
std::vector< int > rdiiNodeList() const
Copy sorted unique node indices currently stored in group assignment vectors.
Definition RDII.cpp:748
std::vector< std::array< ExpDecayParams, 3 > > decay_params
Definition RDII.hpp:249
static int getMaxPeriods(const UnitHydParams &uh, int response, int rainInterval)
Size one response rainfall ring to its longest monthly base duration.
Definition RDII.cpp:123
const std::vector< double > & nodeFlows() const
Borrow the latest emitted strict-grid node-flow row.
Definition RDII.hpp:256
void advance(SimulationContext &ctx, double new_elapsed_sec)
Record current rain chunks and emit every reached fixed wet-step grid tick.
Definition RDII.cpp:561
void init(SimulationContext &ctx)
Resolve authored UH/gage/decay assignments and reset the strict-grid driver.
Definition RDII.cpp:204
std::vector< UnitHydParams > uh_params
Definition RDII.hpp:244
void applyRdiiInflows(SimulationContext &ctx, double elapsed_sec) const
Add an emitted zero-order-held RDII row into the decomposed node inflow array.
Definition RDII.cpp:723
int findUnitHyd(const std::string &name) const
Find a registered UH parameter table by case-insensitive name.
Definition RDII.cpp:96
static int getRainInterval(const UnitHydParams &uh, double wet_step)
Select whole-second UH rainfall processing interval.
Definition RDII.cpp:103
const UhNameMap & uhNameIndex() const
Borrow the case-insensitive UH registry index.
Definition RDII.hpp:217
int addUnitHydParams(const std::string &name, const UnitHydParams ¶ms)
Copy a named monthly UH parameter table into the registry.
Definition RDII.cpp:84
std::unordered_map< std::string, int, CiHash, CiEqual > UhNameMap
UH name → index map type; case-insensitive (legacy hash.c parity).
Definition RDII.hpp:211
double updateIA_exp(const UnitHydParams &uh, UHResponseData &rd, const ExpDecayParams &dp, int month, int response, double rainDepth, double dt_sec, const SimulationContext &ctx)
Update exponential abstraction and optional degree-day SWE for one rain chunk.
Definition RDII.cpp:459
double getRecoveryRate(const ExpDecayParams &dp, double T_celsius)
Compute exponential-IA additive recovery at one air temperature.
Definition RDII.cpp:429
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
bool snow_on
Degree-day snow model enabled.
Definition RDII.hpp:80
double k_dep
Depletion rate (1/project-depth) — temperature-independent.
Definition RDII.hpp:69
double T_freeze
Recovery suppressed below this temperature (deg C)
Definition RDII.hpp:74
double snow_ddf
Degree-day melt factor (project-depth/degC/day)
Definition RDII.hpp:82
double k_T
Thermal recovery rate at T_ref (1/hr)
Definition RDII.hpp:71
double k_0
Base recovery rate (1/hr)
Definition RDII.hpp:70
double snow_T
Rain/snow threshold & melt base (deg C)
Definition RDII.hpp:81
double T_ref
Reference temperature (deg C)
Definition RDII.hpp:72
bool active
Definition RDII.hpp:68
double theta_rec
Temperature sensitivity (1/deg C)
Definition RDII.hpp:73
void resize(int n)
Reset group metadata/queues and resize response objects.
Definition RDII.cpp:39
std::vector< int > gage_idx
Rain gage index per UH group (legacy: UnitHyd[j].rainGage)
Definition RDII.hpp:150
std::vector< int > uh_idx
Unit hydrograph parameter index.
Definition RDII.hpp:149
std::vector< double > rate_recorded_until
Chunk starts with recorded rates (sec)
Definition RDII.hpp:164
std::vector< double > gage_elapsed
Chunk cursor (sec, legacy UHGroup.gageDate)
Definition RDII.hpp:163
std::vector< double > area
Contributing area, project land-area units (acres/ha)
Definition RDII.hpp:151
std::vector< int > node_idx
Target node index.
Definition RDII.hpp:148
std::vector< UHResponseData > uh_data
Per-response data: [group * 3 + response].
Definition RDII.hpp:154
std::vector< std::vector< double > > pending_rates
FIFO of recorded chunk rates.
Definition RDII.hpp:165
std::vector< int > rain_interval
Rain processing interval (sec) per group.
Definition RDII.hpp:156
int count
Definition RDII.hpp:147
int has_past_rain
true if any non-zero past rain
Definition RDII.hpp:92
long dry_seconds
seconds since last non-zero rainfall
Definition RDII.hpp:95
std::vector< int > past_month
month for each past rainfall entry
Definition RDII.hpp:89
int period
current buffer write position
Definition RDII.hpp:90
int max_periods
buffer capacity
Definition RDII.hpp:91
std::vector< double > past_rain
circular buffer of past rainfall depths
Definition RDII.hpp:88
void allocate(int n)
Reset one response's circular rainfall/month buffers and abstraction/SWE state.
Definition RDII.hpp:102
double ia_used
initial abstraction used so far
Definition RDII.hpp:93
double swe
snow water equivalent (project depth; degree-day snow model)
Definition RDII.hpp:94
double iaRecov[12][3]
Linear recovery, project rain-depth units/day.
Definition RDII.hpp:57
double iaMax[12][3]
Maximum abstraction, project rain-depth units.
Definition RDII.hpp:56
double tPeak[12][3]
Time to peak (sec) per month × response.
Definition RDII.hpp:54
double tBase[12][3]
Base time (sec) per month × response.
Definition RDII.hpp:55
double r[12][3]
Rainfall fraction per month × response.
Definition RDII.hpp:53
double iaInit[12][3]
Initial used abstraction, project rain-depth units.
Definition RDII.hpp:58