24#ifndef OPENSWMM_ENGINE_LINK_DATA_HPP
25#define OPENSWMM_ENGINE_LINK_DATA_HPP
141 std::vector<double>
q0;
342 std::vector<double>
cd;
459 int count() const noexcept {
return static_cast<int>(
type.size()); }
462 const auto un =
static_cast<std::size_t
>(n);
465 node1.assign(un, -1);
466 node2.assign(un, -1);
479 slope.assign(un, 0.0);
482 beta.assign(un, 0.0);
488 q_max.assign(un, 0.0);
505 dqdh.assign(un, 0.0);
513 orate.assign(un, 0.0);
515 flow.assign(un, 0.0);
516 depth.assign(un, 0.0);
541 if (n_pollutants > 0) {
542 auto total =
static_cast<std::size_t
>(
count()) *
543 static_cast<std::size_t
>(n_pollutants);
555 std::fill(
flow.begin(),
flow.end(), 0.0);
Definition Controls.cpp:24
LinkType
Link type codes.
Definition LinkData.hpp:40
FlowClass
Link flow state.
Definition LinkData.hpp:82
XsectShape
Conduit cross-section shape code.
Definition LinkData.hpp:52
@ FORCE_MAIN
Circular force main (Hazen-Williams or D-W)
@ STREET_XSECT
Street cross-section.
@ IRREGULAR
User-supplied shape curve.
@ CUSTOM
Shape from CURVE_SHAPE table.
@ RECT_ROUND
Rectangular-round bottom.
@ DUMMY
Dummy (no geometry)
@ RECT_TRIANG
Rectangular-triangular bottom.
Structure-of-Arrays storage for all links.
Definition LinkData.hpp:104
void resize(int n)
Definition LinkData.hpp:461
std::vector< double > orate
Orifice open/close rate (fraction per second).
Definition LinkData.hpp:352
std::vector< long > stat_norm_ltd
Count of steps with normal flow limiting.
Definition LinkData.hpp:443
std::vector< double > stat_vol_flow
Total volume conveyed by this link (project volume units).
Definition LinkData.hpp:409
int stat_n_pollutants
Definition LinkData.hpp:453
std::vector< double > dqdh
Derivative dQ/dH for inlet-controlled culvert flow.
Definition LinkData.hpp:332
std::vector< double > stat_total_load
Cumulative pollutant loads transported through each link.
Definition LinkData.hpp:452
std::vector< double > old_volume
Volume at the previous timestep.
Definition LinkData.hpp:399
std::vector< bool > has_flap_gate
Flap gate on this conduit.
Definition LinkData.hpp:308
std::vector< double > old_depth
Depth at the previous timestep.
Definition LinkData.hpp:396
void reset_state() noexcept
Definition LinkData.hpp:554
std::vector< bool > pump_init_state
Initial pump on/off state.
Definition LinkData.hpp:295
std::vector< double > froude
Current froude number (absolute).
Definition LinkData.hpp:380
std::vector< int > culvert_code
Culvert type code (1-57, 0 = not a culvert).
Definition LinkData.hpp:316
std::vector< double > flow
Current flow rate (project flow units, +ve = node1→node2).
Definition LinkData.hpp:362
std::vector< double > xsect_s_full
Full-pipe section factor.
Definition LinkData.hpp:221
std::vector< double > xsect_r_bot
Multi-purpose shape param: wall length (RECT_TRIANG), wetted perimeter (FILLED_CIRCULAR).
Definition LinkData.hpp:258
std::vector< int > pump_curve
Pump curve index into TableData.
Definition LinkData.hpp:292
std::vector< int > node1
Upstream node index.
Definition LinkData.hpp:117
std::vector< double > stat_time_surcharged
Total duration of surcharge (seconds).
Definition LinkData.hpp:433
std::vector< XsectShape > xsect_shape
Cross-section shape.
Definition LinkData.hpp:154
int count() const noexcept
Definition LinkData.hpp:459
std::vector< long > stat_inlet_ctrl
Count of steps with inlet control.
Definition LinkData.hpp:444
std::vector< double > stat_max_filling
Maximum reported filling ratio (depth / full depth).
Definition LinkData.hpp:427
std::vector< double > q_limit
Maximum allowable flow rate (project flow units, 0 = unlimited).
Definition LinkData.hpp:147
std::vector< double > loss_outlet
Outlet loss coefficient.
Definition LinkData.hpp:304
std::vector< double > length
Conduit length (project length units).
Definition LinkData.hpp:175
std::vector< double > q_full
Full-pipe flow rate: q_full = xsect_s_full * beta.
Definition LinkData.hpp:209
std::vector< double > rough_factor
Roughness factor for head loss: GRAVITY * (n/PHI)^2.
Definition LinkData.hpp:203
std::vector< FlowClass > flow_class
Current flow class (DRY, SUBCRITICAL, etc.).
Definition LinkData.hpp:383
std::vector< double > param2
Rated capacity or parameter 2 (weir side slopes, orifice area, etc.).
Definition LinkData.hpp:345
std::vector< long > stat_flow_class
Definition LinkData.hpp:442
std::vector< double > stat_max_flow
Maximum reported flow rate (project flow units).
Definition LinkData.hpp:415
std::vector< double > q0
Initial flow rate (project flow units).
Definition LinkData.hpp:141
void save_state() noexcept
Definition LinkData.hpp:548
std::vector< double > xsect_w_max
Full hydraulic width of cross-section.
Definition LinkData.hpp:163
std::vector< double > xsect_r_full
Full-pipe hydraulic radius.
Definition LinkData.hpp:215
std::vector< double > xsect_a_bot
Bottom area for FILLED_CIRCULAR, RECT_TRIANG shapes.
Definition LinkData.hpp:245
std::vector< int > xsect_curve
Shape curve index (for IRREGULAR / CUSTOM shapes).
Definition LinkData.hpp:169
std::vector< double > xsect_yw_max
Depth at maximum width.
Definition LinkData.hpp:264
std::vector< double > stat_max_veloc
Maximum reported flow velocity (project length/time units).
Definition LinkData.hpp:421
std::vector< double > q_max
Maximum flow rate at sMax: q_max = xsect_s_max * beta.
Definition LinkData.hpp:233
std::vector< double > roughness
Manning's roughness coefficient.
Definition LinkData.hpp:172
void resize_loads(int n_pollutants)
Resize pollutant load arrays after pollutant count is known.
Definition LinkData.hpp:539
std::vector< bool > is_closed
True if the link is closed by a control rule.
Definition LinkData.hpp:386
std::vector< double > volume
Current full-flow volume (project volume units).
Definition LinkData.hpp:374
std::vector< double > mod_length
Modified conduit length for CFL stability (project length units).
Definition LinkData.hpp:187
std::vector< LinkType > type
Link type.
Definition LinkData.hpp:111
std::vector< double > loss_avg
Average loss coefficient.
Definition LinkData.hpp:306
std::vector< double > offset1
Link offset at upstream node (project length units above invert).
Definition LinkData.hpp:129
std::vector< double > offset2
Link offset at downstream node.
Definition LinkData.hpp:135
std::vector< double > loss_inlet
Inlet loss coefficient.
Definition LinkData.hpp:302
std::vector< double > cd
Discharge coefficient (dimensionless).
Definition LinkData.hpp:342
std::vector< bool > inlet_control
True if inlet control governs for this culvert link.
Definition LinkData.hpp:326
std::vector< double > target_setting
Target setting from control rules.
Definition LinkData.hpp:276
std::vector< double > xsect_s_bot
Multi-purpose shape param: side slope (RECT_TRIANG), C-factor (FORCE_MAIN), number of open sides (REC...
Definition LinkData.hpp:252
std::vector< bool > normal_flow_limited
Definition LinkData.hpp:320
std::vector< double > xsect_s_max
Maximum section factor (at depth of max conveyance).
Definition LinkData.hpp:227
std::vector< int > node2
Downstream node index.
Definition LinkData.hpp:123
std::vector< double > xsect_a_full
Full-flow area of cross-section (sq project length units).
Definition LinkData.hpp:160
std::vector< int > direction
Flow direction: +1 = node1→node2, -1 = reversed.
Definition LinkData.hpp:282
std::vector< double > xsect_y_full
Full depth of cross-section (project length units).
Definition LinkData.hpp:157
std::vector< double > crest_height
Crest height above upstream node invert (project length units).
Definition LinkData.hpp:339
std::vector< double > xsect_y_bot
Bottom depth for FILLED_CIRCULAR, RECT_TRIANG, RECT_ROUND shapes.
Definition LinkData.hpp:239
static constexpr int N_FLOW_CLASSES
Per-link flow classification step counts.
Definition LinkData.hpp:441
std::vector< double > beta
Manning conveyance factor: beta = PHI * sqrt(|slope|) / n.
Definition LinkData.hpp:197
std::vector< double > depth
Current water depth at midpoint (project length units).
Definition LinkData.hpp:368
std::vector< double > seep_rate
Seepage rate (project units).
Definition LinkData.hpp:310
std::vector< int > barrels
Number of identical barrels (conduits only, default 1).
Definition LinkData.hpp:190
std::vector< double > old_flow
Flow at the previous timestep.
Definition LinkData.hpp:393
std::vector< double > slope
Conduit slope (rise/run, dimensionless).
Definition LinkData.hpp:178
std::vector< double > setting
Current link setting (0-1 for pumps/orifices/weirs, 1.0 default for conduits).
Definition LinkData.hpp:270