NodePy: A package for the analysis of numerical ODE solvers

Ordinary differential equations (ODEs) are used to model a vast range of physical and other phenomena. They also arise in the discretization of partial differential equations. In most cases, solutions of differential equations must be approximated by numerical methods. The study of the properties of numerical methods for ODEs comprises an important and large body of knowledge. NodePy (available from https://github.com/ketch/nodepy, with documentation at https://nodepy.readthedocs.io/en/latest/) is a software package for designing and studying the properties of numerical ODE solvers. For the most important classes of methods, NodePy can automatically assess their stability, accuracy, and many other properties. NodePy has also been used as a catalog of coefficients for time integration methods in PDE solver codes.


Summary
Ordinary differential equations (ODEs) are used to model a vast range of physical and other phenomena. They also arise in the discretization of partial differential equations. In most cases, solutions of differential equations must be approximated by numerical methods. The study of the properties of numerical methods for ODEs comprises an important and large body of knowledge. NodePy (available from https://github.com/ketch/nodepy, with documentation at https://nodepy.readthedocs.io/en/latest/) is a software package for designing and studying the properties of numerical ODE solvers. For the most important classes of methods, NodePy can automatically assess their stability, accuracy, and many other properties. NodePy has also been used as a catalog of coefficients for time integration methods in PDE solver codes.

Statement of need
There are many software packages that implement ODE solvers with the purpose of efficiently providing numerical solutions; in contrast, the purpose of NodePy is to facilitate understanding of the properties of the solver algorithms themselves. In this sense, it is a sort of meta-software, consisting of algorithms whose purpose is to compute properties of other algorithms. It also serves as a reference, providing precise definitions of many of the algorithms themselves.
NodePy is written entirely in Python and provides software implementations of many of the theoretical ideas contained for instance in reference texts on numerical analysis of ODEs (Hairer et al., 1993;Hairer & Wanner, 1996). It also contains implementations of many theoretical ideas from the numerical analysis literature. The implementation focuses on the two most important classes of methods; namely, Runge-Kutta and linear multistep methods, but includes some more exotic classes. NodePy provides a means for numerical analysts to quickly and easily determine the properties of existing methods or of new methods they may develop.
NodePy development has been motivated largely by research needs and it has been used in a number of papers (including some written by non-developers; e.g. Jin (2019) and Horváth (2019)) and also as a teaching tool for graduate-level numerical analysis courses. It relies on both SymPy (Meurer et al., 2017) and NumPy (Oliphant, 2006;Walt et al., 2011) in order to provide either exact or floating-point results based on the nature of the inputs provided. It makes use of Matplotlib (Hunter, 2007) for all graphical output.

Features
NodePy includes object-oriented representations of the following classes of numerical methods: • Runge-Kutta methods -Explicit and implicit -Embedded pairs -Classes of low-storage methods -Dense output formulas -Perturbed/additive and downwind methods • Linear multistep methods • Two-step Runge-Kutta methods • Additive (IMEX) linear multistep methods The framework is designed to include general linear methods and even more exotic classes. Any method within these classes can be generated simply by entering its coefficients. Coefficients for many methods are catalogued or can be automatically generated within NodePy, including: • Dozens of specific Runge-Kutta methods and pairs • General extrapolation methods, of any order of accuracy, based on a variety of buildingblock schemes and optionally including an error estimator • Deferred correction methods • Optimal strong stability preserving (SSP) Runge-Kutta methods • Adams-Bashforth, Adams-Moulton, and BDF methods of any order • A number of other specialized families of methods For all of these numerical schemes, NodePy provides methods and functions to compute many of their properties -too many to list here. The theory on which most of these properties are based is outlined in standard references (Hairer et al., 1993;Hairer & Wanner, 1996). Many other properties are based on recent research; usually the method docstring includes a reference to the relevant paper. Implementations of the methods themselves are also included as a convenience, though they are not the primary purpose and are not expected to be efficient since they are coded in pure Python. Additional intermediate objects, such as the absolute stability function of a method, are given their own software representation and corresponding methods.
Additional features are provided to facilitate the analysis and testing of these numerical methods. This includes a range of initial value problems for testing, such as the stiff and non-stiff DETEST suites, and a few simple PDE semi-discretizations. Also included is a library for dealing with rooted trees, which are a class of graphs that play a key role in the theory of Runge-Kutta methods.
NodePy is documented primarily through the Python docstrings for each method, most of which contain examples that also serve as tests ("doctests"). These tests are executed automatically for all new commits and pull requests using the Travis continuous integration service. Some higher-level documentation is also available at https://nodepy.readthedocs.io/ en/latest/, but it is not intended to be comprehensive.

Related research and software
We are not aware of other software packages with a similar purpose. NodePy development has proceeded in close connection to the RK-Opt package (David I.  (https://github.com/ketch/RK-Opt). Whereas NodePy is focused in the analysis of numerical methods, RK-Opt is focused more on their design through the use of numerical optimization to search for optimal coefficients tailored to specific desired properties. A common workflow involves generating new methods with RK-Opt and then studying their properties in more detail using NodePy.
Some of the research projects that have made use of NodePy (most of which have led to its further development) include development of: • Strong stability preserving (SSP) Runge-Kutta methods (Hadjimichael et al., 2013; David I. Ketcheson et al., 2009;David I. Ketcheson, 2008) • SSP general linear methods (Bresten et al., 2017; • Low-storage Runge-Kutta methods (David I. Ketcheson, 2010) • Additive and downwind SSP Runge-Kutta methods (Higueras et al., 2018;David I. Ketcheson, 2011) • High-order parallel extrapolation and deferred correction methods (David I. Ketcheson & bin Waheed, 2014) • SSP linear multistep methods (Hadjimichael et al., 2016; 2018) • Dense output formulas for Runge-Kutta methods (David I. Ketcheson et al., 2017) • Internal stability theory for Runge-Kutta methods (David I.  • Embedded pairs for Runge-Kutta methods (Conde et al., 2018;Horváth, 2019) Additional recent applications include (Jin, 2019;David I. Ketcheson, 2019;Norton, 2015;Nüßlein et al., 2020;Ranocha, 2019). As an example of a completely different kind of use, in the fluid dynamics code SpectralDNS, NodePy is used simply for convenience as a way to enable usage of a range of ODE solvers; here NodePy is used only for retrieving the coefficients and not for the time-stepping implementation. This facilitated the work in (David I. , for instance. As can be seen from this list, applications have mostly stemmed from the work of the main developer's research group, but have recently begun to expand beyond that.