How to implement implicit Runge-kutta (RK-4) method for a system of non-linear differential equation?

535 Views Asked by At

I am trying to solve a set of non-linear ode's using an implicit RK-4 method. I have already solved this problem using a backward euler's method.

$$ \frac{dy_i}{dt} = a_i*y_{i-1} - b_i*y_i + c_i*y_{i+1} , 1<i<n $$ $$ y_1 = d$$ $$ y_n = 0$$

While solving the above system of differential equation using the implicit method, I had solved for the solution for future time-step $l+1$ by computing $\frac{dy_i}{dt}^{l+1}$ and in variable form and substituting in the equation

$$ y_{i}^{l+1} = y_{i}^{l} + \delta_t*\frac{dy_i}{dt}^{l+1}$$

by get a tri-diagonal matrix, and after that used TDMA algorithm (forward elimination and back substitution) to get the solution $y_{i}^{l+1}$.

example for $i =2$ ; $ y_{2}^{l+1} = y_{2}^{l} + a_1*y_{1}^{l+1} - b_1*y_{2}^{l+1} + c_1*y_{3}^{l+1} $ . Now $y_{2}^{l+1} ( 1 + b_1) - a_1*y_{1}^{l+1} - c_1*y_{3}^{l+1} = y_{2}^{l} $

In this when we write all the equations for $2$ to $(n-1)$ , we get a system of equations with tri-diagonal arrangement of unknown variables.


Now, I want to implement a RK-4 method for solving this system. Where I will have to compute $\frac{dy_i}{dt}$ at various time-steps like,

$$ y_{i}^{l+1} = y_{i}^{l} + \delta_i *(\frac{k_1}{6} + \frac{k_2}{3} + \frac{k_3}{3} + \frac{k_4}{6}) $$

where, $k_1 = \frac{dy_i}{dt}^{l}$ , $k_2 = \frac{dy_i}{dt}^{l+k_1/2}$ , $k_3 = \frac{dy_i}{dt}^{l+k_2/2}$ , $k_4 = \frac{dy_i}{dt}^{l+k_3}$

But how will I implement the same method in an implicit way, like I had done the backward euler method.

Thanks for any help!