- edited description
Derivative Command Returns UFL-Form of Wrong Dimensions
Dear all,
It appears the dimensionality of the return value of the derivative function depends on the dimensionality of the evaluation point and not the dimensionality of the desired direction.
This results in inconsistent return values when I differentiate, e.g. (f2-f2)f3 with respect to f2 in comparison to differentiating just 0.0*f3 with respect to f2. Ideally, both should be a "zero" of the same UFL-type, but apparently they are not.
I attach a minimal example to illustrate this. In one case, the code works, in the other it doesn't. I am using version 1.7.0dev.
This makes automatically processing "derivative"-output very tedious, as I would need a check "did my integrand depend on f2 in the first place?" to catch the return value inconsistency and I have no idea how to do this :(
Comments (5)
-
reporter -
reporter - changed version to dev
-
reporter Thanks to Patrick and Simon, one workaround is to use ufl.algorithms.ad.expand_derivatives(), which will return <empty form> in case of the last test and something sensible in the first two
-
- removed milestone
Removing milestone: 1.7 (automated comment)
-
I believe a fix would depend on this getting fixed first:
https://bitbucket.org/fenics-project/ufl/issues/13/avoid-simplifying-0-v-dx-0-dx-by
i.e. making ufl capable of representing the form
0*v*dx
. - Log in to comment