Hi @dokken, I just got around to testing this out. The FunctionAssigner didn’t work as I expected for the EnrichedElement - I had to use the following workaround (commented out). Is this the correct approach? Is there anyway to get it to work with the EnrichedElement? Thank you
from dolfin import *
mesh = UnitSquareMesh(1, 1)
P2 = FiniteElement("P", triangle, degree=2)
bubble = FiniteElement("B", triangle, degree=3)
W = FunctionSpace(mesh, MixedElement(P2 + bubble))
# W = FunctionSpace(mesh, MixedElement([P2] + [bubble])) # this works
V = FunctionSpace(mesh, P2)
# assigning a scalar expression to mixed element fails
# u = interpolate(Expression(('x[0]' ,), degree=3), W)
v = interpolate(Expression('x[0]', degree=3), V)
# print(u.vector()[:]) # returns all zeros
print(v.vector()[:]) # returns x coordinates
B = FunctionSpace(mesh, bubble)
b = interpolate(Expression('x[0]', degree=3), B)
w = Function(W)
assigner = FunctionAssigner(W, [V, B])
assigner.assign(w, [v, b])
print(w.vector()[:])