OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
AquiferLinkExchange.hpp
Go to the documentation of this file.
1
45
46#ifndef OPENSWMM_ENGINE_HYDRAULICS_AQUIFER_LINK_EXCHANGE_HPP
47#define OPENSWMM_ENGINE_HYDRAULICS_AQUIFER_LINK_EXCHANGE_HPP
48
49#include <algorithm>
50#include <cstddef>
51
53
55
70inline double aquiferSeepFactor(double depth, double gw_head_rel, double d_c) noexcept {
71 if (!(d_c > 0.0))
72 return 1.0; // no path length: legacy
73 const double h_eff = (gw_head_rel > 0.0) ? gw_head_rel : 0.0;
74 return std::min((depth - h_eff) / d_c, 1.0);
75}
76
86inline double capAquiferGain(double seep_rate, double gain_max) noexcept {
87 return (seep_rate < -gain_max) ? -gain_max : seep_rate;
88}
89
102inline void applySeepageForcing(const SimulationContext& ctx, std::size_t link,
103 double& seep_rate) noexcept {
104 const auto& f = ctx.forcing;
105 if (link >= f.link_seepage_mode.size())
106 return;
107 switch (f.link_seepage_mode[link]) {
109 seep_rate = f.link_seepage_value[link];
110 break;
111 case ForcingMode::ADD:
112 seep_rate += f.link_seepage_value[link];
113 break;
114 default:
115 break;
116 }
117}
118
119} // namespace openswmm::hydraulics
120
121#endif // OPENSWMM_ENGINE_HYDRAULICS_AQUIFER_LINK_EXCHANGE_HPP
The central, reentrant simulation context for the new engine.
Definition AquiferLinkExchange.hpp:54
void applySeepageForcing(const SimulationContext &ctx, std::size_t link, double &seep_rate) noexcept
Apply the registered host seepage override or addition to a conduit rate.
Definition AquiferLinkExchange.hpp:102
double capAquiferGain(double seep_rate, double gain_max) noexcept
Limit the gaining direction of a signed conduit seepage rate.
Definition AquiferLinkExchange.hpp:86
double aquiferSeepFactor(double depth, double gw_head_rel, double d_c) noexcept
Compute the signed conductance multiplier for conduit-to-aquifer seepage.
Definition AquiferLinkExchange.hpp:70
@ OVERRIDE
Replace computed value with user value.
Definition ForcingData.hpp:57
@ ADD
Add user value to computed value.
Definition ForcingData.hpp:58
Central, reentrant simulation context.
Definition SimulationContext.hpp:390