Consider the following MWE on mixed spaces
from dolfin import *
mesh = UnitSquareMesh(1,1)
P1 = VectorElement('CG', triangle, 1)
P0 = FiniteElement('DG', triangle, 0)
element = MixedElement([P1, P0, P0])
W = FunctionSpace(mesh, element)
v, w1, w2 = TestFunctions(W)
phi, zx, zy = TrialFunctions(W)
phiI = interpolate(Constant((1,2)), W.sub(0).collapse())
a = FunctionAssigner(W.sub(0), phiI.function_space())
phi0 = Function(W)
a.assign(phi0.sub(0), phiI)
e0 = phi[0]*w1*dx # phi[0] gives First component of phi, right?
e1 = action(e0, phi0[0]) # Gives error
Error:
Exception has occurred: AttributeError
'Indexed' object has no attribute 'ufl_function_space'
File "/Users/jaitushar/Documents/myFEniCS/Misc/actionVecComp.py", line 20, in <module>
e1 = action(e0, phi0[0])
Questions:
- Is
phi[0]
ine0
the first component ofphi
? - Is there anyway to make
e1
work?