OrdinaryDiffEq.step!(integrator, t - current_t, true)
I supply u to the right-hand side function via an object that I change before calling step!.
I know the solver cannot know that it changed, but I only do so at the step.
Have you tried using ModelingToolkitInputs.jl? This should give you the functionality your after and set the correct hooks for the integrator to make the correct steps. The demo problem in the docs is exactly this ODE.
The ModelingToolkitInputs approach uses callbacks. If do that too and use a periodic callback, do I need to mark the integrator with u_modified ?
The model now runs twice as slow. Maybe a discrete solver that handles the inputs directly is the better approach after all.
You should be able to have additional callbacks like a periodic callback mixed with ModelingToolkitInputs.jl and this shouldn’t be causing any slowdowns. My understanding is that if a discontinuity occurred then u_modified should be set to true and false otherwise. If it’s possible to provide a MWE I would love to investigate further.