Refining an irregular mesh in FEniCS

I was provided with a 3d hexahedral (hex) mesh with two important characteristics

  1. All mesh points lie on the plane z = 1 or z = 0 (consequently all mesh points lie on the boundary).
  2. If I look at the (x,y) mesh points for a fixed value of z, they trace a complex geometry, as this comes from a geophysics application.

Getting the file to xml format:
The mesh was provided as a p4est connectivity file (.p8c). I was able to write this data to .vtk format and view the mesh in paraview. FEniCS has greater support for tetrahedral (tet) meshes so I first used the tetrahedralize filter in paraview to convert to the hex mesh to a tet mesh. I then saved this in exodus format (.e) and used meshio-convert to convert the .e file to .xml format.

Using the mesh in FEniCS:
I was able to import the mesh into FEniCS, but since the mesh points were all contained on the boundary I needed to refine the mesh to then have internal mesh points to solve a partial differential equation over. I used the refine and adapt functions in FEniCS. I then checked the (x,y) boundary point pairs for fixed z, and the set of boundary points was not consistent with what I expected. Points that I expected to not be boundary nodes were classified as boundary nodes.

Code

Questions (answer any that you can)

  1. Have you worked with and or refined irregular meshes in FEniCS, that is meshes whose boundary cannot be described by a simple mathematical expression? If so how can you appropriately mark newly generated points as boundary points or not?

  2. Have you converted hex meshes to tet meshes? What software package would you recommend?