bte.utils.ERK#
Module Contents#
Classes#
Explicit Runge-Kutta Method |
|
1st order Runge-Kutta |
|
2nd order Runge-Kutta |
|
Explicit Runge-Kutta Method |
|
4nd order Runge-Kutta |
|
Explicit Runge-Kutta Method |
- class bte.utils.ERK.RK(c, b, A)[source]#
Explicit Runge-Kutta Method
Create a runge-kutta method to integrate \(u_t=f(t,u)\)
\[\begin{split}\begin{aligned} y_{n+1}&=y_{n}+h\sum _{i=1}^{s}b_{i}k_{i}\\k_{1}&=f(t_{n},y_{n}),\\k_{2}&=f(t_{n}+c_{2}h,y_{n}+h(a_{21}k_{1})),\\k_{3}&=f(t_{n}+c_{3}h,y_{n}+h(a_{31}k_{1}+a_{32}k_{2})),\\&\ \ \vdots \\k_{s}&=f(t_{n}+c_{s}h,y_{n}+h(a_{s1}k_{1}+a_{s2}k_{2}+\cdots +a_{s,s-1}k_{s-1})). \end{aligned}\end{split}\]- Parameters:
c (list) – runge-kutta coef
b (list) – runge-kutta coef
A (list) – runge-kutta coef
Butcher tableau
\[\begin{split}\begin{array}{c|c} c & A \\ \hline & b \end{array}\end{split}\]- __call__(f, t0, u0, h, f0=None)[source]#
single step of runge-kutta
u_t = f(u,t)
f_0=f(u0,t0)
- Parameters:
f (Callable) – [description]
t0 (float) – [description]
u0 (float) – [description]
h (float) – [description]
f0 ([type], optional) – [description]. Defaults to None.
- Returns:
[description]
- Return type:
[type]
- class bte.utils.ERK.RK1[source]#
Bases:
RK1st order Runge-Kutta
Butcher tableau:
\[\begin{split}\begin{array}{c|c} 0 & 0 \\ \hline & 1 \end{array}\end{split}\]
- class bte.utils.ERK.RK2(alpha=1 / 2)[source]#
Bases:
RK2nd order Runge-Kutta
Butcher tableau:
\[\begin{split}\begin{array}{c|cc} 0 & 0 & 0\\ \alpha & \alpha & 0 \\ \hline & (1 - \frac{1}{2\alpha}) & \frac{1}{2\alpha} \end{array}\end{split}\]- Parameters:
alpha (float, optional) – Defaults to 1/2.
- class bte.utils.ERK.RK3_SSP[source]#
Bases:
RKExplicit Runge-Kutta Method
Create a runge-kutta method to integrate \(u_t=f(t,u)\)
\[\begin{split}\begin{aligned} y_{n+1}&=y_{n}+h\sum _{i=1}^{s}b_{i}k_{i}\\k_{1}&=f(t_{n},y_{n}),\\k_{2}&=f(t_{n}+c_{2}h,y_{n}+h(a_{21}k_{1})),\\k_{3}&=f(t_{n}+c_{3}h,y_{n}+h(a_{31}k_{1}+a_{32}k_{2})),\\&\ \ \vdots \\k_{s}&=f(t_{n}+c_{s}h,y_{n}+h(a_{s1}k_{1}+a_{s2}k_{2}+\cdots +a_{s,s-1}k_{s-1})). \end{aligned}\end{split}\]- Parameters:
c (list) – runge-kutta coef
b (list) – runge-kutta coef
A (list) – runge-kutta coef
Butcher tableau
\[\begin{split}\begin{array}{c|c} c & A \\ \hline & b \end{array}\end{split}\]
- class bte.utils.ERK.RK4[source]#
Bases:
RK4nd order Runge-Kutta
Butcher tableau:
\[\begin{split}\begin{array}{c|cc} 0 & & & &\\ \frac{1}{2} & \frac{1}{2} & & & \\ \frac{1}{2} & 0 & \frac{1}{2} & & \\ 1 & 0 & 0 & 1 & \\ \hline & \frac{1}{6} & \frac{1}{3} & \frac{1}{3} & \frac{1}{6} \end{array}\end{split}\]
- class bte.utils.ERK.RK4_2[source]#
Bases:
RKExplicit Runge-Kutta Method
Create a runge-kutta method to integrate \(u_t=f(t,u)\)
\[\begin{split}\begin{aligned} y_{n+1}&=y_{n}+h\sum _{i=1}^{s}b_{i}k_{i}\\k_{1}&=f(t_{n},y_{n}),\\k_{2}&=f(t_{n}+c_{2}h,y_{n}+h(a_{21}k_{1})),\\k_{3}&=f(t_{n}+c_{3}h,y_{n}+h(a_{31}k_{1}+a_{32}k_{2})),\\&\ \ \vdots \\k_{s}&=f(t_{n}+c_{s}h,y_{n}+h(a_{s1}k_{1}+a_{s2}k_{2}+\cdots +a_{s,s-1}k_{s-1})). \end{aligned}\end{split}\]- Parameters:
c (list) – runge-kutta coef
b (list) – runge-kutta coef
A (list) – runge-kutta coef
Butcher tableau
\[\begin{split}\begin{array}{c|c} c & A \\ \hline & b \end{array}\end{split}\]