Optimizing ODE solver performance for very small step size

Hi, I have a function (containing 2 diff. eqns) that needs to be solved. Unfortunately, the time step needed is 1e-11. I think the program will run into a memory issue. Is there any way to save values at a certain time interval? OR Do I need to non-dimensionalize the eqns.?
P.S. I am using the ode45 solver.

8 comentarios

Damm even I am having a similar kind of issue, I have searched all over the internet and even have posted on number of threads on different forum, no solution seems to work. I am really frustrated, can anyone of you here help me resolve this issue, I am very much tired now.
@Angshuman Podder: The absolute size of the time step does not matter. Remember that "time step" does not have a unit. So Matlab does not know, if it is pico-seconds or years.
The size of the time step does not imply any memory problems. But it would matter, if you have to calculate 1e11 time steps. This would not only exhaust the RAM, but the computing time would be huge also. In other words: While the size of the time step does not matter, the number of steps have an upper limit, if you have limited ressources.
@rahulmittal rahulmittal: Because I do not understand yet, what the problem of the OP exactly is, I'm astonished, that you think you have a similar problem. Please open a new thread here and explain, which problem you exactly have.
@Jan, thanks for the clarification. I am aware of the problems you mentioned which is why I am looking desperately for a solution. The memory problem could be possibly removed if somehow the solver did not save every value for its computation or dumps the value at certain intervals to clear memory. Also, is there any way the ode45 solver could be told to solve the diff. eqns for different time steps based on the scale of the time axis/problem and not a fixed one? I have changed the options as follows to ensure convergence.
options = odeset('InitialStep',1e-11,'MaxStep',2e-11);
The output should look somewhat like this: (Note the time scales)
Let me know if you need the actual code.
Jan
Jan el 21 de Feb. de 2021
Editada: Jan el 21 de Feb. de 2021
Why do you need such a tiny step size?
The accumulated rounding errors will dominate the trajectory. The computations might take a day.
If you force the integrator to use a tiny step size, it might be much cheaper to use a fixed step solver. Then you have full control over what is stored as output. Answers: Fixed Step Solvers
Actually, the program is not converging if I do not force it such low settings. I will try the fixed step solvers. thanks.
Not converging? I'm not sure which kind of convergence you expect for the integration of an ODE. But forcing an integrator to perform 10^11 steps sounds clearly like driving a numerical software apart from its purpose. Maybe the ODE is stiff? ODE45 integrates non-stiff ODEs only.
Not knowing details, the first thing I would always look at is if the problem can be nondimensionalized to remove units and more easily uncover stiffness. Especially since the plots shown have such huge orders of magnitude.
Angshuman Podder
Angshuman Podder el 23 de Feb. de 2021
Editada: Angshuman Podder el 23 de Feb. de 2021
I am sorry about that. Convergence is not the right word, it should be stability. For e.g the diameter/number density is going negative.
I think the ODEs are stiff. I just saw that there are ODE solvers for stiff eqns. Thanks again @Jan.
@J. Alex Lee, you are right. I will sit down with non-dimensionalizing the equations.

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Preguntada:

el 21 de Feb. de 2021

Editada:

el 23 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by