OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
OutfallExchange.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
13#include "NodeCoupling.hpp"
14#include <algorithm>
15#include <array>
16
20namespace openswmm::twoD {
21// A routing-step reservation, consumed before the next surface advance.
22// Overlapping outfalls divide each donor cell; incident 1D links divide each
23// outfall's rate. Unused reservations expire rather than being spent twice.
25public:
26 void initialize(const MeshData&, const std::vector<CouplingPoint>&, SimulationContext&);
27 void prepare(const MeshData&, const SurfaceStateData&, const SolverOptions2D&,
28 SimulationContext&, double dt);
30 double dt, std::vector<double>& accumulated,
31 const std::vector<double>* node_conc = nullptr,
32 std::vector<double>* cell_accumulated = nullptr);
36 void recordTailwater(const SimulationContext&, double dt);
50 bool tailwater(int node, double& engaged_s, double& submerged_s, double& max_stage) const;
51
52private:
53 friend class SurfaceRouter2D;
54 void checkpoint(detail::CompletedSourceArchive&);
55 void validateCheckpoint(const SolverOptions2D&, const std::vector<double>& limits,
56 const std::vector<double>& accumulated, bool changed,
57 const std::array<double, 2>& ledger) const;
64 void resetWindow() { std::fill(pending_.begin(), pending_.end(), 0.0); }
65 struct Point {
66 int index, node;
67 std::vector<int> cells;
68 std::vector<double> fraction, reserved;
69 double total = 0, area = 0;
73 std::vector<int> spread;
74 double bed_ref = 0;
75 };
76 std::vector<Point> points_;
77 std::vector<int> recv_;
78 std::vector<int> nodes_;
79 std::vector<int> degree_;
80 std::vector<double> node_area_, node_reserved_;
82 std::vector<double> tw_engaged_s_, tw_submerged_s_, tw_max_;
83 std::vector<double> pending_; // accepted per-cell receipts since the last surface batch
84 double prepared_dt_ = 0;
85 bool prepared_ = false; // false after consumption; unused reservations expire
86};
87}
Orifice-equation exchange between 2D surface and SWMM nodes.
Definition CompletedSourceArchive.hpp:25
Definition OutfallExchange.hpp:24
void recordTailwater(const SimulationContext &, double dt)
Accumulate distinct outfall tailwater engagement and crown-submergence diagnostics.
Definition OutfallExchange.cpp:339
bool tailwater(int node, double &engaged_s, double &submerged_s, double &max_stage) const
A coupled outfall's tailwater record for the report: seconds with the 2D tailwater engaged / above th...
Definition OutfallExchange.cpp:359
bool apply(const MeshData &, SurfaceStateData &, const SolverOptions2D &, SimulationContext &, double dt, std::vector< double > &accumulated, const std::vector< double > *node_conc=nullptr, std::vector< double > *cell_accumulated=nullptr)
Apply completed routed outfall water and donor-paired species to canonical surface cells.
Definition OutfallExchange.cpp:200
void initialize(const MeshData &, const std::vector< CouplingPoint > &, SimulationContext &)
Build outfall donor partitions, optional spread receivers and native link-limit storage.
Definition OutfallExchange.cpp:39
friend class SurfaceRouter2D
Definition OutfallExchange.hpp:53
void prepare(const MeshData &, const SurfaceStateData &, const SolverOptions2D &, SimulationContext &, double dt)
Reserve each outfall's disjoint share of frozen surface water for one routing step.
Definition OutfallExchange.cpp:144
Definition OutfallExchange.hpp:17
Definition Node.cpp:38
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
Definition SolverOptions2D.hpp:257
Definition SurfaceStateData.hpp:64