-
-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 1221 convert to casadi #1316
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1316 +/- ##
========================================
Coverage 98.10% 98.10%
========================================
Files 272 272
Lines 15277 15290 +13
========================================
+ Hits 14988 15001 +13
Misses 289 289
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, happy to merge once the test passes. Thanks Tino!
) | ||
|
||
# Solve using "safe" mode with debug off | ||
pybamm.settings.debug_mode = False | ||
solver = pybamm.CasadiSolver(mode="safe", rtol=1e-8, atol=1e-8, dt_max=1) | ||
t_eval = np.linspace(0, 5, 100) | ||
solution = solver.solve(model, t_eval) | ||
np.testing.assert_array_less(solution.y[0], 1.5) | ||
np.testing.assert_array_less(solution.y[-1], 2.5 + 1e-10) | ||
np.testing.assert_array_less(solution.y.full()[0], 1.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails but I can't understand why it doesn't take the .full()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_termination_reason
had changed in #1300 and was returning a numpy array
Description
Convert variables to casadi for faster post-processing.
The conversion is done the first time the variable is called, and the casadi function is then stored in the model (in
model._variables_casadi
. Therefore, when doing repeated solutions of the same model (e.g. for parameter sweeps) the conversion is only performed the first time.Fixes #1221
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 docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks: