Table of Contents
NumbaIDA is a Python package allowing you to quickly solve Differential Algebraic Equation (DAE) problems in Numba JIT compiled functions using the LLNL SUNDIALS IDA solver. The code borrows heavilty from NumbdaLSODA but uses IDA instead of LSODA (thank you!)
DAEs may be thought of a a system of ordinary differential equations (ODEs) with some additional constraints. For example, consider the linear sytem
dx/dt = - a * x + b * y,
dy/dt = - b * y + a * x
with the constaint x + y = 1. In this case, you can rewrite the equation for dx/dt so that it doesn't include any y terms. Alternatively, you can use a solver such as IDA to solve this as a DAE problem. NumbaIDA allows you to use the IDA solver in Python as a JIT compiled function using Numba.
The examples
directory shows example(s) of how to input a DAE problem into NumbaIDA.
In order to install NumbaIDA you require a number of commonly used utility programs for building software. On Ubuntu/Debian these may be easily installed by running:
sudo apt-get update
sudo apt-get install -y gcc cmake build-essential clang-tidy python3
Next, install 'pip' and 'venv' with:
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade venv
It is recommended to install and run 'NumbaIDA' a virtual environment. This can be done by navigating to the root directory (NumbaIDA/ by default) and running:
python3 -m pip install --upgrade venv
python3 -m venv .venv
activate .venv/bin/activate
Next install scikit-build into the virtual environment:
python3 -m pip install scikit-build
Finally, install NumbaIDA
with
pip install .
- Does not allow concurrent solve calls
- SUNDIALS is very flexible and allows a number of linear and nonlinear solvers to be used โ currently it is only possible to use the defaults.
- Currently, only dense matrices/vectors may be used
- IT is not yet possible to use one of SUNDIAL's root-finders during the residual calculation
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
See LICENSE.txt
for more information.
SUNDIALS is distributed under the BSD 3-Clause License:
Copyright (c) 2002-2022, Lawrence Livermore National Security and Southern Methodist University. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Nicholaswogan's NumbaLSODA package which this package is heavily based on
- SUNDIALS