# Solution at specific time points using a stiff ODE solver

**URL:** <https://discourse.julialang.org/t/solution-at-specific-time-points-using-a-stiff-ode-solver/83169>\
**Category:** General Usage\
**Tags:** differentialequation, ordinarydiffeq\
**Created:** [June 22, 2022, 8:42am UTC](https://discourse.julialang.org/t/solution-at-specific-time-points-using-a-stiff-ode-solver/83169 "2022-06-22T08:42:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajaydeepk](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@ajaydeepk](https://discourse.julialang.org/u/ajaydeepk)\
**Post date:** [June 22, 2022, 8:42am UTC](https://discourse.julialang.org/t/solution-at-specific-time-points-using-a-stiff-ode-solver/83169/1 "2022-06-22T08:42:20Z")

</div>

While using stiff ODE solver like CVODE\_BDF() and radau(), can we use saveat to save solutions at specific time points. For example, since time step dt changes adaptively, thereby is it a good idea to do  
sol = solve(func, CVODE\_BDF(), reltol=1e-12, abstol=1e-12, saveat=0.01) ?  
As I noticed these algorithms generate solutions for very few time points. In other words, how can we obtain solutions for a desired number of time points in tspan=(0, T) with these solvers as we do in the case of fixed time step solver like RK4().

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 22, 2022, 10:41am UTC](https://discourse.julialang.org/t/solution-at-specific-time-points-using-a-stiff-ode-solver/83169/2 "2022-06-22T10:41:59Z")

</div>

> [@ajaydeepk](#):
>
> While using stiff ODE solver like CVODE\_BDF() and radau(), can we use saveat to save solutions at specific time points. For example, since time step dt changes adaptively, thereby is it a good idea to do  
> sol = solve(func, CVODE\_BDF(), reltol=1e-12, abstol=1e-12, saveat=0.01) ?

Is the question a misunderstanding of interpolation? The solutions have a high order interpolation generated as part of the solving process (which is usually order matching or one order less), so you don’t lose accuracy by interpolating between steps. Thus you only need `1e-12` tolerances if you want a `1e-12` local tolerance on the interpolation (in some sense that is more rigorous in some methods than others) which amounts to about a `1e-10` global error (heuristically). tl;dr, the tolerances apply to the `saveat` points just as much as it does to the steps.

> [@ajaydeepk](#):
>
> As I noticed these algorithms generate solutions for very few time points. In other words, how can we obtain solutions for a desired number of time points in tspan=(0, T) with these solvers as we do in the case of fixed time step solver like RK4().

You can use `saveat` for getting values at desired time points. Or `tstops` to control time stops, though that should only be done really for discontinuity handling.

See the output control part of the documentation for more details.

[https://diffeq.sciml.ai/dev/basics/common\_solver\_opts/](https://diffeq.sciml.ai/dev/basics/common_solver_opts/)

---

<div class="post-metadata">

**Author:** ![ajaydeepk](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@ajaydeepk](https://discourse.julialang.org/u/ajaydeepk)\
**Post date:** [June 22, 2022, 10:57am UTC](https://discourse.julialang.org/t/solution-at-specific-time-points-using-a-stiff-ode-solver/83169/3 "2022-06-22T10:57:51Z")

</div>

“the tolerances apply to the `saveat` points just as much as it does to the steps.” answers my question. I was concerned about accuracy of the solution while using saveat with stiff ODEs solvers, I just wanted to be reassured. Thanks!
