OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::kinwave Namespace Reference

Classes

class  KWSolver
 Kinematic wave solver state. More...
 

Functions

double getLinkInflow (SimulationContext &ctx, hydstruct::StructureSolver *structures, int j, double dt)
 Flow into the upstream end of a link under Steady/Kin. Wave routing.
 
void updateStorageState (SimulationContext &ctx, hydstruct::StructureSolver *structures, const std::vector< int > &order, int pos, int i, double dt)
 Update a storage node's depth & volume by successive approximation.
 
void finishRouting (SimulationContext &ctx, hydstruct::StructureSolver *structures, const std::vector< int > &order, const std::vector< char > &storage_updated, const std::vector< double > &link_y1, const std::vector< double > &link_y2, double dt)
 End-of-step node/link state for tree-layout routing (KW/steady).
 

Variables

constexpr double WX = 0.6
 Distance weighting factor.
 
constexpr double WT = 0.6
 Time weighting factor.
 
constexpr double EPSIL = 0.001
 Newton convergence tolerance.
 

Function Documentation

◆ finishRouting()

void openswmm::kinwave::finishRouting ( SimulationContext & ctx,
hydstruct::StructureSolver * structures,
const std::vector< int > & order,
const std::vector< char > & storage_updated,
const std::vector< double > & link_y1,
const std::vector< double > & link_y2,
double dt )

End-of-step node/link state for tree-layout routing (KW/steady).

PARITY flowrout.c:203-205 — after every link is routed, legacy runs setNewNodeState for every node (non-storage volume integration, overflow shedding, depth reset — a junction stores nothing under KW/SF) and then setNewLinkState's updateNodeDepth raises, which lift each conduit's end-node depths to the conduit end flow depths plus offsets, with a flooded non-outfall node pinned at its full depth. A terminal storage unit (no outlet link, so never visited by the sorted-link loop) gets its updateStorageState here, as legacy does (flowrout.c:88-91).

Parameters
ctxSimulation context.
structuresStructure solver (see getLinkInflow).
orderTopologically sorted link order.
storage_updatedPer-node flags set by the sorted-link loop.
link_y1Per-link flow depth at the upstream end (ft).
link_y2Per-link flow depth at the downstream end (ft).
dtRouting timestep (seconds).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLinkInflow()

double openswmm::kinwave::getLinkInflow ( SimulationContext & ctx,
hydstruct::StructureSolver * structures,
int j,
double dt )

Flow into the upstream end of a link under Steady/Kin. Wave routing.

PARITY flowrout.c:517 getLinkInflow:

if ( Link[j].type == CONDUIT || Link[j].type == PUMP ||
Node[n1].type == STORAGE ) q = link_getInflow(j);
else q = 0.0;
return node_getMaxOutflow(n1, q, dt);
double link_getInflow(int link)
Definition link.c:546
EXTERN TNode * Node
Definition globals.h:155
EXTERN TLink * Link
Definition globals.h:159
double node_getMaxOutflow(int nodeIndex, double q, double tStep)
Limits outflow rate from a node with storage volume.
Definition node.c:405
@ STORAGE
Definition LidLayerSpeciesData.hpp:56
@ CONDUIT
Definition LinkData.hpp:59
@ PUMP
Definition LinkData.hpp:60

A non-conduit link therefore carries its own HEAD-DISCHARGE flow when it drains a storage unit, and NOTHING otherwise — never the upstream node's inflow. Passing the node inflow through gives every outlet of a node the full inflow, so N outlets manufacture N× the water.

Parameters
ctxSimulation context.
structuresStructure solver used to evaluate pump/orifice/weir/ outlet discharge. May be null (structures then carry 0).
jLink index.
dtRouting timestep (seconds).
Returns
Link inflow (cfs), already limited by the upstream node's available volume.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateStorageState()

void openswmm::kinwave::updateStorageState ( SimulationContext & ctx,
hydstruct::StructureSolver * structures,
const std::vector< int > & order,
int pos,
int i,
double dt )

Update a storage node's depth & volume by successive approximation.

PARITY flowrout.c:537 updateStorageState + :611 getStorageOutflow. Called from inside the sorted-link loop, BEFORE routing the links that drain node i, so those links see the converged end-of-step depth. The outflow term is re-evaluated at each iterate because it depends on that depth — an orifice on a pond is an implicit relation, not a known rate.

order/pos locate the node's outlet links: the topological sort emits a node's outgoing links contiguously, so the scan runs forward from pos until node1 changes (matching legacy's if (Link[m].node1 != i) break).

Parameters
ctxSimulation context.
structuresStructure solver (see getLinkInflow).
orderTopologically sorted link order.
posCurrent position in order.
iStorage node index.
dtRouting timestep (seconds).
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ EPSIL

double openswmm::kinwave::EPSIL = 0.001
constexpr

Newton convergence tolerance.

◆ WT

double openswmm::kinwave::WT = 0.6
constexpr

Time weighting factor.

◆ WX

double openswmm::kinwave::WX = 0.6
constexpr

Distance weighting factor.