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

I3769 kolzenberg2020 (Another option for the SEI growth) #4394

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from

Conversation

kawaMANMI
Copy link
Contributor

@kawaMANMI kawaMANMI commented Aug 29, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Another option for the SEI gowth has been added based on teh model of von Kolzenberg et al.
spefically equation (19) has been implemented. Tunilening distance and lithoum ion conductivity in teh SEI as parameters need to be defined here is example to run a case

import pybamm
import numpy as np
import matplotlib.pyplot as plt


no_cycles = 1
exp = pybamm.Experiment(
    [("Charge at C/10 until 4.2 V",
      "Rest for 5 hours",
      "Discharge at C/10 until 2.5 V",
      "Rest for 5 hours",
      )]* no_cycles )

param=pybamm.ParameterValues("Chen2020")
param.update({
  'tunneling distance for electrons [m]': 4e-9,
  'SEI lithium ion conductivity [S.m-1]': 1.0e-3,}, check_already_exists=False) 


sei_option = "Kolzenberg2020"
model = pybamm.lithium_ion.SPM({"particle": "uniform profile",
                                  "SEI": sei_option}) 
solver = pybamm.CasadiSolver(mode="safe")
sim = pybamm.Simulation(model, parameter_values=param,
                          experiment=exp, solver=solver) 
sol = sim.solve(initial_soc=0) 
plt.plot(sol["Time [h]"].entries, sol["X-averaged negative total SEI thickness [m]"].entries)

Fixes #3769

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: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s 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
Member

Great, thanks @kawaMANMI! Will take a look later :)

Copy link
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 Kawa! Nice work, getting there. I have made some suggestions, including one that will hopefully make tests pass. We can address coverage once tests pass.

.gitignore Outdated Show resolved Hide resolved
src/pybamm/CITATIONS.bib Outdated Show resolved Hide resolved
src/pybamm/models/submodels/interface/sei/sei_growth.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.18%. Comparing base (204c076) to head (d0d2a28).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4394      +/-   ##
===========================================
- Coverage    99.25%   99.18%   -0.07%     
===========================================
  Files          302      302              
  Lines        22838    22840       +2     
===========================================
- Hits         22667    22654      -13     
- Misses         171      186      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@brosaplanella
Copy link
Member

Hi Kawa! The tests pass now, well done. The last thing is to improve the coverage. You can see which lines need tests in Codecov. Basically, you want to add some tests to base_lithium_ion_tests.py (in the unit tests folder), around line 283 (you can copy some of the previous tests and add the new model options you created. Similarly, on the base_lithium_ion_tests.py in the integration tests folder. You will also need to test the citations, see test_citations.py. Note you didn't register a citation for the tunnelling model, it would be good to do so.

@brosaplanella brosaplanella mentioned this pull request Sep 26, 2024
8 tasks
@agriyakhetarpal agriyakhetarpal changed the title I3769 kolzenberg2020 (Another option for the SEI gowth) I3769 kolzenberg2020 (Another option for the SEI growth) Oct 4, 2024
@brosaplanella
Copy link
Member

@pipliggins the integration failing test (test_DFN.py, in particular the test_sei_VonKolzenberg2020 is failing because the Sign symbol does not have a _from_json method. I am happy to skip the output tests for this one, but I wanted to check first if that is an easy fix.

@brosaplanella
Copy link
Member

Apologies, marked it as ready by accident. Need to wait for #4470 to be merged first.

@pipliggins
Copy link
Contributor

@pipliggins the integration failing test (test_DFN.py, in particular the test_sei_VonKolzenberg2020 is failing because the Sign symbol does not have a _from_json method. I am happy to skip the output tests for this one, but I wanted to check first if that is an easy fix.

@brosaplanella Sorry it took a while to get to this - Sign doesn't have a _from_json method because my understanding was that all Sign classes should be converted to scalar/array values after discretisation (and as only discretised models can be serialised, there was no need for the function). I'm taking a look to see why that doesn't seem to be happening here, but if that assumption was just incorrect it should be a relatively quick fix to implement the method. Alternatively can be left as-is if the logic operation introduced in bfab8a0 is sufficient.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@brosaplanella
Copy link
Member

This PR includes the changes in #4470 so that one needs merging before this one can be reviewed.

@brosaplanella brosaplanella marked this pull request as ready for review November 22, 2024 11:22
Copy link
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, but would be good to have an extra pair of eyes on it. Not marking it as approved so it doesn't get accidentally merged.

Copy link
Contributor

@DrSOKane DrSOKane left a comment

Choose a reason for hiding this comment

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

This looks excellent! I noticed you coded the equation for L_mig to avoid division by zero, while still ensuring the correct behaviour at zero current by making it a very large number. Well done!

Copy link
Contributor

@kratman kratman left a comment

Choose a reason for hiding this comment

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

Some cleanup is needed for this

@@ -137,3 +137,4 @@ results/

# tests
test_callback.log
# .mypy_cache/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# .mypy_cache/

Copy link
Contributor

Choose a reason for hiding this comment

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

This file should be deleted

Copy link
Contributor

Choose a reason for hiding this comment

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

The change log is messed up. The new items should be at the top and the other changes should be reverted

@@ -36,7 +38,8 @@ def test_citations(self):

# Test key error
with pytest.raises(KeyError):
citations._parse_citation("not a citation") # this should raise key error
# this should raise key error
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# this should raise key error

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.

SEI Growth by Electron Diffusion & Migration
6 participants