-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
Yang2017 Model #1398
Conversation
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. |
Hi Ferran, I have updated the branch. Could you please check again. |
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. |
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 |
Hi Ferran, I have done this. Could please check again. Thanks |
There was a problem hiding this 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()
pybamm/models/full_battery_models/lithium_ion/basic_dfn_half_cell.py
Outdated
Show resolved
Hide resolved
...thium-ion/lithium_platings/yang2017_Li_plating/plating_exchange_current_density_OKane2020.py
Outdated
Show resolved
Hide resolved
...hium-ion/negative_electrodes/graphite_Yang2017/plating_exchange_current_density_OKane2020.py
Outdated
Show resolved
Hide resolved
pybamm/models/full_battery_models/lithium_ion/basic_dfn_half_cell.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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).
...thium-ion/lithium_platings/yang2017_Li_plating/plating_exchange_current_density_OKane2020.py
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,12 @@ | |||
# Graphite negative electrode parameters |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this 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
...thium-ion/lithium_platings/yang2017_Li_plating/plating_exchange_current_density_OKane2020.py
Outdated
Show resolved
Hide resolved
...hium-ion/negative_electrodes/graphite_Yang2017/plating_exchange_current_density_OKane2020.py
Outdated
Show resolved
Hide resolved
pybamm/models/full_battery_models/lithium_ion/basic_dfn_half_cell.py
Outdated
Show resolved
Hide resolved
pybamm/models/full_battery_models/lithium_ion/basic_dfn_half_cell.py
Outdated
Show resolved
Hide resolved
@tinosulzer Response to comment 2: Response to comment 3: Many thanks |
There was a problem hiding this 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.
@@ -0,0 +1,155 @@ | |||
from pybamm import exp, sqrt |
There was a problem hiding this comment.
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/
...thium-ion/lithium_platings/yang2017_Li_plating/plating_exchange_current_density_OKane2020.py
Outdated
Show resolved
Hide resolved
pybamm/models/submodels/interface/lithium_plating/irreversible_plating.py
Outdated
Show resolved
Hide resolved
pybamm/models/submodels/interface/lithium_plating/reversible_plating.py
Outdated
Show resolved
Hide resolved
param = pybamm.LeadAcidParameters() | ||
# param = pybamm.LeadAcidParameters() |
There was a problem hiding this comment.
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/input/parameters/lithium-ion/lithium_platings/yang2017_Li_plating/parameters.csv
Outdated
Show resolved
Hide resolved
pybamm/models/submodels/porosity/full_reaction_driven_porosity.py
Outdated
Show resolved
Hide resolved
pybamm/models/submodels/porosity/leading_reaction_driven_porosity.py
Outdated
Show resolved
Hide resolved
…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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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!
param = pybamm.LeadAcidParameters() | ||
# param = pybamm.LeadAcidParameters() | ||
param = pybamm.LithiumIonParameters() |
There was a problem hiding this comment.
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
@all-contributors add @KennethNwanoro for code, tests |
@tinosulzer I've put up a pull request to add @KennethNwanoro! 🎉 |
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
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.
Key checklist:
$ flake8
$ python run-tests.py --unit
$ cd docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks: