Integrators¶
Here, we collect the documentations of the ordinary-differential-equations (ODE) integrators that are implemented in PyGRO.
A series of different integration schemes is pre-built in PyGRO. These can be chosen at the moment of defining a GeodesicEngine.
In particular, we have implemented a series of adaptive step-size explicit Runge-Kutta methods:
Runge-Kutta-Fehlberg4(5): (
integrator = "rkf45") embedded method from the Runge-Kutta family of the 4th order with error estiamtion of the 5th order. The implemented version is based on [1].Dormand-Prince5(4): (
integrator = "dp45") embedded method of the 5th order with error estiamtion of the 4th order. The implemented version is based on [2]. It is the default choice in PyGRO when nointegratorargument is passed to theGeodesicEngine.Cash-Karp: (
integrator = "ck45") embedded method of the 4th order with error estiamtion of the 5th order. The implemented version is based on [3].Runge-Kutta-Fehlberg7(8): (
integrator = "rkf78") embedded method from the Runge-Kutta family of the 7th order with error estiamtion of the 8th order. The implemented version is based on [4].
All the implemented methods refer to the general class of ExplicitAdaptiveRungeKuttaIntegrator, whose docuemntation is reported here:
- class pygro.integrators.ExplicitAdaptiveRungeKuttaIntegrator[source]View on GitHub¶
Base class for explicit adaptive step-size integrators of the Runge-Kutta family.
The local error is estimated as the difference between the two approximations at higher and lower order:
\[E = \| y_{\text{high}} - y_{\text{low}} \|\]where \(\| \cdot \|\) typically represents a norm, such as the maximum norm or the Euclidean norm (the one we use).
The step size is adapted based on a defined error tolerance, which ensures the solution’s accuracy, computed as:
(1)¶\[\text{tol} = \text{tol}_\text{abs} + \text{tol}_\text{rel} \cdot \| y \|\]The tolerance acts as a threshold for acceptable error in the solution. If \(E \leq \text{tol}\), the step is accepted; otherwise, it is rejected, and a smaller step size is used.
The constructor for the
ExplicitAdaptiveRungeKuttaIntegratorobject accepts the following arguments that can be directly passed to theintegrate()method of theGeodesicEngineobject upon integration:- Parameters:
accuracy_goal (int) – the exponent that defines the integration absolute tolerance
atol = 10**(-accuracy_goal), \(\text{tol}_\text{abs}\), in formula (1).precision_goal (int) – the exponent that defines the integration relative tolerance
rtol = 10**(-precision_goal), \(\text{tol}_\text{rel}\), in formula (1).hmax (float) – maximum acceptable step size (default is
hmax = 1e+16).hmin (float) – minimum acceptable step size (default is
hmin = 1e-16).max_iter (int) – maxium namber of step-size adaptation attempts before rising an error. If this error is reached, try to use smaller
accuracy_goaland/orprecision_goalor to reduce the initial step size of the integration (initial_stepin theintegrate()method).
- interpolator_classView on GitHub¶
alias of
HermiteCubicInterpolator
In the future, we also plan to implement implicit and symplectic integrations schemes.
References