Computing order of accuracy of Runge-Kutta method

710 Views Asked by At

I want to compute the order of accuracy of ''$4^{th}$ order Runge-Kutta method''. In order to do that I work with heat equation $u_t=u_{xx}$ with some initial condition and homogeneous boundary conditions. I compute the numerical solution and calculate the error with the exact solution.

Question: My aim is to see that when I reduce the time step size by half the error should reduce by a factor $2^4$ but when I do it the error does not change at all. It remains the same no matter how much I decrease the step size. I see the same problem when I implement a $2^{nd}$ order RK method.

I proceed as follows:

$u_t = u_{xx} \implies u_t = F*u$
where $F$ is a differentiation matrix derived from 3 points finite difference scheme.

And, I apply RK4 method on this form:

$k_1 = F*u ; $ $u_A = u+dt*k_1/2$

$k_2 = F*u_A ; $ $u_B = u+dt*k_2/2$

$k_3 = F*u_B ; $ $u_C = u+dt*k_3$

$k_4 = F*u_C ; $

$u = u + dt * (k_1+2*k_2+2*k_3+k_4)/ 6 $