I would like to create a domain consisting of a rectangle minus a circle in the middle. I am using the following code :
from dolfin import *
from mshr import*
rect = Rectangle(Point(0, 0), Point(10, 5))
circ = Circle(Point(5, 5), 1)
domain = rect - circ
N = 20
mesh = generate_mesh(domain, N)
File("rectangle-less-circle.xdmf") << mesh
The code produces the mesh :
However I would also like my mesh to have an interior facet running through the center of the circle (0<=x<=10, y=5) so that the nodes will be exactly on this line.
I tried creating two separate rectangles and adding them up, but the mesh blends together and produces the same as the initial code.
from dolfin import *
from mshr import *
rect1 = Rectangle(Point(0, 0), Point(10, 5))
rect2 = Rectangle(Point(0, 5), Point(10, 10))
circ = Circle(Point(5, 5), 1)
domain = rect1 + rect2 - circ
N = 20
mesh = generate_mesh(domain, N)
Does anyone know how to define an internal boundary while creating the mesh so that I can , for example, integrate a function over it later or create a tensor that picks out the nodes lying exactly on this line ?