58#ifndef OPENSWMM_XSECT_KERNELS_HPP
59#define OPENSWMM_XSECT_KERNELS_HPP
70#ifndef OPENSWMM_KERNEL_FN
71#define OPENSWMM_KERNEL_FN inline
79inline constexpr double TINY = 1.0e-6;
80inline constexpr double PI = 3.141592654;
141 return (y_bot + s_bot *
y) *
y;
153 return y *
y * s_bot;
165 return (4.0 / 3.0) * r_bot *
y * std::sqrt(
y);
180 return r_bot * std::pow(
y, s_bot + 1.0);
198 double p = w_max + 2.0 * a / w_max;
217 return a / (w_max + (2.0 - s_bot) * a / w_max);
235 return trapezAofY(
y, y_bot, s_bot) / (y_bot +
y * r_bot);
248 return (
y * s_bot) / (2.0 * r_bot);
278 return y_bot + 2.0 *
y * s_bot;
290 return 2.0 * s_bot *
y;
302 return 2.0 * r_bot * std::sqrt(
y);
315 return (s_bot + 1.0) * r_bot * std::pow(
y, s_bot);
454 return luts ? (
luts +
static_cast<int>(id)) :
nullptr;
473 template <
class Func>
493 constexpr int MAXIT = 60;
495 double df, dx, dxold, f, x, temp, xhi, xlo;
500 dxold = std::fabs(x2 - x1);
504 for (
int j = 1; j <=
MAXIT; ++j) {
505 if (((x - xhi) * df - f) * ((x - xlo) * df - f) >= 0.0 ||
506 (std::fabs(2.0 * f) > std::fabs(dxold * df))) {
508 dx = 0.5 * (xhi - xlo);
520 if (std::fabs(dx) < xacc)
530 return (n <=
MAXIT) ? n : 0;
534 template <
class Func>
550 constexpr int MAXIT = 60;
551 auto SIGN = [](
double a,
double b) {
return (b >= 0.0) ? std::fabs(a) : -std::fabs(a); };
553 double ans, fhi, flo, fm, fnew, s, xhi, xlo, xm, xnew;
560 ans = 0.5 * (x1 + x2);
561 if ((flo > 0.0 && fhi < 0.0) || (flo < 0.0 && fhi > 0.0)) {
564 for (
int j = 1; j <=
MAXIT; ++j) {
565 xm = 0.5 * (xlo + xhi);
567 s = std::sqrt(fm * fm - flo * fhi);
570 xnew = xm + (xm - xlo) * ((flo >= fhi ? 1.0 : -1.0) * fm / s);
571 if (std::fabs(xnew - ans) <= xacc)
575 if (
SIGN(fm, fnew) != fm) {
580 }
else if (
SIGN(flo, fnew) != flo) {
583 }
else if (
SIGN(fhi, fnew) != fhi) {
588 if (std::fabs(xhi - xlo) <= xacc)
651 return table[n_items - 1];
672 double dx = 1.0 /
static_cast<double>(n_items - 1);
676 if (table[n - 3] > table[n - 1])
680 if (n < n_items && y > table[n_items - 1]) {
681 if (
y >= table[n_items - 3])
682 return static_cast<double>(n - 1) * dx;
683 if (
y <= table[n_items - 2])
691 return static_cast<double>(n - 1) * dx;
694 double dy = table[i + 1] - table[i];
699 x = x0 + (
y - table[i]) * dx / dy;
723 double theta, theta1, ap, d;
725 theta = 1.2 + 5.08 * (alpha - 0.04) / 0.96;
727 theta = 0.031715 - 12.79384 * alpha + 8.28479 * std::sqrt(alpha);
729 ap = (2.0 *
PI) * alpha;
730 for (
int k = 1; k <= 40; ++k) {
731 d = -(ap - theta + std::sin(theta)) / (1.0 - std::cos(theta));
733 d = std::copysign(1.0, d);
735 if (std::fabs(d) <= 0.0001)
751 double theta, theta1, ap, tt, tt23, t3, d;
753 theta = 4.17 + 1.12 * (psi - 0.90) / 0.176;
755 theta = 3.14 + 1.03 * (psi - 0.5) / 0.4;
756 else if (psi > 0.015)
757 theta = 1.2 + 1.94 * (psi - 0.015) / 0.485;
759 theta = 0.12103 - 55.5075 * psi + 15.62254 * std::sqrt(psi);
761 ap = (2.0 *
PI) * psi;
762 for (
int k = 1; k <= 40; ++k) {
763 theta = std::fabs(theta);
764 tt = theta - std::sin(theta);
765 tt23 = std::pow(tt, 2.0 / 3.0);
766 t3 = std::pow(theta, 1.0 / 3.0);
767 d = ap * theta / t3 - tt * tt23;
768 d = d / (ap * (2.0 / 3.0) / t3 - (5.0 / 3.0) * tt23 * (1.0 - std::cos(theta)));
770 if (std::fabs(d) <= 0.0001)
792 if (alpha <= 1.0e-5) {
793 theta = std::pow(37.6911 * alpha, 1.0 / 3.0);
794 return theta * theta / 16.0;
797 return (1.0 - std::cos(theta / 2.0)) / 2.0;
816 if (alpha <= 1.0e-5) {
817 theta = std::pow(37.6911 * alpha, 1.0 / 3.0);
818 return std::pow(theta, 13.0 / 3.0) / 124.4797;
821 return std::pow((theta - std::sin(theta)), 5.0 / 3.0) / (2.0 *
PI) /
822 std::pow(theta, 2.0 / 3.0);
841 theta = std::pow(124.4797 * psi, 3.0 / 13.0);
842 return theta * theta * theta / 37.6911;
845 return (theta - std::sin(theta)) / (2.0 *
PI);
864 double alpha = a / xs.
a_full;
865 double alpha1 = alpha - 0.001;
866 double alpha2 = alpha + 0.001;
869 double a1 = alpha1 * xs.
a_full;
870 double a2 = alpha2 * xs.
a_full;
889 double alpha = a / xs.
a_full;
890 double delta = 1.0 /
static_cast<double>(n_items - 1);
891 int i =
static_cast<int>(alpha / delta);
892 if (i >= n_items - 1)
894 double dSdA = (table[i + 1] - table[i]) / delta;
935 double alpha = a / xs.
a_full;
955 double alpha = a / xs.
a_full;
975 double psi = s / xs.
s_full;
999 double alpha = a / xs.
a_full;
1000 if (alpha <= 1.0e-30)
1004 double p = theta * xs.
y_full / 2.0;
1006 double dPdA = 4.0 / xs.
y_full / (1.0 - std::cos(theta));
1007 return (5.0 / 3.0 - (2.0 / 3.0) * dPdA * r) * std::pow(r, 2.0 / 3.0);
1036 return a - xs.
a_bot;
1078 double yy =
y + xs.
y_bot;
1142 double alpha = a / xs.
a_full;
1145 if (alpha <= 1.0e-30)
1148 return (5.0 / 3.0 - (2.0 / 3.0) * (2.0 / xs.
w_max) * r) * std::pow(r, 2.0 / 3.0);
1167 return a * std::pow(r, 2.0 / 3.0);
1184 if (a / xs.
a_full <= 1.0e-30)
1188 return (5.0 / 3.0 - (2.0 / 3.0) * dPdA * r) * std::pow(r, 2.0 / 3.0);
1231 return 2.0 * xs.
s_bot *
y;
1250 return std::sqrt(a / xs.
s_bot);
1272 return a / (2.0 *
y * xs.
r_bot);
1320 if (a / xs.
a_full > alfMax)
1340 double alpha = a / xs.
a_full;
1343 if (alpha <= 1.0e-30)
1347 dPdA = 2.0 / xs.
w_max;
1351 return (5.0 / 3.0 - (2.0 / 3.0) * dPdA * r) * std::pow(r, 2.0 / 3.0);
1397 double theta1 = 2.0 * std::acos(1.0 -
y / xs.
r_bot);
1398 return 0.5 * xs.
r_bot * xs.
r_bot * (theta1 - std::sin(theta1));
1418 return 2.0 * std::sqrt(
y * (2.0 * xs.
r_bot -
y));
1439 double theta1 = 2.0 * std::asin(xs.
w_max / 2.0 / xs.
r_bot);
1440 double p = xs.
r_bot * theta1 + 2.0 * y1;
1447 double theta1 = 2.0 * std::acos(1.0 - y1 / xs.
r_bot);
1448 double p = xs.
r_bot * theta1;
1471 double theta1 = 2.0 * std::acos(1.0 -
y / xs.
r_bot);
1472 return 0.5 * xs.
r_bot * (1.0 - std::sin(theta1)) / theta1;
1490 if (a / xs.
a_full > alfMax)
1495 double alpha = a / aFull;
1496 double sFull = xs.
s_bot;
1499 return sFull *
lookup(alpha,
tbl.S_Circ,
tbl.N_S_Circ);
1517 if (a / xs.
a_full > alfMax)
1521 double dPdA = 2.0 / xs.
w_max;
1522 return (5.0 / 3.0 - (2.0 / 3.0) * dPdA * r) * std::pow(r, 2.0 / 3.0);
1547 return a / xs.
w_max;
1554 y1 = 2.0 * xs.
r_bot * y1;
1576 double theta1 = 2.0 * std::acos(1.0 - y1 / xs.
r_bot);
1577 double a1 = 0.5 * xs.
r_bot * xs.
r_bot * (theta1 - std::sin(theta1));
1601 return 2.0 * std::sqrt(y1 * (2.0 * xs.
r_bot - y1));
1621 double theta1 = 2.0 * std::acos(1.0 - y1 / xs.
r_bot);
1624 p = p + 2.0 * y1 + xs.
w_max;
1642 if (a <= xs.a_full - xs.a_bot && a / xs.a_full > 1.0e-30) {
1643 double r = a / (xs.
w_max + 2.0 * a / xs.
w_max);
1644 double dPdA = 2.0 / xs.
w_max;
1645 return (5.0 / 3.0 - (2.0 / 3.0) * dPdA * r) * std::pow(r, 2.0 / 3.0);
1704 if (xs.
s_bot == 0.0)
1705 return a / xs.
y_bot;
1758 if (a / xs.
a_full <= 1.0e-30)
1762 return (5.0 / 3.0 - (2.0 / 3.0) * dPdA * r) * std::pow(r, 2.0 / 3.0);
1819 return std::sqrt(a / xs.
s_bot);
1871 if (a / xs.
a_full <= 1.0e-30)
1874 double dPdA = xs.
r_bot / std::sqrt(a * xs.
s_bot);
1875 return (5.0 / 3.0 - (2.0 / 3.0) * dPdA * r) * std::pow(r, 2.0 / 3.0);
1932 return std::pow((3.0 / 4.0) * a / xs.
r_bot, 2.0 / 3.0);
1951 double x = 2.0 * std::sqrt(
y) / xs.
r_bot;
1952 double t = std::sqrt(1.0 + x * x);
1953 return 0.5 * xs.
r_bot * xs.
r_bot * (x * t + std::log(x + t));
2052 return std::pow(a / xs.
r_bot, 1.0 / (xs.
s_bot + 1.0));
2072 double dy1 = 0.02 * xs.
y_full;
2073 double h = (xs.
s_bot + 1.0) * xs.
r_bot / 2.0;
2074 double m = xs.
s_bot;
2075 double p = 0.0, y1 = 0.0, x1 = 0.0;
2076 double x2, y2, dx, dy;
2081 x2 = h * std::pow(y2, m);
2084 p += std::sqrt(dx * dx + dy * dy);
2158 double y_norm =
y / xs.
y_full;
2238 double y_norm =
y / xs.
y_full;
2317 double y_norm =
y / xs.
y_full;
2324 if (xs.
y_bot == 0.0)
2385 double alpha = a / xs.
a_full;
2417 return a / xs.
w_max;
2462 double alpha = a / xs.
a_full;
2496 return a * std::pow(r, 2.0 / 3.0);
2552 return std::pow(s / a, 3.0 / 2.0);
2630 double psi = s / xs.
s_full;
2681 double a = 0.5 * (a1 + a2);
2682 double tol = 0.0001 * xs.
a_full;
2683 findroot_Newton(a1, a2, &a, tol, [&](
double aa,
double* f,
double* df) {
2743 y = std::pow(q2g / (xs.
w_max * xs.
w_max), 1.0 / 3.0);
2746 y = std::pow(2.0 * q2g / (xs.
s_bot * xs.
s_bot), 1.0 / 5.0);
2749 y = std::pow(27.0 / 32.0 * q2g / (xs.
r_bot * xs.
r_bot), 1.0 / 4.0);
2752 y = 1.0 / (2.0 * xs.
s_bot + 3.0);
2757 auto qCritical = [&](
double yc,
double qTarget) ->
double {
2761 return a * std::sqrt(
GRAVITY * a / w) - qTarget;
2766 double y0 = 1.01 * std::pow(q2g / xs.
y_full, 0.25);
2773 if (r >= 0.5 && r <= 2.0) {
2775 constexpr int N_INC = 25;
2776 double dy = xs.
y_full / N_INC;
2777 int i1 =
static_cast<int>(y0 / dy);
2778 double q0 = qCritical(i1 * dy, 0.0);
2781 for (
int i = i1 + 1; i <= N_INC; ++i) {
2782 double qc = qCritical(i * dy, 0.0);
2784 y = ((q - q0) / (qc - q0) +
static_cast<double>(i - 1)) * dy;
2791 for (
int i = i1 - 1; i >= 0; --i) {
2792 double qc = qCritical(i * dy, 0.0);
2794 y = ((q - qc) / (q0 - qc) +
static_cast<double>(i)) * dy;
2803 double y2 = 0.99 * xs.
y_full;
2804 double q2 = qCritical(y2, 0.0);
2809 double q0 = qCritical(y0, 0.0);
2810 double q1 = qCritical(0.5 * xs.
y_full, 0.0);
2820 y =
findroot_Ridder(y1, y2, 0.001, [&](
double yc) {
return qCritical(yc, q); });
2825 return std::min(
y, xs.
y_full);
#define OPENSWMM_KERNEL_FN
Definition ExplicitKokkosSurfaceSolver.cpp:22
Structure-of-Arrays (SoA) storage for all link types.
Bit-exact geometry-table interpolation — the single source of truth.
#define SIGN(a, b)
Definition findroot.c:26
#define MAXIT
Definition findroot.c:27
The analytic shape formulas — the single definition of each.
Definition XSectKernels.hpp:111
OPENSWMM_KERNEL_FN double rectClosedWofY(double y_norm, double w_max)
Apply the closed rectangular crown top-width convention.
Definition XSectKernels.hpp:262
OPENSWMM_KERNEL_FN double trapezRofY(double y, double y_bot, double s_bot, double r_bot)
Compute trapezoid hydraulic radius from depth.
Definition XSectKernels.hpp:232
OPENSWMM_KERNEL_FN double trapezAofY(double y, double y_bot, double s_bot)
Compute trapezoid area as (bottom width+side slope*depth)*depth.
Definition XSectKernels.hpp:140
OPENSWMM_KERNEL_FN double rectAofY(double y, double w_max)
Compute rectangular area as depth times width.
Definition XSectKernels.hpp:125
OPENSWMM_KERNEL_FN double trapezWofY(double y, double y_bot, double s_bot)
Compute trapezoid top width from depth.
Definition XSectKernels.hpp:277
OPENSWMM_KERNEL_FN double triangWofY(double y, double s_bot)
Compute triangular top width from depth.
Definition XSectKernels.hpp:289
OPENSWMM_KERNEL_FN double parabAofY(double y, double r_bot)
Compute parabolic area using its square-root depth relation.
Definition XSectKernels.hpp:164
OPENSWMM_KERNEL_FN double powerfuncWofY(double y, double s_bot, double r_bot)
Compute power-function top width as the area-depth derivative.
Definition XSectKernels.hpp:314
OPENSWMM_KERNEL_FN double powerfuncAofY(double y, double s_bot, double r_bot)
Compute power-function section area.
Definition XSectKernels.hpp:179
OPENSWMM_KERNEL_FN double rectClosedRofA(double a, double w_max, double a_full)
Compute closed rectangular hydraulic radius with near-crown perimeter correction.
Definition XSectKernels.hpp:195
OPENSWMM_KERNEL_FN double parabWofY(double y, double r_bot)
Compute parabolic top width from depth.
Definition XSectKernels.hpp:301
OPENSWMM_KERNEL_FN double rectOpenRofA(double a, double w_max, double s_bot)
Compute open rectangular radius excluding selected side banks.
Definition XSectKernels.hpp:214
OPENSWMM_KERNEL_FN double triangAofY(double y, double s_bot)
Compute triangular area from depth and side slope.
Definition XSectKernels.hpp:152
OPENSWMM_KERNEL_FN double triangRofY(double y, double s_bot, double r_bot)
Compute triangular hydraulic radius from its side geometry.
Definition XSectKernels.hpp:247
Definition XSectBatch.hpp:158
const XsectEval & hostEval()
Borrow the immutable host evaluator bound to process-lifetime tables.
Definition XSection.cpp:229
const XsectTables & hostTables()
Borrow host pointers, lengths and inverse maps for every built-in geometry table.
Definition XSection.cpp:129
constexpr double TINY
Definition XSectKernels.hpp:79
constexpr double RECT_ROUND_ALFMAX
Definition XSectKernels.hpp:85
constexpr double RECT_ALFMAX
Definition XSectKernels.hpp:83
constexpr double GRAVITY
Definition XSectKernels.hpp:81
double lookup_exact(double x, const double *t, int n) noexcept
Interpolate a normalized geometry table with the legacy arithmetic grouping.
Definition XSectLookup.hpp:76
int locate_maybe_lut(double y, const double *table, int jLast, const LocateLut *L) noexcept
Use a matching enabled bucket map or fall back to plain bisection.
Definition XSectLookup.hpp:378
constexpr double RECT_TRIANG_ALFMAX
Definition XSectKernels.hpp:84
LutId
Pointers to the shared geometry tables, in whichever memory space the consumer runs in.
Definition XSectKernels.hpp:338
@ S_Egg
Definition XSectKernels.hpp:347
@ A_Arch
Definition XSectKernels.hpp:345
@ Y_Gothic
Definition XSectKernels.hpp:339
@ A_VertEllipse
Definition XSectKernels.hpp:344
@ COUNT
Definition XSectKernels.hpp:354
@ Y_SemiCirc
Definition XSectKernels.hpp:342
@ A_HorizEllipse
Definition XSectKernels.hpp:343
@ S_SemiEllip
Definition XSectKernels.hpp:351
@ S_Catenary
Definition XSectKernels.hpp:350
@ Y_SemiEllip
Definition XSectKernels.hpp:341
@ S_Gothic
Definition XSectKernels.hpp:349
@ S_Circ
Definition XSectKernels.hpp:346
@ S_BasketHandle
Definition XSectKernels.hpp:352
@ S_Horseshoe
Definition XSectKernels.hpp:348
@ S_SemiCirc
Definition XSectKernels.hpp:353
@ Y_Catenary
Definition XSectKernels.hpp:340
int locate_bisect(double y, const double *table, int jLast) noexcept
Find a lower bracketing index in a nondecreasing table.
Definition XSectLookup.hpp:274
constexpr double PI
Definition XSectKernels.hpp:80
XSectShape
Definition XSectBatch.hpp:77
@ TRIANGULAR
Definition XSectBatch.hpp:84
@ RECT_CLOSED
Definition XSectBatch.hpp:81
@ POWERFUNC
Definition XSectBatch.hpp:86
@ ARCH
Definition XSectBatch.hpp:92
@ FORCE_MAIN
Definition XSectBatch.hpp:102
@ RECT_OPEN
Definition XSectBatch.hpp:82
@ BASKETHANDLE
Definition XSectBatch.hpp:98
@ STREET_XSECT
Definition XSectBatch.hpp:103
@ SEMICIRCULAR
Definition XSectBatch.hpp:99
@ IRREGULAR
Definition XSectBatch.hpp:100
@ MOD_BASKET
Definition XSectBatch.hpp:89
@ HORIZ_ELLIPSE
Definition XSectBatch.hpp:90
@ VERT_ELLIPSE
Definition XSectBatch.hpp:91
@ CUSTOM
Definition XSectBatch.hpp:101
@ RECT_ROUND
Definition XSectBatch.hpp:88
@ EGGSHAPED
Definition XSectBatch.hpp:93
@ SEMIELLIPTICAL
Definition XSectBatch.hpp:97
@ CATENARY
Definition XSectBatch.hpp:96
@ CIRCULAR
Definition XSectBatch.hpp:79
@ TRAPEZOIDAL
Definition XSectBatch.hpp:83
@ HORSESHOE
Definition XSectBatch.hpp:94
@ DUMMY
Definition XSectBatch.hpp:78
@ PARABOLIC
Definition XSectBatch.hpp:85
@ RECT_TRIANG
Definition XSectBatch.hpp:87
@ FILLED_CIRCULAR
Definition XSectBatch.hpp:80
@ GOTHIC
Definition XSectBatch.hpp:95
double * y
Definition odesolve.c:37
Native cross-section geometry and borrowed optional normalized transect tables.
Definition XSectBatch.hpp:119
double s_full
Section factor when full (normally ft^(8/3); FORCE_MAIN uses R^0.63)
Definition XSectBatch.hpp:129
double s_bot
Slope of bottom section / exponent.
Definition XSectBatch.hpp:134
const double * hrad_tbl
Normalized hyd-radius vs y/y_full.
Definition XSectBatch.hpp:144
int transect_tbl_size
Entry count of the tables above.
Definition XSectBatch.hpp:146
const double * width_tbl
Normalized width vs y/y_full.
Definition XSectBatch.hpp:145
double a_full
Area when full (ft2)
Definition XSectBatch.hpp:127
double r_bot
Radius of bottom section / coefficient.
Definition XSectBatch.hpp:135
double s_max
Section factor at max flow (same convention as s_full)
Definition XSectBatch.hpp:130
int type
Definition XSectBatch.hpp:120
double a_bot
Area of bottom section.
Definition XSectBatch.hpp:133
const xsect::LocateLut * area_lut
Definition XSectBatch.hpp:151
double w_max
Width at widest point (ft)
Definition XSectBatch.hpp:125
double y_bot
Depth of bottom section / fill depth.
Definition XSectBatch.hpp:132
double y_full
Full depth (ft)
Definition XSectBatch.hpp:124
double r_full
Hydraulic radius when full (ft)
Definition XSectBatch.hpp:128
const double * area_tbl
Normalized area vs y/y_full.
Definition XSectBatch.hpp:143
Definition XSectLookup.hpp:232
The geometry layer itself, parameterized on where its tables live.
Definition XSectKernels.hpp:465
OPENSWMM_KERNEL_FN double getRofY(const XSectParams &xs, double y) const
Dispatch native hydraulic radius from depth.
Definition XSectKernels.hpp:2316
OPENSWMM_KERNEL_FN double filled_circ_getAofY(const XSectParams &xs, double y) const
Compute sediment-filled circular wetted area from depth.
Definition XSectKernels.hpp:1030
OPENSWMM_KERNEL_FN double rect_triang_getYofA(const XSectParams &xs, double a) const
Compute triangular-invert rectangular water depth from wetted area.
Definition XSectKernels.hpp:1248
OPENSWMM_KERNEL_FN double rect_open_getdSdA(const XSectParams &xs, double a) const
Compute open rectangular section-factor derivative with respect to area.
Definition XSectKernels.hpp:1183
OPENSWMM_KERNEL_FN double rect_triang_getRofA(const XSectParams &xs, double a) const
Compute triangular-invert rectangular hydraulic radius from area.
Definition XSectKernels.hpp:1267
OPENSWMM_KERNEL_FN double tabular_getdSdA(const XSectParams &xs, double a, const double *table, int n_items) const
Differentiate the local normalized section-factor table segment.
Definition XSectKernels.hpp:887
OPENSWMM_KERNEL_FN double parab_getRofA(const XSectParams &xs, double a) const
Compute parabolic hydraulic radius from area.
Definition XSectKernels.hpp:1989
OPENSWMM_KERNEL_FN double rect_open_getSofA(const XSectParams &xs, double a) const
Compute open rectangular section factor from area.
Definition XSectKernels.hpp:1164
OPENSWMM_KERNEL_FN double filled_circ_getRofY(const XSectParams &xs, double y) const
Compute sediment-filled circular hydraulic radius from depth.
Definition XSectKernels.hpp:1074
OPENSWMM_KERNEL_FN double rect_round_getYofA(const XSectParams &xs, double a) const
Compute circular-invert rectangular water depth from wetted area.
Definition XSectKernels.hpp:1371
OPENSWMM_KERNEL_FN double mod_basket_getdSdA(const XSectParams &xs, double a) const
Compute modified baskethandle section-factor derivative with respect to area.
Definition XSectKernels.hpp:1641
OPENSWMM_KERNEL_FN bool isOpen(int type) const
Classify kernel section types using the legacy open-shape set.
Definition XSectKernels.hpp:2842
OPENSWMM_KERNEL_FN double rect_round_getWofY(const XSectParams &xs, double y) const
Compute circular-invert rectangular top width from depth.
Definition XSectKernels.hpp:1415
OPENSWMM_KERNEL_FN double mod_basket_getWofY(const XSectParams &xs, double y) const
Compute modified baskethandle top width from depth.
Definition XSectKernels.hpp:1595
OPENSWMM_KERNEL_FN double rect_round_getRofY(const XSectParams &xs, double y) const
Compute circular-invert rectangular hydraulic radius from depth.
Definition XSectKernels.hpp:1466
OPENSWMM_KERNEL_FN double generic_getdSdA(const XSectParams &xs, double a) const
Estimate section-factor derivative with a centered normalized-area difference.
Definition XSectKernels.hpp:863
OPENSWMM_KERNEL_FN double rect_triang_getRofY(const XSectParams &xs, double y) const
Compute triangular-invert rectangular hydraulic radius from depth.
Definition XSectKernels.hpp:1294
OPENSWMM_KERNEL_FN double powerfunc_getWofY(const XSectParams &xs, double y) const
Compute power-function top width from depth.
Definition XSectKernels.hpp:2033
OPENSWMM_KERNEL_FN double lookup(double x, const double *table, int n_items) const
Interpolate normalized geometry with guarded endpoints and exact legacy arithmetic.
Definition XSectKernels.hpp:629
OPENSWMM_KERNEL_FN double findroot_Ridder(double x1, double x2, double xacc, Func func) const
Find a sign-bracketed scalar root using Ridder iterations.
Definition XSectKernels.hpp:549
OPENSWMM_KERNEL_FN double filled_circ_getYofA(const XSectParams &xs, double a) const
Compute sediment-filled circular water depth from wetted area.
Definition XSectKernels.hpp:1052
OPENSWMM_KERNEL_FN double parab_getPofY(const XSectParams &xs, double y) const
Compute parabolic wetted perimeter from depth.
Definition XSectKernels.hpp:1950
OPENSWMM_KERNEL_FN double trapez_getWofY(const XSectParams &xs, double y) const
Compute trapezoidal top width from depth.
Definition XSectKernels.hpp:1686
OPENSWMM_KERNEL_FN double getYcircular(double alpha) const
Compute the circular normalized depth from area.
Definition XSectKernels.hpp:786
OPENSWMM_KERNEL_FN double circ_getAofY(const XSectParams &xs, double y) const
Compute circular wetted area from depth.
Definition XSectKernels.hpp:916
OPENSWMM_KERNEL_FN double powerfunc_getAofY(const XSectParams &xs, double y) const
Compute power-function wetted area from depth.
Definition XSectKernels.hpp:2014
OPENSWMM_KERNEL_FN double circ_getAofS(const XSectParams &xs, double s) const
Compute circular area from section factor.
Definition XSectKernels.hpp:974
OPENSWMM_KERNEL_FN int locate(double y, const double *table, int jLast) const
Find a lower interpolation bracket through shared legacy bisection.
Definition XSectKernels.hpp:610
OPENSWMM_KERNEL_FN double getAcircular(double psi) const
Compute the circular normalized area from section factor.
Definition XSectKernels.hpp:834
OPENSWMM_KERNEL_FN double trapez_getRofY(const XSectParams &xs, double y) const
Compute trapezoidal hydraulic radius from depth.
Definition XSectKernels.hpp:1740
OPENSWMM_KERNEL_FN double rect_triang_getSofA(const XSectParams &xs, double a) const
Compute triangular-invert rectangular section factor from area.
Definition XSectKernels.hpp:1318
OPENSWMM_KERNEL_FN double rect_round_getAofY(const XSectParams &xs, double y) const
Compute circular-invert rectangular wetted area from depth.
Definition XSectKernels.hpp:1394
OPENSWMM_KERNEL_FN double trapez_getYofA(const XSectParams &xs, double a) const
Compute trapezoidal water depth from wetted area.
Definition XSectKernels.hpp:1703
OPENSWMM_KERNEL_FN double mod_basket_getYofA(const XSectParams &xs, double a) const
Compute modified baskethandle water depth from wetted area.
Definition XSectKernels.hpp:1545
OPENSWMM_KERNEL_FN double trapez_getAofY(const XSectParams &xs, double y) const
Compute trapezoidal wetted area from depth.
Definition XSectKernels.hpp:1668
OPENSWMM_KERNEL_FN double getWofY(const XSectParams &xs, double y) const
Dispatch native top width from depth.
Definition XSectKernels.hpp:2237
OPENSWMM_KERNEL_FN double rect_triang_getdSdA(const XSectParams &xs, double a) const
Compute triangular-invert rectangular section-factor derivative with respect to area.
Definition XSectKernels.hpp:1338
OPENSWMM_KERNEL_FN double powerfunc_getYofA(const XSectParams &xs, double a) const
Compute power-function water depth from wetted area.
Definition XSectKernels.hpp:2051
OPENSWMM_KERNEL_FN double getSofA(const XSectParams &xs, double a) const
Dispatch native section factor from area.
Definition XSectKernels.hpp:2461
OPENSWMM_KERNEL_FN double powerfunc_getRofA(const XSectParams &xs, double a) const
Compute power-function hydraulic radius from area.
Definition XSectKernels.hpp:2126
OPENSWMM_KERNEL_FN double getThetaOfAlpha(double alpha) const
Compute the circular angle from normalized area.
Definition XSectKernels.hpp:722
OPENSWMM_KERNEL_FN double getAofS(const XSectParams &xs, double s) const
Invert native section factor to wetted area.
Definition XSectKernels.hpp:2629
OPENSWMM_KERNEL_FN double getAmax(const XSectParams &xs) const
Read the built-in ratio of area at maximum conveyance to full area.
Definition XSectKernels.hpp:2706
OPENSWMM_KERNEL_FN double rect_triang_getAofY(const XSectParams &xs, double y) const
Compute triangular-invert rectangular wetted area from depth.
Definition XSectKernels.hpp:1209
OPENSWMM_KERNEL_FN double triang_getWofY(const XSectParams &xs, double y) const
Compute triangular top width from depth.
Definition XSectKernels.hpp:1801
OPENSWMM_KERNEL_FN double getRofA(const XSectParams &xs, double a) const
Dispatch native hydraulic radius from area.
Definition XSectKernels.hpp:2518
OPENSWMM_KERNEL_FN double rect_round_getRofA(const XSectParams &xs, double a) const
Compute circular-invert rectangular hydraulic radius from area.
Definition XSectKernels.hpp:1434
OPENSWMM_KERNEL_FN double triang_getYofA(const XSectParams &xs, double a) const
Compute triangular water depth from wetted area.
Definition XSectKernels.hpp:1818
OPENSWMM_KERNEL_FN double triang_getdSdA(const XSectParams &xs, double a) const
Compute triangular section-factor derivative with respect to area.
Definition XSectKernels.hpp:1870
OPENSWMM_KERNEL_FN double triang_getRofY(const XSectParams &xs, double y) const
Compute triangular hydraulic radius from depth.
Definition XSectKernels.hpp:1853
OPENSWMM_KERNEL_FN double mod_basket_getAofY(const XSectParams &xs, double y) const
Compute modified baskethandle wetted area from depth.
Definition XSectKernels.hpp:1572
OPENSWMM_KERNEL_FN double getThetaOfPsi(double psi) const
Compute the circular angle from normalized section factor.
Definition XSectKernels.hpp:750
OPENSWMM_KERNEL_FN double rect_closed_getRofA(const XSectParams &xs, double a) const
Compute closed rectangular hydraulic radius from area.
Definition XSectKernels.hpp:1104
OPENSWMM_KERNEL_FN double parab_getYofA(const XSectParams &xs, double a) const
Compute parabolic water depth from wetted area.
Definition XSectKernels.hpp:1931
OPENSWMM_KERNEL_FN double getYcrit(const XSectParams &xs, double q) const
Compute critical depth for a nonnegative native discharge.
Definition XSectKernels.hpp:2730
OPENSWMM_KERNEL_FN double rect_round_getSofA(const XSectParams &xs, double a) const
Compute circular-invert rectangular section factor from area.
Definition XSectKernels.hpp:1488
OPENSWMM_KERNEL_FN double getAofY(const XSectParams &xs, double y) const
Dispatch native wetted area from depth.
Definition XSectKernels.hpp:2150
OPENSWMM_KERNEL_FN double rect_closed_getSofA(const XSectParams &xs, double a) const
Compute closed rectangular section factor from area.
Definition XSectKernels.hpp:1121
OPENSWMM_KERNEL_FN double invLookup(double y, const double *table, int n_items, const LocateLut *lut=nullptr) const
Invert normalized geometry with legacy upper-branch handling.
Definition XSectKernels.hpp:670
OPENSWMM_KERNEL_FN double parab_getWofY(const XSectParams &xs, double y) const
Compute parabolic top width from depth.
Definition XSectKernels.hpp:1914
OPENSWMM_KERNEL_FN double getYofA(const XSectParams &xs, double a) const
Dispatch native water depth from wetted area.
Definition XSectKernels.hpp:2382
OPENSWMM_KERNEL_FN double rect_round_getdSdA(const XSectParams &xs, double a) const
Compute circular-invert rectangular section-factor derivative with respect to area.
Definition XSectKernels.hpp:1515
OPENSWMM_KERNEL_FN double rect_closed_getdSdA(const XSectParams &xs, double a) const
Compute closed rectangular section-factor derivative with respect to area.
Definition XSectKernels.hpp:1141
OPENSWMM_KERNEL_FN double circ_getSofA(const XSectParams &xs, double a) const
Compute circular section factor from area.
Definition XSectKernels.hpp:954
OPENSWMM_KERNEL_FN double triang_getRofA(const XSectParams &xs, double a) const
Compute triangular hydraulic radius from area.
Definition XSectKernels.hpp:1835
OPENSWMM_KERNEL_FN double trapez_getRofA(const XSectParams &xs, double a) const
Compute trapezoidal hydraulic radius from area.
Definition XSectKernels.hpp:1722
XsectTables tbl
Definition XSectKernels.hpp:466
OPENSWMM_KERNEL_FN double triang_getAofY(const XSectParams &xs, double y) const
Compute triangular wetted area from depth.
Definition XSectKernels.hpp:1783
OPENSWMM_KERNEL_FN double parab_getRofY(const XSectParams &xs, double y) const
Compute parabolic hydraulic radius from depth.
Definition XSectKernels.hpp:1970
OPENSWMM_KERNEL_FN double circ_getdSdA(const XSectParams &xs, double a) const
Compute circular section-factor derivative with respect to area.
Definition XSectKernels.hpp:998
OPENSWMM_KERNEL_FN int findroot_Newton(double x1, double x2, double *rts, double xacc, Func func) const
Find a bracketed scalar root with safeguarded Newton/bisection iterations.
Definition XSectKernels.hpp:491
OPENSWMM_KERNEL_FN double mod_basket_getRofA(const XSectParams &xs, double a) const
Compute modified baskethandle hydraulic radius from area.
Definition XSectKernels.hpp:1617
OPENSWMM_KERNEL_FN double trapez_getdSdA(const XSectParams &xs, double a) const
Compute trapezoidal section-factor derivative with respect to area.
Definition XSectKernels.hpp:1757
OPENSWMM_KERNEL_FN double circ_getYofA(const XSectParams &xs, double a) const
Compute circular water depth from wetted area.
Definition XSectKernels.hpp:934
OPENSWMM_KERNEL_FN double getdSdA(const XSectParams &xs, double a) const
Dispatch the native section-factor derivative by shape.
Definition XSectKernels.hpp:2574
OPENSWMM_KERNEL_FN double parab_getAofY(const XSectParams &xs, double y) const
Compute parabolic wetted area from depth.
Definition XSectKernels.hpp:1896
OPENSWMM_KERNEL_FN double getScircular(double alpha) const
Compute the circular normalized section factor from area.
Definition XSectKernels.hpp:810
OPENSWMM_KERNEL_FN double powerfunc_getPofY(const XSectParams &xs, double y) const
Compute power-function wetted perimeter from depth.
Definition XSectKernels.hpp:2071
OPENSWMM_KERNEL_FN double rect_triang_getWofY(const XSectParams &xs, double y) const
Compute triangular-invert rectangular top width from depth.
Definition XSectKernels.hpp:1229
OPENSWMM_KERNEL_FN double powerfunc_getRofY(const XSectParams &xs, double y) const
Compute power-function hydraulic radius from depth.
Definition XSectKernels.hpp:2106
Definition XSectKernels.hpp:357
int N_W_VertEllipse
Definition XSectKernels.hpp:434
int N_Y_Catenary
Definition XSectKernels.hpp:436
const double * S_Catenary
Definition XSectKernels.hpp:373
const double * A_HorizEllipse
Definition XSectKernels.hpp:362
int N_W_Horseshoe
Definition XSectKernels.hpp:431
const double * W_Gothic
Definition XSectKernels.hpp:385
const double * Y_Gothic
Definition XSectKernels.hpp:395
const double * R_Egg
Definition XSectKernels.hpp:368
const double * Y_SemiEllip
Definition XSectKernels.hpp:398
int N_W_Circ
Definition XSectKernels.hpp:427
const double * R_Arch
Definition XSectKernels.hpp:365
const double * A_Baskethandle
Definition XSectKernels.hpp:359
int N_W_SemiEllip
Definition XSectKernels.hpp:433
const double * R_Circ
Definition XSectKernels.hpp:367
int N_S_Circ
Definition XSectKernels.hpp:418
int N_W_Gothic
Definition XSectKernels.hpp:429
const double * Amax
Definition XSectKernels.hpp:399
const double * Y_Egg
Definition XSectKernels.hpp:394
int N_W_BasketHandle
Definition XSectKernels.hpp:425
int N_R_Horseshoe
Definition XSectKernels.hpp:414
int N_W_HorizEllipse
Definition XSectKernels.hpp:430
const double * A_Arch
Definition XSectKernels.hpp:358
const double * R_HorizEllipse
Definition XSectKernels.hpp:369
const LocateLut * luts
Bucket maps for the inverted tables, indexed by LutId; null == bisect.
Definition XSectKernels.hpp:401
int N_W_Catenary
Definition XSectKernels.hpp:426
const double * S_SemiEllip
Definition XSectKernels.hpp:379
int N_Y_Circ
Definition XSectKernels.hpp:437
const double * W_HorizEllipse
Definition XSectKernels.hpp:386
int N_R_Circ
Definition XSectKernels.hpp:411
const double * W_Circ
Definition XSectKernels.hpp:383
const double * R_Baskethandle
Definition XSectKernels.hpp:366
int N_S_Catenary
Definition XSectKernels.hpp:417
const double * S_Egg
Definition XSectKernels.hpp:375
int N_A_Egg
Definition XSectKernels.hpp:405
const double * S_Horseshoe
Definition XSectKernels.hpp:377
int N_Y_BasketHandle
Definition XSectKernels.hpp:435
const double * Y_SemiCirc
Definition XSectKernels.hpp:397
int N_Y_Egg
Definition XSectKernels.hpp:438
const double * R_Horseshoe
Definition XSectKernels.hpp:370
int N_W_Arch
Definition XSectKernels.hpp:424
const double * W_VertEllipse
Definition XSectKernels.hpp:390
int N_A_Arch
Definition XSectKernels.hpp:402
const double * A_Circ
Definition XSectKernels.hpp:360
const double * S_Gothic
Definition XSectKernels.hpp:376
const double * Y_BasketHandle
Definition XSectKernels.hpp:391
OPENSWMM_KERNEL_FN const LocateLut * lut(LutId id) const
Borrow the optional bucket map selected by a geometry-table enum.
Definition XSectKernels.hpp:453
const double * Y_Horseshoe
Definition XSectKernels.hpp:396
int N_S_BasketHandle
Definition XSectKernels.hpp:416
int N_S_SemiEllip
Definition XSectKernels.hpp:423
int N_A_VertEllipse
Definition XSectKernels.hpp:408
int N_A_Horseshoe
Definition XSectKernels.hpp:407
const double * W_Arch
Definition XSectKernels.hpp:380
const double * Y_Circ
Definition XSectKernels.hpp:393
int N_A_Baskethandle
Definition XSectKernels.hpp:403
int N_W_SemiCirc
Definition XSectKernels.hpp:432
const double * R_VertEllipse
Definition XSectKernels.hpp:371
int N_S_Gothic
Definition XSectKernels.hpp:420
const double * W_Catenary
Definition XSectKernels.hpp:382
const double * S_SemiCirc
Definition XSectKernels.hpp:378
const double * A_VertEllipse
Definition XSectKernels.hpp:364
int N_A_Circ
Definition XSectKernels.hpp:404
int N_S_Horseshoe
Definition XSectKernels.hpp:421
int N_R_Arch
Definition XSectKernels.hpp:409
const double * A_Egg
Definition XSectKernels.hpp:361
int N_R_Baskethandle
Definition XSectKernels.hpp:410
const double * S_Circ
Definition XSectKernels.hpp:374
int N_Y_SemiEllip
Definition XSectKernels.hpp:442
int N_W_Egg
Definition XSectKernels.hpp:428
const double * Y_Catenary
Definition XSectKernels.hpp:392
const double * W_BasketHandle
Definition XSectKernels.hpp:381
int N_R_VertEllipse
Definition XSectKernels.hpp:415
const double * W_SemiCirc
Definition XSectKernels.hpp:388
int N_R_HorizEllipse
Definition XSectKernels.hpp:413
int N_Y_Horseshoe
Definition XSectKernels.hpp:440
const double * W_Horseshoe
Definition XSectKernels.hpp:387
int N_S_Egg
Definition XSectKernels.hpp:419
const double * A_Horseshoe
Definition XSectKernels.hpp:363
int N_Y_SemiCirc
Definition XSectKernels.hpp:441
int N_S_SemiCirc
Definition XSectKernels.hpp:422
const double * S_BasketHandle
Definition XSectKernels.hpp:372
int N_R_Egg
Definition XSectKernels.hpp:412
const double * W_Egg
Definition XSectKernels.hpp:384
const double * W_SemiEllip
Definition XSectKernels.hpp:389
int N_A_HorizEllipse
Definition XSectKernels.hpp:406
int N_Y_Gothic
Definition XSectKernels.hpp:439