Open-Systems-Pharmacology / OSPSuite.SimModel

Calculation engine for models built with PK-Sim® or MoBi®
Other
4 stars 3 forks source link

Why are the values of ODE state variables in [0 .. AbsTol] not set to 0 ? #162

Open Yuri05 opened 10 months ago

Yuri05 commented 10 months ago

According to the comment in the code, the values of ODE variables in the range [-AbsTol .. AbsTol] are set to zero: https://github.com/Open-Systems-Pharmacology/OSPSuite.SimModel/blob/7092dd785819f9904abbc1f40cc33c8e4be05a30/src/OSPSuite.SimModelNative/src/DESolver.cpp#L350-L364

However, when looking at the implementation: only the values in [-AbsTol .. 0] are set to zero, but not the values in [0 .. AbsTol] https://github.com/Open-Systems-Pharmacology/OSPSuite.SimModel/blob/7092dd785819f9904abbc1f40cc33c8e4be05a30/src/OSPSuite.SimModelNative/src/SimulationTask.cpp#L186-L193

I assume originally the values in [0 .. AbsTol] were set to zero as well, but we got some kind of problems with this (but I don't remember which exactly.).

_Originally posted by @Yuri05 in https://github.com/Open-Systems-Pharmacology/OSPSuite-R/pull/1341#discussion_r1457388258_

Yuri05 commented 10 months ago

@msevestre Do you remember the reason? @PavelBal FYI

PavelBal commented 3 months ago

@Yuri05 @msevestre Could this be fixed for v12?

Yuri05 commented 3 months ago

The fix is easy, I just wonder why we didn't do this in the first place (s. my comment above). But let's just do and then check if it breaks something.

PavelBal commented 1 month ago

Let's do this please :)

Yuri05 commented 22 hours ago

I think we should roll back this change. Looking at the discussion in https://github.com/Open-Systems-Pharmacology/MoBi/issues/1688 - it might become highly confusing for the user.

An alternative could be to define a new solver option "Remove calculated values below AbsTol" or so, which is false per default but can be set to true by the user.