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

Composite porosity #4417

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

Conversation

DrSOKane
Copy link
Contributor

@DrSOKane DrSOKane commented Sep 5, 2024

Description

Modified reaction_driven_porosity.py so that porosity change still works for composite electrodes

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)

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.22%. Comparing base (a7253b8) to head (ae5f0f8).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4417   +/-   ##
========================================
  Coverage    99.22%   99.22%           
========================================
  Files          303      303           
  Lines        23070    23083   +13     
========================================
+ Hits         22891    22904   +13     
  Misses         179      179           

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

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 Simon! The PR looks nice, just the tests need addressing. Note that once the unit tests are updated to increase coverage, it will also have the same parameter issues as the integration tests.

@DrSOKane
Copy link
Contributor Author

DrSOKane commented Sep 6, 2024

Hi Simon! The PR looks nice, just the tests need addressing. Note that once the unit tests are updated to increase coverage, it will also have the same parameter issues as the integration tests.

That's odd. My working example ran just fine 10 days ago before I went on holiday, but it's now throwing the same parameter error as the automated tests. Was there a recent change to how phase parameters are handled?

@valentinsulzer
Copy link
Member

@parkec3 has also been working on some changes to make composite electrodes compatible with more cases

@parkec3
Copy link
Contributor

parkec3 commented Sep 6, 2024

It looks like the degradation parameters need to be updated to be defined by phase. I'm finishing up work getting the LAM submodel compatible with composite electrodes. I had to make a custom parameter set from Chen2020 composite and Ai2020 for my own local testing. The default parameter set doesn't have those defined.

@DrSOKane
Copy link
Contributor Author

DrSOKane commented Sep 7, 2024

The SEI parameters are defined by phase, but not by domain, which was the underlying cause of the bug. I rewrote the code with if statements to cover three possibilities:

  • Both electrodes have only one phase, in which case phase_name and pref are empty strings
  • domain has only one phase, in which case phase_name is empty but pref = "Primary: "
  • domain has more than one phase, in which case phase_name and pref are different for each phase

There is still a potential error if the electrode with SEI has one phase and the other has two. This can be fixed by giving all the SEI parameter domains, but that would be a separate PR...

@DrSOKane
Copy link
Contributor Author

DrSOKane commented Sep 9, 2024

UPDATE: I've simply set it so that L_sei_0 is zero if there is no SEI on that domain. Much more elegant and means the code will run in some edge cases that would have caused an error before.

@kratman kratman mentioned this pull request Sep 24, 2024
8 tasks
@brosaplanella brosaplanella added the skip-release Do not merge until the next release label Oct 30, 2024
@brosaplanella
Copy link
Member

Labelled this as skip release, given that we need to wait for #3457

@kratman kratman removed the skip-release Do not merge until the next release label Nov 25, 2024
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.

Just a small couple of cosmetic changes

CHANGELOG.md Outdated
@@ -30,6 +30,7 @@
- Added `BasicDFN` model for sodium-ion batteries ([#4451](https://github.com/pybamm-team/PyBaMM/pull/4451))
- Added sensitivity calculation support for `pybamm.Simulation` and `pybamm.Experiment` ([#4415](https://github.com/pybamm-team/PyBaMM/pull/4415))
- Added OpenMP parallelization to IDAKLU solver for lists of input parameters ([#4449](https://github.com/pybamm-team/PyBaMM/pull/4449))
- Porosity change now works for composite electrode ([#4417](https://github.com/pybamm-team/PyBaMM/pull/4417))
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be moved to the unreleased section

Comment on lines 29 to 31
if domain == "separator":
delta_eps_k = 0 # separator porosity does not change
pass # separator porosity does not change
else:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this could be refactored to use

if domain != "separator"

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.

5 participants