After implementing the backward Euler and Crank-Nicolson as shown in this question, I want to implement an IMEX method, using the trapezoidal rule for the diffusion term and a quite simple explicit Runge-Kutta-scheme for the rhs:
$\frac{1}{h}(y_{n+1} - y_n) = \frac{1}{2} rhs(t_n, x_n) + \frac{1}{2} rhs(t_{n+1}, rhs(t_n, x_n) )$
I searched in the pdf-book for an example of an implementation of a Runge-Kutta-method, but couldn't find one. Something is wrong with the definition of my variational form, but I don't know what. Could you please give me a hint?
# ---------- trapezoidal, tpz
m3_old = interpolate(u_start,V)
m3 = TrialFunction(V)
n3 = TestFunction(V)
k3_1 = rhs_old(m3_old)
k3_2 = rhs(k3_1)
B3 = inner(m3,n3)*dx + dt*1/2*inner(nabla_grad(m3), nabla_grad(n3))*dx
G3 = - dt*1/2*inner(nabla_grad(m3_old), nabla_grad(n3))*dx + inner(dt*1/2*(k3_1 + k3_2) + m3_old, n3)*dx
m3 = Function(V)
m3 = interpolate(u_start,V)