This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Extract the components of an enriched function space

+4 votes

Consider the enriched vector function space E defined below.

P1 = VectorFunctionSpace(mesh, "Lagrange", 1)
B  = VectorFunctionSpace(mesh, "Bubble", 3)
E = P1 + B

How do I acces to the components of E? I would like to do E.sub(0), as I would do with P1, but this returns

ValueError: Can only extract SubSpaces with i = 0 ... -1

because

E.num_sub_spaces() 

is 0

asked Feb 17, 2014 by cmaurini FEniCS User (1,130 points)

1 Answer

+1 vote
 
Best answer
P1 = FunctionSpace(mesh, "Lagrange", 1)
B  = FunctionSpace(mesh, "Bubble", 3)
E = P1 + B
vE = MixedFunctionSpace(3*[E])
answered Mar 1, 2014 by Jan Blechta FEniCS Expert (51,420 points)
selected Mar 3, 2014 by cmaurini
...