Skip to content

Commit

Permalink
#1429 merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Mar 26, 2021
2 parents b7c0e1f + 42486f8 commit b9d79d6
Show file tree
Hide file tree
Showing 95 changed files with 1,334 additions and 242 deletions.
10 changes: 10 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,16 @@
"contributions": [
"code"
]
},
{
"login": "KennethNwanoro",
"name": "KennethNwanoro",
"avatar_url": "https://avatars.githubusercontent.com/u/78538806?v=4",
"profile": "https://github.com/KennethNwanoro",
"contributions": [
"code",
"test"
]
}
],
"contributorsPerLine": 7,
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-10.15, ubuntu-20.04]
os: [macOS-10.15, ubuntu-20.04, windows-2019]

steps:
- uses: actions/checkout@v2
Expand All @@ -35,12 +35,19 @@ jobs:
- name: Clone pybind11 repo
run: git clone https://github.com/pybind/pybind11.git

- name: Build wheels
- name: Build wheels on manylinux and macos
if: matrix.os != 'windows-2019'
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_LINUX: "bash build_manylinux_wheels/install_sundials.sh 5.8.1 5.7.0"
CIBW_BEFORE_BUILD_LINUX: "python -m pip install cmake"

- name: Build wheels on windows
if: matrix.os == 'windows-2019'
run: |
python -m pip install wheel
python -m pip wheel --no-deps --wheel-dir wheelhouse .
- uses: actions/upload-artifact@v2
with:
name: wheels
Expand All @@ -58,15 +65,15 @@ jobs:
name: wheels

- name: Publish wheels on PyPI
if: ${{ github.events.inputs.target }} == 'pypi'
if: github.events.inputs.target == 'pypi'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: wheels/

- name: Publish wheels on TestPyPI
if: ${{ github.events.inputs.target }} == 'testpypi'
if: github.events.inputs.target == 'testpypi'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM)

## Features

- Added `NewmanTobias` li-ion battery model ([#1423](https://github.com/pybamm-team/PyBaMM/pull/1423))
- Added `plot_voltage_components` to easily plot the component overpotentials that make up the voltage ([#1419](https://github.com/pybamm-team/PyBaMM/pull/1419))
- Made `QuickPlot` more customizable and added an example ([#1419](https://github.com/pybamm-team/PyBaMM/pull/1419))
- `Solution` objects can now be created by stepping *different* models ([#1408](https://github.com/pybamm-team/PyBaMM/pull/1408))
- Added Yang et al 2017 model that couples irreversible lithium plating, SEI growth and change in porosity which produces a transition from linear to nonlinear degradation pattern of lithium-ion battery over extended cycles([#1398](https://github.com/pybamm-team/PyBaMM/pull/1398))
- Added support for Python 3.9 and dropped support for Python 3.6. Python 3.6 may still work but is now untested ([#1370](https://github.com/pybamm-team/PyBaMM/pull/1370))
- Added the electrolyte overpotential and Ohmic losses for full conductivity, including surface form ([#1350](https://github.com/pybamm-team/PyBaMM/pull/1350))
- Added functionality to `Citations` to print formatted citations ([#1340](https://github.com/pybamm-team/PyBaMM/pull/1340))
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pybamm-team/PyBaMM/blob/develop/)
[![black_code_style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-29-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-30-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

PyBaMM (Python Battery Mathematical Modelling) solves physics-based electrochemical DAE models by using state-of-the-art automatic differentiation and numerical solvers. The Doyle-Fuller-Newman model can be solved in under 0.1 seconds, while the reduced-order Single Particle Model and Single Particle Model with electrolyte can be solved in just a few milliseconds. Additional physics can easily be included such as thermal effects, fast particle diffusion, 3D effects, and more. All models are implemented in a flexible manner, and a wide range of models and parameter sets (NCA, NMC, LiCoO2, ...) are available. There is also functionality to simulate any set of experimental instructions, such as CCCV or GITT, or specify drive cycles.
Expand Down Expand Up @@ -153,6 +153,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
</tr>
<tr>
<td align="center"><a href="https://github.com/asinghgaba"><img src="https://avatars.githubusercontent.com/u/77078706?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Amarjit Singh Gaba</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=asinghgaba" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/KennethNwanoro"><img src="https://avatars.githubusercontent.com/u/78538806?v=4?s=100" width="100px;" alt=""/><br /><sub><b>KennethNwanoro</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=KennethNwanoro" title="Code">💻</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=KennethNwanoro" title="Tests">⚠️</a></td>
</tr>
</table>

Expand Down
4 changes: 2 additions & 2 deletions build_manylinux_wheels/install_sundials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function extract {
SUITESPARSE_VERSION=$1
SUNDIALS_VERSION=$2

SUITESPARSE_ROOT_ADDR=https://github.com/LLNL/sundials/releases/download/v$SUNDIALS_VERSION
SUNDIALS_ROOT_ADDR=https://computing.llnl.gov/projects/sundials/download
SUITESPARSE_ROOT_ADDR=https://github.com/DrTimothyAldenDavis/SuiteSparse/archive
SUNDIALS_ROOT_ADDR=https://github.com/LLNL/sundials/releases/download/v$SUNDIALS_VERSION

SUITESPARSE_ARCHIVE_NAME=v$SUITESPARSE_VERSION.tar.gz
SUNDIALS_ARCHIVE_NAME=sundials-$SUNDIALS_VERSION.tar.gz
Expand Down
1 change: 1 addition & 0 deletions docs/source/models/lithium_ion/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Lithium-ion Models
spme
dfn
newman_tobias
yang2017
6 changes: 6 additions & 0 deletions docs/source/models/lithium_ion/yang2017.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Yang et al 2017
===============

.. autoclass:: pybamm.lithium_ion.Yang2017
:members:

29 changes: 19 additions & 10 deletions examples/notebooks/lithium-plating.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/notebooks/using-submodels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
"source": [
"model.submodels[\"current collector\"] = pybamm.current_collector.Uniform(model.param)\n",
"model.submodels[\"thermal\"] = pybamm.thermal.isothermal.Isothermal(model.param)\n",
"model.submodels[\"porosity\"] = pybamm.porosity.Constant(model.param)\n",
"model.submodels[\"porosity\"] = pybamm.porosity.Constant(model.param, model.options)\n",
"model.submodels[\"negative active material\"] = pybamm.active_material.Constant(\n",
" model.param, \"Negative\", model.options\n",
")\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/custom_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)
model.submodels["current collector"] = pybamm.current_collector.Uniform(model.param)
model.submodels["thermal"] = pybamm.thermal.isothermal.Isothermal(model.param)
model.submodels["porosity"] = pybamm.porosity.Constant(model.param)
model.submodels["porosity"] = pybamm.porosity.Constant(model.param, model.options)
model.submodels["negative active material"] = pybamm.active_material.Constant(
model.param, "Negative", model.options
)
Expand Down
37 changes: 18 additions & 19 deletions examples/scripts/cycling_ageing_yang.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import pybamm as pb

pb.set_logging_level("INFO")
options = {"SEI": "ec reaction limited", "SEI porosity change": "true"}
param = pb.ParameterValues(chemistry=pb.parameter_sets.Ramadass2004)
model = pb.lithium_ion.DFN(options)
pb.set_logging_level("NOTICE")
model = pb.lithium_ion.Yang2017()

experiment = pb.Experiment(
[
(
"Charge at 1 C until 4.2 V",
"Hold at 4.2 V until C/10",
"Rest for 5 minutes",
"Discharge at 2 C until 2.8 V",
"Discharge at 1 C until 2.8 V",
"Rest for 5 minutes",
)
]
Expand All @@ -28,22 +27,22 @@
"Rest for 30 minutes",
"Discharge at 1 C until 2.8 V",
),
(
"Charge at 1 C until 4.2 V",
"Hold at 4.2 V until C/20",
"Rest for 30 minutes",
"Discharge at 2 C until 2.8 V",
),
(
"Charge at 1 C until 4.2 V",
"Hold at 4.2 V until C/20",
"Rest for 30 minutes",
"Discharge at 3 C until 2.8 V",
),
# (
# "Charge at 1 C until 4.2 V",
# "Hold at 4.2 V until C/20",
# "Rest for 30 minutes",
# "Discharge at 2 C until 2.8 V",
# ),
# (
# "Charge at 1 C until 4.2 V",
# "Hold at 4.2 V until C/20",
# "Rest for 30 minutes",
# "Discharge at 3 C until 2.8 V",
# ),
]
)
sim = pb.Simulation(model, experiment=experiment, parameter_values=param)
sim.solve(solver=pb.CasadiSolver(mode="safe", dt_max=120))
sim = pb.Simulation(model, experiment=experiment)
sim.solve(solver=pb.CasadiSolver(mode="safe"))
sim.plot(
[
"Current [A]",
Expand Down
9 changes: 9 additions & 0 deletions examples/scripts/print_parameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Example for printing the (dimensional and dimensionless) parameters of a parameter set
#
import pybamm

parameters = pybamm.LithiumIonParameters()
parameter_values = pybamm.ParameterValues(chemistry=pybamm.parameter_sets.Yang2017)
output_file = "lithium_ion_parameters.txt"
parameter_values.print_parameters(parameters, output_file)
14 changes: 14 additions & 0 deletions pybamm/CITATIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,19 @@ doi={10.1149/2.0661810jes}
doi = {10.1006/jcph.2002.7041},
}


@article{Yang2017,
author = {Yang, Xiao Guang and Leng, Yongjun and Zhang, Guangsheng and Ge, Shanhai and Wang, Chao Yang},
title = {Modeling of lithium plating induced aging of lithium-ion batteries: Transition from linear to nonlinear aging},
journal = {Journal of Power Sources},
volume = {360},
pages = {28--40},
year = {2017},
publisher = {Elsevier},
doi = {10.1016/j.jpowsour.2017.05.110},
}


@article{Ramadass2004,
title={Development of first principles capacity fade model for Li-ion cells},
author={Ramadass, P and Haran, Bala and Gomadam, Parthasarathy M and White, Ralph and Popov, Branko N},
Expand All @@ -360,6 +373,7 @@ doi={10.1149/2.0661810jes}
doi={10.1149/1.1634273},
}


@article{Newman1962,
title={Theoretical analysis of current distribution in porous electrodes},
author={Newman, John S and Tobias, Charles W},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Name [units],Value,Reference,Notes
,,,
Maximum porosity of separator,0.92,,
Separator Bruggeman coefficient (electrolyte),1.5,,
Separator Bruggeman coefficient (electrode),1.5,,
Separator density [kg.m-3],1680, Bulk density from Gigova 2006,
Separator specific heat capacity [J.kg-1.K-1],700, Electronics Cooling (fiberglass),
Separator thermal conductivity [W.m-1.K-1],0.04, University Physics Sears et al. 1999 (fiberglass),
34 changes: 34 additions & 0 deletions pybamm/input/parameters/lithium-ion/cells/Yang2017/parameters.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Name [units],Value,Reference,Notes,,
# Empty rows and rows starting with ‘#’ will be ignored,,,,,
,,,,,
# Macroscale geometry,,,,,
Negative current collector thickness [m],2.50E-05,Scott Moura FastDFN,no info from Peyman MPM,,`
Negative electrode thickness [m],4.87E-05,Yang 2017,,,
Separator thickness [m],2.50E-05,Yang 2017,,,
Positive electrode thickness [m],4.75E-05,Yang 2017,,,
Positive current collector thickness [m],2.50E-05,Scott Moura FastDFN,no info from Peyman MPM,,
Electrode height [m],1,KOKAM SLPB78205130H,Not needed for 1D,,
Electrode width [m],0.205,KOKAM SLPB78205130H,Not needed for 1D,,
Cell cooling surface area [m2],0.41,,pouch,,
Cell volume [m3],3.92E-05,,pouch,,
,,,,,
# Current collector properties ,,,,,
Negative current collector conductivity [S.m-1],59600000,LIONSIMBA,carbon,,
Positive current collector conductivity [S.m-1],35500000,LIONSIMBA,aluminium,,
,,,,,
# Density,,,,,
Negative current collector density [kg.m-3],8954,,,,
Positive current collector density [kg.m-3],2707,,,,
,,,,,
# Specific heat capacity,,,,,
Negative current collector specific heat capacity [J.kg-1.K-1],385,,,,
Positive current collector specific heat capacity [J.kg-1.K-1],897,,,,
,,,,,
# Thermal conductivity,,,,,
Negative current collector thermal conductivity [W.m-1.K-1],401,,,,
Positive current collector thermal conductivity [W.m-1.K-1],237,,,,
,,,,,
# Electrical,,,,,
Nominal cell capacity [A.h],2.4,Yang2017,,,
Typical current [A],2.4,,1C current,,
Current function [A],2.4,default current function,,,
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Parameters for a LiPF6 electrolyte, from the papers

> Ecker, Madeleine, et al. "Parameterization of a physico-chemical model of a lithium-ion battery i. determination of parameters." Journal of the Electrochemical Society 162.9 (2015): A1836-A1848.
>Ecker, Madeleine, et al. "Parameterization of a physico-chemical model of a lithium-ion battery II. Model validation." Journal of The Electrochemical Society 162.9 (2015): A1849-A1857.
> Ecker, Madeleine, et al. "Parameterization of a physico-chemical model of a lithium-ion battery II. Model validation." Journal of The Electrochemical Society 162.9 (2015): A1849-A1857.
The fits to data for the electrode and electrolyte properties are those provided
by Dr. Simon O’Kane in the paper:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lithium plating parameters

Some example parameters for lithium plating from the paper:

> O’Kane, S. E. J., Campbell, I. D., Marzook, M. W. J., Offer, G. J., & Marinescu, M. (2020) Physical origin of the differential voltage minimum associated with lithium plating in Li-ion batteries. Journal of The Electrochemical Society 167(3), 090540.
Note: this parameter set does not claim to be representative of the true parameter values. Instead these are parameter values that were used to fit plating models to observed experimental data in the referenced papers.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Name [units],Value,Reference,Notes
,,,
,,,
# Lithium plating parameters,,,
Lithium metal partial molar volume [m3.mol-1],1.30E-05,Yang2017,
Exchange-current density for plating [A.m-2],[function]plating_exchange_current_density_OKane2020,,
Exchange-current density for stripping [A.m-2],[function]stripping_exchange_current_density_OKane2020,,
Initial plated lithium concentration [mol.m-3],0.00E+00,,
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from pybamm import constants


def plating_exchange_current_density_OKane2020(c_e, c_Li, T):
"""
Exchange-current density for Li plating reaction [A.m-2].
References
----------
.. [1] O’Kane, Simon EJ, Ian D. Campbell, Mohamed WJ Marzook, Gregory J. Offer, and
Monica Marinescu. "Physical origin of the differential voltage minimum associated
with lithium plating in Li-ion batteries." Journal of The Electrochemical Society
167, no. 9 (2020): 090540.
Parameters
----------
c_e : :class:`pybamm.Symbol`
Electrolyte concentration [mol.m-3]
c_Li : :class:`pybamm.Symbol`
Plated lithium concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Returns
-------
:class:`pybamm.Symbol`
Exchange-current density [A.m-2]
"""

k_plating = 1e-10

return constants.F * k_plating * c_e
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from pybamm import constants


def stripping_exchange_current_density_OKane2020(c_e, c_Li, T):
"""
Exchange-current density for Li stripping reaction [A.m-2].
References
----------
.. [1] O’Kane, Simon EJ, Ian D. Campbell, Mohamed WJ Marzook, Gregory J. Offer, and
Monica Marinescu. "Physical origin of the differential voltage minimum associated
with lithium plating in Li-ion batteries." Journal of The Electrochemical Society
167, no. 9 (2020): 090540.
Parameters
----------
c_e : :class:`pybamm.Symbol`
Electrolyte concentration [mol.m-3]
c_Li : :class:`pybamm.Symbol`
Plated lithium concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Returns
-------
:class:`pybamm.Symbol`
Exchange-current density [A.m-2]
"""

k_plating = 1e-10

return constants.F * k_plating * c_Li
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SEI parameters

Some example parameters for SEI growth from the papers:

> Ramadass, P., Haran, B., Gomadam, P. M., White, R., & Popov, B. N. (2004). Development of first principles capacity fade model for Li-ion cells. Journal of the Electrochemical Society, 151(2), A196-A203.
> Ploehn, H. J., Ramadass, P., & White, R. E. (2004). Solvent diffusion model for aging of lithium-ion battery cells. Journal of The Electrochemical Society, 151(3), A456-A462.
> Single, F., Latz, A., & Horstmann, B. (2018). Identifying the mechanism of continued growth of the solid–electrolyte interphase. ChemSusChem, 11(12), 1950-1955.
> Safari, M., Morcrette, M., Teyssot, A., & Delacour, C. (2009). Multimodal Physics-Based Aging Model for Life Prediction of Li-Ion Batteries. Journal of The Electrochemical Society, 156(3),
> Yang, X., Leng, Y., Zhang, G., Ge, S., Wang, C. (2017). Modeling of lithium plating induced aging of lithium-ion batteries: Transition from linear to nonlinear aging. Journal of Power Sources, 360, 28-40.
Note: this parameter set does not claim to be representative of the true parameter values. Instead these are parameter values that were used to fit SEI models to observed experimental data in the referenced papers.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Name [units],Value,Reference,Notes
,,,
,,,
# Lithium plating parameters,,,
Lithium metal partial molar volume [m3.mol-1],1.30E-05,Yang2017,6.94e-3/534
Exchange-current density for plating [A.m-2],0.001,,
Initial plated lithium concentration [mol.m-3],0.00E+00,,
Loading

0 comments on commit b9d79d6

Please sign in to comment.