![]() |
OpenSWMM Engine
6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
|
Functions | |
| int | translateShape (XsectShape link_shape) |
| Translate LinkData::XsectShape to batch XSectShape int code. | |
| double | getVelocity (const XSectParams &xs, double flow, double depth, int barrels=1) |
| Compute flow velocity from flow and depth. | |
| double | getFroude (const XSectParams &xs, double v, double y) |
| Compute Froude number from velocity and depth. | |
| void | computeConveyance (double roughness, double slope, double s_full, double &beta, double &rough_factor, double &q_full) |
| Compute Manning conveyance coefficients for a conduit. | |
| double | getDepthFromFlow (const XSectParams &xs, double beta, double q) |
| Compute normal-flow depth from flow rate (inverse Manning). | |
| double | getCapacity (const XSectParams &xs, double depth) |
| Compute the capacity fraction (depth / full depth for conduits, setting for other links). | |
| double | getHydPower (double flow, double head_upstream, double head_downstream) |
| Compute hydraulic power dissipated in a link. | |
| XSectParams | buildXSectParams (const LinkData &links, std::size_t uj, const std::vector< transect::TransectData > *transects=nullptr) |
| Build XSectParams from LinkData SoA arrays. | |
| void | applyTabulatedXSectParams (XSectParams &xs, const transect::TransectData &td, double y_full, int transect_idx) |
| Derive the full-flow properties of a tabulated cross-section. | |
| void openswmm::link::applyTabulatedXSectParams | ( | XSectParams & | xs, |
| const transect::TransectData & | td, | ||
| double | y_full, | ||
| int | transect_idx ) |
Derive the full-flow properties of a tabulated cross-section.
The counterpart of xsect::setParams() for the three shapes whose geometry comes from a transect table rather than a formula: IRREGULAR, CUSTOM and STREET_XSECT. Fills the y_full/a_full/r_full/ w_max/s_full/s_max/a_bot/yw_max fields of xs from the built table, and attaches the table pointers.
Beyond a/r/w_full this sets the PHYSICAL s_max and a_bot (the area at the maximum section factor), which drive link_getYnorm's getAofS normal-depth solve and the flow limit q_max. Leaving s_max = s_full and a_bot = 0 diverges every transect whose section factor peaks below full depth.
xs.type must already be set to the batch XSectShape code.| xs | [in/out] Params to fill; type must be set on entry. |
| td | Built transect table (buildTables / buildCustomTables output). |
| y_full | Full depth (ft). Used only by CUSTOM, whose table is built at unit height and scaled here; ignored for IRREGULAR/STREET, which take y_full from td. |
| transect_idx | Index to record in xs.transect, or -1 when the table is owned rather than pooled. |
| XSectParams openswmm::link::buildXSectParams | ( | const LinkData & | links, |
| std::size_t | uj, | ||
| const std::vector< transect::TransectData > * | transects = nullptr ) |
Build XSectParams from LinkData SoA arrays.
| links | Link SoA data. |
| uj | Link index (size_t). |
| transects | Optional transect-table pool (ctx.transect_tables). When supplied, IRREGULAR/CUSTOM/STREET_XSECT links get their A/R/W table pointers attached so the per-element accessors can evaluate tabulated geometry. Pass nullptr when the link is known to be a self-contained shape. |
| void openswmm::link::computeConveyance | ( | double | roughness, |
| double | slope, | ||
| double | s_full, | ||
| double & | beta, | ||
| double & | rough_factor, | ||
| double & | q_full ) |
Compute Manning conveyance coefficients for a conduit.
Sets:
| roughness | Manning's n. | |
| slope | Conduit slope (rise/run). | |
| s_full | Section factor at full depth (ft^8/3). | |
| [out] | beta | Manning conveyance factor. |
| [out] | rough_factor | Head loss coefficient. |
| [out] | q_full | Full-pipe flow rate (ft3/s). |
| double openswmm::link::getCapacity | ( | const XSectParams & | xs, |
| double | depth ) |
Compute the capacity fraction (depth / full depth for conduits, setting for other links).
| double openswmm::link::getDepthFromFlow | ( | const XSectParams & | xs, |
| double | beta, | ||
| double | q ) |
Compute normal-flow depth from flow rate (inverse Manning).
Given Q, find y such that Q = beta * S(y). S = Q / beta → A = getAofS(xs, S) → y = getYofA(xs, A).
| xs | Cross-section parameters. |
| beta | Manning conveyance factor. |
| q | Flow rate (ft3/s). |
| double openswmm::link::getFroude | ( | const XSectParams & | xs, |
| double | v, | ||
| double | y ) |
Compute Froude number from velocity and depth.
Fr = |V| / sqrt(g * D_h) where D_h = A/T (hydraulic depth). Returns 0 for dry or fully-full closed conduits.
| xs | Cross-section parameters. |
| v | Velocity (ft/s). |
| y | Water depth (ft). |
| double openswmm::link::getHydPower | ( | double | flow, |
| double | head_upstream, | ||
| double | head_downstream ) |
Compute hydraulic power dissipated in a link.
P = gamma * Q * hL where gamma = specific weight of water, Q = flow rate, hL = head loss across link. hL = friction slope * length (for conduits).
| flow | Flow rate (ft3/s). |
| head_upstream | Head at upstream node (ft). |
| head_downstream | Head at downstream node (ft). |
| double openswmm::link::getVelocity | ( | const XSectParams & | xs, |
| double | flow, | ||
| double | depth, | ||
| int | barrels = 1 ) |
Compute flow velocity from flow and depth.
V = Q / (barrels * A(y)), where A is the cross-sectional area. Returns 0 if depth < 0.01 ft or area < FUDGE.
| xs | Cross-section parameters. |
| flow | Flow rate (ft3/s). |
| depth | Water depth (ft). |
| barrels | Number of identical barrels (default 1). |
| int openswmm::link::translateShape | ( | XsectShape | link_shape | ) |
Translate LinkData::XsectShape to batch XSectShape int code.
The two enums have different orderings. This function provides a safe mapping for use wherever XSectParams.type is set from LinkData::xsect_shape.