How to extract solver info from ODE solution

I am trying to obtain the solver metadata after having calculated the solution of an ODE problem. I am used to MATLAB out.SimulationMetadata.ModelInfo.SolverInfo, but I cannot find any similar feature in Julia. Can anyone help me?

There is not specific example as this issue applies to any ODEProblema and ODESolution.


sol.alg will tell you what the solver was and sol.stats gives the benchmarks (e.g. number of calls, jacobians accepted vs rejected steps etc).

Alright, thanks! Is there any reference where I can find all the sol.something that I can use?
For instance to obtain the max-step (in case it is different than default), min-step, etc.

When I type typeof(sol) the REPL displays SciMLBase.ODESolution{…} with many fields. I believe I should be able to access all these fields with some keywords…


tab completion is very useful here. If you press sol. and then press tab, it will give you all the options for what the fields are. See also ODE Problems · DifferentialEquations.jl for the ODESolution docs.

This is very helpful, thanks!
However when I press sol. + tab the REPL shows many fields that are empty, such as alg_choice, errors, u_analytic. Do you know why? These fields are not even listed in the link you sent me (paragraph Solution type), do you know where I can retrieve the full list of fields?

Also, one more question. I opened this discussion here because I would like to know how to save in a .txt file the results of my simulations (final values of the main quantities of interest) as well as the settings (solver, timespan, total time taken by Julia to complete the simulation).
I know how to get the simulation values (u.sol) but I am having a hard time to obtain the settings:

  • For the solver I could use sol.alg, but then I do not get simply Tsit5() or Rosenbrock23() while the whole sequence such as OrdinaryDiffEq.QNDF{5, 1, false, LinearSolve.RFLUFactorization{true, true}, OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing, Nothing, Nothing, NTuple{5, Float64}}(Val{5}(), LinearSolve.RFLUFactorization{true, true}(), OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}}(1//100, 10, 1//5, 1//5, false, true, 0//1), OrdinaryDiffEq.DEFAULT_PRECS, nothing, nothing, :linear, (-0.185, -0.1111111111111111, -0.0823, -0.0415, 0.0), :Standard)
  • For the total computational time I do not have any idea
  • For the timespan I can just use sol.t[1] and sol.t[end], but if sol.t is previously manipulated for optimised plotting, where can I retrieve the info on the timespan?

Thanks a lot!!