Closed SouthEndMusic closed 3 months ago
The problem was probably with floating point errors. Calculating the level from the storage involves solving an equation of this form:
$$ \frac{1}{2}\frac{\Delta A}{\Delta t}(\ell-\ell_0)^2 + A_0(\ell-\ell_0) - (S-S_0) = 0. $$
The quadratic formula to solve this equation behaves poorly in the case that $\frac{\Delta A}{\Delta t}$ is small, as there is the transition between quadratic and linear behavior. What the new code does differently from the old code is that the threshold for when the area interpolation is considered constant is higher:
Note that this new threshold is just empirically determined.
See https://github.com/Deltares/Ribasim/pull/1543#issuecomment-2163718293. The introduction of SmoothInterpolation reveiled some weirdness in the basin interpolation.