UFL

Comment 2 for bug 875279

Revision history for this message
Martin Sandve Alnæs (martinal) wrote :

Actually, no. It is too messy. The problem is this:

V = VectorElement(...)
f = Coefficient(V)
u, v = split(f)
M = u*v*f*dx
M2 = replace(M, { u: v })

What does this mean? Replacing terminals is rather unambiguous, this is not.

If you instead do:

from ufl import *
fe = VectorElement("CG", triangle, 1)
f = Coefficient(fe)
u0, u1 = split(f)
f2 = as_vector((u1, u1))
print str(replace(u0*dx, {f: f2}))

you should hopefully get what you need.

The alternative would be something much more intelligent than replace.