# Finite Element Method - 2D Mesh Generator - Metfem2D

## Mesh generator.

### Adding new nodes to the mesh

In this section, let us start with the procedure that allows us to add new mesh nodes to the existing ones. The initial configuration of the nodes were already defined. It must define well the shape of the divided area in aspects explained in the description of the Figure 3. These initial nodes are called the constant nodes and are kept immobile through the rest of the algorithm steps. Each triangle could be split up into two new triangles by adding a new node to its longest bar. To avoid producing triangles much smaller than defined by the element size h only part of them could be broken up i. e. these for which the triangle area is one and half times bigger than A. That condition is set in the algorithm by introducing a new control parameter Csplit. The new node is added in the middle of the triangle longest bar.

Fig. 3 presents a division process of non – regular and circular domains together with their boundaries. Pictures a) and c) show meshes with new nodes. Some of them are of the illegal type (defined in Sec. 3.2). These nodes constitute starting points for next complementary division that transforms such not well – defined elements into the correct ones, see pictures b) and d).

There is a need to underline that presented above algorithm is not quite optimal because some of the new nodes could produce triangles with one edge divided by a node resulting from splitting up an adjacent triangle (see Fig. 3). Such triangles are not desirable [1] and are denoted as illegal (see Figure 3a) and Figure 3c)). Thus the previous procedure needs to be improved. Let us add a few extra steps to it:
For each triangle Tk ∈ Ω perform checking whether it is of illegal type. If so, split it up into two new properly defined triangles by connecting so – called illegal node with the vertex of Tk lying oppositely to it. Remove the old Tk triangle. That is it.
Figures Fig 3b) and Fig 3d) show meshes having only desired elements.

### References

1. ^ O. C. Zienkiewicz, R. L. Taylor and J. Z. Zhu, The Finite Element Method: Its Basis and Fundamentals, Sixth edition., Elsevier 2005