[SciPy-Dev] Adding new wrappers (dassl, daspk version 2, cvode version 2.7.0) to scipy.integrate?

Geoff Oxberry goxberry at gmail.com
Wed Jun 20 08:46:58 EDT 2012


Benny,

To your list of wrappers, I'd add petsc4py. I like PETSc a lot, but right now, the petsc4py documentation only consists of some examples (and these don't cover all of the PETSc API, which is quite large).

> My main problem is that using some of these gives a full simulation environment, which is for many people much more than what you want. As a consequence, they are daunting for a master thesis student or somebody else less into modelling to use for his problem. 
> 
> Integration of sundials in scipy in some way with a basic interface would solve that.


That's my main motivation. I agree with you that the some of the interfaces you've mentioned aren't terribly simple. In order to be a good, drop-in replacement for MATLAB, there should be a good, full-featured suite of numerical integrators that are easy to use (in the sense that a newcomer who knows how to program in Python can pick up the API in a half-hour or less).

Brevity of a good example is as good a proxy as any for how long it will take for someone to learn the API; the longer the example, the more commands there are to learn:

- MATLAB's first ode45 example is 7 lines (http://www.mathworks.com/help/techdoc/ref/ode45.html)
- scipy.integrate.ode's example is 13 lines
- CasADi's SUNDIALS example is ~32 lines (http://casadi.sourceforge.net/tutorials/integration/sundials.pdf)
- The scikits.odes example is effectively 9 lines, if you take some liberties (https://github.com/bmcage/odes/blob/master/docs/src/examples/ode/simpleoscillator.py)
- Assimulo's most basic example is effectively ~10 lines (http://www.jmodelica.org/assimulo_home/_modules/assimulo/examples/cvode_basic.html#run_example)  

Given the number of open source ODE solver codes with permissive licenses out there, I think SciPy has the potential to be a lot better than MATLAB when it comes to numerical integrators because it could give users a wide variety of numerical methods (and implementations) to try out through a minimal interface. 

Geoff

On Jun 20, 2012, at 3:43 AM, Benny Malengier wrote:

> As co-author of scikits.odes, let me mention some things. Sundials has been wrapped a lot in 2011. Not only by my group, but also others. The main ones are:
> 
> 1. https://openmodelica.org/ The author of python-sundials (http://code.google.com/p/python-sundials/) uses that now, so this last probably will not be further developed
> 
> 2. http://www.jmodelica.org/assimulo Very extensive and good bindings. It is however more high-level.
> 
> These two are targeted for use with modelica compiler, but work outside too using their api.
> 
> 3. http://pysundials.sourceforge.net  Not developed at the moment. I contributed some patches there, but they are happy with the current code, and concentrate on what they model. No time/funds to keep working on it.
> 
> 4. our own scikit.odes. Very low level 1-1 mapping of sundials, combined with a higher level API to quickly start solving a problem. It was nice to work on that, now we use it is our models. Also for us, funding and time are uncertain in the near future. Our use case is solving PDE using method of lines (ODE), which is why we are not 100% happy with the approaches that come from other fields.
> 
> 5. CasADi, http://sourceforge.net/apps/trac/casadi/
> 
> 6. DAE Tools, http://daetools.sourceforge.net/w/index.php/Main_Page by using pyDAE
> 
> My main problem is that using some of these gives a full simulation environment, which is for many people much more than what you want. As a consequence, they are daunting for a master thesis student or somebody else less into modelling to use for his problem. 
> 
> Integration of sundials in scipy in some way with a basic interface would solve that.
> 
> Benny
> 
> 2012/6/20 Geoff Oxberry <goxberry at gmail.com>
> Claus,
> 
> What made me skittish about the API documentation of Assimulo is when you describe the CVODE in the "Documentation contents" page of your documentation (http://www.jmodelica.org/assimulo) as an "explicit solver". That, to me, seemed "non-standard".
> 
> After an initial moment of confusion, I realized that you were instead talking about explicit ordinary differential equations, not explicit methods for integrating ODEs. (I believe my comments on the Trac Ticket reflect this.) As someone who's seen enough software thrown out there by people who either don't maintain it, or don't document it, I get very skeptical when I see something that looks out of place in documentation. Anyone who jumps to the Assimulo home page will immediately realize the distinction you're making; I just happened to type in "assimulo documentation" because I had already been recommended the package by a user on Computational Science Stack Exchange (of which I am a moderator).
> 
> When I downloaded your project to compile the Trac ticket report, I did notice that your project is among the more actively maintained wrappers of Sundials out there, and receiving an e-mail from you is a pleasant surprise. I also appreciate that your project has documentation. Of the six wrappers to Sundials or DASSL that I know of out there, Assimulo looks like it's the best documented.
> 
> Recently, I attempted to integrate a stiff system of ODEs derived from the GRI-Mech 3.0 combustion chemistry model with DVODE, varying the absolute tolerances from 1e-9 to 1e-20 and the relative tolerances from 1e-6 to 1e-15. For whatever reason, I don't obtain the expected solution behavior, but I do obtain the expected solution behavior with the MATLAB wrapper to CVODE, and I also obtain this behavior with a modified version of DASSL (that simulation was programmed in Fortran 90). Perhaps I should give Assimulo's wrapper a try, especially since I've found that IDA tends to work well on my problems also.
> 
> That said, I still believe that DVODE in scipy.integrate should be supplemented (or even replaced) by CVODE. DVODE has had a long history of successful use in combustion chemistry, but CVODE, DASSL, DASPK, and IDA seem to have superior stepping heuristics for these sorts of problems, based on my 5 or so years of experience working on them.
> 
> Thank you for your response,
> 
> Geoff
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
> 
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20120620/851cad6e/attachment.html>


More information about the SciPy-Dev mailing list