![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Runge-Kutta-Cash-Karp (RK45) ODE integrator with adaptive step control. More...
Go to the source code of this file.
Namespaces | |
| namespace | openswmm |
| namespace | openswmm::ode |
Typedefs | |
| using | openswmm::ode::DerivFunc = std::function<void(double x, const double* y, double* dydx)> |
| Synchronous derivative evaluator for an n-equation ODE system. | |
| using | openswmm::ode::BatchDerivFunc |
| Synchronous derivative evaluator for a batch of two-state systems. | |
Functions | |
| int | openswmm::ode::integrate (double *y, int n, double x1, double x2, double eps, double h1, const DerivFunc &derivs) |
| Advance an ODE system with adaptive Cash-Karp RK45 steps. | |
| template<typename F> | |
| int | openswmm::ode::integrateCallable (double *y, int n, double x1, double x2, double eps, double h1, F &&derivs) |
| Integrate with a concrete synchronous derivative callable. | |
| int | openswmm::ode::integrate_batch_2eq (double *y0, double *y1, int n_sys, double x1, double x2, double eps, double h1, const BatchDerivFunc &derivs) |
| Advance independent two-state systems with one explicit Euler step. | |
Variables | |
| constexpr int | openswmm::ode::MAXSTP = 10000 |
| Maximum integration steps. | |
| constexpr double | openswmm::ode::TINY = 1.0e-30 |
| Underflow protection. | |
| constexpr double | openswmm::ode::SAFETY = 0.9 |
| Step adjustment safety factor. | |
| constexpr double | openswmm::ode::PGROW = -0.2 |
| Exponent for step increase. | |
| constexpr double | openswmm::ode::PSHRNK = -0.25 |
| Exponent for step decrease. | |
| constexpr double | openswmm::ode::ERRCON = 1.89e-4 |
| = (5/SAFETY)^(1/PGROW) | |
| constexpr int | openswmm::ode::ODE_OK = 0 |
| Success. | |
| constexpr int | openswmm::ode::ODE_TOO_MANY = 1 |
| n > allocated max | |
| constexpr int | openswmm::ode::ODE_UNDERFLOW = 2 |
| Step size underflowed. | |
| constexpr int | openswmm::ode::ODE_MAX_STEPS = 3 |
| Exceeded MAXSTP. | |
Runge-Kutta-Cash-Karp (RK45) ODE integrator with adaptive step control.
Numerically identical to legacy odesolve.c. Uses 5th-order Runge-Kutta with embedded 4th-order error estimate for automatic step size control.
Used by:
Vectorization note: Each subcatchment's ODE system is independent. For batch integration over N subcatchments, call integrate() N times or use integrate_batch_2eq() for a single explicit Euler step over SoA state arrays; the batch helper does not use adaptive RK45.