Skip to content

BUG: LinearSolver is not taped in the adjoint #3051

Open
@connorjward

Description

@connorjward

The following code

from firedrake import *
from firedrake_adjoint import *
mesh = RectangleMesh(10, 10, 1, 1)
V = FunctionSpace(mesh, "CG", 1)
v  = TestFunction(V)
dv = TrialFunction(V)
bcs = [DirichletBC(V, Constant(0), 1)]
A = assemble(inner(grad(v), grad(dv))*dx, bcs=bcs)
x = Function(V).vector()
b = assemble(inner(Constant(1),v)*ds(2))
solver = LinearSolver(A)
solver.solve(x, b)

fails with the error message

NotImplementedError: Taping with explicit FormAssembler objects is not supported yet. Use assemble instead.

This occurs because we do not tape linear solves and so the tape is still running when we hit this line.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions