PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

I3769 kolzenberg2020 (Another option for the SEI growth)

Open kawaMANMI opened this issue 1 year ago • 8 comments

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 # (issue) #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.

  • [x] 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

kawaMANMI avatar Aug 29 '24 13:08 kawaMANMI

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

brosaplanella avatar Aug 30 '24 11:08 brosaplanella

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.18%. Comparing base (3421fac) to head (c87b5dd).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4394      +/-   ##
===========================================
- Coverage    99.22%   99.18%   -0.04%     
===========================================
  Files          302      302              
  Lines        22821    22840      +19     
===========================================
+ Hits         22643    22654      +11     
- Misses         178      186       +8     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

codecov[bot] avatar Sep 26 '24 14:09 codecov[bot]

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 avatar Sep 26 '24 14:09 brosaplanella

@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 avatar Oct 04 '24 15:10 brosaplanella

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

brosaplanella avatar Oct 10 '24 14:10 brosaplanella

@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.

pipliggins avatar Oct 15 '24 10:10 pipliggins

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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

brosaplanella avatar Oct 15 '24 12:10 brosaplanella

I will squash this after tests pass.

@all-contributors please add @kawaMANMI for code

kratman avatar Nov 25 '24 16:11 kratman

@kratman

@kawaMANMI already contributed before to code

allcontributors[bot] avatar Nov 25 '24 16:11 allcontributors[bot]