# Failure to create a mesh with ToElementMesh [closed]

When I created mesh by function with ToElementMesh, some errors occured. The code below is a minimal example. I can't understand why it failed.

Needs["NDSolveFEM"]
coordinates = {{0,0}, {1,0}, {1,1}, {0,1}};
meshinc = TriangleElement[{{1, 2, 4}}];
mesh = ToElementMesh["Coordinates" -> coordinates, "MeshElements" -> {meshinc}]


I think it should have succeeded in creating a triangle element with the vertexs of $(0,0)$, $(1,0)$, $(0,1)$, I know the nodes of the elements should be in the anticlockwise dieection, but it stilled failed. However, it will succeed when

meshinc = TriangleElement[{{1, 2, 3}}]


The code below also failed

mesh =
ToElementMesh[
"Coordinates" ->
{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}},
"MeshElements" -> {QuadElement[{{1, 2, 5, 4}}]}]


Could you explain my failures and advise me on some principles to use when creating a mesh?

## closed as off-topic by Michael E2, bbgodfrey, user9660, m_goldberg, Bob HanlonJan 4 '16 at 20:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, bbgodfrey, Community, m_goldberg, Bob Hanlon
If this question can be reworded to fit the rules in the help center, please edit the question.

• The reason is given in the error message. See my answer/long comment. – Michael E2 Jan 4 '16 at 13:50

The explanation is in the error message (emphasis mine):

ToElementMesh::fememins: The mesh elements are not valid. A set of valid mesh element incidents needs to be positive integers and be able to form a complete sequence starting from 1 to the largest incident present. There are missing incidents; a complete sequence cannot be formed. >>

It helps to give complete information in the question, by the way, including error messages.

• Thanks a lot @Michael E2, I'm using a Chinese version MMA, I think maybe I can switch to English :) – Ice0cean Jan 4 '16 at 13:53
• Oh I noted the message provided in Chinese, it looks so strange – Ice0cean Jan 4 '16 at 13:59
• @Ice0cean Ah. Do you mean the messages say something different in Chinese? – Michael E2 Jan 4 '16 at 13:59
• Yes, even I'm a native Chinese speaker, I can't understand what's the message means, it looks confusing. em, just like some Chinese characters's combination :( Maybe something wrong when translated to Chinese. – Ice0cean Jan 4 '16 at 14:06
• @Ice0cean Yes, it must take a lot of work to get all the translations correct. Consider reporting it to WRI, if you can. – Michael E2 Jan 4 '16 at 14:13