SciML / SciMLBase.jl

The Base interface of the SciML ecosystem
https://docs.sciml.ai/SciMLBase/stable
MIT License
129 stars 95 forks source link

option to control interpolation behavior for solution objects when using `saveat` #759

Open isaacsas opened 1 month ago

isaacsas commented 1 month ago

It would be nice when one is using saveat to have the ability to tell solution objects an interpolation option to use. For example, currently when using saveat in JumpProcesses and not saving every jump, objects will still use piecewise constant interpolation whereas I would think piecewise linear is more sensible.

Adding a kwarg to call sol(t; interp_method = ...) or such would be a nice way to allow other interpolations while still allowing one to use the solution interface. I could imagine just passing a symbol that identifies the interpolation to use from ones that are currently supported, but perhaps there could be a function-based interface for more generality?

ChrisRackauckas commented 3 weeks ago

I like this idea at a high level. At an implementation level it would be a bit tricker than expected but possible. The problem is that the interpolations are defined by the objects right now. But in theory switching to linear and piecewise constant should always be possible since those require no more data. So you could switch to those from any interpolation, while if you had a linear interpolation you could switch to piecewise constant and that's it. So the docs might be a little weird for what's allowable, but nothing in principle would be blocking this.