Explicitly integrate variables which appear nowhere else on the rhs - #2348
Conversation
…o issue-2240-explicit becasue I forgot to flake8 on the test
valentinsulzer
left a comment
There was a problem hiding this comment.
Code changes look good, some style comments. Let's see what the tests say. Could maybe do with a couple more tests (e.g. testing the output of an explicit integration - unless that is now done somewhere else by one of the existing tests?)
valentinsulzer
left a comment
There was a problem hiding this comment.
Thanks, looks good (once tests pass)
|
Just had a thought, it might be worth special-casing the case where the rhs is |
valentinsulzer
left a comment
There was a problem hiding this comment.
A few more comments from looking more closely ...
…o issue-2240-explicit style
Codecov ReportBase: 99.65% // Head: 99.66% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #2348 +/- ##
===========================================
+ Coverage 99.65% 99.66% +0.01%
===========================================
Files 361 269 -92
Lines 19948 20190 +242
===========================================
+ Hits 19879 20123 +244
+ Misses 69 67 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
…o issue-2240-explicit style prob
|
@all-contributors add @abillscmu for code |
|
@tinosulzer I've put up a pull request to add @abillscmu! 🎉 |
Description
This change moves variables from the model which do not appear on the right hand side to the variables dictionary with a
pybamm.ExplicitTimeIntegralwrapper. When called by the solution object, thepybamm.ExplicitTimeIntegralintegrates the variable (which can be easily explicitly calculated from the solution object).Variables are only moved if all of the following is true
y_slices(needed for experiments in the case that the variable is used in one experiment step and not others).len(var.domains)==0)Issue #2240 provides a brief overview of the impetus for the PR, but the main point is that in the case where the model has a rest step, not doing this results in a singular Jacobian matrix (due to
Discharge capacity [A.h], which can cause slowdowns and failures in some solvers.Fixes #2240
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.
Key checklist:
$ flake8$ python run-tests.py --unit$ cd docsand then$ make clean; make htmlYou can run all three at once, using
$ python run-tests.py --quick.Further checks: