Changing ode solver tolerances on the fly
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Salil Kulkarni
am 27 Okt. 2023
Beantwortet: Torsten
am 27 Okt. 2023
I am trying to solve a set of coupled stiff ode's using the ode45/ode15s solvers. The solver sometimes does not converge and exists with an error for a particluar set of "Absolute tolerance", Relative Tolerance". Is it possible to change (relax) the values of the "Absolute tolerance", Relative Tolerance" on the fly just for the "problem" time step, help it cross over, and then switch back to the original values.
Thank you
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 27 Okt. 2023
If you use a tspan with exactly two elements, and you use ode options to set the Refine option to 0, then the ode functions will output all successful time-steps (and no other timesteps.)
You could then adopt a strategy of letting the integration fail, then backing up a small number of steps in the output time, and starting a new call with whatever changed options are appropriate -- possibly specifying a fairly narrow tspan that you guess will be wide enough to get over the problem.
Most of the time this will not really get you anywhere. Switching back and forth between solvers might maybe help, but you would want to use a pretty narrow time window on the ode45 calls
0 Kommentare
Weitere Antworten (1)
Torsten
am 27 Okt. 2023
Is it possible to change (relax) the values of the "Absolute tolerance", Relative Tolerance" on the fly just for the "problem" time step, help it cross over, and then switch back to the original values.
No, the stepsizes cannot be changed during the integration. Make a second run with relaxed tolerances to see if it really matters. If there is a problem with your equations, the solver will usually abort integration also for larger tolerances.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!