How to get the time step used in PDEPE solver?

16 views (last 30 days)
For PDEPE, Matlab guide says. "The pdepe function performs the time integration with an ODE solver that selects both the time step and the formula dynamically."
How to get the actual time step used by PDEPE as an ouput?

Answers (1)

Torsten
Torsten on 10 Aug 2022
Edited: Torsten on 10 Aug 2022
pdepe uses ode15s as solver for the arising differential equations.
This solver uses adaptive time stepping - thus if the problem is difficult, small time steps are chosen, if the problem is easy, large time steps are chosen.
The basic time steps (time steps that led to a successful integration step because the error tolerance was satisfied) can be seen after integration has finished if you choose only start and end point of integration for the definition of tspan:
tspan = [tstart tend]
Getting time steps to modify your equations during integration is almost impossible.
Could you explain why you want to get the time steps as output ?
  6 Comments
Gopinath NK
Gopinath NK on 10 Aug 2022
Thanks. I shall give this a try.
"If inputs to radiative or convective heat flux depend on time (external temperature, heat transfer coefficients,...), it's of course different" - Yes, this is my case.
Torsten
Torsten on 10 Aug 2022
I'd simply use "tspan" according to your needs and calculate the heat fluxes from the solution "sol" (which is supplied for the times defined in "tspan"). Then you don't need the "OutputFcn".

Sign in to comment.

Categories

Find more on Partial Differential Equation Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!