Skip to content

Commit

Permalink
Merge pull request #1139 from pybamm-team/develop
Browse files Browse the repository at this point in the history
Release 0.2.4
  • Loading branch information
valentinsulzer authored Sep 7, 2020
2 parents 09a3c08 + c320ad7 commit f00b8d1
Show file tree
Hide file tree
Showing 269 changed files with 12,955 additions and 3,902 deletions.
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

47 changes: 0 additions & 47 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build_wheels_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [macos-latest]
python-version: [3.6, 3.7]
python-version: [3.6, 3.7, 3.8]
include:
- os: ubuntu-latest
python-version: 3.8
Expand Down
67 changes: 23 additions & 44 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check style
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install package
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -e .[dev]
- name: Check style
run: python -m flake8
run: |
python -m pip install tox
tox -e flake8
build:
needs: style
Expand All @@ -35,7 +32,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7]
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
Expand All @@ -47,7 +44,7 @@ jobs:
- name: Install Linux system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt install gfortran gcc libopenblas-dev liblapack-dev graphviz
sudo apt install gfortran gcc libopenblas-dev graphviz
sudo apt install python${{ matrix.python-version }}.dev
- name: Install MacOS system dependencies
Expand All @@ -64,51 +61,33 @@ jobs:
- name: Install standard python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -e .
python -m pip install tox
- name: Install SUNDIALS and SuiteSparse
- name: Install SuiteSparse and Sundials
if: matrix.os != 'windows-latest'
run: |
pip install wget
git clone https://github.com/pybind/pybind11.git
python scripts/setup_KLU_module_build.py
export SUNDIALS_INST=$HOME/.local
pip install scikits.odes
pip install -e .
run: tox -e pybamm-requires

- name: Run unit tests Windows
if: matrix.os == 'windows-latest'
run: |
python run-tests.py --unit --folder all
- name: Run unit tests
- name: Run unit tests for GNU/Linux and MacOS
if: matrix.os != 'windows-latest'
run: |
export LD_LIBRARY_PATH=$HOME/.local/lib:scikits.odes/sundials5/lib:$LD_LIBRARY_PATH
python run-tests.py --unit --folder all
run: python -m tox -e tests

- name: Run unit tests for Windows
if: matrix.os == 'windows-latest'
run: python -m tox -e windows-tests

- name: Install docs dependencies and run doctests
if: matrix.os != 'windows-latest'
run: |
export LD_LIBRARY_PATH=$HOME/.local/lib:scikits.odes/sundials5/lib:$LD_LIBRARY_PATH
pip install -e .[docs]
python run-tests.py --doctest
run: tox -e doctests

- name: Install dev dependencies and run example tests
if: matrix.os != 'windows-latest'
run: |
export LD_LIBRARY_PATH=$HOME/.local/lib:scikits.odes/sundials5/lib:$LD_LIBRARY_PATH
pip install -e .[dev]
python run-tests.py --examples
- name: Install and run coverage
if: success() && (matrix.os == 'ubuntu-latest' && matrix.python-version == 3.7)
run: |
pip install coverage
export LD_LIBRARY_PATH=$HOME/.local/lib:scikits.odes/sundials5/lib:$LD_LIBRARY_PATH
coverage run run-tests.py --nosub
coverage xml
run: tox -e examples

- name: Instal and run coverage
if: success() && (matrix.os == 'unbuntu-latest' && matrix.python-version == 3.7)
run: tox -e coverage

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.7
uses: codecov/codecov-action@v1

8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ cmake_install.cmake
*.so
*.json


third-party/pybind11
pybind11/

setup.log
# Build dependencies/
KLU_module_deps

# setup
setup.log

# tox
.tox/

39 changes: 38 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
# [v0.2.4](https://github.com/pybamm-team/PyBaMM/tree/v0.2.4) - 2020-09-07

This release adds new operators for more complex models, some basic sensitivity analysis, and a spectral volumes spatial method, as well as some small bug fixes.

## Features

- Added variables which track the total amount of lithium in the system ([#1136](https://github.com/pybamm-team/PyBaMM/pull/1136))
- Added `Upwind` and `Downwind` operators for convection ([#1134](https://github.com/pybamm-team/PyBaMM/pull/1134))
- Added Getting Started notebook on solver options and changing the mesh. Also added a notebook detailing the different thermal options, and a notebook explaining the steps that occur behind the scenes in the `Simulation` class ([#1131](https://github.com/pybamm-team/PyBaMM/pull/1131))
- Added particle submodel that use a polynomial approximation to the concentration within the electrode particles ([#1130](https://github.com/pybamm-team/PyBaMM/pull/1130))
- Added `Modulo`, `Floor` and `Ceiling` operators ([#1121](https://github.com/pybamm-team/PyBaMM/pull/1121))
- Added DFN model for a half cell ([#1121](https://github.com/pybamm-team/PyBaMM/pull/1121))
- Automatically compute surface area per unit volume based on particle shape for li-ion models ([#1120](https://github.com/pybamm-team/PyBaMM/pull/1120))
- Added "R-averaged particle concentration" variables ([#1118](https://github.com/pybamm-team/PyBaMM/pull/1118))
- Added support for sensitivity calculations to the casadi solver ([#1109](https://github.com/pybamm-team/PyBaMM/pull/1109))
- Added support for index 1 semi-explicit dae equations and sensitivity calculations to JAX BDF solver ([#1107](https://github.com/pybamm-team/PyBaMM/pull/1107))
- Allowed keyword arguments to be passed to `Simulation.plot()` ([#1099](https://github.com/pybamm-team/PyBaMM/pull/1099))
- Added the Spectral Volumes spatial method and the submesh that it works with ([#900](https://github.com/pybamm-team/PyBaMM/pull/900))

## Bug fixes

- Fixed bug where some parameters were not being set by the `EcReactionLimited` SEI model ([#1136](https://github.com/pybamm-team/PyBaMM/pull/1136))
- Fixed bug on electrolyte potential for `BasicDFNHalfCell` ([#1133](https://github.com/pybamm-team/PyBaMM/pull/1133))
- Fixed `r_average` to work with `SecondaryBroadcast` ([#1118](https://github.com/pybamm-team/PyBaMM/pull/1118))
- Fixed finite volume discretisation of spherical integrals ([#1118](https://github.com/pybamm-team/PyBaMM/pull/1118))
- `t_eval` now gets changed to a `linspace` if a list of length 2 is passed ([#1113](https://github.com/pybamm-team/PyBaMM/pull/1113))
- Fixed bug when setting a function with an `InputParameter` ([#1111](https://github.com/pybamm-team/PyBaMM/pull/1111))

## Breaking changes

- The "fast diffusion" particle option has been renamed "uniform profile" ([#1130](https://github.com/pybamm-team/PyBaMM/pull/1130))
- The modules containing standard parameters are now classes so they can take options
(e.g. `standard_parameters_lithium_ion` is now `LithiumIonParameters`) ([#1120](https://github.com/pybamm-team/PyBaMM/pull/1120))
- Renamed `quick_plot_vars` to `output_variables` in `Simulation` to be consistent with `QuickPlot`. Passing `quick_plot_vars` to `Simulation.plot()` has been deprecated and `output_variables` should be passed instead ([#1099](https://github.com/pybamm-team/PyBaMM/pull/1099))


# [v0.2.3](https://github.com/pybamm-team/PyBaMM/tree/v0.2.3) - 2020-07-01

This release enables the use of [Google Colab](https://colab.research.google.com/github/pybamm-team/PyBaMM/blob/master/) for running example notebooks, and adds some small new features and bug fixes.

## Features

- Added JAX evaluator, and ODE solver ([#1038](https://github.com/pybamm-team/PyBaMM/pull/1038))
- Reformatted Getting Started notebooks ([#1083](https://github.com/pybamm-team/PyBaMM/pull/1083))
- Reformatted Landesfeind electrolytes ([#1064](https://github.com/pybamm-team/PyBaMM/pull/1064))
- Adapted examples to be run in Google Colab ([#1061](https://github.com/pybamm-team/PyBaMM/pull/1061))
Expand Down Expand Up @@ -32,7 +69,7 @@ This release enables the use of [Google Colab](https://colab.research.google.com
## Breaking changes

- `Simulation.specs` and `Simulation.set_defaults` have been deprecated. Users should create a new `Simulation` object for each different case instead ([#1090](https://github.com/pybamm-team/PyBaMM/pull/1090))
- The solution times `t_eval` must now be provided to `Simulation.solve()` when not using an experiment or prescribing the current using drive cycle data ([#1086](https://github.com/pybamm-team/PyBaMM/pull/1086))
- The solution times `t_eval` must now be provided to `Simulation.solve()` when not using an experiment or prescribing the current using drive cycle data ([#1086](https://github.com/pybamm-team/PyBaMM/pull/1086))

# [v0.2.2](https://github.com/pybamm-team/PyBaMM/tree/v0.2.2) - 2020-06-01

Expand Down
54 changes: 31 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ If you're already familiar with our workflow, maybe have a quick look at the [pr
Before you commit any code, please perform the following checks:

- [No style issues](#coding-style-guidelines): `$ flake8`
- [All tests pass](#testing): `$ python run-tests.py --unit`
- [The documentation builds](#building-the-documentation): `$ cd docs` and then `$ make clean; make html`

You can even run all three at once, using `$ python run-tests.py --quick`.

- [All tests pass](#testing): `$ tox -e quick` (GNU/Linux and MacOS), `$ python -m tox -e windows-quick` (Windows)
- [The documentation builds](#building-the-documentation): `$ python -m tox -e docs`

## Workflow

Expand Down Expand Up @@ -52,13 +49,26 @@ Finally, if you really, really, _really_ love developing PyBaMM, have a look at
To install PyBaMM with all developer options, type:

```bash
pip install -e .[dev,docs]
tox -e dev # (GNU/Linux and MacOS)
#
python -m tox -e windows-dev # (Windows)
```

This will

1. Install all the dependencies for PyBaMM, including the ones for documentation (docs) and development (dev).
2. Tell Python to use your local pybamm files when you use `import pybamm` anywhere on your system.
1. Create a virtual environment located at `.tox/dev`.
2. Install all the dependencies for PyBaMM, including the ones for documentation and development.
3. Tell Python to use your local pybamm files when you use `import pybamm` anywhere on your system.

Finally, activate your environment.


```bash
source .tox/dev/bin/activate # (GNU/Linux and MacOS)
#
.tox\dev\Scripts\activate.bat # (Windows)
```


## Coding style guidelines

Expand All @@ -71,11 +81,7 @@ We use [flake8](http://flake8.pycqa.org/en/latest/) to check our PEP8 adherence.
```bash
flake8
```
The configuration file
```
.flake8
```
allows us to ignore some errors. If you think this should be added or removed, please submit an [issue](#issues)
Flake8 is configured inside the file `tox.ini`, under the section `[flake8]`, allowing us to ignore some errors. If you think this should be added or removed, please submit an [issue](#issues)

When you commit your changes they will be checked against flake8 automatically (see [infrastructure](#infrastructure)).

Expand Down Expand Up @@ -145,7 +151,9 @@ All code requires testing. We use the [unittest](https://docs.python.org/3.3/lib
To run quick tests, type

```bash
python run-tests.py --unit
tox -e quick # (GNU/Linux and MacOS)
#
python -m tox -e windows-quick (Windows)
```

### Writing tests
Expand All @@ -160,7 +168,9 @@ The tests are divided into `unit` tests, whose aim is to check individual bits o
If you want to check integration tests as well as unit tests, type

```bash
python run-tests.py --unit --folder all
tox -e tests # (GNU/Linux and MacOS)
#
python -m tox -e windows-tests (Windows)
```

When you commit anything to PyBaMM, these checks will also be run automatically (see [infrastructure](#infrastructure)).
Expand All @@ -170,7 +180,9 @@ When you commit anything to PyBaMM, these checks will also be run automatically
To test all example scripts and notebooks, type

```bash
python run-tests.py --examples
tox -e examples # (GNU/Linux and MacOS)
#
python -m tox -e windows-examples (Windows)
```

If notebooks fail because of changes to pybamm, it can be a bit of a hassle to debug. In these cases, you can create a temporary export of a notebook's Python content using
Expand Down Expand Up @@ -277,16 +289,12 @@ Using [Sphinx](http://www.sphinx-doc.org/en/stable/) the documentation in `docs`

### Building the documentation

To test and debug the documentation, it's best to build it locally. To do this, make sure you have the relevant dependencies installed (see [installation](#installation)), navigate to your PyBaMM directory in a console, and then type:
To test and debug the documentation, it's best to build it locally. To do this, navigate to your PyBaMM directory in a console, and then type:

```
cd docs
make clean
make html
python -m tox -e docs (GNU/Linux, MacOS and Windows)
```

Next, open a browser, and navigate to your local PyBaMM directory (by typing the path, or part of the path into your location bar). Then have a look at `<your pybamm path>/docs/build/html/index.html`.

And then visit the webpage served at http://127.0.0.1:8000. Each time a change to the documentation source is detected, the HTML is rebuilt and the browser automatically reloaded.

### Example notebooks

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018-2020, University of Oxford (University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK).
Copyright (c) 2018-2020, the PyBaMM team.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ include pybamm/input/parameters/lithium-ion/separators/separator_Chen2020/README
include pybamm/input/parameters/lithium-ion/separators/separator_Marquis2019/README.md
include pybamm/version
include pybamm/CITATIONS.txt
include CMakeBuild.py
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ sim = pybamm.Simulation(model, experiment=experiment, solver=pybamm.CasadiSolver
sim.solve()
sim.plot()
```
However, much greater customisation is available. It is possible to change the physics, parameter values, geometry, submesh type, number of submesh points, methods for spatial discretisation and solver for integration (see DFN [script](examples/scripts/DFN.py) or [notebook](examples/notebooks/models/dfn.ipynb)).
However, much greater customisation is available. It is possible to change the physics, parameter values, geometry, submesh type, number of submesh points, methods for spatial discretisation and solver for integration (see DFN [script](examples/scripts/DFN.py) or [notebook](examples/notebooks/models/DFN.ipynb)).

For new users we recommend the [Getting Started](examples/notebooks/Getting%20Started/) guides. These are intended to be very simple step-by-step guides to show the basic functionality of PyBaMM.
For new users we recommend the [Getting Started](examples/notebooks/Getting%20Started/) guides. These are intended to be very simple step-by-step guides to show the basic functionality of PyBaMM, and can either be downloaded and used locally, or used online through [Google Colab](https://colab.research.google.com/github/pybamm-team/PyBaMM/blob/master/).

Further details can be found in a number of [detailed examples](examples/notebooks/README.md), hosted here on
github. In addition, there is a [full API documentation](http://pybamm.readthedocs.io/),
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
# -- Project information -----------------------------------------------------

project = "PyBaMM"
copyright = "2020, Valentin Sulzer"
copyright = "2020, The PyBaMM Team"
author = "The PyBaMM Team"

# The short X.Y version
version = "0.2"
# The full version, including alpha/beta/rc tags
release = "0.2.3"
release = "0.2.4"


# -- General configuration ---------------------------------------------------
Expand Down
Loading

0 comments on commit f00b8d1

Please sign in to comment.