pybamm.CasadiSolver wraps the CasADi integrator (backed by SUNDIALS CVODES/IDA) and adds battery-specific logic for event detection and step-and-check integration.
Constructor
float
default:"1e-6"
Relative tolerance for the integrator.
float
default:"1e-6"
Absolute tolerance for the integrator.
str
default:"\"casadi\""
Method for computing consistent initial conditions for DAE systems.
"casadi" uses CasADi’s Newton rootfinder. Any valid scipy.optimize.root method string (e.g. "lm", "hybr") is also accepted.float
default:"1e-6"
Tolerance for the root-finding step.
int
default:"5"
Maximum number of times the step size may be halved before raising an error.
float | None
default:"600"
Maximum global step size (seconds) in
"safe" mode. Defaults to 600 s when None.float | None
default:"0"
Tolerance for detecting extrapolation beyond the solved interval.
str
default:"\"error\""
Behaviour when extrapolation is detected:
"error", "warn", or "ignore".dict | None
default:"{}"
Options forwarded to the CasADi integrator at creation time. Useful keys include
"max_num_steps" and "print_stats". See the CasADi docs for the full list.dict | None
default:"{}"
Options forwarded to the CasADi integrator at call time.
bool
default:"false"
If
True, return a partial Solution when the solver fails mid-simulation instead of raising an error.bool | None
default:"None"
Whether to perturb algebraic initial conditions to avoid singularities. Defaults to
True in "safe" mode, False otherwise.int
default:"100"
LRU cache size for compiled CasADi integrators. Set to
0 for unbounded caching.