PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

Allow SEI layers choice

Open lorenzofavaro opened this issue 11 months ago • 12 comments

Description

Currently, the default for SEI is one inner and one outer layer. Continuing the work of #3457, this change is to include an option to have a single layer SEI model, rather than just the 2-layer version.

Closes #2333

Type of change

  • [X] New feature (non-breaking change which adds functionality)

Key checklist:

  • [X] No style issues: $ pre-commit run (or $ nox -s pre-commit)
  • [X] All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • [X] The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

lorenzofavaro avatar Mar 22 '24 22:03 lorenzofavaro

Codecov Report

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

Project coverage is 99.58%. Comparing base (09ee982) to head (7a021e5). Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3920   +/-   ##
========================================
  Coverage    99.58%   99.58%           
========================================
  Files          257      257           
  Lines        21245    21277   +32     
========================================
+ Hits         21157    21189   +32     
  Misses          88       88           

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

codecov[bot] avatar Mar 22 '24 23:03 codecov[bot]

@lorenzofavaro This was being worked on by another person. Did you ask @GBlanka if they were still working on it? In general you don't want to take over the work of another developer unless they were not interested in continuing

kratman avatar Mar 25 '24 20:03 kratman

@lorenzofavaro This was being worked on by another person. Did you ask @GBlanka if they were still working on it? In general you don't want to take over the work of another developer unless they were not interested in continuing

You're right, I forgot to specify this in the PR description but I asked her about it on another platform (on Github she's no longer active) and she confirmed that she was no longer interested in working on the PR #3457.

Edit: She just closed her pull request.

lorenzofavaro avatar Mar 26 '24 08:03 lorenzofavaro

I'm wondering whether it would be cleaner to have entirely separate classes for double-layer or single-layer SEIs. There are a lot of if statements now in sei_growth.py

@tinosulzer Could we think of adding two classes SingleLayer and DoubleLayer in this way?

UML-SEI_Layers

After that, update the function set_six_submodel in the base_lithium_ion_model module, so that it handles the correct initialization of the submodel, based on the double SEI layer option.

Edit: updated UML

lorenzofavaro avatar Apr 04 '24 14:04 lorenzofavaro

NoSEI and ConstantSEI should only have the single-SEI case (as it's pointless to model a double-layer SEI if it's not there or constant). TotalSEI is an aggregator anyway so that should deal with both single and double cases. That only leaves SEIGrowth and DoubleLayerSEIGrowth. In fact we may want to put the "double" option inside the SEI option e.g. "solvent-diffusion limited" and "solvent-diffusion limited (double-layer)"

Btw, thanks for your work on this and sorry for changing the specs along the way, it just became clearer when thinking about it more

valentinsulzer avatar Apr 04 '24 18:04 valentinsulzer

The other (simpler) option is to just get rid of double layer SEI, which is just confusing and hard to parameterize. Thoughts @rtimms @brosaplanella @DrSOKane ?

valentinsulzer avatar Apr 04 '24 19:04 valentinsulzer

I would happily remove the double layer stuff. If people really really want it they can implement as a custom submodel or basic model.

rtimms avatar Apr 04 '24 19:04 rtimms

I agree with Rob. In fact, I believe that most of the 2 layer models can be hacked into a single layer model just by adjusting the parameters.

Related to this, I am not sure if it would be better to split the various models into classes rather than have a single class with several if statements.

brosaplanella avatar Apr 08 '24 12:04 brosaplanella

There's pros and cons to separating into different classes. I think a good middle ground is to have different submodel classes when the variables in submodel.rhs or submodels.algebraic change, and use if statements if we keep the same general structure but only vary the form of the equations. So in this case, keep it all in one submodel class

valentinsulzer avatar Apr 08 '24 18:04 valentinsulzer

@lorenzofavaro the conclusion is let's just go ahead and get rid of the double SEI entirely. It should make the changes much cleaner

valentinsulzer avatar Apr 08 '24 18:04 valentinsulzer

Hi @lorenzofavaro! Any updates on this?

brosaplanella avatar May 13 '24 15:05 brosaplanella

Hi @lorenzofavaro! Any updates on this? Otherwise we can take this over as we need this feature for some work we are doing with @kawaMANMI.

brosaplanella avatar Aug 29 '24 08:08 brosaplanella