How to recover BoundaryMesh or equivalent SubMesh from facet_region

Hi all;

I have a lot of difficulties to define a SubMesh or BoundaryMesh over a given mesh generated by GMSH.

My objective is (i) to recover the value of a function on a subset of the boundary of a given domain and (ii) to apply it on the subset of the boundary of another domain. The point (ii) is done simply with e.g. DirichletBC(V, value, boundaries, 30)
where
boundaries = MeshFunction("size_t", mesh, '..._facet_region.xml')
and I have troubles with the converse point (i).

Please, note that I cannot mark the boundary “by hands” with SubDomain, since the geometry is complicated. What I do is define parts of my boundary as some physical entities labeled by a given number in my GMSH .geo file, and use dolfin-convert to convert my .msh into a .xml. Then I define a MeshFunction that reads the …facet_region.xml.

And my question is: How to define the (Sub)BoundaryMesh from that, a function over it and recover the value from the function defined in the entire domain?

Thank you all for your help!

1 Like

Hi afalaize,
I know it is a bit late. But for the conversion part I think I can help.

I have a small module that I use for for 3D meshes. It does the conversion and imports and exports the functions. I heavily made use of the other contributions in the fenicsproject.discourse group.

You can acces it via:


I hope it works for you!

Baltasar