Bug introduced in 10.2 or earlier, and fixed in 11.0.0
I am trying to change the element mesh for a FEA application I'm doing. I thought I understood it, when I did it in 2D. Here's my shape:
Needs["NDSolve`FEM`"];
myrect = Rectangle[{0, 0}, {5, 8}];
mydisk = Disk[{2, 4}, 1];
rectcirc = RegionDifference[myrect, mydisk];
rmesh = NDSolve`FEM`ToElementMesh[rectcirc,
MaxCellMeasure -> {"Length" -> .5}]
rmesh["Wireframe"]
If I set the MaxBoundaryCellMeasure to 0.1, it figures out that the boundary is around the inner edge of the rectangle, and outside of the circle, and the mesh is adjusted accordingly:
rmesh2 = NDSolve`FEM`ToElementMesh[rectcirc,
MaxCellMeasure -> {"Length" -> .5}, "MaxBoundaryCellMeasure" -> .1]
rmesh2["Wireframe"]
Now I am trying to do a very similar thing for a 3 dimensional setup:
mycub = Cuboid[{0, 0, 0}, {10, 10, 10}];
mysmallcube = Cuboid[{4, 4, 4}, {6, 6, 6}];
Graphics3D[{Opacity[.1], mycub, Opacity[.4], mysmallcube}]
myreg = RegionDifference[mycub, mysmallcube];
mcm = 1;
cubmesh = NDSolve`FEM`ToElementMesh[myreg, MaxCellMeasure -> mcm]
cubmesh2 =
NDSolve`FEM`ToElementMesh[myreg, "MaxBoundaryCellMeasure" -> .2,
MaxCellMeasure -> mcm]
Print@"only MCM:";
cubmesh["Wireframe"]
cubmesh["Wireframe"[PlotRange -> {All, {4, 6}, All}]]
cubmesh["Wireframe"["MeshElement" -> "MeshElements",
PlotRange -> {All, {4, 6}, All}]]
Print@"MCM and MBCM:";
cubmesh2["Wireframe"[PlotRange -> {All, {4, 6}, All}]]
cubmesh2["Wireframe"["MeshElement" -> "MeshElements",
PlotRange -> {All, {4, 6}, All}]]
Now, it seems like it should behave similarly to the 2D case. It seems like because cubmesh2 has a smaller MaxBoundaryCellMeasure, it should have a finer mesh along its boundaries (inner surface of big cuboid, outer surface of small one), but I'm not seeing that in the output. Both cubmesh and cubmesh2 look exactly the same, but you can tell that this isn't right for cubmesh2, because with its MaxBoundaryCellMeasure of 0.2 and cuboid wall size of 10, there should theoretically be $10/0.2=50$ cells, and there are obviously far fewer than that (I've taken a slice of the graphic and tilted it, to see it easier):
I've read this page but I feel like I'm missing something. I suspect it has something to do with using a BoundaryMesh instead, but I don't really know why. Why isn't this working?