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;
105}
106
108
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
131 bool viable() const noexcept { return c_w > 0.0 && c_b > 0.0; }
132};
133
135struct PairStep {
136 double dt_w = 0.0;
137 double dt_b = 0.0;
138};
139
165PairStep relaxPair(const BedCoupling& g, double t_w, double t_b, double j0, double j1, double h,
166 double area_m2, double dt) noexcept;
167
170 double dc_w = 0.0;
171 double dc_b = 0.0;
172};
173
188SolutePairStep exchangePair(double c_w, double c_b, double vol_w, double vol_b, double q_exch,
189 double dt) noexcept;
190
205BedCoupling bedCouplingForLink(const SimulationContext& ctx, int link, double vol_ft3,
206 double t_gr) noexcept;
207
223 double bed_m2, double vol_ft3, double t_gr) noexcept;
224
231double groundTempFor(const SimulationContext& ctx, const SedimentConfig& sc,
232 double t_gr_global) noexcept;
233
236double bedExchangeQ(const SedimentConfig& cfg, double bed_m2) noexcept;
237
240double linkBedAreaM2(const SimulationContext& ctx, int link) noexcept;
241
246double linkFreeSurfaceFt2(const SimulationContext& ctx, int link) noexcept;
249
254double groundTemperature(SimulationContext& ctx) noexcept;
255
257bool bedExchangeEnabled(const SimulationContext& ctx) noexcept;
258
270
286void applyBedSoluteExchange(SimulationContext& ctx, double* link_conc, int n_arr, int offset,
287 int n_total, double dt);
288
289} // namespace openswmm::transport::heat
290
291#endif // OPENSWMM_ENGINE_TRANSPORT_BED_EXCHANGE_HPP
Plan H6b — the bed / hyporheic transient-storage zone.
Definition BedExchange.cpp:39
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:120
double groundTempFor(const SimulationContext &ctx, const SedimentConfig &sc, double t_gr_global) noexcept
Choose one element's held deep-ground constant or globally sampled series temperature.
Definition BedExchange.cpp:370
void fillChannelThermalGeometry(const SimulationContext &ctx, ChannelThermalRegion &region) noexcept
Publish native conduit thermal region geometry in SI.
Definition BedExchange.cpp:388
double groundTemperature(SimulationContext &ctx) noexcept
Sample the global held deep-ground temperature at native absolute model time.
Definition BedExchange.cpp:264
double bedExchangeQ(const SedimentConfig &cfg, double bed_m2) noexcept
Compute total finite-bed solute exchange rate from diffusion and hyporheic velocity.
Definition BedExchange.cpp:355
BedCoupling bedCouplingFromContact(const SimulationContext &ctx, const SedimentConfig &sc, double bed_m2, double vol_ft3, double t_gr) noexcept
Construct finite water/bed conductance and capacity from one SI contact footprint.
Definition BedExchange.cpp:420
double linkBedAreaM2(const SimulationContext &ctx, int link) noexcept
Compute wetted conduit bed contact area from native geometry.
Definition BedExchange.cpp:282
bool bedExchangeEnabled(const SimulationContext &ctx) noexcept
Test current native finite-bed heat family process enable.
Definition BedExchange.cpp:251
BedCoupling bedCouplingForLink(const SimulationContext &ctx, int link, double vol_ft3, double t_gr) noexcept
Build a conduit finite-bed pair from current wet perimeter and resolved element material.
Definition BedExchange.cpp:462
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:217
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:532
void seedBedTemperature(SimulationContext &ctx)
Size and seed native link bed temperatures at their initial owner phase.
Definition BedExchange.cpp:486
double linkFreeSurfaceFt2(const SimulationContext &ctx, int link) noexcept
Compute native open-conduit free surface for heat/evaporation binding.
Definition BedExchange.cpp:323
Definition ExchangeLaw.hpp:60
Definition ChannelThermalData.hpp:19
[SEDIMENT_EXCHANGE] — the bed zone's material and geometry.
Definition BedZoneData.hpp:88
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
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:131
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:135
double dt_b
Bed.
Definition BedExchange.hpp:137
double dt_w
Channel water.
Definition BedExchange.hpp:136
Simultaneous concentration increments for the coupled pair.
Definition BedExchange.hpp:169
double dc_b
Bed water.
Definition BedExchange.hpp:171
double dc_w
Channel water.
Definition BedExchange.hpp:170