# CVODE\_BDF outperforms Julia solvers for stiff system biology model?

**URL:** <https://discourse.julialang.org/t/cvode-bdf-outperforms-julia-solvers-for-stiff-system-biology-model/113936>\
**Category:** Modelling & Simulations\
**Tags:** question\
**Created:** [May 7, 2024, 9:19am UTC](https://discourse.julialang.org/t/cvode-bdf-outperforms-julia-solvers-for-stiff-system-biology-model/113936 "2024-05-07T09:19:00Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [May 8, 2024, 3:05pm UTC](https://discourse.julialang.org/t/cvode-bdf-outperforms-julia-solvers-for-stiff-system-biology-model/113936/5 "2024-05-08T15:05:31Z")

</div>

We found what CVODE is doing differently here. Turns out that on the chosen problem the nonlinear solvers seem to always converge in one iteration, while our method always did at least two iterations to check the convergence rate. We just need to add a fast path for that behavior.

> <https://github.com/SciML/OrdinaryDiffEq.jl/pull/2183>
>
> CVODE estimates the convergence of the first iteration by reusing the
> convergen…ce rate of the previous nonlinear solver iteration.
> 
> Reference: https://github.com/LLNL/sundials/blob/2abd63bd6cbc354fb4861bba8e98d0b95d65e24a/src/cvodes/cvodes\_nls.c#L325-L331
> 
> MWE: https://discourse.julialang.org/t/cvode-bdf-outperforms-julia-solvers-for-stiff-system-biology-model/113936
> 
> Master branch:
> \`\`\`julia
> julia\> sol = solve(oprob\_jac, FBDF()).stats
> SciMLBase.DEStats
> Number of function 1 evaluations: 311
> Number of function 2 evaluations: 0
> Number of W matrix evaluations: 31
> Number of linear solves: 222
> Number of Jacobians created: 2
> Number of nonlinear solver iterations: 212
> Number of nonlinear solver convergence failures: 0
> Number of fixed-point solver iterations: 0
> Number of fixed-point solver convergence failures: 0
> Number of rootfind condition calls: 0
> Number of accepted steps: 84
> Number of rejected steps: 2
> \`\`\`
> 
> This PR:
> \`\`\`julia
> julia\> sol = solve(oprob\_jac, FBDF()).stats
> SciMLBase.DEStats
> Number of function 1 evaluations: 251
> Number of function 2 evaluations: 0
> Number of W matrix evaluations: 32
> Number of linear solves: 159
> Number of Jacobians created: 2
> Number of nonlinear solver iterations: 149
> Number of nonlinear solver convergence failures: 0
> Number of fixed-point solver iterations: 0
> Number of fixed-point solver convergence failures: 0
> Number of rootfind condition calls: 0
> Number of accepted steps: 86
> Number of rejected steps: 3
> \`\`\`

That should merge by the end of the week.

---

_[View the full topic](https://discourse.julialang.org/t/cvode-bdf-outperforms-julia-solvers-for-stiff-system-biology-model/113936)._
