ODE45

5 views (last 30 days)
Chembian Parthiban
Chembian Parthiban on 8 May 2011
I am running a ODE45 routine from to = 0 to tf = 50 with step = 0.01. After running certain number of loops i get this error message and i am not sure why this is happening and what can i do to get rid of this. I want the routine to run for the complete 5000 routines.
Error Message: Warning: Failure at t=2.220205e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.105427e-015) at time t. > In ode45 at 371

Answers (1)

Adrien Leygue
Adrien Leygue on 8 May 2011
First the step in ode45 has little meaning since the method is adaptive and will choose the appropriate time step based on a predictor corrector scheme. The 0.01 step that you might specify through the time vector input is merely a set of time values for which you want the value to be computed. Internally the function might use very different time steps.
Second, since the method adapts the time step, the error that you get simply tells you that in order to satisfy the error tolerance it had to use an extremely small time step which seems unreasonable (i.e. a time step of 1e-15 is simply not feasible if you integrate over several units of time). For you information in molecular dynamics such small tie step can be used but the time integration usually only goes for a few nanoseconds and still it might take weeks to compute.
The reason for the small time step is probably that your system is stiff. In mechanical systems, this would correspond to a very stiff spring, in chemical reactions to a very fast reaction. This might also come from a constraint in the system that you are enforcing using a penalization method.
My advice: use another ODE solver (ODE15s, ODE23S) specifically designed to handle stiff problems. You might also play a bit with tolerances and other parameters you can manipulate through "odeset" and explore methods that also use the jacobian of the "ode function". If you still have problems with the stiff integration methods, you might want to check your program for validity. Each time I have had this type of problem and i could not get rid of it, it turned out I had a bug in my program or i wan considering unphysical parameters.
Hope this helps.
A.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!