3
$\begingroup$

Can somebody tell me if this is a bug?

<< NDSolve`FEM`
Table[
  x0 = 2.5;
  cords = {{-x0, 0, 0}, {x0, 0, 0}};
  r = 
    RegionDifference[
      Cuboid[{- L, -L, -L}, {L, L, L}], 
      RegionUnion[Ball[#, 1] & /@ cords]];
  mesh2 = ToElementMesh[ r, "RegionHoles" -> cords];
  mesh2["Wireframe"], 
  {L, 4, 10, 2}]

enter image description here

As you can see the holes in the middle loose their shape as the outer cube becomes larger.

I've tried two different ways of fixing the problem: defining a MeshRefinementFunction and using implicit region instead of region unions. Neither work. A similar problem I faced with a previous version of Mathematica in 2D is documented here.

If you look carefully at the documentation you can see the same problem: enter image description here

The inner ellipse has a really bad resolution even though the elements are quite small.

Running 10.3.1 in macosx 10.8.5

$\endgroup$

1 Answer 1

6
$\begingroup$

It's not a bug this is what is expected. Here is what I get in 10.4.1

<< NDSolve`FEM`
GraphicsRow[Table[x0 = 2.5;
  cords = {{-x0, 0, 0}, {x0, 0, 0}};
  r = RegionDifference[Cuboid[{-L, -L, -L}, {L, L, L}], 
    RegionUnion[Ball[#, 1] & /@ cords]];
  mesh2 = ToElementMesh[r, "RegionHoles" -> cords];
  mesh2["Wireframe"[PlotRange -> {{-L, L}, {0, L}, {-L, L}}]], {L, 4, 
   10, 2}], ImageSize -> Full]

enter image description here

You can use "MaxBoundaryCellSize" to resolve the smaller features:

<< NDSolve`FEM`
GraphicsRow[Table[x0 = 2.5;
  cords = {{-x0, 0, 0}, {x0, 0, 0}};
  r = RegionDifference[Cuboid[{-L, -L, -L}, {L, L, L}], 
    RegionUnion[Ball[#, 1] & /@ cords]];
  mesh2 = 
   ToElementMesh[r, "RegionHoles" -> cords, 
    "MaxBoundaryCellMeasure" -> 1];
  mesh2["Wireframe"[PlotRange -> {{-L, L}, {0, L}, {-L, L}}]], {L, 4, 
   10, 2}], ImageSize -> Full]

enter image description here

$\endgroup$
3
  • $\begingroup$ not working in 10.3.1 :( but nice to know it will work when I get my new computer :) $\endgroup$ Commented Jun 10, 2016 at 0:49
  • 1
    $\begingroup$ @tsuresuregusa, that this is not working in 10.3.1 is expected. In 10.4 a new boundary mesh generator for 3D was connected. You might get this to work in 10.3.1 if you use BoundaryDiscretizeRegion and set the option MaxCellMeasure -> {"Length" -> ....}. You can then convert that with ToBoundaryMesh[bmr]. Give that a shot. $\endgroup$
    – user21
    Commented Jun 10, 2016 at 0:58
  • $\begingroup$ great! Thanks a lot, works as a charm. $\endgroup$ Commented Jun 10, 2016 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.