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

Update SPMe to generalised version #4329

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

brosaplanella
Copy link
Sponsor Member

Description

This issue generalises the SPMe formulation. The main contributions are

Fixes #4274

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 brosaplanella changed the title [WIP] Update SPMe to generalised version Update SPMe to generalised version Aug 9, 2024
@brosaplanella
Copy link
Sponsor Member Author

I ran some comparison between all the SPMe models.

Accuracy

I compared the outputs of the models and there are no appreciable differences across SPMe implementations. That might sound a bit disappointing as we are comparing a good approximation with a slightly better approximation. In O'Regan 2022 maybe one can argue that the new model does slightly better, as there the thermodynamic factor and transfer number are also dependent on concentration, which is what the new model captures. I did similar comparison for the half-cell and it also agrees very well.

Marquis 2019

compare_SPMe_vars
compare_SPMe_volt_comps
compare_SPMe_error

O'Regan 2022

compare_SPMe_vars_OR
compare_SPMe_volt_comps_OR
compare_SPMe_error_OR

Solving times

Here are the solving times. It is just one occurrence, but I ran the example multiple times and they are representative. Basically, the new SPMe is not significantly slower than the all one so all good. These times are for the Marquis2019 parameter set and the full cell.

Model Build time [ms] Solve time [ms]
new SPMe 44.578 11.814
old SPMe 45.518 12.957
integrated SPMe 50.563 11.331
DFN 54.589 113.854

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.41%. Comparing base (9e62b66) to head (be25bcd).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4329      +/-   ##
===========================================
- Coverage    99.42%   99.41%   -0.01%     
===========================================
  Files          297      296       -1     
  Lines        22685    22618      -67     
===========================================
- Hits         22554    22486      -68     
- Misses         131      132       +1     

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

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.

Clarify definition of PyBaMM's SPMe
1 participant