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:

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).

Hi,
Thank you for your answer, I didn’t know this was available. However in addition to the velocity I would need to define tensors on the same refined grid which would be of order 0. I tried to pass 0 as order in your code but I got an error “Cannot create a continuous order 0 Lagrange basis function”. It seems that it forces the elements to be continuous. Is there any workaround ?

Also this does not provide a tensor but only a scalar, I wanted to plug this into ufl.TensorElement but the family name ‘iso’ does not exist (that’s actually why I thought it was not implemented). I thought using “ufl.finiteelement.elementlist.register_element” would solve the problem but depending on the order of the element, the sobolev space varies from H1 to L2, but the basix family name remains ‘iso’, so I can’t register both order 1 and order 0 in the same script. Did I miss anything ?

ufl.TensorElement and ufl.finiteelement.elementlist.register_element are deprecated and will be removed in the next UFL release, so we recommend moving away from using these.

The functions in basix.ufl should be able to do everything that you used to do with these. You can create a tensor element by passing a shape into the element function, for example:

element = basix.ufl.element(
basix.ElementFamily.P, basix.CellType.triangle, 0,
discontinuous=true, shape=(2, 2))

There’s no need to use an iso element here as it would be the same as a DP0 element

?
Concerning the use of basix.ElementFamily.iso, I don’t understand why this is the same as basix.ElementFamily.P when the degree is 0. For me the latter designates the use of Lagrange elements, so if we consider the order 0 this makes only one degree of freedom per triangle. What I want is Lagrange elements of order 0 but on the refined grid, so this makes 3 degrees of freedom per triangle on the coarse mesh. Is there any way to get that ?

Yes, that’s exactly how to create a vector element.

In Basix, the basis functions of an iso element are always continuous across the boundaries between edges on the fine mesh (that are not edges in the coarse mesh), so there’s currently no way to make this element. I’ve opened an issue for this: Add discontinuous iso element · Issue #794 · FEniCS/basix · GitHub