-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
#644 set atol and rtol #645
Conversation
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 :)
Still think we need a better solution for examples vs results, making sure the right things are tested but without taking forever. Maybe separate repository is the solution
@@ -71,6 +71,10 @@ def test_solving(self, solver=None, t_eval=None): | |||
# Overwrite solver if given | |||
if solver is not None: | |||
self.solver = solver | |||
else: |
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.
should this be else or just default behaviour?
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.
yeah probably should just be default.
I agree, I think a separate repository on pybamm-team with paper results and any undocumented (or poorly documented) examples would be good. Then make sure the examples that come as part of pybamm are actually really useful for learning how to use it/showcasing feature, rather than just a relatively random collection of scripts we make during development.
…/PyBaMM into issue-644-solver-tol
Codecov Report
@@ Coverage Diff @@
## master #645 +/- ##
=========================================
Coverage ? 98.49%
=========================================
Files ? 167
Lines ? 8177
Branches ? 0
=========================================
Hits ? 8054
Misses ? 123
Partials ? 0
Continue to review full report at Codecov.
|
Description
Allows the user to set
rtol
andatol
separately. For the defaults I've selected 1e-3 for rtol and 1e-6 for atol. This is the same as other solvers (e.g. scipy.integrate or MATLABs ODE15s) and provides a pretty significant speedup vs 1e-8 for both. I've also reduced the default number of points in x, as again this speed things up quite a bit. Both of these result in a RMS voltage error of around 1e-4 compared with the previous defaults, but the default DFN now runs in around 3 seconds vs 23 seconds (on my computer at least).I think for most users, this kind of error is ok out of the box (the plots are indistinguishable), particularly if they are new users and just want to quickly run some examples. Users now have more control over both solver tolerances, so I think this is an ok compromise.
EDIT: I've decreased rtol to 1e-6 too. Seems like the thermal model and some other models didn't like rtol as low as 1e-3. Probably safer to have both set as 1e-6 so that the solvers don't immediately fall over when people add new physics.
Fixes #644
Type of change
Please delete options that are not relevant.
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: