pybamm.Solution object is returned by sim.solve(). It stores the time vector, state trajectories, and processed variables, and provides methods to plot and export results.
Accessing variables
Index a solution with a variable name to obtain aProcessedVariable:
ProcessedVariable
Indexing aSolution returns a ProcessedVariable object.
The variable values evaluated at all solution time points. For spatially resolved variables the shape is
(n_spatial_points, n_times).The time points at which this variable was evaluated (seconds).
Spatial coordinates for spatially resolved variables.
None for scalar variables.Alias for
entries. Provided for compatibility.ProcessedVariable at a specific time:
Solution properties
All times at which the solution is evaluated (seconds), concatenated across sub-solutions.
Full state vector of shape
(n_states, n_times).List of per-cycle sub-solutions. Only populated when using a
pybamm.Experiment.Human-readable reason the solver stopped, e.g.
"final time", "event: Minimum voltage", or "event: Maximum voltage".Wall-clock time spent inside the solver. Prints as a human-readable string (e.g.
"1.234 s").Wall-clock time spent building and discretising the model.
Cycle-level summary variables (capacity fade, energy throughput, etc.). Only populated when using a
pybamm.Experiment.The input parameter dictionaries used across all sub-solutions.
A lightweight
Solution containing only the first time point. Useful for initialising subsequent simulations.A lightweight
Solution containing only the final time point.Cycle and step access
When running an experiment, you can drill into individual cycles and steps:Summary variables
After solving an experiment,sol.summary_variables gives cycle-level aggregate quantities:
Plotting
sol.plot()
Launch an interactive pybamm.QuickPlot:
sol.plot_summary_variables()
Plot cycle-summary quantities as a function of cycle number:
plot_summary_variables() is only available after solving an experiment.