OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SourceSnow.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
13#include "NativeSnow.hpp"
14#include "../Runoff.hpp"
15#include <vector>
16namespace openswmm::detail {
18}
19namespace openswmm::surface {
20// Snow owns solid/liquid pack water. The source water ledger receives only
21// completed liquid delivery; together their two balances recover precipitation.
23 double end = 0, initial = 0, precipitation = 0, liquid = 0, sublimation = 0, removed = 0,
24 stored = 0; // seconds, ft3
29 double residual() const {
31 }
32};
33
39public:
57 std::string initialize(SimulationContext& context, const std::vector<std::vector<int>>& groups,
58 const std::vector<double>& nonlid_area);
79 void advance(SimulationContext& context, int group, double start, double end,
80 std::vector<runoff::RunoffSourceForcing>& forcing);
93 void checkpoint(detail::CompletedSourceArchive& archive, bool model,
94 SimulationContext& context);
106 void exportAccepted(const SimulationContext& source, SimulationContext& target,
107 snow::SnowSoA& output) const;
111 bool active() const { return active_; }
116 const snow::SnowSoA& state() const { return solver_.state(); }
121 const std::vector<SourceSnowLedger>& ledgers() const { return ledger_; }
122
123private:
124 bool active_ = false;
125 snow::SnowSolver solver_;
126 std::vector<std::vector<int>> groups_;
127 std::vector<double> area_;
128 std::vector<SourceSnowLedger> ledger_;
134 double storage(int group) const;
135};
136}
Adapter for native SWMM snow accumulation and melt calculations.
Subcatchment runoff generation — batch-oriented nonlinear reservoir.
Definition CompletedSourceArchive.hpp:25
Per-source-group native/UEB snow ownership and cumulative water balance. Liquid source delivery,...
Definition SourceSnow.hpp:38
const snow::SnowSoA & state() const
Borrow the native owner arrays without checking active/initialization.
Definition SourceSnow.hpp:116
std::string initialize(SimulationContext &context, const std::vector< std::vector< int > > &groups, const std::vector< double > &nonlid_area)
Build source-group snow ownership and initial pack inventory.
Definition SourceSnow.cpp:41
void checkpoint(detail::CompletedSourceArchive &archive, bool model, SimulationContext &context)
Stream private snow model identity or runtime owner/ledger state.
Definition SourceSnow.cpp:199
void exportAccepted(const SimulationContext &source, SimulationContext &target, snow::SnowSoA &output) const
Overlay owned accepted snow rows into a compatible native restart view.
Definition SourceSnow.cpp:167
void advance(SimulationContext &context, int group, double start, double end, std::vector< runoff::RunoffSourceForcing > &forcing)
Advance one exact closed snow-owner interval and expose liquid forcing.
Definition SourceSnow.cpp:80
bool active() const
Read whether snow-enabled source weather ownership is installed.
Definition SourceSnow.hpp:111
const std::vector< SourceSnowLedger > & ledgers() const
Borrow per-source-group elapsed endpoints and cumulative snow water accounts.
Definition SourceSnow.hpp:121
Definition OutfallExchange.hpp:17
DegreeDaySnow SnowSolver
Definition DegreeDaySnow.hpp:324
Definition GroundHeat.hpp:19
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
Definition DegreeDaySnow.hpp:66
Definition SourceSnow.hpp:22
double removed
Definition SourceSnow.hpp:23
double residual() const
Compute this snow ledger's signed water-balance residual.
Definition SourceSnow.hpp:29
double end
Definition SourceSnow.hpp:23
double stored
Definition SourceSnow.hpp:24
double precipitation
Definition SourceSnow.hpp:23
double sublimation
Definition SourceSnow.hpp:23
double liquid
Definition SourceSnow.hpp:23
double initial
Definition SourceSnow.hpp:23