Skip to content

fix: include side-reaction heat from SEI growth and lithium plating - #5875

Draft
rtimms wants to merge 16 commits into
mainfrom
fix/side-reaction-heating
Draft

rtimms wants to merge 16 commits into
mainfrom
fix/side-reaction-heating

Conversation

@rtimms

@rtimms rtimms commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes #5820. Supersedes #5841, whose commits are included here with their original authorship.

From #5841, irreversible heating includes the SEI film drop for the main intercalation reaction. It still covered only that reaction, so the electrical energy lost to side reactions never appeared in "Total heating [W]" or the cell temperature.

This PR adds a BaseThermal._side_reaction_heating helper, called for each porous electrode and particle phase. It adds:

  • SEI growth and SEI on cracks: side-reaction current × (delta_phi − SEI open-circuit potential)
  • lithium plating: plating current × delta_phi, since plating has zero open-circuit potential

At a planar lithium metal electrode (half cells), the total interfacial current is plating plus SEI growth, but the heat term applied the plating overpotential to all of it. The main term now uses the plating current, and SEI growth adds its current × (delta_phi − SEI open-circuit potential).

delta_phi is the full surface potential difference, so these terms include any SEI film drop. The SEI open-circuit potential is only read when SEI growth is on, so parameter sets without SEI parameters are unaffected.

Energy check

TestEnergyBalance.test_side_reaction_heat_matches_electrical_loss checks that ohmic plus irreversible heat equals the electrical loss: terminal power minus the power stored by every reaction at its open-circuit potential. It runs three DFN cases at 268.15 K for 1800 s, each matching to rtol=1e-3:

case heat without this PR electrical loss
OKane2022, 10 A charge, SEI growth + SEI on cracks + partially reversible plating 768.70 J 783.57 J (1.9% missing)
Bonkile2024 composite graphite/silicon, 10 A charge, SEI growth + plating in both phases coverage for the per-phase path
Xu2019 half cell, 2.4 mA, reaction-limited SEI on the lithium metal 0.0619 J 0.0804 J (23% missing)

Type of change

Bug fix, with an entry under ## Bug fixes in CHANGELOG.md.

Important checks:

  • No style issues: uv run pre-commit run --all-files
  • Tests added that prove fix is effective: the new energy-balance test fails without the helper
  • All tests pass: thermal integration tests plus the lithium-ion integration suite (354), -m unit on tests/unit/test_models (922). Full nox -s tests left to CI.
  • The documentation builds: not run, no docs changes
  • Code is commented for hard-to-understand areas

🤖 Generated with Claude Code

shaurya20335 and others added 6 commits October 4, 2026 21:52
With "SEI film resistance" on, the voltage drop across the film is added to the
reaction overpotential eta_r, which lowers the terminal voltage. The thermal
model computed irreversible heating as a*j*eta_r, so the energy lost across the
film never appeared in "Total heating [W]" or the cell temperature.

Use a*j*(eta_r - eta_sei), i.e. the full departure from the open-circuit
potential, for both electrodes, every particle phase, and the planar lithium
metal electrode. Add an energy-balance test: at fixed temperature, the extra
heat from switching on the film resistance equals the extra electrical loss.

Fixes #5820

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Irreversible heating covered only the main intercalation reaction, so the
electrical energy lost to SEI growth, SEI on cracks and lithium plating never
appeared in the heat source. Add each side-reaction current times
(delta_phi - U) for that reaction, and an energy-balance test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rtimms
rtimms requested a review from a team as a code owner October 8, 2026 18:06
rtimms and others added 3 commits October 8, 2026 19:06
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In a half cell the total interfacial current is plating plus SEI growth, but
irreversible heating applied the plating overpotential to all of it. Use the
plating current for the main term and add SEI growth current times
(delta_phi - U_sei). Extend the energy-balance test to composite and half-cell
models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

ProjectPyBaMM
Branchfix/side-reaction-heating
Testbedbare-metal

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

🐰 View full continuous benchmarking report in Bencher

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.23%. Comparing base (1495fe3) to head (8156c93).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5875   +/-   ##
=======================================
  Coverage   98.23%   98.23%           
=======================================
  Files         348      348           
  Lines       35761    35794   +33     
=======================================
+ Hits        35130    35163   +33     
  Misses        631      631           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

rtimms and others added 2 commits October 12, 2026 07:39
…tions explicitly

Add well-posedness tests for lumped thermal with SEI growth, SEI on cracks and
plating, and for a half cell with SEI growth, so the new heating branches are
covered by the unit suite. Pass the options that #5818 deprecates relying on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rtimms

rtimms commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Consolidation note: this PR contains all of #5841's source changes (the SEI film size-average in base_interface.py and eta_r - eta_sei in the irreversible heating). #5841 lands first, and this gets rebased on it, so the diff shrinks to:

  • BaseThermal._side_reaction_heating (SEI, SEI on cracks, lithium plating in porous electrodes)
  • the lithium-metal branch, where the current is split into plating j_pl * (eta_r - eta_sei) and SEI growth j_sei * (delta_phi - U_sei)

Also checked against the other thermal PRs:

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

ProjectPyBaMM
Branchfix/side-reaction-heating
Testbedbare-metal

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

🐰 View full continuous benchmarking report in Bencher

@rtimms
rtimms marked this pull request as draft October 22, 2026 12:10

This branch has not been deployed

No deployments
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 film resistance loss is not included in heat generation

2 participants