How to refine the mesh of my subdomain

Hi everyone
i have meshed my domain. but there is a subdomain, where the mesh is less fine than others. this domain where the mesh is less than others, is a rectangle ,at the right of the whole domain.
I want to refine the mesh of this domain.
the whole domain is :
‘’‘poly = Polygon( [Point(-4.0, -1.0),Point(0.0, -1.0),Point(2.0, -0.2),Point(6.0, -0.2),Point(6.0, 0.2),Point(2.0 , 0.2),Point(0.0, 1.0),Point(-4.0, 1.0)])’’’

the domain to refine is :
Rectangle(p2,p4)
where p2 = Point(np.array([2.0, -0.2]))
p4 = Point(np.array([6.0, 0.2]))

You case use the refine function.
First create a mesh function consistent of books. Then loop through all the cells, and check if the midpoint is inside the rectangle. For a similar example, look at this demo

1 Like

thank"s a lot . i have done it and it work