Skip to content

Improve composite model performance and sparsity#5439

Open
MarcBerliner wants to merge 7 commits intomainfrom
imporve-composite-speed
Open

Improve composite model performance and sparsity#5439
MarcBerliner wants to merge 7 commits intomainfrom
imporve-composite-speed

Conversation

@MarcBerliner
Copy link
Copy Markdown
Member

Description

Improved performance of the composite models by removing dense blocks in the Jacobian. Also adds a jacobian sparsity helper in IDAKLUSolver

Benchmark: composite SPMe (particle_phases=(2, 1)), 1C discharge 3600s

Metric main This PR Change
surface form = algebraic
System size 124x124 127x127 +3 algebraic equations
Jacobian nnz 3,129 866 -72%
Sparsity 79.7% 94.6%
Median solve time 10.7 ms 6.6 ms -38%
Max voltage diff -- 3.78e-12 V
surface form = differential
System size 124x124 127x127 +3 algebraic equations
Jacobian nnz 3,129 866 -72%
Sparsity 79.7% 94.6%
Median solve time 12.6 ms 9.7 ms -23%
Max voltage diff -- 1.70e-12 V
sparsity_before_after

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #)

Important checks:

Please confirm the following before marking the PR as ready for review:

  • No style issues: nox -s pre-commit
  • All tests pass: nox -s tests
  • The documentation builds: nox -s doctests
  • Code is commented for hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@MarcBerliner MarcBerliner changed the title Imporve composite performance and speed Improve composite performance and speed Apr 9, 2026
@MarcBerliner MarcBerliner changed the title Improve composite performance and speed Improve composite model performance and sparsity Apr 9, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 96.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.30%. Comparing base (9209226) to head (02bedc6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/pybamm/solvers/idaklu_solver.py 88.88% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5439      +/-   ##
==========================================
- Coverage   98.33%   98.30%   -0.04%     
==========================================
  Files         336      337       +1     
  Lines       30699    31025     +326     
==========================================
+ Hits        30189    30498     +309     
- Misses        510      527      +17     

☔ View full report in Codecov by Sentry.
📢 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.

@MarcBerliner MarcBerliner marked this pull request as ready for review April 9, 2026 17:59
@MarcBerliner MarcBerliner requested a review from a team as a code owner April 9, 2026 17:59
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.

1 participant