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

I1863 idklu casadi #2002

Merged
merged 36 commits into from
Apr 20, 2022
Merged

I1863 idklu casadi #2002

merged 36 commits into from
Apr 20, 2022

Conversation

martinjrobins
Copy link
Contributor

@martinjrobins martinjrobins commented Mar 31, 2022

Description

Adds a casadi version of the idklu solver, currently getting approx 2 x speed-up over current casadi solver with fast events, but this still needs to be properly benchmarked

As part of the above, the process function in the base solver now also returns a function that evaluates the jacobian times a vector (e.g. casadi.jtimes). This was neccessary to implement the sensitivity equations that IDA expects, but will also be useful when we add the option of using iterative solvers.

update: also fixed a discretisation bug that occurs when an input parameter is indexed, see #2008

Fixes #1863
Fixes #2008

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: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

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

@martinjrobins martinjrobins marked this pull request as draft March 31, 2022 11:34
@martinjrobins martinjrobins marked this pull request as ready for review March 31, 2022 12:34
@codecov
Copy link

codecov bot commented Mar 31, 2022

Codecov Report

Merging #2002 (e01bb98) into develop (00b8b0c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop    #2002   +/-   ##
========================================
  Coverage    99.35%   99.35%           
========================================
  Files          346      346           
  Lines        18939    19033   +94     
========================================
+ Hits         18816    18911   +95     
+ Misses         123      122    -1     
Impacted Files Coverage Δ
pybamm/discretisations/discretisation.py 99.79% <100.00%> (+<0.01%) ⬆️
pybamm/expression_tree/input_parameter.py 100.00% <100.00%> (ø)
...bamm/expression_tree/operations/evaluate_python.py 98.29% <100.00%> (+0.06%) ⬆️
pybamm/solvers/base_solver.py 100.00% <100.00%> (ø)
pybamm/solvers/idaklu_solver.py 98.98% <100.00%> (+1.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffcb0c3...e01bb98. Read the comment docs.

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

Thanks @martinjrobins ! I didn't look too closely at the C++ code (since I can't read it), but the tests look good

pybamm/solvers/base_solver.py Show resolved Hide resolved
tests/unit/test_solvers/test_idaklu_solver.py Show resolved Hide resolved
@martinjrobins martinjrobins merged commit 9eea12b into develop Apr 20, 2022
@martinjrobins martinjrobins deleted the i1863-idklu-casadi branch April 20, 2022 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants