Borrar filtros
Borrar filtros

Changing ode solver tolerances on the fly

2 visualizaciones (últimos 30 días)
Salil Kulkarni
Salil Kulkarni el 27 de Oct. de 2023
Respondida: Torsten el 27 de Oct. de 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

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de Oct. de 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

Más respuestas (1)

Torsten
Torsten el 27 de Oct. de 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.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by