pybamm.JaxSolver integrates PyBaMM models using JAX, enabling JIT compilation, GPU/TPU execution, and end-to-end differentiation through the solver.
Constructor
str
default:"\"BDF\""
Integration method:
str | None
default:"None"
Method for computing consistent initial conditions.
None uses the BDF solver’s internal Newton chord method. Can be overridden with any BaseSolver-compatible method.float
default:"1e-6"
Relative tolerance.
float
default:"1e-6"
Absolute tolerance.
float | None
default:"0"
Tolerance for extrapolation detection.
str
default:"\"warn\""
Behaviour on extrapolation:
"warn", "error", or "ignore".dict | None
default:"{}"
Additional options forwarded to the JAX integrator.
Requirements
get_solve
Returns a compiled JAX function for repeated fast solves.
t_eval reuse the compiled function.
Examples
When using
JaxSolver, the model must be set up with convert_to_format="jax" and must not contain any termination events (e.g. voltage cut-off events). A RuntimeError is raised otherwise.