Subtracting off a sphere from a box in 3D and meshing shows that the sphere is also getting meshed

Dear All

While simulating the flow past a cylinder in 2D, one creates the domain by subtracting a circle from a rectangular channel. It is clearly seen that only the space outside the circle is getting meshed.

channel = Rectangle(Point(0, 0), Point(2.2, 0.41))
cylinder = Circle(Point(0.2, 0.2), 0.05)
domain = channel - cylinder
mesh = generate_mesh(domain, 64)

I tried doing the same exercise in 3D, by subtracting a sphere from a box. However, it appears that the sphere also is getting meshed in the process.

h = 0.25
r = 0.3h
box = Box(Point(0, 0, 0), Point(1, h, h))
s1 = Sphere(Point(0.3, 0.50
h, 0.50*h), r)
domain = box - s1
mesh = generate_mesh(domain, 32)


I want only the space external to the sphere to be meshed. Wanted to check if I am doing something wrong, or if it is an artefact of the visualizing tool (ParaView)?

Thank You

1 Like

I am attaching the 2D result here, corresponding to a circle in a rectangular channel, which displays the expected meshing pattern

I think this is just an issue of how you’re interpreting the wireframe visualization from Paraview. It is plotting a wireframe of the mesh boundary only, and you want the surface of the sphere to be part of the mesh boundary. (If the interior of the sphere was being meshed, you wouldn’t see it in the wireframe visualization.) If you instead apply a clip filter with the clipping plane passing through the sphere, you will see clearly that the sphere is cut out of the mesh, as desired.

3 Likes

Thank you, that explanation is very helpful. I have attached a figure with the clip filter applied, which clearly shows that the sphere is cut out of the mesh.

Cheers and Regards