Skip to content
/ PyDAS Public

A Python wrapper for the DASSL, DASPK, and DASKR differential algebraic system solvers

Notifications You must be signed in to change notification settings

jwallen/PyDAS

Repository files navigation

PyDAS - A Python wrapper to several differential algebraic system solvers

Introduction

PyDAS provides a means for Python code to utilize several notable Fortran-based differential algebraic system solvers from Python code. The solvers made available -- DASSL, DASPK, and DASKR -- are all publicly-available from Netlib, and are distributed with PyDAS. PyDAS provides a Python extension type for each solver, which in turn provides a Pythonic means of setting the solver options, providing residual and jacobian functions, and running the solver.

The DASSL, DASPK, and DASKR solvers are all substantially more robust than VODE, the solver used within the ODE solver functionality provided by SciPy.

License

Copyright (c) 2010 by Joshua W. Allen ([email protected]).

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Dependencies

PyDAS has been tested on Python versions 2.5 and 2.6. It may or may not work for other Python versions.

There are several Python dependencies that you must install before installing PyDAS:

  • Python (versions 2.5.x and 2.6.x are known to work)
  • NumPy (version 1.3.0 or later is recommended)
  • Cython (version 0.12.1 or later is recommended)

In addition, you will also need a Fortran compiler and a C compiler that produce object files that can interoperate. The gfortran and gcc compiles from the GNU Compiler Collection are known to work. On Windows the MinGW compiler collection provides these compilers.

The code for the differential algebraic system solvers DASSL, DASPK, and DASKR has been provided with the PyDAS package. The licenses for these solvers is different than that of the PyDAS wrapper code. You are responsible for knowing and abiding by all licenses associated with each solver as well as with PyDAS as a whole.

Installation

Note

Currently only the DASSL solver has been wrapped. The installation scripts therefore only build and install the DASSL wrapper by default.

Windows

The provided batch scripts will compile all of the solvers and the PyDAS wrapper code. These scripts presume that you have the 32-bit version of the MinGW C and Fortran compilers installed. Once you have run the batch script, you can install PyDAS into your Python packages if you desire by running the following command from the base package directory:

> python setup.py install

Linux

A Makefile has been provided that can be used to compile all of the solvers and the PyDAS wrapper code. To use, invoke the following command from the base package directory:

$ make

This command will build PyDAS in-place, rather than installing it to your Python package directory. If you wish to formall install PyDAS, run the following command from the base package directory after the make command (you may need root privileges for this):

$ python setup.py install

You may wish to write a file make.inc that sets certain variables used by the Makefiles (e.g. the Fortran compiler). An example of such a file, make.inc.example, has been provided.

Mac OS X

Homebrew (http://brew.sh) is an easy way to get gfortran:

$ brew install gcc

But your system may still not be able to find the correct libgfortran.a library file (see Homebrew/legacy-homebrew#8539 ). Also, there are some problems linking with clang, so you need to make it link with gcc. This one-liner should build and install, assuming you have NumPy, Cython, etc. all set up:

$ LIBRARY_PATH=/usr/local/lib/gcc LDSHARED='gcc -bundle -undefined dynamic_lookup -arch x86_64' make F77=gfortran install

Or perhaps, with a newer version of Homebrew / Python / gfortran / NumPy / Cython, it will be a simple:

$ LIBRARY_PATH=/usr/local/Cellar/gfortran/4.8.0/gfortran/lib make F77=gfortran

It seems to keep on changing. If you have difficulty, check the issue tracker, and if you solve your difficulty, please share your successful approach.

About

A Python wrapper for the DASSL, DASPK, and DASKR differential algebraic system solvers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages