Module rk4_tl_ad
A classical fourth order Runge-Kutta scheme for the TL/AD model.
Butcher tableau:
0 | 1/2 | 1/2 1/2 | 0 1/2 1 | 0 0 1 +------------------- 1/6 1/3 1/3 1/6
Functions
rk4_tl_ad (n) | Create a TL/AD integrator for n-arrays. |
integrator (y, deltay, f, f_tl, t, dt, ynew, deltaynew) | Integrator for n-arrays |
Functions
- rk4_tl_ad (n)
-
Create a TL/AD integrator for n-arrays.
y is also evolved to calculate the correct TL.
Note that the function
f_tl
has more arguments than a regular integrator. You need to pass both has both the trajectory y (also ystar) and the perturbation deltay:f_tl(t,y,deltay,buf)
instead off(t,y,buf)
Parameters:
- n number of variables (length of the array)
Returns:
-
Integrator for n-arrays
- integrator (y, deltay, f, f_tl, t, dt, ynew, deltaynew)
-
Integrator for n-arrays
Parameters:
- y variables at time t
- deltay perturbation at time t
- f function to calculate the time derivatives of the variables
- f_tl function to calculate the time derivatives of the tangent linear model
- t time
- dt time integration step
- ynew n-array (buffer) to store the new y value
- deltaynew n-array (buffer) to store the new perturbation value
Returns:
- t+dt (incremented time)
- ynew array with variables at time t+dt
- deltaynew array with perturbation at time t+dt