HOWTO: combine geometries with keeping interfaces



I was trying to use mshr to combine different geometries and create a mesh. What I realized was the interface between geometries was smeared after mesh generation. Is there a way to combine geometries with keeping those interfaces as is?



Hello, I don’t know if it is exactly what you want but you can use the set_subdomain method of mshr to define subdomains which will then have a mesh-conforming interface:

from dolfin import *
from mshr import *
domain = Rectangle(Point(0, 0), Point(1, 1))
domain.set_subdomain(1, Circle(Point(0.5, 0.5), 0.4))
mesh = generate_mesh(domain, 10)

This only works for 2D, right?


did you check ?
However if you need 3D meshes with multiple domains, I would suggest using a meshing software like Gmsh for instance.


I do need subdomains in 3D. Thanks anyways