ufl icon indicating copy to clipboard operation
ufl copied to clipboard

CoordinateDerivative and Conj do not compose correctly.

Open dham opened this issue 4 years ago • 1 comments

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.

dham avatar Apr 28 '20 12:04 dham

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.

wence- avatar Apr 28 '20 14:04 wence-