ufl
ufl copied to clipboard
CoordinateDerivative and Conj do not compose correctly.
suppose in a complex valued inverse problem we have:
x = SpatialCoordinate(mesh)
functional = f(x)*dx
where f(x)
is some UFL expression which might be a function of x. Now, the adjoint will need to compute:
conj(derivative(functional, mesh)
Which is currently an error since CoordinateDerivative
must be the outermost operator on any expression. If we push the conj
inside the derivative then this is also an error because then the conjugate is not applied to the det(J)
which results from integral scaling. In combination with the CoordinateDerivative
this causes unconjugated test functions, which is an error.
Answers on a postcard please.
The requirement that coordinate derivative was outermost was because we didn't want to have to think through all the necessary distributivity rules and so forth. Assuming the conj should just apply linearly, you could strip it off in the lowering phase, apply spatial derivatives, and then reapply conj.