ODE45: small time-step size

48 views (last 30 days)
Shayan
Shayan on 19 Sep 2014
Answered: Shayan on 16 Oct 2014
Hi,
I'm trying to solve the transient 1D heat diffusion equation (dT/dt = a*d2T/dx2) with ODE45.
If I impose a short time interval (1000seconds with Dt=10s) everything is fine.
But if I want to solve the system on a long time interval (20000s), the solver starts to take very very small time step sizes when solving at t=±2500s...
I read in one of the previous posts ( ODE45 errer :input argument y is undefined ) that Jan Simon refers to such problems. I quote him:
"Btw., the function to be integrated must be smooth, otherwise the step-size control of ODE45 can lead to unexpected effects: [...] ODE45 reduces the step size to such a tiny value, that the integration takes hours to run and the accumulated rounding error dominates the solution. This is exactly what the step size control should avoid."
I think this is exactly my problem.
By reading some of his recommended references in the same post, I tried to run it using ode15s, but the same issue occurs at around t=±2800s and after a few iterations I get the error message "Unable to meet integration tolerances without reducing the step size below the smallest value allowed at time t".
So, I don't know how to solve this problem.
Thanks for your help
Shayan

Answers (4)

Mischa Kim
Mischa Kim on 19 Sep 2014
Shayan, as indicated in the equation above the heat equation is a PDE (as opposed to ODE). Check out the documentation and examples on how to solve the heat equation.
  3 Comments
Mischa Kim
Mischa Kim on 19 Sep 2014
I see. Is the heat equation the way you set it up supposed to be a stable system? At any rate the documentation and examples linked above should be a good reference solution you can work of.
Shayan
Shayan on 19 Sep 2014
I discretized it using 2nd order central differences... I'm not sure but I think it should be stable...

Sign in to comment.


Jan
Jan on 5 Oct 2014
The problems I've mentioned concern discontinuities only. The step size control cannot handles them. "Fortunately" it reduces the step size until the discontinuity is covered by the round-off errors and the intergration "works" at least. But the results are not trustworthy anymore due to the huge number of integrations steps and the accumulated round-off errors.
But the integration by ODE45 can suffer from otehr problems also, most of all the stiffness and instabilities of the problem. In the first case a solver for stiff problems can help, in the second case another mathematical method is required.

alexander
alexander on 16 Oct 2014
Hi,
I'm having a similar issue where the step size reduces significantly and then produces an error. The error occurs when running a simulation on my laptop using R2011a. When I try the same model on R2014a there is no issue so I don't believe it is the model. The simulation has a repetitive step in which the system recovers after each step, the error only occurs after several steps have been completed.
Could this problem be due to a system hardware issue, perhaps running out of memory? I am running 64-bit Windows 7 on an Intel Core i3 CPU M370 @ 2.40GHz with 4GB of RAM.
I have seen a similar issue before that has worked on an identical (factory spec) laptop but not on mine.
Thanks

Shayan
Shayan on 16 Oct 2014
Thanks for the replies.
My BCs are: - imposed heat flux, dT/dx=q, on one side - adiabatic wall on the other side, dT/dx=q=0
Note that I also tried the 'pdepe' function. It turned out that the result are pretty close to my discretization/ODE method (for span times smaller than the limit after which the issue appears). It is much more faster as well (about one hour for ODE, while PDEPE finishes in a couple of minutes). However, the same problem persists...
Any idea please ?
Thanks.

Community Treasure Hunt

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

Start Hunting!