Deltares / Ribasim

Water resources modeling
https://deltares.github.io/Ribasim/
MIT License
36 stars 5 forks source link

Get rid of reduction factors for `Pump`, `UserDemand`, `Outlet` #1576

Open SouthEndMusic opened 5 days ago

SouthEndMusic commented 5 days ago

Why The goal of this issue is to get rid of as many non-zeros in the Jacobian (more precisely: the jacobian_prototype) as possible to boost performance. Some of these non-zeros are only there in case a reduction factor is triggered, which is generally a rare event. Connections that only cause non-zeros in the Jacobian because of a reduction factor:

.* Unless controlled by PID control (or continuous control in the future)

If we can get rid of the reduction factors for these nodes, we can probably significantly boost the performance of models that have many connections of this type.

How We still somehow need to handle the events that are now captured by these reduction factors. One way to do this is by using VectorContinuousControl which we previously used for DiscreteControl. Say for each basin we have a boolean flag is_empty and the expression

is_empty + storage^2

Then is_empty is set to true if this expression is $0$, in which state no abstraction from the basin is possible. One thing to figure out is what should be the trigger to set is_empty back to false.

Maybe we can get rid of low_storage_factor completely this way. Similar things can be done for the other reduction factors of Outlet.

SouthEndMusic commented 4 days ago

This makes https://github.com/Deltares/Ribasim/issues/1515 obsolete.