2
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ Mini_h.num_sub_spaces() returns 0 for your example, so the problem is probably in the construction of Mini_h. $\endgroup$ – Christian Clason May 22 '13 at 15:05
4
$\begingroup$

You can define the Mini element in this alternative manner if you want a mixed enriched element rather than an enriched mixed element:

U = FunctionSpace(mesh, "Lagrange", 1)
B = FunctionSpace(mesh, "Bubble", 3)
M = U + B
Mini_h = MixedFunctionSpace([M, M])
| cite | improve this answer | |
$\endgroup$
2
$\begingroup$

The vector part of the MINI element is not a mixed function space, which is why you cannot extract a subspace from it. The bubble is an enrichment (which is indicated by the '+' in your construction of Mini_h.

The distinction between mixed and enriched spaces is discussed in Section 2.3 of the UFL paper:

http://arxiv.org/abs/1211.4047

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Yes, but consider that one would appreciate associativity of * and + operation so that Mini_h.sub(0) == U_h.sub(0) + B.sub(0). Is there major design issue why it is not possible? $\endgroup$ – Jan Blechta May 22 '13 at 19:17
  • $\begingroup$ Yes,you are right. U = FunctionSpace(mesh, "Lagrange", 1) B = FunctionSpace(mesh, "Bubble", 3) Q = FunctionSpace(mesh, "DG", 1) M = (U + B)*(U + B) Mixed_h = MixedFunctionSpace([M,Q]) $\endgroup$ – jiangliuer2013 May 27 '13 at 13:05
0
$\begingroup$

You have two options:

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

This problem have be solved,thanks everyone!

U = FunctionSpace(mesh, "Lagrange", 1)
B = FunctionSpace(mesh, "Bubble", 3)
Q = FunctionSpace(mesh, "DG", 1)
M = (U + B)*(U + B)
Mixed_h = MixedFunctionSpace([M,Q])

This time we can use Mixed_h.sub(0).sub(0).

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.