Time-dependent expressions and preassembled solves interact in a funny way
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dolfin-adjoint |
Fix Committed
|
High
|
Patrick Farrell |
Bug Description
When the script below is run the replay_dolfin() function fails, but if the time-stepping information is added then the replay works! Doing the same thing with a series of variational problem solves without the timestepping information is ok as well. Is there something special about the matrix vector solves that requires them to always need time-stepping information?
from dolfin import *
from dolfin_adjoint import *
mesh = UnitSquareMesh(4,4)
V = FunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
a = inner(grad(u), grad(v))*dx
u = Function(V, name = "solution")
bc = DirichletBC(V, 0, "on_boundary")
source = Expression(
f = source*v*dx
t = 0.0
dt = 0.1
A = assemble(a)
#adj_start_
for i in range(2):
t += dt
source.t = t
F = assemble(f)
bc.apply(A)
bc.apply(F)
solve(A, u.vector(), F, "cg", "ilu")
#adj_
adj_html(
assert(
Interestingly, uncommenting those lines doesn't change that the replay fails, for me.