How to generate 2D mesh from binary image representing complex geometry?

Hello Fenics Community,

I randomly generate complex geometries (see picture below) and they are full of holes (black regions), what is the best way to approach these kind of meshes?



you can look at this post

1 Like


I looked at the linked post and am unsure how to use the UserExpression to solve over these type of binary structures where one phase is an inclusion. How can this be done?

Do you mesh just to the non-removed part of the domain, or use a full mesh of the domain and just solve over the one phase?