EN FR
EN FR


Section: New Software and Platforms

SundialsML

Sundials/ML

Keywords: Simulation - Mathematics - Numerical simulations

Functional Description

Sundials/ML is a comprehensive OCaml interface to the Sundials suite of numerical solvers (CVODE, CVODES, IDA, IDAS, KINSOL, ARKODE). Its structure mostly follows that of the Sundials library, both for ease of reading the existing documentation and for adapting existing source code, but several changes have been made for programming convenience and to increase safety, namely:

  • solver sessions are mostly configured via algebraic data types rather than multiple function calls;

  • errors are signalled by exceptions not return codes (also from user-supplied callback routines);

  • user data is shared between callback routines via closures (partial applications of functions);

  • vectors are checked for compatibility (using a combination of static and dynamic checks); and

  • explicit free commands are not necessary since OCaml is a garbage-collected language.

OCaml versions of the standard examples usually have an overhead of about 50% compared to the original C versions, and almost never more than 100%.

New Progress

The current version of Sundials/ML comprises about 37,000 lines of OCaml (plus 15,000 lines of api documentation) and 16,000 lines of C (plus 1600 lines of commentary). This year we worked on updating the interface to support Sundials 2.6.x. This involved adding support for a new solver (ARKODE), new modules for sparse matrices (SuperLU_MT and KLU), new nvectors (pthreads and OpenMP), and new linear solvers (SPFGMR and PCG), as well as treating several other new or modified features. This work is almost complete and will be released early in 2016. The technical developments required to interface OCaml with this library are explained in a report which has been sumitted as a deliverable in the MODRIO project: “D.4.2.16—OCaml interface to the Sundials suite of numerical solvers”. This text will be developed and submitted for journal publication in early 2016.