Open-Systems-Pharmacology / PK-Sim

PK-Sim® is a comprehensive software tool for whole-body physiologically based pharmacokinetic modeling
Other
100 stars 49 forks source link

Fixes #2770 #2783

Closed msevestre closed 10 months ago

msevestre commented 10 months ago

@Yuri05 WIP but my local does not run tests anymore and I don't know why

Yuri05 commented 10 months ago

@msevestre Good news: simulations with ontogeny, which produced different results compared to V11 are now correct and produce exactly the same results as in V11 👍 Bad news: 3 other simulations, which were correct before the fix (compared to V11), now produce some differences. Investigating... grafik

Yuri05 commented 10 months ago

OK, so at least one of the problems is the solver issue.

If I reduce the maximal solver step both in V11 and V12, then I get the same results in both versions (which are different from V11-results and different from V12-results with the default solver settings). One thing I will try is this: https://github.com/Open-Systems-Pharmacology/OSPSuite.SimModel/issues/156

It is still not clear for me though, why this PR leads to the differences between V11 and V12 - I could not find the reason neither in the project nor in generated SimModel-XMLs

V11 vs. V12 (default solver settings)

V11 vs. V12 with HMax=0.001

Yuri05 commented 10 months ago

The second problem is a solver issue as well. Again, reducing the max step of the ODE makes the curves identical.

Here; there are no tables, but a tablet with Use As Suspension = false (meaning it "jumps" from one GI-Segment to the next one). An improvement would be to use the root finding feature of CVODES and to reformulate the definition of the tablet location using events.

I don't see it as urgent; the differences in the plasma curve are negligible; there are only small differences in few GI segments (s. below). The only problem is that it destroys the batch comparison 😄

V11 vs. V12 (default solver settings)

grafik

V11 vs. V12 with HMax=0.01

grafik

Yuri05 commented 10 months ago

For the remaining 3rd simulation with the differences: also here reducing the solver max step brings the sim results together. So overall: the fix is good 👍

msevestre commented 10 months ago

Awesome I don't understand however how the same generated simmodel file produces different results. I thought our changes were completely equivalent

Yuri05 commented 10 months ago

Good question. This wonders me as well...