3
$\begingroup$

Mesh generator ToElementMesh allows to resolve internal boundaries of the domain to be tesselated:

<< NDSolve`FEM`
bmesh = ToBoundaryMesh[
   "Coordinates" -> {{0, 0.5}, {0., 0.}, {1., 0.}, {1., 1}, {0, 
      1.}, {0., 0.5}, {1, 0.5}},
   "BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 
        5}, {5, 6}, {6, 7}}]}
   ];
mesh = ToElementMesh[bmesh];
bmesh["Wireframe"]
mesh["Wireframe"]

enter image description here enter image description here

I tried to do the same by means of DistMesh generator from FEMAddOns package:

Needs["FEMAddOns`"]
DistMesh[bmesh]

enter image description here

Is it possible to resolve internal boundaries when using DistMesh generator? Thanks in advance for any effort to overcome this issue.

$\endgroup$

1 Answer 1

3
$\begingroup$

No, DistMesh can not resolve internal boundaries. The implementation of DistMesh follows the original paper pretty closely.

That being said, the FEMAddOns have a mesh smoothing function called ElementMeshSmoothing. DistMesh is popular for two reasons. It is a very simple mesh generator and it produces extremely smooth meshes. Now, ElementMeshSmoothing does not reach to 'smoothness' level DistMesh does, mainly because the DistMesh algorithm is very slow. Never the less it may come in handy in some cases. Assuming you are after smooth meshes, then here is an example:

Needs["FEMAddOns`"]
mesh = ToElementMesh[
   ImplicitRegion[Abs[ 0.7 - Sqrt[ x^2 + y^2 ] ] - 0.3 <= 0, {x, y}], 
   "RegionHoles" -> None];
mesh["Wireframe"]

enter image description here

Histogram[mesh["Quality"]]

enter image description here

smoothedMesh = ElementMeshSmoothing[mesh]

Show[mesh[
  "Wireframe"["MeshElementStyle" -> Directive[EdgeForm[LightGray]]]], 
 smoothedMesh["Wireframe"]]

enter image description here

Note, that the internal boundary has been preserved.

Histogram[{Join @@ mesh["Quality"], Join @@ smoothedMesh["Quality"]}]

enter image description here

Again, ElementMeshSmoothing is not a silver bullet, but it can help in some cases. Try it out.

$\endgroup$

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.