P1isoP2 elements

Is it possible to implement “P1isoP2” elements in fenicsx, where one has a mixed element on a grid and a refined version of that same grid?

I’m interested in trying this in the context of solving the Navier-Stokes equations, with linear elements for the pressure on a regular triangular grid, and linear elements for velocity on a refined triangulation. My naïve approach using two meshes didn’t get very far:

mesh = create_unit_square(MPI.COMM_WORLD, h//2, h//2, CellType.triangle)
mesh_refined = create_unit_square(MPI.COMM_WORLD, h, h, CellType.triangle)

P2v = ufl.VectorElement("P", mesh.ufl_cell(), 1)
P1 = ufl.FiniteElement("P", mesh_refined.ufl_cell(), 1)
TH = ufl.MixedElement([P2v, P1])
W = fem.FunctionSpace(mesh_refined, TH)

Which leads to odd but not surprising errors when attempting to construct the forms:

TypeError: '<' not supported between instances of 'Mesh' and 'Mesh'


I don’t think this is possible yet, but it may be possible in the (quite distant) future once we’ve looked at supporting macro elements (eg Guzmán-Neilan elements).