Interpolating Functions on higher order elements

The error message states that the degree of the function space does not match the mesh degree. The mesh degree is the order of the Lagrange space used to represent a single cell in the mesh geometry.

This representation is used to map points to and from the reference element.

The XDMF file format only supports first or second order Lagrange elements, where the degree has to be equal to the order of the mesh geometry.

Thus for straight edged triangles, tetrahedra, quadrilatrals or hexahedrons) the XDMFFile can only store first order Lagrange finite elements. This means that you have to interpolate the higher order function into a lower order space.

In legacy FEniCS this was done implicitly under the hood (causing confusion and misinterpretations of results).
If you use the VTKFile or VTXWriter (recommended) to write out abritrary order Lagrange or DG finite element functions to file. The reason that I stress the finite element family is that Paraview/VTK does not support more exotic finite elements such as RT or N1curl, and thus one have to interpolate into an appropriate Lagrange/DG space.

2 Likes