stim-assign: possible error in calculating state variable update (explicit integration not done?)
Summary
We believe the updating of ion concentration state variables with --stim-assign
in bench
does not take the time step into account.
What version of openCARP are you using?
What operating system and processor architecture are you using?
Linux (CentOS Stream 8, Kernel 4.18.0-518)
AMD EPYC 7H12 (x86_64)
Steps to reproduce
Long-running single cell bench simulation with the OHara model, using stim-assign for ion species K.
Use --surface-to-volume
635 (!) and time steps 5e-3 ms and 20e-3 ms.
What is the current bug behavior?
Ion concentrations will diverge significantly between the two simulations even though they should not be that time-step sensitive at this range.
(simulations by Sophia O.)
What is the expected correct behavior?
The ion concentration trajectories should probably be very similar.
Possible fixes
Ion concentrations are updated here: https://git.opencarp.org/openCARP/openCARP/-/blob/master/physics/limpet/src/MULTI_ION_IF.cc?ref_type=heads#L1768
It seems that ion concentrations are updated directly but what is computed would probably have to be multiplied by the time step (for explicit integration) before being added to the ion concentration state variable.
If this is correct, it might also explain the strong discrepancy between opencarp and non-opencarp simulations with OHara we've been seeing. As stated above, we'd need a surface-to-volume-ratio of >600 to get qualitatively comparable results to the original and myokit implementations.