# Finite Element Method - 2D Mesh Generator - Metfem2D

## The Lagrange polynomials.

The Lagrange polynomials pk(x) are given by the general formula [1, 2]

 n pk(x) = ∏ (x - xi)/(xk - xi) i=1 i ≠ k

for k = 1, …, n.
It is clearly seen from the above – given expression that for x = xk pk(xk) = 1 and for x = xj such that j ≠ k pk(xj) = 0. Between nodes values of pk(x) vary according to the polynomial order i. e. n-1 which is the order of interpolation. Making use of these polynomials one can represent an arbitrary function φ(x) as

 φ(x) = ∑k pk(x) φk

On the other hand, when the interpolated function φ depends on two spacial coordinates one can define basis polynomials in the form

 pm(x, y) ≡ pIJ (x, y) = pI(x) pJ(y),

where I J describe row and column number for the m-th node in a rectangular lattice (rows align along x and columns along y direction, respectively). And consequently, the set {p1, …, pm, …, pn} is a basis of a n – dimensional functional space because each function pm for m = 1, …, n equals 1 at the interpolation node (xm, ym) and 0 at others. It is easy to demonstrate that such functions are orthogonal. Instead of spacial coordinates any other coordinates can be considered. In the case of mesh elements the natural coordinates are the area coordinates L defined already in the Sec. The mathematical concept of FEM. On that basis the shape functions could be constructed as a composition of these three basis polynomials i. e. Nm(L1,L2,L3) = paI(L1)pbJ(L2)pcK(L3) where the values of a, b and c assign the polynomial order in each Lk-th coordinate and I, J and K denote the m-th node position in a triangular lattice (i. e. in the coordinates L1, L2 and L3, respectively).

In the  could be found a comprehensive description of various elements belonging to the triangular family starting from a linear through quadratic to cubic one. For simplicity, in the article only the linear case is looked on. It explicitly means that shape functions Nk = Lk(x, y), where k = 1, 2, 3, change between two nodes linearly (see Eq. (3)).

### References

1. ^ O. C. Zienkiewicz, R. L. Taylor and J. Z. Zhu, The Finite Element Method: Its Basis and Fundamentals, Sixth edition., Elsevier 2005
2. ^ A. Kendall, H. Weimin, Theoretical Numerical analysis, A Functional Analysis Framework, Third Edition., Springer 2009