# How to create a 1D mesh from a curved line (with ToElementMesh)

I want to create an element mesh from an arc $$x=Rcos(\varphi), y=Rsin(\varphi)$$, with $$R=100, \varphi \in [0,\pi/4]$$ which looks like this:

Graphics[Circle[{0, 0}, 100, {0, Pi/4}]]


I want to discretize the region with 8 elements, so I tried something like this:

ToElementMesh[
"Coordinates" -> Table[{100 Cos[phi], 100 Sin[phi]}, {phi, 0, Pi/4, 1/8 Pi/4}],
"MeshElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}}]}
]


This results in:

ToElementMesh: The element dimension of LineElement[{{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,8},{8,9}}] is not consistent with other elements that are of dimension 2.
ToElementMesh: A mesh could not be generated.


I used this example for 1D from the docs as a template (this is the only example of 1D element meshes from the docs):

ToElementMesh[
"Coordinates" -> Partition[Range[0., 1., 1/9], 1],
"MeshElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}}]}
]


The problem seems to be that the dimension of the "Coordinates" is {9,2} instead of {9,1}, but I haven't been able to figure out how to deal with this. Can this be done with ToElementMesh or is there another way to do this?

EDIT: This does what I wanted:

MeshRegion[
Table[{100 Cos[phi], 100 Sin[phi]}, {phi, 0, Pi/4, 1/8 Pi/4}],
Line[{1, 2, 3, 4, 5, 6, 7, 8, 9}]
]


• Have you seen MeshRegion and DiscretizeGraphics? Commented Jun 22, 2020 at 7:29
• @HenrikSchumacher Thanks for the tip, tried that now and DiscretizeGraphics does the trick! Commented Jun 22, 2020 at 7:33

When you use ToElementMesh the result will always be a mesh of the full region. What you want to do in this case is to generate a boundary mesh were the embedding dimension is not the same as the region dimension:

Needs["NDSolveFEM"]
ToBoundaryMesh[
"Coordinates" ->
Table[{100 Cos[phi], 100 Sin[phi]}, {phi, 0, Pi/4, 1/8 Pi/4}],
"BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4,
5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}}]}]

(* ElementMesh[{{70.7107, 100.}, {0., 70.7107}}, Automatic] *)

• Thank you for the explanation, this works. Commented Jun 22, 2020 at 8:08
• @inot12, you are welcome. Commented Jun 22, 2020 at 8:11