I am facing problems in using the Adaptive Solvers in a loop.

When the problem is time dependent. Each time the mesh is refined, is it necessary to recompute a FunctionSpace and/or the associated Test and Trial functions?

Thank you in advance.

```
from dolfin import *
mesh = UnitSquareMesh(8, 8)
V = FunctionSpace(mesh, "Lagrange", 1)
u0 = Function(V)
bc = DirichletBC(V, u0, "x[0] < DOLFIN_EPS || x[0] > 1.0 - DOLFIN_EPS")
w = TrialFunction(V)
v = TestFunction(V)
f = 1
g = 0
a = inner(grad(w), grad(v))*dx()
L = f*v*dx()
u = Function(V)
M = u*dx()
toll= 1.e-5
err = [0,0.002,0.003,0.00005,0.0000006,0.5]
iter = 0
curr_step = 0
problem = LinearVariationalProblem(a, L, u, bc)
solver = AdaptiveLinearVariationalSolver(problem, M)
solver.parameters["error_control"]["dual_variational_solver"]["linear_solver"] = "cg"
while curr_step <= 4:
curr_step += 1
if err[curr_step] > toll:
iter += 1
solver.solve(toll)
filename = "phi-fine-poisson"+ str(iter)
xdmf = XDMFFile("output/" + filename + ".xdmf")
xdmf.write(u.leaf_node())
mesh = Mesh()
filename = "output/" + filename + ".xdmf"
f = XDMFFile(MPI.comm_world, filename)
f.read(mesh)
plot(mesh)
```