OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
BedExchange.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
96
97#ifndef OPENSWMM_ENGINE_TRANSPORT_BED_EXCHANGE_HPP
98#define OPENSWMM_ENGINE_TRANSPORT_BED_EXCHANGE_HPP
99
100#include "../../../data/BedZoneData.hpp" // SedimentConfig (light header)
101
102namespace openswmm {
103struct SimulationContext;
104}
105
107
118 double g_wb = 0.0;
119 double g_bg = 0.0;
120 double c_w = 0.0;
121 double c_b = 0.0;
122 double t_gr = 0.0;
123
125 bool viable() const noexcept { return c_w > 0.0 && c_b > 0.0; }
126};
127
129struct PairStep {
130 double dt_w = 0.0;
131 double dt_b = 0.0;
132};
133
162PairStep relaxPair(const BedCoupling& g, double t_w, double t_b,
163 double j0, double j1, double h, double area_m2,
164 double dt) noexcept;
165
168 double dc_w = 0.0;
169 double dc_b = 0.0;
170};
171
187SolutePairStep exchangePair(double c_w, double c_b, double vol_w,
188 double vol_b, double q_exch, double dt) noexcept;
189
206 double vol_ft3, double t_gr) noexcept;
207
225 const SedimentConfig& sc,
226 double bed_m2, double vol_ft3,
227 double t_gr) noexcept;
228
235double groundTempFor(const SimulationContext& ctx, const SedimentConfig& sc,
236 double t_gr_global) noexcept;
237
240double bedExchangeQ(const SedimentConfig& cfg, double bed_m2) noexcept;
241
244double linkBedAreaM2(const SimulationContext& ctx, int link) noexcept;
245
250double linkFreeSurfaceFt2(const SimulationContext& ctx, int link) noexcept;
251
256double groundTemperature(SimulationContext& ctx) noexcept;
257
259bool bedExchangeEnabled(const SimulationContext& ctx) noexcept;
260
274
294void applyBedSoluteExchange(SimulationContext& ctx, double* link_conc,
295 int n_arr, int offset, int n_total, double dt);
296
297} // namespace openswmm::transport::heat
298
299#endif // OPENSWMM_ENGINE_TRANSPORT_BED_EXCHANGE_HPP
Plan H6b — the bed / hyporheic transient-storage zone.
Definition BedExchange.cpp:37
PairStep relaxPair(const BedCoupling &g, double t_w, double t_b, double j0, double j1, double h, double area_m2, double dt) noexcept
One exact step of the coupled (water, bed) pair.
Definition BedExchange.cpp:81
double groundTempFor(const SimulationContext &ctx, const SedimentConfig &sc, double t_gr_global) noexcept
Definition BedExchange.cpp:241
double groundTemperature(SimulationContext &ctx) noexcept
Definition BedExchange.cpp:180
double bedExchangeQ(const SedimentConfig &cfg, double bed_m2) noexcept
Definition BedExchange.cpp:235
BedCoupling bedCouplingFromContact(const SimulationContext &ctx, const SedimentConfig &sc, double bed_m2, double vol_ft3, double t_gr) noexcept
The material half of the coupling, geometry already folded in.
Definition BedExchange.cpp:251
double linkBedAreaM2(const SimulationContext &ctx, int link) noexcept
Definition BedExchange.cpp:189
bool bedExchangeEnabled(const SimulationContext &ctx) noexcept
True when [HEAT_FLUXES] SEDIMENT_EXCHANGE is on and heat transport is.
Definition BedExchange.cpp:176
BedCoupling bedCouplingForLink(const SimulationContext &ctx, int link, double vol_ft3, double t_gr) noexcept
Bed conductances for link j from the deck configuration and the link's current hydraulics.
Definition BedExchange.cpp:283
SolutePairStep exchangePair(double c_w, double c_b, double vol_w, double vol_b, double q_exch, double dt) noexcept
One exact step of the two-body solute exchange.
Definition BedExchange.cpp:149
void applyBedSoluteExchange(SimulationContext &ctx, double *link_conc, int n_arr, int offset, int n_total, double dt)
Step every conduit's bed/channel solute exchange for one dt.
Definition BedExchange.cpp:324
void seedBedTemperature(SimulationContext &ctx)
Size and seed the bed temperature array, idempotently.
Definition BedExchange.cpp:296
double linkFreeSurfaceFt2(const SimulationContext &ctx, int link) noexcept
Definition BedExchange.cpp:217
Definition NodeCoupling.cpp:16
[SEDIMENT_EXCHANGE] — the bed zone's material and geometry.
Definition BedZoneData.hpp:88
Central, reentrant simulation context.
Definition SimulationContext.hpp:353
One element's bed coupling, fully reduced to SI conductances.
Definition BedExchange.hpp:117
double c_b
Bed heat capacity, J/K.
Definition BedExchange.hpp:121
bool viable() const noexcept
True when the pair is worth stepping at all.
Definition BedExchange.hpp:125
double g_bg
Bed<->deep-ground conductance, W/K.
Definition BedExchange.hpp:119
double g_wb
Water<->bed conductance, W/K (conduction + advection)
Definition BedExchange.hpp:118
double t_gr
Deep-ground temperature, °C.
Definition BedExchange.hpp:122
double c_w
Water heat capacity, J/K.
Definition BedExchange.hpp:120
Simultaneous temperature increments for the coupled pair, °C.
Definition BedExchange.hpp:129
double dt_b
Bed.
Definition BedExchange.hpp:131
double dt_w
Channel water.
Definition BedExchange.hpp:130
Simultaneous concentration increments for the coupled pair.
Definition BedExchange.hpp:167
double dc_b
Bed water.
Definition BedExchange.hpp:169
double dc_w
Channel water.
Definition BedExchange.hpp:168