OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
Node.hpp
Go to the documentation of this file.
1
16#ifndef OPENSWMM_NODE_HPP
17#define OPENSWMM_NODE_HPP
18
19#include "../data/NodeData.hpp"
20#include "../data/TableData.hpp"
21
22namespace openswmm {
23
24struct SimulationContext;
25
26namespace node {
27
28// ============================================================================
29// Per-element functions (for C API / single-object queries)
30// ============================================================================
31
43double getVolume(const NodeData& nodes, int idx, double depth,
44 TableData* tables = nullptr);
45
57double getSurfArea(const NodeData& nodes, int idx, double depth,
58 TableData* tables = nullptr);
59
71double getPondedArea(const NodeData& nodes, int idx, double depth);
72
84double getMaxOutflow(const NodeData& nodes, int idx, double q, double dt);
85
98double getOverflow(double new_volume, double full_volume, double dt);
99
103inline double getHead(double invert_elev, double depth) {
104 return invert_elev + depth;
105}
106
107// ============================================================================
108// Batch functions (for routing hot loop)
109// ============================================================================
110
119void computeHeads(const double* invert, const double* depth, double* head, int n);
120
128void computeVolumes(const NodeData& nodes, const double* depth, double* volume);
129
139void computeOverflows(const double* new_volume, const double* full_volume,
140 double* overflow, double dt, int n);
141
142} // namespace node
143
144// ============================================================================
145// Constants
146// ============================================================================
147
148namespace constants {
149 constexpr double GRAVITY = 32.2;
150 constexpr double PHI = 1.486;
151 constexpr double FUDGE = 0.0001;
152 constexpr double MIN_SURFAREA = 12.566;
153} // namespace constants
154
155} // namespace openswmm
156
157#endif // OPENSWMM_NODE_HPP
constexpr double MIN_SURFAREA
4*pi sq ft ≈ 4-ft diameter manhole
Definition Node.hpp:152
constexpr double FUDGE
Minimum depth/area threshold (ft)
Definition Node.hpp:151
constexpr double GRAVITY
ft/s^2
Definition Node.hpp:149
constexpr double PHI
Manning's units factor (US)
Definition Node.hpp:150
double getHead(double invert_elev, double depth)
Compute head from depth: head = invert + depth.
Definition Node.hpp:103
void computeVolumes(const NodeData &nodes, const double *depth, double *volume)
Compute volumes for all nodes from their current depths.
Definition Node.cpp:146
void computeOverflows(const double *new_volume, const double *full_volume, double *overflow, double dt, int n)
Compute overflow for all nodes.
Definition Node.cpp:157
void computeHeads(const double *invert, const double *depth, double *head, int n)
Compute head = invert + depth for all nodes.
Definition Node.cpp:136
double getSurfArea(const NodeData &nodes, int idx, double depth, TableData *tables)
Compute surface area at a given depth for a single node.
Definition Node.cpp:64
double getOverflow(double new_volume, double full_volume, double dt)
Compute overflow rate at a node.
Definition Node.cpp:125
double getMaxOutflow(const NodeData &nodes, int idx, double q, double dt)
Compute max outflow limited by available volume.
Definition Node.cpp:110
double getPondedArea(const NodeData &nodes, int idx, double depth)
Get the ponded area (for overflow above rim).
Definition Node.cpp:93
double getVolume(const NodeData &nodes, int idx, double depth, TableData *tables)
Compute volume at a given depth for a single node.
Definition Node.cpp:24
Definition Controls.cpp:24
Structure-of-Arrays storage for all nodes.
Definition NodeData.hpp:89