GeometricIntegrators.jl

Geometric Numerical Integration in Julia
Popularity
46 Stars
Updated Last
4 Months Ago
Started In
August 2016

GeometricIntegrators.jl

Julia library of geometric integrators for differential equations.

Stable Latest License PkgEval Status CI Coverage DOI

GeometricIntegrators.jl is a library of geometric integrators for ordinary differential equations, stochastic differential equations and differential algebraic equations in Julia. Its main aim is the democratization and proliferation of geometric integrators, providing a comprehensive collection of standard and structure-preserving algorithms under a unified interface. Furthermore it serves as testbed for the implementation and verification of novel geometric integrators, in particular their analysis with respect to long-time stability and conservation of geometric structures. GeometricIntegrators.jl can be used either interactively or as computational core in other codes. It provides both, a high-level interface that requires only very few lines of code to solve an actual problem, and a lean low-level interface that allows for straightforward integration into application codes via the exchange of very small data structures. Due to the modular structure and the use of the multiple dispatch paradigm, the library can easily be extended, e.g., towards new algorithms or new types of equations. GeometricIntegrators.jl is designed to minimize overhead and maximize performance in order to be able to perform simulations with millions or even billions of time steps to facilitate the study of the long-time behaviour of both numerical algorithms and dynamical systems.

Installation

GeometricIntegrators.jl and all of its dependencies can be installed via the Julia REPL by typing

]add GeometricIntegrators

Basic usage

In the simplest cases, the use of GeometricIntegrators.jl requires the construction of two objects, an equation and an integrator. For many standard methods, the integrator can be implicitly selected by specifying an equation and a tableau.

Before any use, we need to load GeometricIntegrators,

using GeometricIntegrators

Then we can create an ODE problem for the equation $\dot{x} (t) = x(t)$ with integration time span $(0, 1)$. a time step of $\Delta t = 0.1$, and initial condition $x(0) = 1$,

prob = ODEProblem((ẋ, t, x, params) -> ẋ[1] = x[1], (0.0, 1.0), 0.1, [1.0])

An integrator for this ODE, using the explicit Euler method is obtained by

int = GeometricIntegrator(prob, ExplicitEuler())

With that, the solution is simply computed by

sol = integrate(int)

which returns an object holding the solution for all time steps. With the help of the Plots.jl package we can visualise the result and compare with the exact solution:

using Plots
plot(xlims=[0,1], xlab="t", ylab="x(t)", legend=:bottomright)
plot!(sol.t, sol.q[:,1], label="numeric")
plot!(sol.t, exp.(sol.t), label="exact")

expontential_growth

References

If you use GeometricIntegrators.jl in your work, please consider citing it by

@misc{Kraus:2020:GeometricIntegrators,
  title={GeometricIntegrators.jl: Geometric Numerical Integration in Julia},
  author={Kraus, Michael},
  year={2020},
  howpublished={\url{https://github.com/JuliaGNI/GeometricIntegrators.jl}},
  doi={10.5281/zenodo.3648325}
}

Development

We are using git hooks, e.g., to enforce that all tests pass before pushing. In order to activate these hooks, the following command must be executed once:

git config core.hooksPath .githooks