# Finite Element Method - 2D Mesh Generator - Metfem2D

## Mesh generator.

#### The boundary of the domain

The one of the most important issues to define is the domain boundary. After determining the boundary ΓA by the initial constant nodes (lines 1-18 of the presented below algorithm), the next task is to determine which new nodes are lying on boundary line segments Γ (as it is visible in Fig. 4). These selection is done with a help of the following algorithm:

1. For an initial node table p (nodes from 1 to N) find all pairs of neighbouring vertices.
2. Connect them by a segment line. If x1 - x2 ≠ 0 then a function y=ax+b exists and one can find pairs a, b for each such a line segment otherwise a vertical line x = a together with limits [y1, y2] must be found.
3. Establish the table of coefficients a, b.
4. For each new node check whether its coordinates (x, y) fulfill any of y=ax + b equations or x = a where y < y2 and y > y1
5. If yes classify it as a boundary node else classify it as an internal node.

Fig. 4 presents the square domain divided into a set of new elements Ωi with corresponding set of line segments Γi being its boundary. A way of finding new nodes constitutes the main point of the mesh generation process (see Sec. 3.2) while a selection of nodes is perform according to the algorithm from Sec. 3.3 a) nodes a,b,c,d have been classified as boundary nodes whereas b) nodes e,f,g have been determined as internal nodes.

### References

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