OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SurfaceExchange.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
14#include <algorithm>
15namespace openswmm {
16// A surface-coupled outfall is a finite reservoir, not an unlimited stage
17// boundary. Apply before node continuity consumes the hydraulic link flow.
31inline double boundSurfaceOutfallFlow(const SimulationContext& ctx, int link, double q) {
32 if (ctx.surface_outfall_link_limit.empty() || q == 0)
33 return q;
34 const int donor = q > 0 ? ctx.links.node1[link] : ctx.links.node2[link];
35 if (donor < 0 || static_cast<std::size_t>(donor) >= ctx.surface_outfall_link_limit.size())
36 return q;
37 const double cap = ctx.surface_outfall_link_limit[donor];
38 return q > 0 ? std::min(q, cap) : std::max(q, -cap);
39}
40}
The central, reentrant simulation context for the new engine.
Definition ExchangeLaw.hpp:60
double boundSurfaceOutfallFlow(const SimulationContext &ctx, int link, double q)
Bound a link flow by its upwind surface-outfall donor allowance.
Definition SurfaceExchange.hpp:31
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
std::vector< double > surface_outfall_link_limit
System mass-balance totals for the optional 2D surface domain.
Definition SimulationContext.hpp:1520
LinkData links
All link state and properties.
Definition SimulationContext.hpp:580