I'm playing around with ToElementMesh
and I noticed the following behaviour that puzzles me. Consider the two regions
<< NDSolve`FEM`
Ω1 =
Polygon[{{-1/2, -1}, {-1/2, 1}, {1/2, 1}, {1/2, -1}}];
Ω2 = Rectangle[{-1/2, -1}, {1/2, 1}];
RegionEqual[Ω1, Ω2]
returns True
, but
mesh1 = ToElementMesh[Ω1,
"BoundaryMeshGenerator" -> "Continuation", MaxCellMeasure -> 0.05,
"MaxBoundaryCellMeasure" -> 0.05];
mesh2 = ToElementMesh[Ω2,
"BoundaryMeshGenerator" -> "Continuation", MaxCellMeasure -> 0.05,
"MaxBoundaryCellMeasure" -> 0.05];
Show[RegionPlot[Ω1], mesh1["Wireframe"]]
Show[RegionPlot[Ω2], mesh2["Wireframe"]]
yields two different meshes:
Questions:
- Why this behaviour? From the documentation I couldn't find an explanation for this.
- How can I control the mesh generation to get a uniform behaviour?
Answer
This is a shortcoming in ToElementMesh
. I filed this as a bug, but it will take a bit of time to fix.
As a workaround you could use
mesh1 =
ToElementMesh[
BoundaryDiscretizeRegion[Ω1,
MaxCellMeasure -> {"Edges" -> 0.01}],
"BoundaryMeshGenerator" -> "Continuation", MaxCellMeasure -> 0.05,
"MaxBoundaryCellMeasure" -> 0.01];
Show[RegionPlot[Ω1], mesh1["Wireframe"]]
Comments
Post a Comment