I am solving a simple ODE system with 5 state variables.
It is essentially made of 5 coupled RC sytems with a few (current) excitations.
These excitations are 6000 experimental data measured every 10 minutes.
I am using DifferentialEquations.jl and wanted to test the various solvers.
The experimental data are provided to the model by LinearInterpolation.
To my big surprise, almost all solvers failed.
for Euler I got this warning: “Warning: Instability detected. Aborting”
for Tsit5: “Warning: Interrupted. Larger maxiters is needed.”
I checked that the model was accessed 6000001 times !
Even stranger, the solver only explored the 80 first time steps of the data.
the same for RK4, …
However, TRBDF2 solves the problem very easily and accessed the model only 134187 times, and of course accessed all the data.
These equations should not be stiff.
It is a very simple model of heat conduction in a building.
Below are the equations.
The heat sources (i1, …) are measurements averaged over the time step (10 min).
These sources are a bit noisy, but that should not matter a lot.
The time constants are all rather large, except maybe for one of them.
That would likely lead to a form of stiffness in the definition. You might want to use DataInterpolations to generate a regression spline instead of doing a direct interpolation if that’s the case.
Those models are usually stiff.
All of this is pointing to the equation either being stiff, or, the other issue is that
So if you have a lot of data points, then your f is discontinuous at every data point, in which case the error estimators will have a very difficult time handling your problem. You probably want to use a higher order interpolation to smooth it out.