OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SurfaceFluxCalculator.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
33
34#ifndef OPENSWMM_ENGINE_2D_SURFACE_FLUX_CALCULATOR_HPP
35#define OPENSWMM_ENGINE_2D_SURFACE_FLUX_CALCULATOR_HPP
36
37#include "../data/MeshData.hpp"
40
41namespace openswmm::twoD {
42
54 int nthreads = 1);
55
68 double epsilon, int nthreads = 1);
69
83inline double evapSink(double rate, double depth, double dry_depth) noexcept {
84 if (rate <= 0.0 || depth <= 0.0) return 0.0;
85 if (depth >= dry_depth) return rate;
86 double t = depth / dry_depth;
87 return rate * t * t * (3.0 - 2.0 * t);
88}
89
111inline double infilSink(double rate, double depth, double dry_depth) noexcept {
112 if (rate <= 0.0 || depth <= 0.0) return 0.0;
113 if (depth >= dry_depth) return rate;
114 double t = depth / dry_depth;
115 return rate * t * t * (3.0 - 2.0 * t);
116}
117
124double computeBoundaryEdgeFlux(const MeshData& mesh,
125 const SurfaceStateData& state,
126 const SolverOptions2D& opts,
127 double dh_eps, int i, int idx) noexcept;
128
150void computeCellContinuity(const MeshData& mesh, SurfaceStateData& state,
151 const SolverOptions2D& opts, double dt);
152
168void computeFaceVelocity(const MeshData& mesh, SurfaceStateData& state,
169 const SolverOptions2D& opts);
170
171} // namespace openswmm::twoD
172
173#endif // OPENSWMM_ENGINE_2D_SURFACE_FLUX_CALCULATOR_HPP
Structure-of-Arrays (SoA) storage for 2D triangular mesh geometry.
Configuration options for the 2D surface routing solver.
Structure-of-Arrays (SoA) storage for 2D surface routing state.
Definition NodeCoupling.cpp:16
void computeFaceVelocity(const MeshData &mesh, SurfaceStateData &state, const SolverOptions2D &opts)
Reconstruct cell-centred velocity (vx, vy) from edge fluxes (RT0).
Definition SurfaceFluxCalculator.cpp:344
double infilSink(double rate, double depth, double dry_depth) noexcept
Depth-limited infiltration sink rate (m/s) for one cell (plan §5.5).
Definition SurfaceFluxCalculator.hpp:111
void computeCellContinuity(const MeshData &mesh, SurfaceStateData &state, const SolverOptions2D &opts, double dt)
Compute the per-cell continuity residual (local mass-balance check).
Definition SurfaceFluxCalculator.cpp:302
void computeLimitedGradients(const MeshData &mesh, SurfaceStateData &state, double epsilon, int nthreads)
Apply Jawahar-Kamath slope limiter (Eq. [23]–[24]).
Definition SurfaceFluxCalculator.cpp:219
void computeUnlimitedGradients(const MeshData &mesh, SurfaceStateData &state, int nthreads)
Compute unlimited gradients for all triangles via Green-Gauss theorem.
Definition SurfaceFluxCalculator.cpp:181
double evapSink(double rate, double depth, double dry_depth) noexcept
Depth-limited evaporation sink rate (m/s) for one cell.
Definition SurfaceFluxCalculator.hpp:83
double computeBoundaryEdgeFlux(const MeshData &mesh, const SurfaceStateData &state, const SolverOptions2D &opts, double dh_eps, int i, int idx) noexcept
Boundary-edge flux for cell i across flat mesh edge slot idx (m³/s, inflow-positive)....
Definition SurfaceFluxCalculator.cpp:398
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:67
Definition SurfaceStateData.hpp:59