Conversation
* Fix typo in concentration description in notebook * Add CHANGELOG.md entry for typo fix * Remove unneccesary changelog entry Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --------- Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com>
main -> develop
* fix `InputParameter` serialisation * Update CHANGELOG.md
…-fix Don't be too strict with func_args longer than symbol.children
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: add`silence_sundial_warnings` solver option * refactor: `silence_sundials_warnings` -> `silence_sundials_errors`
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* raise `SolverError` at failure to init sundials * Update simulation.py * Update idaklu_solver.py * reuse `pybammsolvers` error messages * Update test_idaklu_solver.py * bump `pybammsolvers` * Update CHANGELOG.md * Update CHANGELOG.md Update CHANGELOG.md
Co-authored-by: martinjrobins <martinjrobins@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds the ability to export discretized PyBaMM models to the DiffSL format, enabling integration with the DiffSL solver ecosystem (specifically pydiffsol). The implementation converts PyBaMM expression trees to DiffSL code that can be compiled and solved using diffsol's ODE/DAE solvers.
Changes:
- New
DiffSLExportclass for converting PyBaMM models to DiffSL format - Unit tests covering basic ODE and heat equation (PDE) exports
- Integration tests validating exports against actual pydiffsol solver for SPM, SPMe, and DFN battery models
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
src/pybamm/expression_tree/operations/diffsl.py |
Core implementation of DiffSL export functionality with methods to convert PyBaMM symbols, vectors, and matrices to DiffSL format |
tests/unit/test_expression_tree/test_operations/test_diffsl_export.py |
Unit tests for basic ODE and PDE model exports |
tests/integration/test_solvers/test_diffsl_export.py |
Integration tests validating DiffSL export against pydiffsol solver for multiple battery models |
src/pybamm/__init__.py |
Export of DiffSLExport class to public API |
pyproject.toml |
Addition of pydiffsol as dev dependency for testing |
CHANGELOG.md |
Documentation of new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5370 +/- ##
==========================================
+ Coverage 98.03% 98.05% +0.02%
==========================================
Files 327 328 +1
Lines 28690 29050 +360
==========================================
+ Hits 28126 28486 +360
Misses 564 564 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR adds the ability to export PyBaMM models to the DiffSL format, enabling models to be used with the DiffSL solver ecosystem.
Note this was started before the move from
developtomain, in the process some commits got added, but these don't affect the diffChanges
New
DiffSLExportclass insrc/pybamm/expression_tree/operations/diffsl.py:Unit and integration tests:
test_ode)test_heat_equation)Related Issues
Closes #5262
Checklist