Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yang2017 Model #1398

Merged
merged 54 commits into from
Mar 20, 2021
Merged

Yang2017 Model #1398

merged 54 commits into from
Mar 20, 2021

Conversation

KennethNwanoro
Copy link
Contributor

@KennethNwanoro KennethNwanoro commented Feb 25, 2021

Description

The Yang2017 model 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.

Fixes # (issue)

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

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

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@brosaplanella
Copy link
Sponsor Member

Hi Kenneth, thanks for the PR! In order to check everything is in order, can you please merge the most recent version of the develop branch and push again? Otherwise, the automatic tests don't run.

@KennethNwanoro
Copy link
Contributor Author

Hi Ferran,

I have updated the branch. Could you please check again.
I am seeing warning about conflict with lithium_ion_parameters.py file. I have checked but don't see any issues.
Many thanks.

@brosaplanella
Copy link
Sponsor Member

There are some conflicts on the file still to be resolved. You can either resolve them on the web editor (clicking the Resolve conflicts button) or on your local editor (most of them have in-built functionality to assist with that). It also seems that the develop branch you merged is not the most recent one, so you first need to update to the most recent version of the develop branch. Let me know if I can help.

@brosaplanella
Copy link
Sponsor Member

Now the tests run, so the first thing to fix is the style. Here you can find more information about it. You can install the package black which automatically formats your code.

@KennethNwanoro
Copy link
Contributor Author

Hi Ferran, I have done this. Could please check again. Thanks

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @KennethNwanoro , looking pretty good, just a few things to change.
In terms of tests to add, we need:

  • tests for the lithium plating porosity change, in this file, e.g.
def test_well_posed_reversible_plating_with_porosity(self):
        options = {"lithium plating": "reversible", "lithium plating porosity change": "true"}
        model = pybamm.lithium_ion.DFN(options)
        model.check_well_posedness()

and then similarly in this file, and also equivalent tests for the SPM and SPMe

  • a test for the Yang2017 model in a new file, for example
def test_basic_processing(self):
        model = pybamm.lithium_ion.Yang2017()
        modeltest = tests.StandardModelTest(model)
        modeltest.test_all()

Copy link
Sponsor Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Kenneth! Looks good. Just a few comments from me, which should help with making the tests pass.

):
self.submodels["porosity"] = pybamm.porosity.LeadingOrder(
self.param, self.options
)
if self.options["SEI porosity change"] == "false":
self.submodels["porosity"] = pybamm.porosity.Constant(self.param)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to pass self.options as second argument (that is what causes most of the tests to fail).

):
self.submodels["porosity"] = pybamm.porosity.LeadingOrder(
self.param, self.options
)
if self.options["SEI porosity change"] == "false":
self.submodels["porosity"] = pybamm.porosity.Constant(self.param)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to pass self.options as second argument (that is what causes most of the tests to fail).

self.options["sei porosity change"] == "true"
or self.options["lithium plating porosity change"] == "true"
):
self.submodels["porosity"] = pybamm.porosity.Full(self.param, self.options)
if self.options["SEI porosity change"] == "false":
self.submodels["porosity"] = pybamm.porosity.Constant(self.param)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to pass self.options as second argument (that is what causes most of the tests to fail).

@@ -0,0 +1,12 @@
# Graphite negative electrode parameters
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using the Ecker parameter set for Yang? If so, we don't need to define it again. Otherwise, the Yang paper should be listed in the references here.

@@ -0,0 +1,11 @@
# SEI parameters
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as with graphite

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, some comments:

  • check plating function names / duplication
  • move the "electrolytes" folder out of the "cells"
  • check whether we need to redefine the Ecker parameter set or if we can just use the existing one

@KennethNwanoro
Copy link
Contributor Author

@tinosulzer
Response to comment 1:
The lithium plating exchange current density for Yang2017 is a constant, I initially used the OKane function for consistency but since that is a bit confusing, I have reverted to using a constant value without using a FunctionParameter.

Response to comment 2:
I have removed this folder in the cells folder (strange how that got that, I might have moved it unknowingly.

Response to comment 3:
Here is my response to Ferran's comment about this.
Most of the parameters (OCPs, coefficients and thermal parameters) used in the Yang2017 were not listed in that paper. I have adapted and changed some parameter values in the Ecker parameter set that were given in Yang2017 paper. I think it is ok to have Yang2017 parameter set defined now even if some parameters values were from Ecker (I have referenced Ecker in the Yang2017 parameter set) so that when the full parameters from that paper is obtained (I plan to contact them regarding this), it will be easier to just change them in the already defined Yang2017 parameter set.

Many thanks

Copy link
Sponsor Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Just a few minor comments (see the suggested changes). There is also a file called python which should be deleted from the commit.

pybamm/CITATIONS.txt Outdated Show resolved Hide resolved
@@ -0,0 +1,155 @@
from pybamm import exp, sqrt
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what happened with the electrolyte parameters is that they were accidentally moved into cells. Remove the folder pybamm/input/parameters/lithium-ion/cells/electrolytes/

param = pybamm.LeadAcidParameters()
# param = pybamm.LeadAcidParameters()
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with the leading order reaction driven porosity.

pybamm/models/submodels/porosity/base_porosity.py Outdated Show resolved Hide resolved
KennethNwanoro and others added 11 commits March 19, 2021 11:22
…ity.py

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
…Li_plating/parameters.csv

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
…thium_ion/test_spm.py

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
…lating.py

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
…thium_ion/test_yang2017.py

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
…ery_model.py

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
…_plating.py

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
Copy link
Sponsor Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, great work! Let's see if @tinosulzer has any comments and it should be good to merge.

You should add a line on CHANGELOG.md under new features (note that they are sorted in order of descending PR number, so the comment should go between PR #1408 and #1370).

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me now! The final thing to do is to update the changelog, and also add the Yang2017 model to the docs (see dfn.rst for an example). Hopefully we can get the real parameters from the authors so that we can replicate their results exactly!

Comment on lines -12 to +13
param = pybamm.LeadAcidParameters()
# param = pybamm.LeadAcidParameters()
param = pybamm.LithiumIonParameters()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably why we miss the coverage earlier but it's fine - need to reformat these porosity models anyway

@valentinsulzer
Copy link
Member

@all-contributors add @KennethNwanoro for code, tests

@allcontributors
Copy link
Contributor

@tinosulzer

I've put up a pull request to add @KennethNwanoro! 🎉

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
@brosaplanella brosaplanella merged commit ed6e01a into pybamm-team:develop Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants