# Finite Element Method - 2D Mesh Generator - Metfem2D

## Transformation in local L-coordinates

Let us compute the determinant of the jacobian transformation between the global x, y and a local L1, L2, L3 coordinate frame. One notices immediately that the problem is degenerate. That is why, we introduce a new coordinate z as a linear combination of L1, L2, L3 i. e. z = L1 + L2 + L3. Note that z is not an independent coordinate and has a constant value equal 1. After taking into account relations Eq. (3) we find the jacobian matrix in the form

J(L1, L2, L3) ≡ ∂(x, y, z)/∂(L1, L2, L3) = ( ∂x/∂L1 ∂x/∂L2 ∂x/∂L3
∂y/∂L1 ∂y/∂L2 ∂y/∂L3
∂z/∂L1 ∂z/∂L2 ∂z/∂L3
) = (
 x1 x2 x3 y1 y2 y3 1 1 1
)

Furthermore, we have the relation between the jacobian and an element area

det(J) ≡ 2 Δ,

where Δ denotes the area of a triangle which is based on vertices (x1, y1), (x2, y2), (x3, y3). And finally, we obtain the coordinates transformation rule

dxdy = 2 ΔdL1dL2, and L3 = 1 - L1 - L2.

The relation between the gradient operator Δ in cartesian and in new coordinates is given by:

 [∂/∂x, ∂/∂y] = [∂L1/∂x ∂/∂L1 + ∂L2/∂x ∂/∂L2 + ∂L3/∂x ∂/∂L3, ∂L1/∂y ∂/∂L1 + ∂L2/∂y ∂/∂L2 + ∂L3/∂y ∂/∂L3]
[∂/∂x, ∂/∂y] = 1/(2Δ) [∂/∂L1, ∂/∂L2, ∂/∂L3] (
 a1 b1 a2 b2 a3 b3
) = [∂/∂L1, ∂/∂L2, ∂/∂L3] T

where Lk = (akx + bky + ck)/(2Δ) (k = 1, 2, 3) and a1 = y2 - y3, b1 = x3 - x2, c1 = x2y3 - x3y2, the rest of coeficients is obtained by cyclic permutation of indices 1, 2 and 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