pybamm.IDAKLUSolver is generally the fastest solver for lithium-ion battery models. It wraps the SUNDIALS IDA DAE integrator with the KLU sparse-direct linear solver, provided by the pybammsolvers package.
Constructor
float
default:"1e-4"
Relative tolerance for the IDA integrator.
float
default:"1e-6"
Absolute tolerance for the IDA integrator.
str
default:"\"casadi\""
Method for consistent initial conditions.
"casadi" uses CasADi’s Newton solver; any scipy.optimize.root method string is also accepted.float
default:"1e-6"
Tolerance for the root-finding step.
float | None
default:"0"
Tolerance for detecting extrapolation beyond the solved interval.
str
default:"\"warn\""
Behaviour on extrapolation:
"warn", "error", or "ignore".str
default:"\"error\""
Behaviour when the solver returns an error flag:
"error", "warn", or "ignore".list[str] | None
default:"[]"
If provided, only these variables are computed during the solve. This can significantly reduce memory usage and solve time for large models.
dict | None
default:"{}"
Advanced solver options. See the Options reference below.
Options Reference
Theoptions dict exposes the full SUNDIALS IDA configuration. All keys and their defaults: