Repository: pybamm-team/PyBaMM

Issue:
v0.2.0 release
Final things to do for release:

- update version number
- update version number in docs
- update authors in docs
- update changelog section title from "unreleased"

anything else? @tlestang is all the pip stuff automatic?

Discussion:

Patch:
diff --git a/.requirements-docs.txt b/.requirements-docs.txt
index 6dbc42b98..6f64da025 100644
--- a/.requirements-docs.txt
+++ b/.requirements-docs.txt
@@ -1,6 +1,6 @@
 # Requirements for readthedocs.io
 numpy>=1.14
-scipy>=1.0
+scipy>=1.3
 pandas>=0.23
 anytree>=2.4.3
 autograd>=1.2
@@ -8,4 +8,3 @@ scikit-fem>=0.2.0
 casadi>=3.5.0
 guzzle-sphinx-theme
 sphinx>=1.5
-python-Levenshtein>=0.12.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d7a91a959..27d615ba0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,6 @@
-# [Unreleased](https://github.com/pybamm-team/PyBaMM)
+# [v0.2.0](https://github.com/pybamm-team/PyBaMM/tree/v0.2.0) - 2020-02-26
+
+This release introduces many new features and optimizations. All models can now be solved using the pip installation - in particular, the DFN can be solved in around 0.1s. Other highlights include an improved user interface, simulations of experimental protocols (GITT, CCCV, etc), new parameter sets for NCA and LGM50, drive cycles, "input parameters" and "external variables" for quickly solving models with different parameter values and coupling with external software, and general bug fixes and optimizations.
 
 ## Features
 
diff --git a/README.md b/README.md
index d3e5b0831..0808ced56 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
 [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pybamm-team/PyBaMM/master?filepath=examples%2Fnotebooks)
 [![black_code_style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
 
-Python Battery Mathematical Modelling solves continuum models for batteries, using both numerical methods and asymptotic analysis.
+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.
 
 ## How do I use PyBaMM?
 
@@ -19,6 +19,24 @@ sim = pybamm.Simulation(model)
 sim.solve()
 sim.plot()
 ```
+or simulate an experiment such as CCCV:
+```python3
+import pybamm
+experiment = pybamm.Experiment(
+    [
+        "Discharge at C/10 for 10 hours or until 3.3 V",
+        "Rest for 1 hour",
+        "Charge at 1 A until 4.1 V",
+        "Hold at 4.1 V until 50 mA",
+        "Rest for 1 hour",
+    ]
+    * 3,
+)
+model = pybamm.lithium_ion.DFN()
+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)).
 
 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.
@@ -50,7 +68,7 @@ instructions please see [here](INSTALL-WINDOWS.md)
 
 If you use PyBaMM in your work, please cite our paper
 
-"Sulzer, V., Marquis, S. G., Timms, R., Robinson, M., & Chapman, S. J. (2020). Python Battery Mathematical Modelling (PyBaMM). _ECSarXiv. February, 7_."
+> Sulzer, V., Marquis, S. G., Timms, R., Robinson, M., & Chapman, S. J. (2020). Python Battery Mathematical Modelling (PyBaMM). _ECSarXiv. February, 7_.
 
 You can use the bibtex
 
diff --git a/docs/conf.py b/docs/conf.py
index 732f8082a..e7cd1274e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -22,13 +22,13 @@ sys.path.insert(0, os.path.abspath("../"))
 # -- Project information -----------------------------------------------------
 
 project = "PyBaMM"
-copyright = "2018, Valentin Sulzer"
-author = "Valentin Sulzer"
+copyright = "2020, Valentin Sulzer"
+author = "The PyBaMM Team"
 
 # The short X.Y version
-version = ""
+version = "0.2"
 # The full version, including alpha/beta/rc tags
-release = ""
+release = "0.2.0"
 
 
 # -- General configuration ---------------------------------------------------
diff --git a/examples/scripts/compare_lead_acid_3D.py b/examples/scripts/compare_lead_acid_3D.py
deleted file mode 100644
index 4828408b2..000000000
--- a/examples/scripts/compare_lead_acid_3D.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Compare lead-acid battery models
-#
-import argparse
-import numpy as np
-import pybamm
-
-parser = argparse.ArgumentParser()
-parser.add_argument(
-    "--debug", action="store_true", help="Set logging level to 'DEBUG'."
-)
-args = parser.parse_args()
-if args.debug:
-    pybamm.set_logging_level("DEBUG")
-else:
-    pybamm.set_logging_level("INFO")
-
-# load models
-models = [
-    # pybamm.lead_acid.LOQS(
-    #     {"current collector": "potential pair", "dimensionality": 2}, name="2+1D LOQS"
-    # ),
-    pybamm.lead_acid.Full(
-        {"current collector": "potential pair", "dimensionality": 1}, name="1+1D Full"
-    ),
-    # pybamm.lead_acid.Full(
-    #     {"dimensionality": 1}, name="1+1D uniform Full"
-    # ),
-    pybamm.lead_acid.Composite(
-        {"current collector": "potential pair quite conductive", "dimensionality": 1},
-        name="1+1D composite",
-    ),
-    pybamm.lead_acid.Composite(
-        {"current collector": "potential pair", "dimensionality": 1},
-        name="1+1D composite",
-    ),
-    # # pybamm.lead_acid.Composite({"dimensionality": 1}, name="composite"),
-    pybamm.lead_acid.LOQS(
-        {"current collector": "potential pair", "dimensionality": 1}, name="1+1D LOQS"
-    ),
-    # pybamm.lead_acid.LOQS({"dimensionality": 1}, name="LOQS"),
-]
-
-# load parameter values and process models and geometry
-param = models[0].default_parameter_values
-param.update(
-    {
-        "Current function [A]": 1,
-        "Initial State of Charge": 1,
-        "Typical electrolyte concentration [mol.m-3]": 5600,
-        "Negative electrode reference exchange-current density [A.m-2]": 0.08,
-        "Positive electrode reference exchange-current density [A.m-2]": 0.006,
-        "Negative electrode conductivity [S.m-1]": 500000,
-        "Positive electrode conductivity [S.m-1]": 500000,
-    }
-)
-for model in models:
-    param.process_model(model)
-
-# discretise models
-for model in models:
-    geometry = model.default_geometry
-    param.process_geometry(geometry)
-    var = pybamm.standard_spatial_vars
-    var_pts = {
-        var.x_n: 10,
-        var.x_s: 10,
-        var.x_p: 10,
-        var.r_n: 10,
-        var.r_p: 10,
-        var.y: 10,
-        var.z: 10,
-    }
-    mesh = pybamm.Mesh(geometry, model.default_submesh_types, var_pts)
-    disc = pybamm.Discretisation(mesh, model.default_spatial_methods)
-    disc.process_model(model)
-
-# solve model
-solutions = [None] * len(models)
-t_eval = np.linspace(0, 3600 * 15, 1000)
-for i, model in enumerate(models):
-    solution = model.default_solver.solve(model, t_eval)
-    solutions[i] = solution
-
-# plot
-output_variables = [
-    "Local voltage [V]",
-    "Negative current collector potential [V]",
-    "Positive current collector potential [V]",
-    "X-averaged electrolyte concentration",
-    # "Leading-order current collector current density",
-    "Current collector current density",
-    "Terminal voltage [V]",
-]
-plot = pybamm.QuickPlot(solutions, output_variables)
-plot.dynamic_plot()
diff --git a/examples/scripts/experimental_protocols/cccv.py b/examples/scripts/experimental_protocols/cccv.py
index c20dc90b6..c04e4eaae 100644
--- a/examples/scripts/experimental_protocols/cccv.py
+++ b/examples/scripts/experimental_protocols/cccv.py
@@ -7,16 +7,15 @@ import matplotlib.pyplot as plt
 pybamm.set_logging_level("INFO")
 experiment = pybamm.Experiment(
     [
-        "Discharge at C/10 for 13 hours or until 3.3 V",
+        "Discharge at C/10 for 10 hours or until 3.3 V",
         "Rest for 1 hour",
         "Charge at 1 A until 4.1 V",
         "Hold at 4.1 V until 50 mA",
         "Rest for 1 hour",
     ]
     * 3,
-    period="2 minutes",
 )
-model = pybamm.lithium_ion.DFN()  # use {"thermal": "x-lumped"} for thermal effects
+model = pybamm.lithium_ion.DFN()
 sim = pybamm.Simulation(model, experiment=experiment, solver=pybamm.CasadiSolver())
 sim.solve()
 
diff --git a/examples/scripts/experimental_protocols/cccv_lead_acid.py b/examples/scripts/experimental_protocols/cccv_lead_acid.py
deleted file mode 100644
index 4614fd514..000000000
--- a/examples/scripts/experimental_protocols/cccv_lead_acid.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Constant-current constant-voltage charge
-#
-import pybamm
-
-pybamm.set_logging_level("INFO")
-experiment = pybamm.Experiment(
-    [
-        "Discharge at C/2 until 11 V",
-        "Rest for 1 hour",
-        "Charge at C/2 until 14.5 V",
-        "Hold at 14.5 V until 200 mA",
-        "Rest for 1 hour",
-    ]
-)
-model = pybamm.lead_acid.Full()
-sim = pybamm.Simulation(model, experiment=experiment, solver=pybamm.CasadiSolver())
-sim.solve()
-sim.plot()
diff --git a/pybamm/CITATIONS.txt b/pybamm/CITATIONS.txt
index 8b77fb447..416790a95 100644
--- a/pybamm/CITATIONS.txt
+++ b/pybamm/CITATIONS.txt
@@ -123,3 +123,15 @@ journal={ECSarXiv. February},
 volume={7},
 year={2020}
 }
+
+@software{scikit-fem,
+  author       = {Tom Gustafsson and
+                  Geordie McBain},
+  title        = {kinnala/scikit-fem 0.4.0},
+  month        = jan,
+  year         = 2020,
+  publisher    = {Zenodo},
+  version      = {0.4.0},
+  doi          = {10.5281/zenodo.3597656},
+  url          = {https://doi.org/10.5281/zenodo.3597656}
+}
diff --git a/pybamm/spatial_methods/scikit_finite_element.py b/pybamm/spatial_methods/scikit_finite_element.py
index a4d8a7693..48f01d393 100644
--- a/pybamm/spatial_methods/scikit_finite_element.py
+++ b/pybamm/spatial_methods/scikit_finite_element.py
@@ -29,6 +29,7 @@ class ScikitFiniteElement(pybamm.SpatialMethod):
 
     def __init__(self, options=None):
         super().__init__(options)
+        pybamm.citations.register("scikit-fem")
 
     def build(self, mesh):
         super().build(mesh)
diff --git a/pybamm/version b/pybamm/version
index c7cff60e5..6e91a93f8 100644
--- a/pybamm/version
+++ b/pybamm/version
@@ -1,1 +1,1 @@
-0, 1, 0
+0, 2, 0


Test patch:
diff --git a/tests/unit/test_citations.py b/tests/unit/test_citations.py
index cb7a064c7..0590120f2 100644
--- a/tests/unit/test_citations.py
+++ b/tests/unit/test_citations.py
@@ -74,6 +74,14 @@ class TestCitations(unittest.TestCase):
         pybamm.lead_acid.Full(build=False)
         self.assertIn("sulzer2019physical", citations._papers_to_cite)
 
+    def test_scikit_fem(self):
+        citations = pybamm.citations
+
+        citations._reset()
+        self.assertNotIn("scikit-fem", citations._papers_to_cite)
+        pybamm.ScikitFiniteElement()
+        self.assertIn("scikit-fem", citations._papers_to_cite)
+
     def test_parameter_citations(self):
         citations = pybamm.citations