Fix PotentialPair1plus1D/2plus1D normalisation for parallel electrodes (#5467)#5478
Open
kamal20122012 wants to merge 2 commits intopybamm-team:mainfrom
Open
Conversation
The 1+1D and 2+1D potential-pair current-collector submodels apply a Neumann boundary condition at the positive tab of a single modelled electrode pair. The boundary condition was computed from the total cell current (applied_current_density * A_cc) instead of the per-electrode current. Because A_cc already includes the "Number of electrodes connected in parallel to make a cell" factor, this overstated the gradient of phi_s_cp at the tab by that factor when more than one electrode pair was connected in parallel: voltage drops in the current collector were inflated, the lower voltage cutoff was hit prematurely, and the reported discharge capacity was approximately 1/n_electrodes_parallel of the correct value. Divide by n_electrodes_parallel so the BC uses the current per electrode pair. No effect for the default n=1 case. Adds an integration regression test that compares discharge capacity between an equivalent wide single-electrode configuration and a two-parallel-electrode configuration; capacities now match. Fixes pybamm-team#5467
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5478 +/- ##
=======================================
Coverage 98.15% 98.15%
=======================================
Files 338 338
Lines 31115 31122 +7
=======================================
+ Hits 30542 30549 +7
Misses 573 573 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PotentialPaircurrent-collector submodels apply a Neumann BC at the positive tab of a single modelled electrode pair, but the boundary condition was computed from the total cell current (applied_current_density * A_cc) rather than the per-electrode-pair current. BecauseA_ccalready includesn_electrodes_parallel, the gradient ofphi_s_cpat the tab was overstated by that factor whenever more than one electrode pair was connected in parallel — voltage drops in the current collector were inflated, the lower voltage cutoff was hit prematurely, and the reported discharge capacity was approximately1 / n_electrodes_parallelof the correct value.n_electrodes_parallelso the BC uses the current per modelled electrode pair. No effect for the defaultn=1case.Fixes #5467
Test plan
pytest tests/integration/test_models/test_full_battery_models/test_lithium_ion/test_dfn.py::TestDFN::test_potential_pair_1plus1D_parallel_electrodes(passes; verified to fail on pre-fix code)pytest tests/unit/test_models/test_full_battery_models/test_lithium_ion -k "1plus1D or 2plus1D or potential_pair"— 50 passedpre-commit run --files <changed files>— all hooks pass (ruff-check, ruff-format, blacken-docs, file-checks, sp-repo-review)