Python Battery Mathematical Modelling solves continuum models for batteries, using both numerical methods and asymptotic analysis.
PyBaMM comes with a number of detailed examples, hosted here on github. In addition, there is a full API documentation, hosted on Read The Docs.
You'll need the following requirements:
- Python 3.5+
- Python libraries:
numpy
scipy
pandas
matplotlib
These can easily be installed using pip
. To do this, first make sure you have the latest version of pip installed:
pip install --upgrade pip
Then navigate to the path where you downloaded PyBaMM to, and install both PyBaMM and its dependencies by typing:
pip install .
Or, if you want to install PyBaMM as a developer, use
pip install -e .[dev,docs]
To uninstall again, type
pip uninstall pybamm
Users can install scikits.odes in order to use the wrapped SUNDIALS ODE and DAE solvers.
To install scikits.odes, you will need to first download and compile sundials 3.1.1. On the command-line type:
INSTALL_DIR=`pwd`/sundials
wget https://computation.llnl.gov/projects/sundials/download/sundials-3.1.1.tar.gz
tar -xvf sundials-3.1.1.tar.gz
mkdir build-sundials-3.1.1
cd build-sundials-3.1.1/
cmake -DLAPACK_ENABLE=ON -DSUNDIALS_INDEX_TYPE=int32_t -DBUILD_ARKODE:BOOL=OFF -DEXAMPLES_ENABLE:BOOL=OFF -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR ../sundials-3.1.1/
make install
Then install scikits.odes, letting it know the sundials install location:
SUNDIALS_INST=$INSTALL_DIR pip install scikits.odes
After this, you will need to set your LD_LIBRARY_PATH
to point to the sundials
library:
export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH
You may wish to put this last line in your .bashrc
or virtualenv activate
script,
which will save you needing to set your LD_LIBRARY_PATH
every time you log in. For
example, to add this line to your .bashrc
you can type:
echo "export LD_LIBRARY_PATH=$INSTALL_DIR/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
Please see the scikits.odes documentation for more detailed installation instructions.
If you'd like to help us develop PyBaMM by adding new methods, writing documentation, or fixing embarrassing bugs, please have a look at these guidelines first.
PyBaMM is fully open source. For more information about its license, see LICENSE.