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

Top-level orchestrator for the 2D surface routing module. More...

#include <SurfaceRouter2D.hpp>

Collaboration diagram for openswmm::twoD::SurfaceRouter2D:

Classes

struct  PendingBoundaryRow
 Per-row buffer for [2D_BOUNDARY_CONDITIONS] parse output. More...
 

Public Member Functions

 SurfaceRouter2D ()=default
 
 ~SurfaceRouter2D ()=default
 
 SurfaceRouter2D (const SurfaceRouter2D &)=delete
 
SurfaceRouter2Doperator= (const SurfaceRouter2D &)=delete
 
 SurfaceRouter2D (SurfaceRouter2D &&)=default
 
SurfaceRouter2Doperator= (SurfaceRouter2D &&)=default
 
void initialize (SimulationContext &ctx)
 Initialize the 2D module after input parsing is complete.
 
void step (SimulationContext &ctx, double dt, double t)
 Advance the 2D surface routing by one SWMM routing step.
 
void updateOutfallsPreRouting (SimulationContext &ctx)
 Pre-routing hook: update outfall boundaries from 2D surface heads.
 
void advancePostRouting (SimulationContext &ctx, double dt, double t)
 Post-routing hook: compute coupling exchange and advance 2D solver.
 
void finalize ()
 Finalize the 2D module at simulation end.
 
double computeCflHint (const SimulationContext &ctx) const
 Compute a CFL-like stability hint for the 2D domain.
 
bool isActive () const noexcept
 Check if the 2D module is active.
 
const MeshDatamesh () const noexcept
 Access mesh data (read-only).
 
MeshDatamesh () noexcept
 Access mesh data (mutable, for input parsing).
 
const SurfaceStateDatastate () const noexcept
 Access surface state (read-only).
 
SurfaceStateDatastate () noexcept
 Access surface state (mutable, for forcing).
 
const SolverOptions2Doptions () const noexcept
 Access solver options (read-only).
 
SolverOptions2Doptions () noexcept
 Access solver options (mutable).
 
const BoundaryDataboundary () const noexcept
 Access per-edge boundary-condition data (read-only).
 
BoundaryDataboundary () noexcept
 Access per-edge boundary-condition data (mutable, for forcing/parsing).
 
std::vector< PendingBoundaryRow > & pendingBCRows () noexcept
 
const std::vector< PendingBoundaryRow > & pendingBCRows () const noexcept
 
double totalVolume () const
 Get total 2D surface volume (sum of depth * area).
 
double totalExchangeFlow () const
 Get total exchange flow (sum of coupling flows, m³/s).
 
long lastCvodeSteps () const
 
double lastCvodeStepSize () const
 

Detailed Description

Top-level orchestrator for the 2D surface routing module.

Constructor & Destructor Documentation

◆ SurfaceRouter2D() [1/3]

openswmm::twoD::SurfaceRouter2D::SurfaceRouter2D ( )
default

◆ ~SurfaceRouter2D()

openswmm::twoD::SurfaceRouter2D::~SurfaceRouter2D ( )
default

◆ SurfaceRouter2D() [2/3]

openswmm::twoD::SurfaceRouter2D::SurfaceRouter2D ( const SurfaceRouter2D )
delete

◆ SurfaceRouter2D() [3/3]

openswmm::twoD::SurfaceRouter2D::SurfaceRouter2D ( SurfaceRouter2D &&  )
default

Member Function Documentation

◆ advancePostRouting()

void openswmm::twoD::SurfaceRouter2D::advancePostRouting ( SimulationContext ctx,
double  dt,
double  t 
)

Post-routing hook: compute coupling exchange and advance 2D solver.

Must be called AFTER the 1D routing step.

Parameters
ctxSimulation context.
dtSWMM routing timestep (seconds).
tCurrent simulation time (seconds from start).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ boundary() [1/2]

const BoundaryData & openswmm::twoD::SurfaceRouter2D::boundary ( ) const
inlinenoexcept

Access per-edge boundary-condition data (read-only).

◆ boundary() [2/2]

BoundaryData & openswmm::twoD::SurfaceRouter2D::boundary ( )
inlinenoexcept

Access per-edge boundary-condition data (mutable, for forcing/parsing).

◆ computeCflHint()

double openswmm::twoD::SurfaceRouter2D::computeCflHint ( const SimulationContext ctx) const

Compute a CFL-like stability hint for the 2D domain.

Returns an advisory maximum dt based on mesh resolution and wave speeds. CVODE handles its own sub-stepping, but this prevents the coupling interval from being too large.

Parameters
ctxSimulation context.
Returns
Advisory maximum timestep (seconds).
Here is the call graph for this function:

◆ finalize()

void openswmm::twoD::SurfaceRouter2D::finalize ( )

Finalize the 2D module at simulation end.

◆ initialize()

void openswmm::twoD::SurfaceRouter2D::initialize ( SimulationContext ctx)

Initialize the 2D module after input parsing is complete.

Builds mesh topology, vertex stencils, resolves coupling names, and initializes the CVODE solver.

Parameters
ctxSimulation context (must have mesh_2d populated from parsing).
Here is the call graph for this function:

◆ isActive()

bool openswmm::twoD::SurfaceRouter2D::isActive ( ) const
inlinenoexcept

Check if the 2D module is active.

◆ lastCvodeSteps()

long openswmm::twoD::SurfaceRouter2D::lastCvodeSteps ( ) const
inline

◆ lastCvodeStepSize()

double openswmm::twoD::SurfaceRouter2D::lastCvodeStepSize ( ) const
inline

◆ mesh() [1/2]

const MeshData & openswmm::twoD::SurfaceRouter2D::mesh ( ) const
inlinenoexcept

Access mesh data (read-only).

◆ mesh() [2/2]

MeshData & openswmm::twoD::SurfaceRouter2D::mesh ( )
inlinenoexcept

Access mesh data (mutable, for input parsing).

◆ operator=() [1/2]

SurfaceRouter2D & openswmm::twoD::SurfaceRouter2D::operator= ( const SurfaceRouter2D )
delete

◆ operator=() [2/2]

SurfaceRouter2D & openswmm::twoD::SurfaceRouter2D::operator= ( SurfaceRouter2D &&  )
default

◆ options() [1/2]

const SolverOptions2D & openswmm::twoD::SurfaceRouter2D::options ( ) const
inlinenoexcept

Access solver options (read-only).

◆ options() [2/2]

SolverOptions2D & openswmm::twoD::SurfaceRouter2D::options ( )
inlinenoexcept

Access solver options (mutable).

◆ pendingBCRows() [1/2]

const std::vector< PendingBoundaryRow > & openswmm::twoD::SurfaceRouter2D::pendingBCRows ( ) const
inlinenoexcept

◆ pendingBCRows() [2/2]

std::vector< PendingBoundaryRow > & openswmm::twoD::SurfaceRouter2D::pendingBCRows ( )
inlinenoexcept

◆ state() [1/2]

const SurfaceStateData & openswmm::twoD::SurfaceRouter2D::state ( ) const
inlinenoexcept

Access surface state (read-only).

◆ state() [2/2]

SurfaceStateData & openswmm::twoD::SurfaceRouter2D::state ( )
inlinenoexcept

Access surface state (mutable, for forcing).

◆ step()

void openswmm::twoD::SurfaceRouter2D::step ( SimulationContext ctx,
double  dt,
double  t 
)

Advance the 2D surface routing by one SWMM routing step.

Sequence:

  1. Update outfall boundary heads from 2D state (before 1D routing)
  2. After 1D routing: compute coupling exchange flows
  3. Update 2D rainfall from system gages
  4. Advance CVODE by dt_swmm
  5. Transfer outfall discharges into 2D cells
  6. Update statistics
Parameters
ctxSimulation context.
dtSWMM routing timestep (seconds).
tCurrent simulation time (seconds from start).
Here is the call graph for this function:

◆ totalExchangeFlow()

double openswmm::twoD::SurfaceRouter2D::totalExchangeFlow ( ) const

Get total exchange flow (sum of coupling flows, m³/s).

Here is the call graph for this function:

◆ totalVolume()

double openswmm::twoD::SurfaceRouter2D::totalVolume ( ) const

Get total 2D surface volume (sum of depth * area).

Here is the call graph for this function:

◆ updateOutfallsPreRouting()

void openswmm::twoD::SurfaceRouter2D::updateOutfallsPreRouting ( SimulationContext ctx)

Pre-routing hook: update outfall boundaries from 2D surface heads.

Must be called BEFORE the 1D routing step, after setOutfallDepths().

Parameters
ctxSimulation context.
Here is the call graph for this function:
Here is the caller graph for this function:

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