← Back to team overview

ufl team mailing list archive

Re: grad() w.r. to a coefficient

 

Garth N. Wells wrote:


On 06/07/10 13:25, Patrick Riesen wrote:
hello,

i want to take the gradient of a coefficient with respect to some other
quantity than the spatial coordinates (i.e. some other coefficient).

i tried to construct a custom operator derived from diff() and the
SpatialCoordinate/Derivative classes in ufl but after some point beyond
my knowledge it always gets evaluated to zero by FFC then stops
compiling with FFC : division by zero!

does somebody of you experts know an approach to this?


Did you try using 'variable'?

    . . .
    v  = variable(v)
    f  = v*v
df = diff(f, v)
yes, but if f is a coefficient and not an expression of v, this won't work, i.e.,

f = Coefficient(element)
f = variable(f)
v = SpatialCoordinates(cell)
v = variable(v)
df = diff(f, v)

will end up as Type Zero, although this is equivalent to grad(f). that's the one case, and it v = Coefficient(element) as well, it will also be zero.
if would be nice if where not zero :-)

patrick

Garth

many thanks and best regards,
patrick

_______________________________________________
Mailing list: https://launchpad.net/~ufl
Post to : ufl@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~ufl
More help : https://help.launchpad.net/ListHelp





Follow ups

References