# FEniCS, refinement not 'respecting' domain boundary

Short question: how to ensure that extra points are not included as 'boundary' points after calling the refine function.

More details.

I am working with a hexahedral mesh in $$3$$d. Let $$X$$ be the set of mesh points. The mesh describes a connected object with an irregular geometry, but is flat in the sense that if $$\pmb{x}\in X$$, then the third component of $$\pmb{x}$$ is in the set $$\lbrace z_{1},z_{2}\rbrace$$.

The hexahedral mesh was unsuitable for use in FEniCS, so I used the tetrahedralize filter in paraview. I then converted to xml format and was able to read this into a FEniCS code.

The mesh was unsuitable to solve PDEs on since all mesh points were boundary points. I then called refine and have mesh points $$\pmb{x}$$ such that their z-component is in the set $$\lbrace z_{1},z_{3/2},z_{2}\rbrace$$. I extracted the boundary mesh by calling bmesh = BoundaryMesh(mesh, "exterior", True). I find that there are too many bmesh coordinate points and that they lie on the interior of the object that I am meshing. Unfortunately the geometry of the mesh is complicated and so I can't describe the boundary with a simple function like $$x[0]=0$$.

• I think you need a better mesh to start with, specially based on your sentence: "The mesh was unsuitable to solve PDEs on since all mesh points were boundary points." Use gmsh to have a better hexahedral mesh to start with. Keep in mind FEniCS and ParaView are not mesh generator softwares, so you should not expect to get a reasonable mesh after refining in FEniCS. Commented Nov 11, 2019 at 15:40
• Thanks for the suggestion. I will work on using gmsh. Commented Nov 11, 2019 at 19:07
• In particular, if you want either paraview or FEniCS to give you meshes that respect the geometry of the boundary, then they need to have knowledge of the geometry of the domain. I don't know about FEniCS, but I know for sure that if all you give Paraview is a VTK/VTU file, then it has no knowledge of the underlying geometry and the best it can do is refine the mesh by using the midpoints of all edges and faces, rather than putting them onto the actual geometry. Commented Nov 12, 2019 at 20:16