Skip to content
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

Add more idaklu solver options (number 2) #4282

Merged
merged 9 commits into from
Jul 24, 2024

Conversation

MarcBerliner
Copy link
Member

Description

Adds more user-configurable options to the IDA solver following the list in the IDA guide.

Some code cleanup to enforce early returns.

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.

  • New feature (non-breaking change which adds functionality)

Key checklist:

  • No style issues: $ 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)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ 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:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@kratman
Copy link
Contributor

kratman commented Jul 22, 2024

Replacement for #4249, review was partially done there

@kratman kratman self-requested a review July 22, 2024 18:29
Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.45%. Comparing base (668e563) to head (e3961f6).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4282   +/-   ##
========================================
  Coverage    99.45%   99.45%           
========================================
  Files          288      288           
  Lines        22089    22091    +2     
========================================
+ Hits         21969    21971    +2     
  Misses         120      120           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@martinjrobins martinjrobins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @MarcBerliner, be great to have all these new options in there. I think the main todo left is to update the docstring for the idaklu solver to describe all the new options.

pybamm/solvers/c_solvers/idaklu/IDAKLUSolverOpenMP.inl Outdated Show resolved Hide resolved
pybamm/solvers/idaklu_solver.py Show resolved Hide resolved
@MarcBerliner
Copy link
Member Author

I changed IDAKLUSolver's default rtol from 1e-6 to 1e-4. This is more closely in line with other ODE/DAE solvers, such as MATLAB and Julia's DifferentialEquations of 1e-3. I've found that 1e-4 is more appropriate for solving battery systems of equations.

Copy link
Contributor

@martinjrobins martinjrobins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, I'm happy with this. Thanks @MarcBerliner

Copy link
Contributor

@kratman kratman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy still looks like false alarms, just the minor changelog issue

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@kratman kratman merged commit ba39170 into pybamm-team:develop Jul 24, 2024
23 of 24 checks passed
@MarcBerliner MarcBerliner mentioned this pull request Jul 24, 2024
6 tasks
js1tr3 pushed a commit to js1tr3/PyBaMM that referenced this pull request Aug 12, 2024
* IDAKLU options updates

* format

* update defaults and docstrings

* Update CHANGELOG.md

* Update test_idaklu_solver.py

* Move changelog to `Unreleased`

* Update CHANGELOG.md

---------

Co-authored-by: kratman <kratmandu@gmail.com>
Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants