Create Bubble element


87
views
0
9 weeks ago by
Hello:

I am trying to create mixed function space as shown below:

mesh = UnitSquareMesh(64,64)

U = VectorElement("CG", mesh.ufl_cell(), 1)
UB  = VectorElement("Bubble", mesh.ufl_cell(), 3)
PS = FiniteElement("CG", mesh.ufl_cell(), 1)
PF = FiniteElement("CG", mesh.ufl_cell(), 1)
W = FunctionSpace(mesh,  MixedElement(U+UB, PS, PF))​
 
This way gives 'MixedElement' object has no attribute 'degree' error.

U = VectorFunctionSpace(mesh, "CG", 1)
UB = VectorFunctionSpace(mesh, "Bubble", 3)
PS = FunctionSpace(mesh, "CG", 1)
PF = FunctionSpace(mesh, "CG", 1)
W = (U+UB)*PS*PF​

This way gives TypeError: unsupported operand type(s) for +: 'FunctionSpace' and 'FunctionSpace' error.

Do you have any recommendations to fix this issue?

Thank you very much!

Meen
Community: FEniCS Project

1 Answer


1
9 weeks ago by
This will do it.
from fenics import *
mesh = UnitSquareMesh(64,64)
P1 = FiniteElement("CG", triangle, 1)
B3 = FiniteElement("Bubble", triangle, 3)
V = VectorElement(P1 + B3)
PS = FiniteElement("CG", triangle, 1)
PF = FiniteElement("CG", triangle, 1)
W = FunctionSpace(mesh, MixedElement([V, PS, PF]))
​
Thank you very much!!
written 9 weeks ago by Teeratorn Kadeethum  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »