42#ifndef OPENSWMM_LID_HPP
43#define OPENSWMM_LID_HPP
96 return storage_thickness <= 0 || storage_ksat > 0;
110 return (type ==
"BC" || type ==
"RG" || type ==
"IT" || type ==
"PP") &&
111 (thickness <= 0 || ksat > 0);
152 std::vector<std::string>
367 const std::vector<CompletedUnitInput>& inputs);
385 return groups_[
static_cast<size_t>(type_index)];
391 int numGroups()
const {
return static_cast<int>(groups_.size()); }
402 const std::vector<std::pair<int, int>>&
usageOrder()
const {
return usage_order_; }
413 double storedVolume(
const std::vector<int>* source_owners =
nullptr)
const;
429 bool lazy_buffers =
false);
491 const std::vector<int>* source_owners =
nullptr);
499 void setRunoffTime(
double old_runoff_sec) { old_runoff_sec_ = old_runoff_sec; }
512 void setNativeInfil(std::vector<double> native, std::vector<double> max_native) {
513 native_infil_ = std::move(native);
514 max_native_infil_ = std::move(max_native);
526 infil_factor_ = std::move(infil_factor);
527 recovery_factor_ = recovery_factor;
538 bool anyWet(
const std::vector<int>* source_owners =
nullptr)
const;
697 std::vector<LIDGroupSoA> groups_;
698 std::vector<std::pair<int, int>> usage_order_;
699 double old_runoff_sec_ = 0.0;
712 std::map<std::pair<int, int>, std::unique_ptr<LidRptFile>> rpt_files_;
730 void saveLidReport(
SimulationContext& ctx,
int gi, LIDGroupSoA& g, std::size_t u,
double dt);
731 double recovery_factor_ = 1.0;
732 std::vector<double> native_infil_;
733 std::vector<double> max_native_infil_;
734 std::vector<double> infil_factor_;
Infiltration models — Horton, Green-Ampt, SCS Curve Number.
Definition CompletedSourceArchive.hpp:25
static void batchGreenRoofFlux(LIDGroupSoA &g, double rainfall, const double *evap_rate, double dt)
Advance a standalone green-roof group through the shared legacy kernel.
Definition LID.cpp:1907
int numGroups() const
Return the number of currently allocated type groups.
Definition LID.hpp:391
const std::vector< std::pair< int, int > > & usageOrder() const
Borrow the deterministic legacy accumulation order for usage rows.
Definition LID.hpp:402
void executeCompleted(double dt, double start, double recovery_factor, const std::vector< CompletedUnitInput > &inputs)
Advance selected units with already-resolved completed-source forcing.
Definition LID.cpp:1984
static void batchPavementFlux(LIDGroupSoA &g, double rainfall, const double *evap_rate, double dt)
Advance a standalone permeable-pavement group through the shared legacy kernel.
Definition LID.cpp:1911
LIDSolver waterTrial() const
Copy water parameters, runtime state and ledgers for an independent trial.
Definition LID.cpp:1972
bool anyWet(const std::vector< int > *source_owners=nullptr) const
Test the last evaluated wet flags of included units.
Definition LID.cpp:2236
static void batchSwaleFlux(LIDGroupSoA &g, double rainfall, const double *evap_rate, double dt)
Advance a standalone vegetative-swale group through the shared legacy kernel.
Definition LID.cpp:1899
static void batchSwaleModPuls(LIDGroupSoA &g, double rainfall, const double *evap_rate, double dt)
Advance a standalone Modified Puls swale group through the shared legacy kernel.
Definition LID.cpp:1903
void checkpoint(detail::CompletedSourceArchive &a, bool model, bool lazy_buffers=false)
Visit LID model identity or accepted-boundary water state in archive order.
Definition LIDCheckpoint.cpp:16
LIDGroupSoA & group(int type_index)
Borrow mutable parameters and water state for a type group.
Definition LID.hpp:376
const LIDGroupSoA & group(int type_index) const
Borrow read-only parameters and water state for a type group.
Definition LID.hpp:384
double storedVolume(const std::vector< int > *source_owners=nullptr) const
Sum current planar, void-weighted layer storage for ordinary runoff continuity.
Definition LID.cpp:611
void setNativeInfil(std::vector< double > native, std::vector< double > max_native)
Take ownership of per-subcatchment native-soil rates for subsequent ordinary steps.
Definition LID.hpp:512
static void batchInfilTrenchFlux(LIDGroupSoA &g, double rainfall, const double *evap_rate, double dt)
Advance a standalone infiltration-trench group through the shared legacy kernel.
Definition LID.cpp:1895
void setInfilFactors(std::vector< double > infil_factor, double recovery_factor)
Take ownership of infiltration multipliers and set the evaporation recovery factor.
Definition LID.hpp:525
void execute(SimulationContext &ctx, double dt, double rainfall, double evap_rate, const std::vector< int > *source_owners=nullptr)
Advance ordinary LID units with staged inflow and context-resolved evaporation.
Definition LID.cpp:2024
double totalInfilVolume() const
Sum cumulative native plus spatial bottom exfiltration over all unit footprints.
Definition LID.cpp:1946
void init(SimulationContext &ctx)
Build eight type groups and initialize water state from resolved LID controls and usage.
Definition LID.cpp:180
void validateCheckpoint(const LIDSolver &model, std::size_t runoff_count) const
Check restored LID water state against an initialized model.
Definition LIDCheckpoint.cpp:72
static void batchBioCellFlux(LIDGroupSoA &g, double rainfall, const double *evap_rate, double dt)
Advance a standalone biocell/rain-garden group through the shared legacy kernel.
Definition LID.cpp:1888
void setRunoffTime(double old_runoff_sec)
Set the old runoff clock used by regeneration and report timestamps.
Definition LID.hpp:499
double totalInitVolume() const
Sum the initialized water-balance store ledger over all unit footprints.
Definition LID.cpp:1935
static void batchBarrelFlux(LIDGroupSoA &g, double rainfall, double dt)
Advance a standalone rain-barrel group through the shared legacy kernel.
Definition LID.cpp:1892
double totalEvapVolume() const
Sum cumulative evaporation over all unit footprints.
Definition LID.cpp:1957
double totalStoredVolume() const
Sum the latest kernel water-balance final-store ledger over all unit footprints.
Definition LID.cpp:1924
static void batchRoofDisconFlux(LIDGroupSoA &g, double rainfall, const double *evap_rate, double dt)
Advance a standalone roof-disconnection group through the shared legacy kernel.
Definition LID.cpp:1915
Definition OutfallExchange.hpp:17
constexpr int STOR
Definition LID.hpp:120
constexpr int SOIL
Definition LID.hpp:119
constexpr int N_LAYERS
Definition LID.hpp:122
LIDType
Definition LID.hpp:69
@ ROOF_DISCON
Definition LID.hpp:77
@ INFIL_TRENCH
Definition LID.hpp:73
@ VEG_SWALE
Definition LID.hpp:76
@ RAIN_BARREL
Definition LID.hpp:75
@ BIO_CELL
Definition LID.hpp:70
@ RAIN_GARDEN
Definition LID.hpp:71
@ GREEN_ROOF
Definition LID.hpp:72
@ PERM_PAVEMENT
Definition LID.hpp:74
double completedUnitStorage(const LIDGroupSoA &g, int u)
Measure one completed-source unit using its physical layer geometry.
Definition LID.cpp:594
bool hasNativeBottom(LIDType type, double storage_thickness, double storage_ksat)
Classify whether an enumerated LID has an infiltrating native-soil bottom.
Definition LID.hpp:90
constexpr int PAVE
Definition LID.hpp:121
constexpr int SURF
Definition LID.hpp:118
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
std::vector< double > soil_wp
Soil wilting point.
Definition LID.hpp:170
double ucf_rainfall
ft/sec → in/hr|mm/hr (RAINFALL)
Definition LID.hpp:137
std::vector< double > pave_void
Pavement void fraction.
Definition LID.hpp:193
std::vector< double > pave_imperv_frac
Impervious fraction of pavement.
Definition LID.hpp:194
std::vector< double > surface_runoff
Definition LID.hpp:238
std::vector< double > soil_thick
Soil thickness (ft)
Definition LID.hpp:167
std::vector< double > wb_evap
Definition LID.hpp:276
std::vector< int > control_idx
LID control index (into ctx.lid_controls)
Definition LID.hpp:140
std::vector< double > surf_alpha
Surface Manning alpha = sqrt(slope)/n.
Definition LID.hpp:208
std::vector< double > in_surf
External inflow onto the surface.
Definition LID.hpp:260
std::vector< double > pave_regen_days
Pavement regeneration interval (days)
Definition LID.hpp:197
std::vector< double > evap_surf
Definition LID.hpp:266
std::vector< double > drainmat_alpha
legacy drainMat.alpha = PHI / roughness * sqrt(surfSlope)
Definition LID.hpp:235
std::vector< int > drain_subcatch
Resolved drain-to subcatch index (-1=none)
Definition LID.hpp:146
std::vector< double > drain_coeff
Drain coefficient.
Definition LID.hpp:183
std::vector< std::string > rpt_path
Per-unit LID report file ([LID_USAGE] col 9); empty = none.
Definition LID.hpp:153
std::vector< double > drain_hopen
Head to open drain valve (ft)
Definition LID.hpp:187
std::vector< int > drain_node
Resolved drain-to node index (-1=none)
Definition LID.hpp:145
std::vector< double > inflow
Per-unit inflow rate (ft/sec) — set before execute()
Definition LID.hpp:147
std::vector< int > drain_open
Current drain valve state (1=open, 0=closed)
Definition LID.hpp:189
std::vector< double > f_old_stor
Previous storage flux rate.
Definition LID.hpp:271
std::vector< double > drain_hclose
Head to close drain valve (ft)
Definition LID.hpp:188
std::vector< double > drain_expon
Drain exponent.
Definition LID.hpp:184
std::vector< double > wb_surf_flow
Total surface outflow volume (ft)
Definition LID.hpp:280
std::vector< double > pave_thick
Pavement thickness (ft)
Definition LID.hpp:192
std::vector< double > surf_depth
Current surface ponded depth.
Definition LID.hpp:216
std::vector< double > pave_ksat
Pavement saturated K (ft/sec)
Definition LID.hpp:195
std::vector< double > stor_ksat
Storage exfiltration K (ft/sec)
Definition LID.hpp:178
std::vector< double > surf_slope
Surface slope.
Definition LID.hpp:164
std::vector< double > stor_void
Storage void fraction.
Definition LID.hpp:177
std::vector< double > wb_final_vol
Final stored volume (ft)
Definition LID.hpp:283
std::vector< double > subcatch_rain
Parent subcatchment rainfall (ft/sec) — for the rain-barrel dry-time reset (legacy lid....
Definition LID.hpp:151
std::vector< double > soil_kslope
Conductivity slope.
Definition LID.hpp:172
int n_pollutants
Number of pollutants (for indexing drain_rmvl)
Definition LID.hpp:245
std::vector< double > soil_poros
Soil porosity.
Definition LID.hpp:168
std::vector< double > dry_time
Seconds since last rainfall.
Definition LID.hpp:213
std::vector< double > stor_thick
Storage thickness (ft)
Definition LID.hpp:176
std::vector< GreenAmptState > soil_infil
Definition LID.hpp:229
std::vector< double > surf_store
Surface storage depth (ft)
Definition LID.hpp:162
std::vector< double > wb_spatial_infil
Definition LID.hpp:278
std::vector< double > drainmat_thick
Drainage mat thickness (ft)
Definition LID.hpp:202
std::vector< double > rpt_surf_infil
SurfaceInfil this step.
Definition LID.hpp:157
std::vector< double > soil_ksat
Soil saturated K (ft/sec)
Definition LID.hpp:171
std::vector< double > f_old_surf
Previous surface flux rate.
Definition LID.hpp:269
std::vector< double > drain_flow
Definition LID.hpp:239
std::vector< double > in_stor
Definition LID.hpp:263
void resize(int n)
Reset a type group to default per-unit arrays.
Definition LID.cpp:43
std::vector< double > wb_infil
Total exfiltration volume (ft)
Definition LID.hpp:279
std::vector< double > wb_init_vol
Initial stored volume (ft)
Definition LID.hpp:282
std::vector< double > f_old_pave
Previous pavement flux rate.
Definition LID.hpp:272
std::vector< double > surf_rough
Surface Manning's n.
Definition LID.hpp:163
std::vector< double > soil_suction
Suction head for Green-Ampt (ft)
Definition LID.hpp:173
std::vector< double > pave_regen_deg
Pavement regeneration degree (0-1)
Definition LID.hpp:198
std::vector< double > full_width
Full width for Manning's flow (ft)
Definition LID.hpp:210
std::vector< double > wb_inflow
Total inflow volume (ft)
Definition LID.hpp:275
std::vector< double > f_old_soil
Previous soil flux rate.
Definition LID.hpp:270
std::vector< double > evap_soil
Definition LID.hpp:266
std::vector< double > pave_clog_factor
Pavement clog factor (ft of treated volume)
Definition LID.hpp:196
std::vector< int > stor_covered
1 if rain barrel is covered (blocks rainfall)
Definition LID.hpp:180
std::vector< double > wb_drain_flow
Total drain outflow volume (ft)
Definition LID.hpp:281
std::vector< double > drainmat_rough
Drainage mat Manning's roughness.
Definition LID.hpp:204
std::vector< int > subcatch_idx
Which subcatchment this unit belongs to.
Definition LID.hpp:139
std::vector< double > pave_depth
Current pavement depth.
Definition LID.hpp:219
std::vector< double > rpt_soil_perc
SoilPerc this step.
Definition LID.hpp:159
std::vector< double > spatial_infil_loss
Completed spatial bottom water, ft over the full unit footprint.
Definition LID.hpp:278
std::vector< double > stor_depth
Current storage depth.
Definition LID.hpp:218
double ucf_raindepth
ft → in|mm (RAINDEPTH)
Definition LID.hpp:136
std::vector< double > infil_loss
Native infiltration loss this step (ft)
Definition LID.hpp:241
std::vector< double > surf_void_frac
Surface void fraction (default 1.0)
Definition LID.hpp:207
LIDType type
Definition LID.hpp:129
std::vector< double > evap_rate_unit
Per-unit effective PET rate (ft/sec) — filled by execute()
Definition LID.hpp:149
std::vector< double > in_pave
Surface → pavement.
Definition LID.hpp:261
std::vector< double > unit_area
ONE unit's area (ft2) — legacy lidUnit->area.
Definition LID.hpp:211
std::vector< int > to_perv
Route surface outflow to pervious area (1=yes)
Definition LID.hpp:144
std::vector< double > evap_pave
Definition LID.hpp:266
std::vector< double > drain_delay
Drain delay time (sec, rain barrel)
Definition LID.hpp:186
std::vector< double > old_drain_flow
Definition LID.hpp:230
std::vector< double > area
Unit area (ft2)
Definition LID.hpp:141
std::vector< uint8_t > is_wet
legacy lidproc_saveResults isDry == FALSE this step (HasWetLids)
Definition LID.hpp:232
std::vector< double > evap_stor
Definition LID.hpp:266
std::vector< double > evap_loss
Evaporation loss this step (ft of depth)
Definition LID.hpp:240
std::vector< double > unit_width
ONE unit's width (ft) — legacy lidUnit->fullWidth.
Definition LID.hpp:212
int count
Definition LID.hpp:130
std::vector< double > from_perv
Fraction of pervious runoff treated (0-1)
Definition LID.hpp:143
std::vector< double > stor_clog
Storage clogging factor (ft)
Definition LID.hpp:179
std::vector< double > next_regen_day
Next day for pavement regeneration (OADate)
Definition LID.hpp:199
std::vector< double > soil_fc
Soil field capacity.
Definition LID.hpp:169
std::vector< double > in_soil
Layer above → soil.
Definition LID.hpp:262
std::vector< double > surf_side_slope
Swale side slope (run/rise)
Definition LID.hpp:209
std::vector< double > vol_treated
Cumulative volume treated (ft, for clog model)
Definition LID.hpp:284
std::vector< double > drainmat_void
Drainage mat void fraction.
Definition LID.hpp:203
std::vector< double > from_imperv
Fraction of impervious runoff treated (0-1)
Definition LID.hpp:142
std::vector< double > drain_rmvl
Removal fraction per unit per pollutant.
Definition LID.hpp:244
std::vector< uint8_t > can_overflow
Definition LID.hpp:233
std::vector< double > drain_offset
Drain offset depth (ft)
Definition LID.hpp:185
std::vector< double > rpt_pave_perc
PavePerc this step.
Definition LID.hpp:158
std::vector< double > soil_moist
Current soil moisture (0-porosity)
Definition LID.hpp:217