OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
QuadVfr.hpp File Reference

Volume–free-surface relationship (VFR) for a quadrilateral cell. More...

#include <cmath>
#include "VfrClosure.hpp"
Include dependency graph for QuadVfr.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  openswmm
 
namespace  openswmm::twoD
 

Functions

OPENSWMM_KERNEL_FN double openswmm::twoD::quadWetFraction (const double *zs, double A1, double A2, double eta) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::twoD::quadMeanDepthFromEta (const double *zs, double A1, double A2, double eta, double eps) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::twoD::quadMeanDepthSlope (const double *zs, double A1, double A2, double eta, double eps) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::twoD::quadEtaFromMeanDepth (const double *zs, double A1, double A2, double mean_depth, double eps) noexcept
 
OPENSWMM_KERNEL_FN double openswmm::twoD::quadDEtaDMeanDepth (const double *zs, double A1, double A2, double eta, double eps) noexcept
 dη/dh̄ of the regularised quad closure at stage η: 1/max(slope, eps).
 
int openswmm::twoD::quadVfrPrecompute (const double *x, const double *y, const double *z, double *zs, double &A1, double &A2) noexcept
 Choose the B&S 2007 diagonal for a quad and emit its precomputed VFR data.
 

Variables

constexpr int openswmm::twoD::kQuadVfrZ = 6
 

Detailed Description

Volume–free-surface relationship (VFR) for a quadrilateral cell.

Begnudelli & Sanders (2007), "Conservative Wetting and Drying Methodology for Quadrilateral Grid Finite-Volume Models", JHE 133(3):312–322. Four vertices do not in general lie on a plane, so the cell is split along a diagonal into two planar sub-triangles for the purpose of budgeting storage; the diagonal is chosen from the elevation ordering n1 ≤ n2 ≤ n3 ≤ n4 (their Cases 1–3):

Case 1 n1, n4 diagonally opposite → diagonal n1–n4, sub-triangles (n1,n2,n4), (n1,n3,n4) Case 2 n1, n4 adjacent, n2 adjacent to n1 → diagonal n2–n4, sub-triangles (n1,n2,n4), (n2,n3,n4) Case 3 n1, n4 adjacent, n2 adjacent to n4 → diagonal n3–n4, sub-triangles (n1,n3,n4), (n2,n3,n4)

The paper's Eqs. 8–13 (piecewise cubic / quadratic / linear h(η) with the Appendix coefficient tables) are exactly the SUM of the two planar-triangle VFRs (B&S 2006, VfrClosure.hpp) weighted by the sub-triangle areas:

h̄(η) = [ A₁·d̄(η; z_a,z_b,z_d) + A₂·d̄(η; z_a,z_c,z_d) ] / (A₁+A₂)

This header implements that sum directly (the plan's "Q-A" generic form), reusing the tested, ε-regularised triangle closure so quads and triangles share one regularisation and one round-trip contract. The inverse η(h̄) is a safeguarded Newton on the monotone sum (closed form when fully wet). The closed-form Appendix coefficients are an optional optimisation ("Q-B") and would be unit-tested against these functions.

Per-quad data is precomputed once (quadVfrPrecompute): the six sub-triangle vertex elevations, each triple sorted, and the two planimetric sub-triangle areas. Everything here is device-callable scalar arithmetic like the rest of the 2D kernels.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n Apache-2.0