I have been trying to use the RKSolver on the heat equation, but no matter what I do I can't get the time dependence to work. For the following heat equation I get a constant 0 solution, although we should see it increase over time.
dt = 0.01
viz = None
mesh = UnitSquareMesh(30, 30)
W = FunctionSpace(mesh, 'CG', 1)
u = Function(W)
v = TestFunction(W)
time = 0.
f = Expression('2 * pi * pi * sin(pi * x[0]) * sin(pi * x[1]) * sin(pi*time)', time=time)
r = -(inner(grad(u), grad(v)) - f * v) * dx
bcs = DirichletBC(W, Constant(0.), 'on_boundary')
scheme = RK4(r, u, time, [bcs])
solver = RKSolver(scheme)
next_dt = dt
while float(scheme.t())<T:
solver.step(next_dt)
next_dt = min(T-float(scheme.t()), dt)
if viz is None:
viz = plot(u)
else:
viz.plot(u)