|
CLASSpp Manual
Cosmology reference and developer manual
|
#include <evolver_erk.h>
Shared core for the explicit embedded Runge-Kutta evolvers.
evolver_rkdp45 (Dormand-Prince 5(4)) and evolver_tsit5 (Tsitouras 5(4)) differ ONLY in their Butcher tableau and dense-output coefficients. Both run through the one driver in evolver_erk_impl.h, so any comparison between them measures the tableau and nothing else – step controller, error norm, non-finite handling, output emission and FSAL bookkeeping are literally the same code.
The tableaux below are POLICY TYPES carrying constexpr coefficient arrays, and the driver is a template over them, so every Butcher coefficient is a compile-time constant inside the stage loops. That is not decoration: with the coefficients behind a runtime pointer the compiler contracts the multiply-adds differently, and the resulting ULP drift in the dense output is amplified by the ODE into a ~2e-5 relative shift in C_l. Keeping them constexpr reproduces the previous hand-written rkdp45 bit for bit.
Layout conventions:
A is row-major stages*stages, strict lower triangle used; rest reads 0.b are the propagating weights (the higher-order solution).e are the ERROR weights, already differenced: e = b - bhat.R is row-major stages*dense_deg holding the continuous extension b_i(theta) = sum_{m=1..dense_deg} R[i*dense_deg + (m-1)] * theta^m, so that y(t + theta*h) = y_n + h * sum_i b_i(theta) * k_i. b_i(0) = 0 is built into the parametrisation (no theta^0 column).fsal means the last stage equals the propagating weights, i.e. row stages-1 of A equals b, so k_{s-1} of this step is k_0 of the next and a step costs stages-1 derivative evaluations rather than stages. Dormand-Prince 5(4) – the historical CLASS rkdp45.