DiffEqs: Hybrid (continuous+discrete) system / periodic callback

As usual thanks for a detailed answer about the whole situation with DEDataArrays. Myself, I need DEDataArrays desperately as it seems the only sane way to handle the simulaiton data.

Since you mentioned the correctness issue, is it perhaps enough if a user provides relevant methods for the DEDataArrays? Like Base.:+(a::myarray, b::myarray) = myarray(a.x .+b.x, max(a.discrete, b.discrete) Surely there are a lot of methods to provide, but that’s a reasonable cost for such a powerful data structure.

I also have another issue with having parameterized functions because it requires copying p for each simulation that runs in parallel (threads). With DEarrays, p can be immutable with each thread writing data to its DEArray. Does anyone have a solution for this? I’d like to use parametrized functions approach but I also would not want to create many copies of p just to avoid parallel data writing.

You need more than a few though. You need to be able to define what to do for arbitrary combinations generated by broadcast dispatches. That’s not in general an easy thing to do. In theory we could provide an API for that to the user though, but for now you would have to define a broadcast dispatch yourself which isn’t easy even in the easy case.

You can use an immutable object for p and just distribute what you need.

Could you clarify this a bit? I always wanted to achieve p non-mutating integration while somehow storing intermediate discrete values. This sounds too good to be true, but probably I just don’t know enough.

As usual, big fan of your work Chris! DiffEq carried my grad school for the most part!

Use a SavingCallback to save out the discrete values while not mutating p at all?