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

#include <LagrangianSolver.hpp>

Collaboration diagram for openswmm::lard::LagrangianSolver:

Public Member Functions

std::string checkpointState () const
 Export a validated completed-source snapshot of solver-owned segment/particle/topology state.
 
void restoreCheckpointState (const std::string &bytes, SimulationContext &ctx)
 Restore solver-owned completed-source state against a matching prepared context.
 
bool initialized () const noexcept
 Read whether this segment owner completed initialization.
 
std::vector< ChannelThermalRegion > thermalRegions (const SimulationContext &ctx) const
 Export one mean-temperature channel region per wet represented link.
 
std::vector< ChannelSpeciesRegion > speciesRegions (const SimulationContext &ctx) const
 Export mean carried-species tuples for each wet represented channel link.
 
std::string applySpeciesIncrements (SimulationContext &ctx, const std::vector< ChannelSpeciesIncrement > &updates)
 Apply caller concentration deltas to represented nonthermal channel rows then republish.
 
std::string applyThermalIncrements (SimulationContext &ctx, const std::vector< ChannelThermalIncrement > &updates)
 Add caller channel temperature increments uniformly to represented segments then republish.
 
void step (SimulationContext &ctx, double dt_routing)
 One routing step of LTD transport. Lazily initializes on the first call (needs router-set volumes, the ARD precedent).
 
void substep (SimulationContext &ctx, double dt, double frac)
 One LTD substep: AGE → DRAIN → MIX(+passthrough) → RELEASE → DECAY.
 
void publish (SimulationContext &ctx, double dt_routing)
 Per-routing-step publication: link means + the conc_old convention. dt_routing ages the held state of empty slabs (once per step).
 

Member Function Documentation

◆ applySpeciesIncrements()

std::string openswmm::lard::LagrangianSolver::applySpeciesIncrements ( SimulationContext & ctx,
const std::vector< ChannelSpeciesIncrement > & updates )
inline

Apply caller concentration deltas to represented nonthermal channel rows then republish.

Parameters
[in,out]ctxMatching initialized row policy/public quality stores; publish(ctx,0) refreshes link means and copies node/link pollutant current values into old histories.
[in]updatesOwning stable region0 deltas, one total-row tuple per valid link; temperature delta must be exactly0. Positive existing mean scales each segment proportionally, otherwise sets target mean.
Returns
Empty on success, descriptive validation message for unavailable state, region/row mismatch, nonzero thermal delta or nonfinite/negative candidate; validation precedes mutation of all entries.
Note
Repeated updates to same link validate independently against pre-update state, then apply sequentially to changed state, so caller must qualify duplicate/aggregate deltas. Allocation/publish can throw after earlier writes. No external mass ledger or physical/clock booking; exclusive coupling phase.
Here is the call graph for this function:

◆ applyThermalIncrements()

std::string openswmm::lard::LagrangianSolver::applyThermalIncrements ( SimulationContext & ctx,
const std::vector< ChannelThermalIncrement > & updates )
inline

Add caller channel temperature increments uniformly to represented segments then republish.

Parameters
[in,out]ctxMatching initialized thermal/public quality state; publish(ctx,0) also refreshes pollutant old histories, not just temperature.
[in]updatesStable valid link/region0 records whose celsius field is a signed degC increment.
Returns
Empty on success; message for unavailable owner, invalid identity or nonfinite candidate. All entries are prevalidated independently before writes; repeated-link aggregate overflow is not revalidated after each increment. Allocation/publish may throw after writes; no rollback, ledger, water or clock mutation. Caller owns exclusive completed coupling phase and qualified absolute temperatures.
Here is the call graph for this function:

◆ checkpointState()

std::string openswmm::lard::LagrangianSolver::checkpointState ( ) const
inline

Export a validated completed-source snapshot of solver-owned segment/particle/topology state.

Returns
Owning archive bytes, including initialized flag; excludes SimulationContext inventories, clock, options and scratch. Retain matching completed context and configuration separately.
Note
Copies this owner, then archives/validates copy; allocation/archive/validation exceptions propagate without original solver mutation. Caller establishes a stable exclusive checkpoint barrier.
Here is the call graph for this function:

◆ initialized()

bool openswmm::lard::LagrangianSolver::initialized ( ) const
inlinenoexcept

Read whether this segment owner completed initialization.

Returns
Initialized flag only; does not validate current context/layout or prepare state. No allocation/mutation.

◆ publish()

void openswmm::lard::LagrangianSolver::publish ( SimulationContext & ctx,
double dt_routing )
inline

Per-routing-step publication: link means + the conc_old convention. dt_routing ages the held state of empty slabs (once per step).

Publish represented conduit means and copy pollutant current values into old histories.

Parameters
[in,out]ctxMatching row policy and covered link/node public pollutant/age/heat/MSX arrays.
[in]dt_routingElapsed accepted interval s added only to age of empty conduit rings;0 for coupling republish avoids additional aging. No independent time validation.
Note
Requires initialized store and scratch covering row count. Pollutants publish zero means for empty rings; heat/MSX preserve old public values when empty. Nonconduit outputs remain from node routing. Copies all link/node pollutant current arrays to old, can allocate/throw after partial publication. No hydraulic/clock/global-ledger advance; exclusive completed quality phase.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ restoreCheckpointState()

void openswmm::lard::LagrangianSolver::restoreCheckpointState ( const std::string & bytes,
SimulationContext & ctx )
inline

Restore solver-owned completed-source state against a matching prepared context.

Parameters
[in]bytesComplete archive from checkpointState with compatible dimensions/options/layout.
[in,out]ctxMatching completed SimulationContext; ready snapshot calls init(ctx), which may seed scalar/native context state before archive fields are read.
Exceptions
std::runtime_errorArchive/trailing-byte, topology, segment or particle validation failure; allocation/dependency exceptions propagate. Partial owner/context changes are retained on failure.
Note
Archives do not contain context inventories/configuration. Exclusive lifecycle, not transactional; false-ready snapshot skips init and checkpointFields uses this owner's current initialized flag, so caller must restore into the intended matching initialization phase.

◆ speciesRegions()

std::vector< ChannelSpeciesRegion > openswmm::lard::LagrangianSolver::speciesRegions ( const SimulationContext & ctx) const
inline

Export mean carried-species tuples for each wet represented channel link.

Parameters
[in]ctxStable matching row layout/names and native completed hydraulic geometry.
Returns
Owning region0 records, volume m3 and row-order mean values: pollutant/native declared units, age seconds, temperature degC. Empty when uninitialized OR temperature row absent, even with species.
Note
Requires configured names/extents for all rows. No state mutation, ledger or clock advance; allocation can throw. Returned copied records are phase snapshots, not live borrowed views.
Here is the call graph for this function:

◆ step()

void openswmm::lard::LagrangianSolver::step ( SimulationContext & ctx,
double dt_routing )
inline

One routing step of LTD transport. Lazily initializes on the first call (needs router-set volumes, the ARD precedent).

Advance segment advection/mixing/kinetics with optional RWPT and final heat/bed exchange.

Parameters
[in,out]ctxPrepared completed hydraulics and freshly assembled external quality/scalar rates; updates node/link family concentrations, histories, HRT, reaction/negative-source and heat/bed state.
[in]dt_routingPositive finite accepted hydraulic interval s, not validated here.
Note
No carried rows returns. Lazily initializes; reverses conduit segment order on meaningful flow-sign flips, recomputes directed topology, subdivides by positive quality_step, then applies heat/bed once and publishes. Caller keeps owner dimensions/layout/options stable after init and assembles source rates once for whole interval. Internal routines allocate/mutate progressively, exceptions retain partial work. No hydraulic water/engine clock advance or concurrent owner use.
Here is the call graph for this function:

◆ substep()

void openswmm::lard::LagrangianSolver::substep ( SimulationContext & ctx,
double dt,
double frac )
inline

One LTD substep: AGE → DRAIN → MIX(+passthrough) → RELEASE → DECAY.

Parameters
fracfraction of the per-routing-step external volume (qual_vol_in) this substep consumes.

Route and react one LARD quality subinterval against held hydraulic state.

Parameters
[in,out]ctxPrepared node/link quality, age/heat/native arrays and external-rate assembly; receives node/segment mixing, pollutant decay, treatment/HRT/native kinetics and diagnostics.
[in]dtPositive finite subinterval s.
  • Additional argument frac: Positive hydraulic interval fraction used on already integrated qual_vol_in; external mass/scalar rates use dt independently, so fractions across routing step must sum1.
Note
Requires init, matching row policy, fresh topology and receipts. Ages all segments/nodes, drains conduit downstream/front excess, mixes nodes in order, forwards nonconduit loads, refills conduits, optionally disperses particles then decays/reacts. Pending cyclic graph receipts remain for next traversal. Not a standalone source assembler or publisher; no water/clock advance. Shared scratch, allocation, warning and integration can leave partial stores/ledgers on exception; exclusive once-per-subinterval chronology and stable hydraulic/source owner required.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ thermalRegions()

std::vector< ChannelThermalRegion > openswmm::lard::LagrangianSolver::thermalRegions ( const SimulationContext & ctx) const
inline

Export one mean-temperature channel region per wet represented link.

Parameters
[in]ctxStable matching initialized row policy, native geometry and heat/contact configuration.
Returns
Owning regions with link identity, region0/full-link interval, volume m3 and mean degC plus resolved thermal geometry. Empty when uninitialized or temperature row absent; zero-volume links skip.
Note
Read-only owner; context remains stable through geometry queries. Allocations may throw; returned records own values and need no owner lifetime, but later state/configuration changes make them stale.
Here is the call graph for this function:

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