Deltares / Ribasim

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

Consider removing RibaMod driver and refactoring RibaMetaMod #1550

Open Huite opened 2 weeks ago

Huite commented 2 weeks ago

Currently RibaMod uses a very simple sequential scheme, and RibaMetaMod uses a different scheme as well as incorporating MetaSWAP of course. The latter one can be run without MetaSWAP via booleans.

I think it's worth considering keeping RibaMod and RibaMetaMod as separate classes although with the same scheme, encapsulating the coupling logic in separate (mixin) classes, and assembling the classes via inheritance. This would match the preprocessing, internal:

class RibaMetaCoupling(DriverCoupling):
     ...

class MetaModCoupling(DriverCoupling):
     ...

class RibaModCoupling(DriverCoupling):
    ...

And user facing:

class RibaMod(RibaModCoupling):
     ...

class RibaMetaMod(RibaMetaCoupling, RibaModCoupling, MetaModCoupling):
     ...

This may not be practical, and brings the downsides of multiple inheritance. But generally, using types to skip conditionals is nice.

gijsber commented 2 weeks ago

I assume a typo ?

class RibaMod(RibaMetaCoupling): >> class RibaMeta(RibaMetaCoupling):

Huite commented 2 weeks ago

Bad copy-pasting on my part yes, I've fixed it now.