Bubble enriched vector element

Hi,

I was wondering if it is possible to Bubble Enrich vector elements. Here is a naive attempt:

from dolfin import *

mesh = UnitSquareMesh(200,200)

P1 = VectorElement(‘P’,triangle,1)
B1 = VectorElement(‘B’,triangle,3)
V = VectorFunctionSpace(mesh,P1+B1)

Which gives the error:

V = VectorFunctionSpace(mesh,P1+B1)
TypeError: VectorFunctionSpace() missing 1 required positional argument: ‘degree’

Is it even possible to do this?

Best,

I can get around this error by first creating a bubble-enriched scalar element, then combining several copies of it into a MixedElement (which is equivalent to a VectorElement):

from dolfin import *
mesh = UnitSquareMesh(200,200)
#P1 = VectorElement("P",triangle,1)
#B1 = VectorElement("B",triangle,3)
#V = VectorFunctionSpace(mesh,P1+B1)
P1_scalar = FiniteElement("P",triangle,1)
B1_scalar = FiniteElement("B",triangle,3)
VE_scalar = P1_scalar + B1_scalarb
VE = MixedElement(2*[VE_scalar])
V = FunctionSpace(mesh,VE)
2 Likes

Oh. So you are manually creating a vector function space?

Yes, a VectorElement is essentially just a MixedElement combining dim copies of a FiniteElement. dim defaults to the dimension of the mesh, but can alternatively be set as a keyword argument to the VectorElement constructor.

1 Like

Awesome. Thank you so much it is working now.

Another solution would be to use NodalEnrichedElement, as is used in this example to construct a MINI element.

You could construct your enriched vector function space like this:

from dolfin import *
mesh = UnitSquareMesh(200,200)
P1 = FiniteElement('P', triangle, 1)
B1 = FiniteElement('B', triangle, 3)
VE = VectorElement(NodalEnrichedElement(P1, B1)
V = FunctionSpace(mesh, VE)