OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
KinematicWave.hpp
Go to the documentation of this file.
1
28#ifndef OPENSWMM_KINEMATIC_WAVE_HPP
29#define OPENSWMM_KINEMATIC_WAVE_HPP
30
31#include "XSectBatch.hpp"
32#include <vector>
33
34namespace openswmm {
35
36struct SimulationContext;
37
38namespace kinwave {
39
40// ============================================================================
41// Constants (matching legacy)
42// ============================================================================
43
44constexpr double WX = 0.6;
45constexpr double WT = 0.6;
46constexpr double EPSIL = 0.001;
47
48// ============================================================================
49// KW solver — operates on entire conduit set
50// ============================================================================
51
58class KWSolver {
59public:
61 void init(int n_conduits, const XSectGroups& groups);
62
76 int execute(SimulationContext& ctx, double dt);
77
78private:
79 int n_conduits_ = 0;
80
81 // Per-conduit SoA state (indexed by conduit-link index)
82 std::vector<double> q1_;
83 std::vector<double> a1_;
84 std::vector<double> q2_;
85 std::vector<double> a2_;
86
87 // Working buffers (reused each timestep)
88 std::vector<double> q_in_;
89 std::vector<double> a_in_;
90 std::vector<double> q_out_;
91 std::vector<double> a_out_;
92 std::vector<double> sf_in_;
93
95 int solveConduit(int idx, const XSectParams& xs,
96 double q_full, double a_full, double s_full,
97 double beta, double length, double dt,
98 double loss_rate);
99};
100
101} // namespace kinwave
102} // namespace openswmm
103
104#endif // OPENSWMM_KINEMATIC_WAVE_HPP
Cross-section geometry — unified batch + per-element API.
Shape-grouped cross-section manager for batch computation.
Definition XSectBatch.hpp:193
Kinematic wave solver state.
Definition KinematicWave.hpp:58
int execute(SimulationContext &ctx, double dt)
Route all conduits for one KW timestep.
Definition KinematicWave.cpp:143
void init(int n_conduits, const XSectGroups &groups)
Initialise for n conduit-type links. Call once after model is built.
Definition KinematicWave.cpp:35
constexpr double WX
Distance weighting factor.
Definition KinematicWave.hpp:44
constexpr double EPSIL
Newton convergence tolerance.
Definition KinematicWave.hpp:46
constexpr double WT
Time weighting factor.
Definition KinematicWave.hpp:45
Definition Controls.cpp:24
Central, reentrant simulation context.
Definition SimulationContext.hpp:141
Definition XSectBatch.hpp:92