# Bubble Functions NoneType in FunctionSpace Declaration

Hi, I’m trying to implement the classical P1-B-P1 scheme for 2D Stokes in a lid-driven cavity problem (the old documentation example does not work in FeniCSx). I manage to set up the elements correctly, however, when it comes to declaring the FunctionSpace, I receive the following error:

``````  order = max(e.get_order() for e in elements)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'NoneType' and 'NoneType'
``````

Here is my code set-up:

``````from dolfin import *
from fenics import *

import matplotlib.pyplot as plt

mu = Constant(1)            # dynamic viscosity
f  = Constant((0,0))

mesh = UnitSquareMesh(64, 64)

deg_velocity = 1
deg_pressure = 1

V_el = VectorElement("P", mesh.ufl_cell(), 1)
B_el = VectorElement("Bubble", mesh.ufl_cell(), 3)
Q_el = FiniteElement("P", mesh.ufl_cell(), 1)
W_el = MixedElement([V_el+B_el, Q_el])
# Define function spaces
V = VectorFunctionSpace(mesh, "P", 1)
B = VectorFunctionSpace(mesh, "Bubble", 3)
Q = FunctionSpace(mesh, "P", 1)
W = FunctionSpace(mesh, W_el)
``````

I receive the error when creating W.

I also tried to declare W_el in terms of a NodalEnrichedBasis, with the one change of

``````W_el = MixedElement([NodalEnrichedElement(V_el, B_el), Q_el])
``````

but the exact snippet of code with just that change leads to the following error:

``````   raise NotImplementedError("get_nodal_basis not implemented")
NotImplementedError: get_nodal_basis not implemented
``````

I have gotten this to work with just P1-P1 and P2-P0, which leads me to think that the issue lies in the way that Bubble functions work, but I’m not sure how to fix my problem since I’ve been following the documentation pretty closely. Could someone please help?

I would suggest using DOLFINx, as you can define the bubble manually by: Creating a custom element — Basix 0.6.0.0 documentation
and described for higher order bubbles at
The Stokes equations — FEniCS 22 tutorial
or use the Basix ufl wrapper described here: dolfinx/test_interpolation.py at 59590276702737f8bd758d7257ad569e2f75f760 · FEniCS/dolfinx · GitHub
and

1 Like