How to save additional data in or with a solution when using DifferentialEquations

Is there an idiom for saving non-state variables in or with the solution?

I would like to be able to list additional variables (either intermediate ones that I calculate anyway or derived ones of interest) and have them be saved at the same time steps and accessible with the same interpolation methods as the state variables for easy plotting.

These can all be determined from the state variables of course, but doing so has required refactoring and more complicated plotting commands. I’m guessing there’s an easier way and I’m not seeing it.


For now we have . There may be a better way in the future.