odes icon indicating copy to clipboard operation
odes copied to clipboard

sparse jacobians and iterative solvers in IDA

Open mrkwjc opened this issue 7 years ago • 5 comments

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

mrkwjc avatar May 05 '18 14:05 mrkwjc

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

bmcage avatar May 07 '18 07:05 bmcage

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!

rtimms avatar Apr 10 '19 09:04 rtimms

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 avatar May 02 '19 15:05 martinjrobins

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?

martinjrobins avatar May 02 '19 15:05 martinjrobins

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 !

bmcage avatar May 03 '19 06:05 bmcage