dokken
10
You could use:
V_c = FunctionSpace(mesh, "Real", 0)
u_R = Function(V_c)
# ...
dF_m = assemble(derivative(F, u_R))
or as @Calva
suggested
lmbda = Function(V)
grad = assemble(-action(adjoint(derivative(F, u_R)), lmbda))
print(grad.get_local())
which would give you a single number
1 Like