Refactor get_initial_stoichiometries with custom and default tolerance - #3714
Conversation
This commit enhances the `get_initial_stoichiometries` method by introducing a new parameter, `solver_tolerance`. The primary change allows users to specify a custom tolerance level for the solver. The method now includes a default solver tolerance set at 1e-6, maintaining a balance between precision and computational efficiency for general use cases. Additionally, users can adjust this tolerance level as needed, catering to specific requirements of different battery modeling scenarios. Resolves: #3688
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3714 +/- ##
========================================
Coverage 99.59% 99.59%
========================================
Files 258 258
Lines 20823 20825 +2
========================================
+ Hits 20738 20740 +2
Misses 85 85 ☔ View full report in Codecov by Sentry. |
|
Question: should we set the function argument to be just |
…cy with AlgebraicSolver class
|
I've updated the function argument name from |
kratman
left a comment
There was a problem hiding this comment.
This seems fine to me as long as the tests pass
|
I see that the Run benchmarks on push / benchmarks fail, let me know if any changes are required or if the PR can be merged |
Not to worry, the benchmarks on PRs have always been flaky, and I don't think the changes here can influence them in any way. Let's wait till @rtimms's review as the author of the linked issue, and it should be good to merge after that |
|
@AlessioBugetti Can you just add a small summary to the change log? |
Yes, of course. I have updated the change log as requested. |
|
@AlessioBugetti Sorry to do this, but I think it should be in the unreleased section not the RC section for the change log |
Yes, I have made the corrections as requested |
|
Thanks, just waiting for the tests to pass now |
pybamm-team#3714) * Refactor get_initial_stoichiometries with custom and default tolerance This commit enhances the `get_initial_stoichiometries` method by introducing a new parameter, `solver_tolerance`. The primary change allows users to specify a custom tolerance level for the solver. The method now includes a default solver tolerance set at 1e-6, maintaining a balance between precision and computational efficiency for general use cases. Additionally, users can adjust this tolerance level as needed, catering to specific requirements of different battery modeling scenarios. Resolves: pybamm-team#3688 * style: pre-commit fixes * Refactor argument name from 'solver_tolerance' to 'tol' for consistency with AlgebraicSolver class * Update CHANGELOG.md * Fix CHANGELOG.md --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com>
Description
This commit enhances the
get_initial_stoichiometriesmethod by introducing a new parameter,solver_tolerance. The primary change allows users to specify a custom tolerance level for the solver.The method now includes a default solver tolerance set at 1e-6, maintaining a balance between precision and computational efficiency for general use cases. Additionally, users can adjust this tolerance level as needed, catering to specific requirements of different battery modeling scenarios.
Fixes #3688
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:
$ pre-commit run(or$ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all(or$ nox -s tests)$ python run-tests.py --doctest(or$ nox -s doctests)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick(or$ nox -s quick).Further checks: