I have a problem solving a system of differential equations using the Runge Kutta algorithm. So far I have rewritten the second order PDE into a set of two coupled equations where
f(L1,L2) = L2
g(L1,L2) = A*(B*L1-C*L2-D)
are the two equations and A, B, C and D are constants. In order to get the value for the next step, I proceeded as follows for each time step dt:
k1 = f(L1,L2)
l1 = g(L1,L2)
k2 = f(L1 + 0.5 * dt * k1,L2 + 0.5 * dt * l1 )
l2 = g(L1 + 0.5 * dt * k1,L2 + 0.5 * dt * l1 )
k3 = f(L1 + 0.5 * dt * k2,L2 + 0.5 * dt * l2 )
l3 = g(L1 + 0.5 * dt * k2, L2 + 0.5 * dt * l2 )
k4 = f(L1 + dt * k1,L2 + dt * l1 )
l4 = g(L1 + dt * k1,L2 + dt * l1 )
Where I use the values for L1 and L2 of the current time step and calculate the coefficients iteratively.
As a result I get L1 and L2 by summing up and weighting the coefficients at the end. My problem is, that the whole algorithm becomes unstable after 4 time steps.
Does anybody know if the realization is technically correct? Thanks!