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

sparse jacobians and iterative solvers in IDA #77

Open
mrkwjc opened this issue May 5, 2018 · 5 comments
Open

sparse jacobians and iterative solvers in IDA #77

mrkwjc opened this issue May 5, 2018 · 5 comments

Comments

@mrkwjc
Copy link

mrkwjc commented May 5, 2018

Hi!

Nice work with odes! But, of course, i have a question. Is this possible to use sparse jacobians in IDA? And another one: can i use iterative preconditioned solvers with custom preconditioner? Unfortunately my problems are quite large and dense jacobians is not an option for me so i'm looking for possible solutions...

Best regards,
Marek

@bmcage
Copy link
Owner

bmcage commented May 7, 2018

Yes Sparse is possible. There are several ways, but not all are exposed in the API.
For preconditioning, I have not used it myself, but if memory serves a contributor added this somewhat. It is possible in the C++ solver, exposing this in the python interface is possible. Ideally you help with #76 and help expose the relevant interfaces. Adding the preconditioner part of sundials 2.7.0 (current odes) would mean redoing it soon after for the 3.1.0 port

@rtimms
Copy link

rtimms commented Apr 10, 2019

Great job with the scikits.odes! We are currently using the sundials solvers in a battery modelling package PyBaMM, and are trying to use sparse jacobians in IDA and CVODE. I was just wondering if you had any more information on how to get sparse jacobians into these solvers, please?

Thanks!

@martinjrobins
Copy link
Contributor

I can see how you can use sparse matrices using CVODE, using the iterative solvers and the CV_JacTimesVecFunction provided by scikits.odes (https://bmcage.github.io/odes/dev/api.html#module-scikits.odes.sundials.cvode). But a similar option does not seem to exist for IDA, which only has IDA_WrapJacRhsFunction. Or am I missing something?

@martinjrobins
Copy link
Contributor

Seems like it would be straightforward to implement IDA_JacTimesVecFunction following the example of CV_JacTimesVecFunction. I can create a PR for this if it would be helpful @bmcage?

@bmcage
Copy link
Owner

bmcage commented May 3, 2019

Yes, all extra exposure of sundials API is useful!
Intelligent copy paste and adaptation of cvode code should indeed be straightforward.
I do assume people only add stuff they intend to use, so add a test for it too !

martinjrobins added a commit to martinjrobins/odes that referenced this issue May 4, 2019
martinjrobins added a commit to martinjrobins/odes that referenced this issue May 5, 2019
martinjrobins added a commit to martinjrobins/odes that referenced this issue May 5, 2019
martinjrobins added a commit to martinjrobins/odes that referenced this issue May 6, 2019
martinjrobins added a commit to martinjrobins/odes that referenced this issue May 6, 2019
bmcage pushed a commit that referenced this issue Jul 4, 2019
* #77 add JacTimesSetupFn and JacTimesVecFn to IDA

* #77 add ida test for jac_times_vec

* #77 fix bugs with jac_times_vecfc and jac_times_setupfn

* #77 add comments to test_dae.py
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

No branches or pull requests

4 participants