You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Pull request #3552 states "Also default to L2 projection.", but the following test seems to contradict it. Update: the error is in line 228 of firedrake/adjoint_utils/function.py, where
from firedrake import *
from firedrake.adjoint import *
mesh = UnitSquareMesh(2,2)
V = FunctionSpace(mesh, "CG", 1)
x, y = SpatialCoordinate(mesh)
u_ = Function(V).interpolate(x**2+y) #target soln
f = Function(V) # control
u = Function(V) # state variable
v = TestFunction(V)
F = (u - f)*v*dx # state constraint
# annotate solve and define reduced functional
continue_annotation()
solve(F == 0, u)
J = assemble((u - u_)**2*dx)
Jhat = ReducedFunctional(J, Control(f))
pause_annotation()
print("riesz_representation: default")
dJ = Jhat.derivative()
with dJ.dat.vec_ro as dJ:
print(dJ.array)
for RR in [None, "l2", "L2", "H1"]:
print("riesz_representation: ", RR)
dJ = Jhat.derivative(options={"riesz_representation": RR})
with dJ.dat.vec_ro as dJ:
print(dJ.array)
Describe the bug
Pull request #3552 states "Also default to L2 projection.", but the following test seems to contradict it. Update: the error is in line 228 of firedrake/adjoint_utils/function.py, where
should be
Steps to Reproduce
The code
outputs
Expected behavior
I would expect the default to be like L2, not l2.
Environment:
firedrake-status
The text was updated successfully, but these errors were encountered: