Is adjoint_inc_timestep neccessary for a repeated matrix-vector solve.

Asked by Gabriel Balaban

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("t*sin(x[0])*sin(x[1])", t = 0.0)
f = source*v*dx

t = 0.0
dt = 0.1

A = assemble(a)
#adj_start_timestep()
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_inc_timestep(t)

adj_html("forward.html", "forward")
assert(replay_dolfin())

Question information

Language:
English Edit question
Status:
Answered
For:
dolfin-adjoint Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Patrick Farrell (pefarrell) said :
#1

This is definitely a bug. I'll take a look at it now.

Revision history for this message
Gabriel Balaban (gabrib) said :
#2

Thanks Patrick! It looks innocent at the moment but it's good know that you are checking to see if there is anything more to this.

Revision history for this message
Patrick Farrell (pefarrell) said :
#3

That bug is now fixed in r726.

Can you help with this problem?

Provide an answer of your own, or ask Gabriel Balaban for more information if necessary.

To post a message you must log in.