Q2-P1 stokes element on FEniCSx

Hello all,

I want to reproduce the results of this paper, where the authors use the space Q2-P1 to solve the stationary Stokes equation.

In this space, P1 is discontinuous across elements and could be implemented in two ways:

  1. Mapping from a reference element (“mapped”)
  2. Defining it directly in the geometrical elements (“unmapped”)

In my code, I implemented the spaces according to

Q2 = VectorElement('CG',msh.ufl_cell(),2)
P1 = FiniteElement('DPC',msh.ufl_cell(),1)

W   = FunctionSpace(msh,MixedElement([Q2,P1]))

which seems to lead to the “mapped” version of P1. How could I implement the “unmapped” version?

In DOLFINx we use code generation to generate the assembly kernels, i.e. Computing the maps from the reference element to the physical element etc.

I dont know how you would define the unmapped version, maybe @mscroggs has an idea.

FEniCSx doesn’t support elements defined directly on the physical cells. (I’m 99% sure FEniCS doesn’t support this either.)

It might be possible to implement this with FEniCSx by using a custom kernel instead of using the kernels generated by FFCx.

To add to this, I’m not sure what the motivation to implement elements is, as it removes alot of the benefits of finite elements.

Thanks for your replies. I’m fairly inexperienced with FEniCSx, so using custom kernels seems a little out of reach for me. Do you know some forum threads or tutorials that can guide me through this?

About the motivation for using the unmapped P1, the article I cited argues that, for some types of quadrilateral meshes, the unmapped version achieves better convergence rates than the mapped. It is a somewhat edge case, but I found it interesting to test.

I am not aware of an easy way to do it with DOLFIN or DOLFINx. I’ll let you know if I hear of a way to do it.

1 Like