Skip to content

Latest commit

 

History

History
 
 

notebooks

Getting started

For new users we recommend the Getting Started notebooks. These are intended to be very simple step-by-step guides to show the basic functionality of PyBaMM. For more detailed notebooks, please see the examples listed below.

Examples

Open In Colab

This page contains a number of examples showing how to use PyBaMM.

Each example was created as a Jupyter notebook (http://jupyter.org/). These notebooks can be downloaded and used locally by running

$ jupyter notebook

from your local PyBaMM repository or used online through Google Colab. Alternatively, you can simply copy/paste the relevant code.

Using PyBaMM

The easiest way to start with PyBaMM is by running and comparing some of the inbuilt models:

It is also easy to add new models or change the setting that are used:

For more advanced usage, new sets of parameters, spatial methods and solvers can be added:

Expression tree structure

PyBaMM is built around an expression tree structure.

The following notebooks are specific to different stages of the PyBaMM pipeline, such as choosing a model, spatial method, or solver.

Models

Several battery models are implemented and can easily be used or compared. The notebooks below show the solution of each individual model. We always welcome new models!

Once you are comfortable with the expression tree structure, a good starting point to understand the models in PyBaMM is to take a look at the basic SPM and basic DFN, since these define the entire model (variables, equations, initial and boundary conditions, events) in a single class and so are easier to understand. However, we recommend that you subsequently use the full models as they offer much greater flexibility for coupling different physical effects and visualising a greater range of variables.

Lithium-ion models

Lead-acid models

Spatial Methods

The following spatial methods are implemented

  • Finite Volumes (1D only)
  • Spectral Volumes (1D only)
  • Finite Elements (only for 2D current collector domains)

See here for instructions on adding new spatial methods.

Solvers

The following notebooks show examples for generic ODE and DAE solvers. Several solvers are implemented in PyBaMM and we encourage users to try different ones to find the most appropriate one for their models.

See here for instructions on adding new solvers.