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

Kinematic wave solver state. More...

#include <KinematicWave.hpp>

Collaboration diagram for openswmm::kinwave::KWSolver:

Public Member Functions

void init (int n_conduits, const XSectGroups &groups)
 
void setLinkOrder (const std::vector< int > &sorted_links)
 Set topological link order (must be called after init, before first execute).
 
int execute (SimulationContext &ctx, double dt)
 Route all conduits for one KW timestep.
 
int solveConduit (int idx, const XSectParams &xs, double q_full, double a_full, double s_full, double beta, double length, double dt, double loss_rate)
 Per-conduit Newton solve. Returns iteration count.
 

Public Attributes

std::vector< int > sorted_links_
 Topological link order (upstream → downstream)
 
std::vector< double > q1_
 Previous inlet flow (cfs)
 
std::vector< double > a1_
 Previous inlet area (ft2)
 
std::vector< double > q2_
 Previous outlet flow (cfs)
 
std::vector< double > a2_
 Previous outlet area (ft2)
 
std::vector< double > q_in_
 Inflow to each conduit (cfs)
 
std::vector< double > a_in_
 Inlet area from inflow (ft2)
 
std::vector< double > q_out_
 Computed outflow (cfs)
 
std::vector< double > a_out_
 Outlet area from Newton solve (ft2)
 
std::vector< double > sf_in_
 Section factor at inlet.
 

Detailed Description

Kinematic wave solver state.

Holds SoA working arrays for all conduits. Allocated once at init. The execute() method routes all conduits for one timestep.

Member Function Documentation

◆ execute()

int openswmm::kinwave::KWSolver::execute ( SimulationContext ctx,
double  dt 
)

Route all conduits for one KW timestep.

  1. Batch-compute inlet section factors from inflows using XSectGroups
  2. For each conduit, solve the Newton continuity equation
  3. Batch-compute outflows from outlet section factors
  4. Update state arrays
Parameters
ctxSimulation context (links/nodes modified in place).
dtTimestep (seconds).
Returns
Average number of Newton iterations across all conduits.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void openswmm::kinwave::KWSolver::init ( int  n_conduits,
const XSectGroups groups 
)

Initialise for n conduit-type links. Call once after model is built. Builds topological link order for upstream → downstream processing.

Here is the caller graph for this function:

◆ setLinkOrder()

void openswmm::kinwave::KWSolver::setLinkOrder ( const std::vector< int > &  sorted_links)
inline

Set topological link order (must be called after init, before first execute).

Here is the caller graph for this function:

◆ solveConduit()

int openswmm::kinwave::KWSolver::solveConduit ( int  idx,
const XSectParams xs,
double  q_full,
double  a_full,
double  s_full,
double  beta,
double  length,
double  dt,
double  loss_rate 
)

Per-conduit Newton solve. Returns iteration count.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ a1_

std::vector<double> openswmm::kinwave::KWSolver::a1_

Previous inlet area (ft2)

◆ a2_

std::vector<double> openswmm::kinwave::KWSolver::a2_

Previous outlet area (ft2)

◆ a_in_

std::vector<double> openswmm::kinwave::KWSolver::a_in_

Inlet area from inflow (ft2)

◆ a_out_

std::vector<double> openswmm::kinwave::KWSolver::a_out_

Outlet area from Newton solve (ft2)

◆ q1_

std::vector<double> openswmm::kinwave::KWSolver::q1_

Previous inlet flow (cfs)

◆ q2_

std::vector<double> openswmm::kinwave::KWSolver::q2_

Previous outlet flow (cfs)

◆ q_in_

std::vector<double> openswmm::kinwave::KWSolver::q_in_

Inflow to each conduit (cfs)

◆ q_out_

std::vector<double> openswmm::kinwave::KWSolver::q_out_

Computed outflow (cfs)

◆ sf_in_

std::vector<double> openswmm::kinwave::KWSolver::sf_in_

Section factor at inlet.

◆ sorted_links_

std::vector<int> openswmm::kinwave::KWSolver::sorted_links_

Topological link order (upstream → downstream)


The documentation for this class was generated from the following files: