My program (in Python, using FEniCS):
mesh=UnitSquareMesh(16,16)
U_h = VectorFunctionSpace(mesh, "Lagrange", 1)
B = VectorFunctionSpace(mesh, "Bubble", degree=3,dim=2)
Mini_h = U_h + B
Boundary definition (for example, u0_boundary
and u1_boundary
are part of square, respectively):
w0 = Constant("0.0")
bc0 = DirichletBC(Mini_h.sub(0), w0, u0_boundary) #error
bc1 = DirichletBC(Mini_h.sub(1), w0, u1_boundary)
I get: ValueError: Can only extract SubSpaces with i = 0 ... -1
Who can tell me why? Mini_h.sub(0)
is the first component of Mini_h
.
Actually, the problem is only for vector bubble element, everything is OK. For example:
B = VectorFunctionSpace(mesh, "Bubble", degree=3,dim=2)
bc0 = DirichletBC(B.sub(0), w0, u0_boundary)
bc1 = DirichletBC(B.sub(1), w0, u1_boundary)
In addition, I want to know why can not directly added to a mini finite element, rather than CG + Bubble.
Mini_h.num_sub_spaces()
returns0
for your example, so the problem is probably in the construction ofMini_h
. $\endgroup$ – Christian Clason May 22 '13 at 15:05