Solving ordinary differential equations

14. Solving ordinary differential equations#

We are developing a library for solving nonlinear ordinary differential equations, and learn the numerical analysis behind the methods. First we build an abstraction of nonlinear functions, and implement solvers for nonlinear equations. On this basis we can simply define time-stepping algorithms. We apply it to mechanical systems of masses connected by springs and constraints. 3D visualization in Jupyter notebooks is provided by pythreejs.

The chapter covers:

14.1. Getting the code#

Fork that github repo ASC-ODE, and clone it via

git clone https://github.com/my_fork_on_github/ASC-ODE.git

It contains the basic linear algebra package nanoblas as a git submodule. Populate it using

cd ASC-ODE
git submodule update --init

You are welcome to replace nanoblas by your preferred linear algebra package.

ASC-ODE has the following dependency which must be installed:

  • pybind11

The LAPACK interface of nanoblas is not needed for ASC-ODE. It is switched off by default, and can be enabled by cmake -DNANOBLAS_USE_LAPACK=ON ...

Then you can use cmake to build ASC-ODE:

mkdir build
cd build
cmake ..
make

The Runge-Kutta methods and the mechanical systems are provided in the branches RungeKutta and Newmark. The corresponding sections explain how to merge them into your fork.