# Finite Element Method - 2D Mesh Generator - Metfem2D

## Variational principles

We shall now look on the left hand of the Eq. (1) i. e. the integral expression Π

 Π = ∫ L(u, φ, ∂φ/∂x, ∂φ/∂y, …) dΩ. Ω

We are aimed at determining the appropriate φ continuous function for which the first variation δΠ vanish. If

 δΠ = κ (d/dκ Π[φ + κη])κ = 0 = 0

for any δφ then we can say that the expression Π is made to be stationary. The function φ is embed in a family of functions

φ + δφ = φ(x, y) + κη(x, y)

with the parameter κ. The variational requirement (equation above) gives vanishing of the first variation for any arbitrary η. In the presented article, the variational problem is limited to the case in which values of desired function φ at the boundary of the region of integration i. e. at the boundary curve Γ are assumed to be prescribed. Generally, the first variation of has the form

 δΠ = ∂Π/∂φ δφ + ∂Π/∂φx δ(φx) + ∂Π/∂φy δ(φy) + …

and vanishes when

 ∂Π/∂φ = 0, ∂Π/∂φx = 0, ∂Π/∂φy = 0, …

The condition above – presented gives the Euler's equations. Moreover, if the functional is quadratic i.e. if all its variables and their derivatives are in the maximum power of 2, then the first variation of has a standard linear form

 δΠ ≡ δ φT(K φ + f) = 0,

which represents, though, in matrix notation. A vector φ denotes all variational variables i. e. φ and its derivatives as it is written in Euler eqs. K denotes stiffness matrix (the FEM nomenclature ) and f is a constant vector (does not depend on φ). We are interested in finding solutions to the Poisson and the Laplace differential equations under some boundary conditions. These classes of differential problems can be represent in such a general linear form. Now, we construct a functional Π which the first variation gives the Poisson – type equation. Firstly, we define the functional Π in the form:

 Π = ∫ [ε/2 (∂φ/∂x)2 + ε/2 (∂φ/∂y)2 + ρφ] dxdy + ∫ (γ - 1/2φ)φdΓ, Ω Γ

where dΓ = (dx2 + dy2)1/2, ρ, γ andε can be functions of spacial variables x and y. Secondly, we find the first variation of Π

 δΠ = ∫ [ ε ∂φ/∂x δφx + ε ∂φ/∂yδφy + ρδφ] dxdy + ∫ (γ - φ)δφdΓ, Ω Γ

where δφx = ∂(δφ)/∂x. And after integration by parts and taking advantage of the Green's theorem one can simplify the above – written equation to the form

 δΠ = ∫ [ -ε ∂2φ/∂x2 - ε ∂2φ/∂y2 + ρ] dxdy + ∫ ε δφ ∂φ/∂n dΓ + ∫ (γ - φ)δφdΓ = 0, Ω Γ Γ

where ∂φ/∂n denotes the normal derivative to the boundary Γ. The expression within the first integral constitutes the Poisson equation

 -ε ∂2φ/∂x2 - ε ∂2φ/∂y2 + ρ = 0 in Ω

whereas the second term in the main equation gives the Neumann boundary condition

 ε ∂φ/∂n = 0 on Γ

and the third one represents the Dirichlet boundary condition

φ = γ on Γ.

Note. The above – presented calculation demonstrates a way in which one can incorporate the boundary conditions of Neumann or Dirichlet type into a variational expression Π. However, an appropriately formulated boundary – value problem must include only one kind of b.c. (Neumann or Dirichlet b.c.) defined on the whole boundary Γ or it is permitted to mix them but only in not self – overlapping way.

### References

1. ^ R. Courant, D. Hilbert, Methods of Mathematical Physics, Volume 1, Interscience Publisher, New York, 1953
2. ^ O. C. Zienkiewicz, R. L. Taylor and J. Z. Zhu, The Finite Element Method: Its Basis and Fundamentals, Sixth edition., Elsevier 2005