フィルターのクリア

Changing ode solver tolerances on the fly

2 ビュー (過去 30 日間)
Salil Kulkarni
Salil Kulkarni 2023 年 10 月 27 日
回答済み: Torsten 2023 年 10 月 27 日
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

採用された回答

Walter Roberson
Walter Roberson 2023 年 10 月 27 日
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

その他の回答 (1 件)

Torsten
Torsten 2023 年 10 月 27 日
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.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by