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.
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.
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:
- Add a model (documentation)
- Add a model (example)
- Change model options
- Using submodels
- Change the settings (parameters, spatial method or solver)
- Change the applied current
For more advanced usage, new sets of parameters, spatial methods and solvers can be added:
PyBaMM is built around an expression tree structure.
- The expression tree notebook explains how this works, from model creation to solution.
- The broadcast notebook explains the different types of broadcast.
The following notebooks are specific to different stages of the PyBaMM pipeline, such as choosing a model, spatial method, or solver.
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.
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.
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.