# How to create an ElementMesh with at least two triangle elements at each corner?

Based on this simple example of a triangle mesh

Needs["NDSolveFEM"]
mesh = ToElementMesh[Rectangle[] , "MaxCellMeasure" -> .05 ,"MeshElementType" ->"TriangleElement", "MeshOrder" -> 1]
mesh["Wireframe"]

I would like to ask the following question:

How can I force mathematica to create a triangle mesh with at least two elements at each corner?

Thanks!

• I think I may not be understanding your question. Could you clarify (perhaps with a graphical example) what you mean by two triangle elements in each corner? Do you mean that the vertex of the enclosing square should be a vertex for two triangles, instead of one as it is above? Dec 6, 2022 at 14:09
• Sorry for need of clarification. The simpliest mesh I'm looking for would consist of rectangle +two diagonals. Dec 6, 2022 at 15:14
• I am not sure why TWO diagonals would be the simplest. Surely the simplest triangulation would only have ONE diagonal, i.e. dividing the rectangle into two triangles? That can be accomplished with a large enough value of MaxCellMeasure, e.g. MaxCellMeasure -> 1. I could not find any value for MaxCellMeasure that would give four triangles (i.e. both diagonals). Dec 6, 2022 at 16:49
• I can get the TWO diagonal version using TriangulateMesh[Rectangle[], MaxCellMeasure -> 0.3] if that helps Dec 6, 2022 at 17:00
• @MarcoB two diagonal version fullfills all four corner conditions Dec 6, 2022 at 19:59

I was able to get the desired outcome using the build in TriangulateMesh:

TriangulateMesh[Rectangle[], MaxCellMeasure -> 0.3]

The best I could get with the FEM machinery is only one diagonal:

Needs["NDSolveFEM"]

ToElementMesh[
Rectangle[], "MaxCellMeasure" -> 1,
"MeshElementType" -> "TriangleElement", "MeshOrder" -> 1
]["Wireframe"]

• Thanks for your helpful answer. Still I would like to give a mesh constraint "Every meshpoint has at least 3 neighbors" Dec 7, 2022 at 8:46

You could try including more points near the corners. E.g.:

Needs["NDSolveFEM"]
mesh = ToElementMesh[Rectangle[], "MaxCellMeasure" -> .02,
"MeshElementType" -> "TriangleElement", "MeshOrder" -> 1,
"IncludePoints" -> {{0.1, 0.1}, {0.9, 0.9}}]
mesh["Wireframe"]

• Tahnks for this simple approach. But it depends sensitively on value of MaxCellMeasure. I tried "MaxCellMeasure" -> .04 which gives unexpacted result Dec 6, 2022 at 15:33
• You could try to add additional points on the border near the corners. Dec 7, 2022 at 8:48