We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
recompute
interpolate
Describe the bug recompute tape is failing for the following code:
Steps to Reproduce
from firedrake import * import firedrake.adjoint as fda mesh = UnitSquareMesh(2, 2) V = FunctionSpace(mesh, "DG", 0) u = Function(V) fda.continue_annotation() p = fda.AdjFloat(0.) u.interpolate(p) J = assemble(u*dx) fda.stop_annotating() Jhat = fda.ReducedFunctional(J, fda.Control(p)) J = Jhat(fda.AdjFloat(1.)) print("J: ", J, " u: ", u.block_variable.checkpoint.dat.data_ro) J = Jhat(fda.AdjFloat(2.)) print("J: ", J, " u: ", u.block_variable.checkpoint.dat.data_ro)
The output is
J: 0.0 u: [0. 0. 0. 0. 0. 0. 0. 0. 0.] J: 0.0 u: [0. 0. 0. 0. 0. 0. 0. 0. 0.]
The expected output is:
J: 1.0 u: [1. 1. 1. 1. 1. 1. 1. 1. 1.] J: 2.0 u: [2. 2. 2. 2. 2. 2. 2. 2. 2.]
It seems to be an issue related to u.interpolate(p); when we modify it to u.assign(p), the result is right.
u.interpolate(p)
u.assign(p)
Environment:
The text was updated successfully, but these errors were encountered:
Is this related to #3909?
Sorry, something went wrong.
UFL sees an AdjFloat as being just a float, and creates a FloatValue. I think the conversion is happening in as_ufl.
AdjFloat
float
FloatValue
as_ufl
Yes, do we not need to use a function in R in these cases?
R
I see.
The controls are working in R space. A warning (or raising an error) for this case looks to be good.
Ig-dolci
No branches or pull requests
Describe the bug
recompute
tape is failing for the following code:Steps to Reproduce
The output is
The expected output is:
It seems to be an issue related to
u.interpolate(p)
; when we modify it tou.assign(p)
, the result is right.Environment:
The text was updated successfully, but these errors were encountered: