![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
#include <ExplicitInertialSolver.hpp>
Public Member Functions | |
| void | publishMomentumVelocity () |
| void | initialize (MeshData &mesh, SurfaceStateData &state, SolverOptions2D &opts) override |
| Prepare the CPU finite-volume marcher from authoritative surface volume and resolved model. | |
| double | advance (double t_current, double t_target) override |
| Advance one accepted CPU surface/groundwater window to its target horizon. | |
| double | completedSourceTime () const noexcept override |
| Read the finest accepted source synchronization horizon. | |
| void | reinitialize (double t0) override |
| Reconstruct externally edited volume after discarding stale surface momentum/side packets. | |
| void | resyncFromVolumes (double t0) override |
| Reconstruct head/depth after authoritative external volume transfers without losing momentum. | |
| void | pinExternalSourceCells (const std::vector< int > &cells) |
| External outfall transfers keep these cells and their halo on tier zero. | |
| void | setCommonSourceStage (CommonSourceStage &stage) |
| Internal qualification adapter; owned externally and attached at time zero. | |
| void | setChannelGround (ChannelGroundState &) |
| Attach a borrowed active channel/soil finite thermal owner before first advance. | |
| void | setSourceResultHistory (SourceResultHistory &history) |
| Capture initial state and every finest accepted source interval, after all due groundwater firings/node sampling; externally owned recorder. | |
| std::string | saveCheckpoint (const std::string &path) const |
| Internal accepted CPU source boundary or standalone water-only RK2 component checkpoint; not a whole-engine hotstart. Borrowed owners are guarded. | |
| std::string | loadCheckpoint (const std::string &path) |
| Restore a component checkpoint into fresh initialized matching exclusive owners. | |
| void | resumeSourceResultHistory (SourceResultHistory &history) |
| Bind a saved exact source-history prefix after a marcher restore. | |
| std::string | configureRk2Reactions (const SimulationContext &) |
| Configure the standalone coupled RK2 surface reaction owner at time zero. | |
| std::string | configureRk2BoundarySignals (SimulationContext &, double stage_scale, double flow_scale) |
| Resolve owned cursor-free surface boundary forcing for the fresh coupled RK2 owner. | |
| void | resolveRk2BoundarySignals (double time) |
| Evaluate owned project boundary signals at the current coupled stage time/state. | |
| double | surfaceReactionLoss (int row) const noexcept |
| Read one row's cumulative qualified RK2 native reaction loss. | |
| void | finalize () override |
| Detach source/checkpoint recorders, settle CPU surface packets and release marching work lists. | |
| void | refreshBoundaries () |
| Refresh changed perimeter topology between completed advances. | |
| long | last_num_steps () const noexcept override |
| Read base substeps executed by the most recent accepted advance. | |
| double | last_step_size () const noexcept override |
| Read the most recent accepted base or tail duration. | |
| RunStats | run_stats () const noexcept override |
| Snapshot cumulative CPU marcher work and rebuild-sampled active/tier statistics. | |
| bool | is_initialized () const noexcept override |
| Read the marcher's stored lifecycle activation flag. | |
| const std::vector< double > & | last_coupling_exchange () const noexcept override |
| Borrow the last advance's integrated live junction exchange. | |
| double | spillDeficit () const noexcept |
| C3: cumulative spill volume (m³) the coupled nodes could not supply from their ponded storage. Should stay 0 on a well-posed deck; a growing value means the orifice is sized to move more water than the nodes hold above the rim. | |
| void | setExchangeHeadSlopes (std::vector< double > slopes) |
| Experimental (OPENSWMM_2D_HEAD_RAMP): per-coupling-point 1D head trend slope (m/s, 2D frame) extrapolated across the batch — the exchange evaluates against h_1d + slope·τ instead of the held batch-start head. Empty = held heads (default). | |
| void | setSubsurface (SubsurfaceSolver *gw) noexcept |
Attach (or detach, with nullptr) the groundwater kernel. Must be called before the first advance and after initialize. | |
| void | refreshSubsurfaceRows () |
| Rebuild exact-name native surface-to-groundwater row mapping after owners are prepared. | |
| const InertialEdges & | inertialEdges () const noexcept |
The unique interior-edge topology this marcher built. Exposed so the groundwater kernel can put its lateral Darcy flux on the SAME faces rather than build a second, necessarily-consistent copy of the same graph. Valid only after initialize. | |
Public Member Functions inherited from openswmm::twoD::ISurfaceSolver | |
| virtual | ~ISurfaceSolver ()=default |
| Destroy a backend solver through its polymorphic interface. | |
Friends | |
| struct | ExplicitInertialSolverTestAccess |
| class | SurfaceRouter2D |
| class | openswmm::SWMMEngine |
|
overridevirtual |
Advance one accepted CPU surface/groundwater window to its target horizon.
| [in] | t_current | Finite elapsed start s, consistent with current canonical owners; common-source and coupled-RK2 modes require exact equality with their accepted completed clocks. |
| [in] | t_target | Finite target s at least t_current, caller scheduled at applicable forcing cuts. |
| std::invalid_argument | Invalid completed-clock/common-stage input. |
| std::runtime_error | Unsupported coupled RK2 profile or delegated physics/source/recording failure. |
Implements openswmm::twoD::ISurfaceSolver.
|
inlineoverridevirtualnoexcept |
Read the finest accepted source synchronization horizon.
Reimplemented from openswmm::twoD::ISurfaceSolver.
| std::string openswmm::twoD::ExplicitInertialSolver::configureRk2BoundarySignals | ( | SimulationContext & | ctx, |
| double | stage_scale, | ||
| double | flow_scale ) |
Resolve owned cursor-free surface boundary forcing for the fresh coupled RK2 owner.
Stage immutable project surface time-series/rating bindings for the initial coupled RK2 owner.
| [in,out] | ctx | Prepared project tables/names/start calendar. Read during this call; owned signal/ rating copies are retained, while the outer heat/reaction owners have their separate borrow contracts. |
| [in] | stage_scale | Finite positive authored stage/curve-coordinate to SI m factor. |
| [in] | flow_scale | Finite positive authored flow-ordinate to the boundary's SI flow convention factor; stored per-edge flow is the downstream boundary law's unit discharge, not an extra edge sum. |
| std::string openswmm::twoD::ExplicitInertialSolver::configureRk2Reactions | ( | const SimulationContext & | ctx | ) |
Configure the standalone coupled RK2 surface reaction owner at time zero.
Bind qualified surface pollutant decay and compiled BULK PIPE laws at initial coupled time.
Configure initial qualified surface decay and compiled PIPE reaction ownership.
| [in] | ctx | Prepared native pollutant/MSX layout, finite nonnegative decay 1/s and compiled reaction token/term/species tables. ReactionData is borrowed on kinetics success and must outlive solver uses without identity mutation. |
|
overridevirtual |
Detach source/checkpoint recorders, settle CPU surface packets and release marching work lists.
Implements openswmm::twoD::ISurfaceSolver.
|
inlinenoexcept |
The unique interior-edge topology this marcher built. Exposed so the groundwater kernel can put its lateral Darcy flux on the SAME faces rather than build a second, necessarily-consistent copy of the same graph. Valid only after initialize.
|
overridevirtual |
Prepare the CPU finite-volume marcher from authoritative surface volume and resolved model.
| [in,out] | mesh | Prepared SI triangle/quad mesh, complete topology/stencils/material/initial- velocity arrays. Borrowed for the marcher lifetime; geometry identity remains stable while running. |
| [in,out] | state | Matching canonical water/native/thermal owner, with live optional boundary, node/coupling and groundwater bindings. Borrowed; seeded volume is authoritative and head/depth are reconstructed. Allocates species boundary composition and ensures boundary receipt rows. |
| [in,out] | opts | Resolved controls, borrowed. FULL_SWE reduces CFL>0.5 and order-two LTS tiers>1 with stderr advisories; unsupported standalone second-order overland transport uses first order. |
| std::runtime_error | Authored boundary quality targets a WALL/nonboundary edge or invalid row. |
| std::invalid_argument | Surface/groundwater native row names are incomplete. |
Implements openswmm::twoD::ISurfaceSolver.
|
inlineoverridevirtualnoexcept |
Read the marcher's stored lifecycle activation flag.
Implements openswmm::twoD::ISurfaceSolver.
|
inlineoverridevirtualnoexcept |
Borrow the last advance's integrated live junction exchange.
Reimplemented from openswmm::twoD::ISurfaceSolver.
|
inlineoverridevirtualnoexcept |
Read base substeps executed by the most recent accepted advance.
Implements openswmm::twoD::ISurfaceSolver.
|
inlineoverridevirtualnoexcept |
Read the most recent accepted base or tail duration.
Implements openswmm::twoD::ISurfaceSolver.
| std::string openswmm::twoD::ExplicitInertialSolver::loadCheckpoint | ( | const std::string & | path | ) |
Restore a component checkpoint into fresh initialized matching exclusive owners.
Read and restore a qualified component checkpoint into fresh prepared matching owners.
| [in] | path | Readable checkpoint file path within the internal size bound. |
| void openswmm::twoD::ExplicitInertialSolver::pinExternalSourceCells | ( | const std::vector< int > & | cells | ) |
External outfall transfers keep these cells and their halo on tier zero.
| [in] | cells | Valid prepared zero-based surface cells; duplicates are harmless. |
| std::out_of_range | Invalid cell through pin_t0_.at(); earlier valid pins remain set. |
| void openswmm::twoD::ExplicitInertialSolver::publishMomentumVelocity | ( | ) |
Publish FULL_SWE velocity from accepted conserved momentum, using the internal negative-outflow display convention. No flux change.
| void openswmm::twoD::ExplicitInertialSolver::refreshBoundaries | ( | ) |
Refresh changed perimeter topology between completed advances.
| void openswmm::twoD::ExplicitInertialSolver::refreshSubsurfaceRows | ( | ) |
Rebuild exact-name native surface-to-groundwater row mapping after owners are prepared.
| std::invalid_argument | Active surface/groundwater layout lacks exactly one name per row. |
|
overridevirtual |
Reconstruct externally edited volume after discarding stale surface momentum/side packets.
| [in] | t0 | Retained interface time, ignored by this implementation. |
| std::runtime_error | A common source stage is attached; generic rollback/edit is unqualified. |
Implements openswmm::twoD::ISurfaceSolver.
| void openswmm::twoD::ExplicitInertialSolver::resolveRk2BoundarySignals | ( | double | time | ) |
Evaluate owned project boundary signals at the current coupled stage time/state.
| [in] | time | Finite elapsed time s for immutable signal interpolation; rating curves instead query current canonical volume-derived SI head divided by their authored coordinate scale. |
| std::runtime_error | Changed table identity or nonfinite converted query/value. Guarded slot/volume indexing can throw std::out_of_range. |
| void openswmm::twoD::ExplicitInertialSolver::resumeSourceResultHistory | ( | SourceResultHistory & | history | ) |
Bind a saved exact source-history prefix after a marcher restore.
| [in,out] | history | Borrowed saved recorder prefix, whose exact accepted checkpoint state must match the restored common source stage. Must outlive subsequent capture/refresh use. |
| std::invalid_argument | Invalid checkpoint boundary, another attached recorder or history resume mismatch. Append/identity allocation errors can also propagate. |
|
overridevirtual |
Reconstruct head/depth after authoritative external volume transfers without losing momentum.
| [in] | t0 | Retained interface time, ignored. |
| std::runtime_error | A common source stage is attached, because arbitrary external edits are not qualified with its receipt clocks. |
Reimplemented from openswmm::twoD::ISurfaceSolver.
|
overridevirtualnoexcept |
Snapshot cumulative CPU marcher work and rebuild-sampled active/tier statistics.
Reimplemented from openswmm::twoD::ISurfaceSolver.
| std::string openswmm::twoD::ExplicitInertialSolver::saveCheckpoint | ( | const std::string & | path | ) | const |
Internal accepted CPU source boundary or standalone water-only RK2 component checkpoint; not a whole-engine hotstart. Borrowed owners are guarded.
Publish a qualified component checkpoint through the temporary-file publisher.
| [in] | path | Destination filesystem path, with a writable existing parent and exclusive writer. |
| void openswmm::twoD::ExplicitInertialSolver::setChannelGround | ( | ChannelGroundState & | stage | ) |
Attach a borrowed active channel/soil finite thermal owner before first advance.
Borrow a prepared active shared channel/physical-ground owner at the initial CPU source clock.
| [in,out] | stage | External finite channel/ground mapping and canonical borrowed owners, stable and alive through all marcher use. Inactive stage is ignored without attachment. |
| std::invalid_argument | Marcher is uninitialized, accepted source time is nonzero or a common source stage is attached. |
| void openswmm::twoD::ExplicitInertialSolver::setCommonSourceStage | ( | CommonSourceStage & | stage | ) |
Internal qualification adapter; owned externally and attached at time zero.
| [in,out] | stage | Borrowed prepared stage matching this exact mesh/state/groundwater identity. Must outlive marcher use, begin at completed time zero and satisfy qualified heat ownership. |
| std::invalid_argument | Existing attachment, uninitialized/noninitial/second-order state, mismatched owner identity or unsupported catchment/LID heat profile. |
|
inline |
Experimental (OPENSWMM_2D_HEAD_RAMP): per-coupling-point 1D head trend slope (m/s, 2D frame) extrapolated across the batch — the exchange evaluates against h_1d + slope·τ instead of the held batch-start head. Empty = held heads (default).
| [in] | slopes | Owned per-coupling-point SI head trends m/s, moved into the solver. Empty selects held heads; caller supplies correct point order/extent and finite values, not validated here. |
| void openswmm::twoD::ExplicitInertialSolver::setSourceResultHistory | ( | SourceResultHistory & | history | ) |
Capture initial state and every finest accepted source interval, after all due groundwater firings/node sampling; externally owned recorder.
Borrow and seed an empty source-history recorder at the initial common-stage boundary.
| [in,out] | history | External empty recorder, kept alive/stable through subsequent captures. Initial append may allocate and mutates history on success; ownership remains with caller. |
| std::invalid_argument | No common stage, any recorder already attached, noninitial time, nonempty tables or recorder append refusal. |
|
inlinenoexcept |
Attach (or detach, with nullptr) the groundwater kernel. Must be called before the first advance and after initialize.
| [in] | gw | Optional borrowed prepared groundwater owner, null detaches. Must outlive all marcher firings/checkpoints, with matching cell/edge/row identity; callable after initialize and before first advance. Stores pointer only; does not initialize, settle or refresh row mapping. |
|
inlinenoexcept |
C3: cumulative spill volume (m³) the coupled nodes could not supply from their ponded storage. Should stay 0 on a well-posed deck; a growing value means the orifice is sized to move more water than the nodes hold above the rim.
|
inlinenoexcept |
Read one row's cumulative qualified RK2 native reaction loss.
| [in] | row | Zero-based native transport row; invalid returns zero. |
|
friend |
|
friend |
|
friend |