# Meshing a cylindrical geometry with a notch

I have been trying to mesh a cylindrical geometry with a notch. To generate the geometry i use the following command.

<< NDSolveFEM
reg1 = Disk[{0, 0}, 0.25];
Region[reg1];
reg2 = RegionProduct[reg1, Line[{{0}, {2}}]];
Region[reg2];
reg3 = Cuboid[{-0.25, -0.1, 0.9}, {-0.15, 0.1, 1.1}];
Region[reg3];
reg4 = RegionDifference[reg2, reg3];
RegionPlot3D[reg4, PlotPoints -> 100] I am trying to mesh this geometry using linear Tetrahederal elements using the script

ToElementMesh[reg4, MaxCellMeasure -> {"Volume" -> 0.001},"MeshOrder" -> 1]


I get the following error

ToElementMesh::femtemnbb: The bounds for BooleanRegion[#1&&!#2&,
{Cylinder[{{0,0,0},{0,0,2}},0.25],Cuboid[{-0.25,-0.1,0.9},{-0.15,0.1,1.1}]}]
are {{-\[Infinity],\[Infinity]},{-\[Infinity],\[Infinity]},{-\[Infinity],\
[Infinity]}}. Unless finite numeric bounds are specified, the mesh generation
will constrain the region to have finite bounds.


I will grateful if i could get any help on this issue or if there is a another way to do it? Thanks

Here is an alternative with exact numbers:

r = RegionDifference[Cylinder[{{0, 0, 0}, {0, 0, 2}}, 1/4],
Cuboid[{-1/4, -1/10, 9/10}, {-15/100, 1/10, 11/10}]];
m = ToElementMesh[r, MaxCellMeasure -> {"Volume" -> 0.001},
"MeshOrder" -> 1]


But since you want a fist order mesh you could also discretize the regions first and then construct the region difference. This would allow for a good intersection of the regions:

r = RegionDifference[
DiscretizeRegion@Cylinder[{{0, 0, 0}, {0, 0, 2}}, 1/4],
DiscretizeRegion@
Cuboid[{-1/4, -1/10, 9/10}, {-15/100, 1/10, 11/10}]];
m = ToElementMesh[r, MaxCellMeasure -> {"Volume" -> 0.001},
"MeshOrder" -> 1]

m["Wireframe"[PlotRange -> {8/10, 12/10}]] This will requite a few more elements but it might be worth it.

• @user21Thanks, this is a good alternative, especially that fine mesh is required at the intersecting regions. – KVK318 Apr 3 '18 at 21:34

The issue can be addressed by specifying explicit numerical bounds:

<< NDSolveFEM
reg=RegionDifference[
Cylinder[{{0, 0, 0}, {0, 0, 2}}, 1/4],
Cuboid[{-0.25, -0.1, 0.9}, {-0.15, 0.1, 1.1}]];
RegionPlot3D[reg,PlotPoints->100]
ToElementMesh[reg, {{-1/4,1/4}, {-1/4, 1/4},{0,2}}]

• @YoungThanks, this works. – KVK318 Apr 3 '18 at 17:17
• +1 for referencing a message page! – user21 Apr 3 '18 at 17:21
• @user21Thanks, i forgot to do that last time. – KVK318 Apr 3 '18 at 17:24
• @KVK318, thanks! – user21 Apr 3 '18 at 17:25