Finite Element Methods An Introduction using Variational Calculus Pouya Bastani . – p.1/18 Outline Introduction History and Application Overview of FEM Variational Calculus Finite Element Method Implementation Numerical Results . – p.2/18 Introduction The finite element method (FEM) is a technique in finding approximate solutions of partial differential equations One approach is based one eliminating the differential equation completely and work with a minimization problem Advantages: Flexibility with respect to boundary conditions and gemetries It is easy to incorporate adequate spatial resolution by varying the element size manually or adaptively Issues: Implementation is often ‘tough’ Works best for diffusion-dominated problems; criticized for its inability to handle convection-dominated problems occurring, for example in high-speed flows . – p.3/18 History and Application Mid-1950’s: Origin of the FEM based on variational techniques Initially used for solving problems in aeronautical and civil engineering Later generalized for a broader ranger of differential equations, with applications in fluid mechanics and structural dynamics Late 1960’s: new formulation by the method of weighted residuals Weighted residual method has the advantage that it can be applied when there is no variational formulation for the problem . – p.4/18 Overview of FEM In FEM, the domain of the problem is divided into smaller subregions 1D: lines, 2D: triangles or quadrilaterals, 3D: tetrahedra and prisms Approximate the unknown function by a set of simple functions Replace the original problem with an integral formulation Weighted residual and variational methods . – p.5/18 Variational Calculus - 1D The goal is to find a minimizing function u(x) for the functional F (u) = Z b f (x, u(x), u′ (x)) dx (1) a Thus, for all functions η(x) we require that d =0 F (u(x) + ǫη(x)) dǫ ǫ=0 (2) Regarding ǫη(x) as a small variation about u(x), Taylor expansion gives f (x, u + ǫη, u′ + ǫη ′ ) ≈ f (x, u, u′ ) + ǫfu (x, u, u′ )η + ǫfu′ (x, u, u′ )η ′ It follows that F (u + ǫη) = F (u) + ǫ Z b fu (x, u, u′ )η + fu′ (x, u, u′ )η ′ dx (3) a . – p.6/18 Euler-Lagrange Equations Applying condition (2) and integrating by parts gives Z b fu (x, u, u′ )η + fu′ (x, u, u′ )η ′ dx a Z b b d fu′ η dx = fu′ η + fu − dx x=a a 0 = By the fundamental lemma of variational calculus, d fu′ = fu dx fu′ (a, u(a), u′ (a))η(a) = 0 fu′ (b, u(b), u′ (b))η(b) = 0 (4) (5) In general, this results in a second order boundary value problem. If u(a) is given, we require η(a) = 0; otherwise, fu′ = 0 at x = a (similarly for x = b). . – p.7/18 Example Deduce a BVP by minimizing the functional below with u(1) = 1 F (u) = Z 3 {−(u′ )2 − 4u} dx + 12u(3) 1 Because u(1) is given, we require η(1) = 0, but otherwise, η(x) is arbitrary. F (u + ǫη) = F (u) − ǫ Z 3 ′ ′ {2u η + 4η} dx − 12η(3) − ǫ 1 2 Z 3 (η ′ )2 dx 1 Condition (2) along with integration by parts gives Z 3 (2u′′ − 4)η dx + (12 − 2u′ (3))η(3) = 0 1 Thus, we obtain u′′ = 2 u(1) = 1 u′ (3) = 6 . – p.8/18 Weak Solution A second order BVP can be transformed into a minimization problem where only the first derivatives occur This was due to integration by parts which transfered the derivative from the minimizer u(x) to the variation η(x). Thus, in finding the solutions, we do not require the approximation u(x) to be twice-differentiable. In fact, in many simple application, u is only once-differentiable FEM is based on this weak formulation of the BVP and discards with the twice-differentiabiliy condition required by the strong form of the BVP. . – p.9/18 FEM in 2D The techniques of minimization in 1D can be extended to 2D. For example, it can be shown that if u(x, y) = g1 (x, y) for (x, y) ∈ Γ1 , then minimizing Z ZZ 2 b u a −g2 u + h ds f = |∇u|2 + u2 + hu dA + F (u) = 2 2 2 Γ2 Ω is equivalent to solving the following BVP: ∇ · (a∇u) − bu = h for (x, y) ∈ Ω (6) u = g1 for (x, y) ∈ Γ1 (7) an̂ · ∇u = g2 for (x, y) ∈ Γ2 (8) where we assume the domain Ω has boundary Γ = Γ1 ∪ Γ2 . . – p.10/18 Discritization The domain Ω is approximated by a finite set of triangles, on each of which, the function u is replaced by a linear function determined by the three values of u at the corners. Integral over the domain splits into a sum of integrals over each triangle. We seek an approximation of the form Φ(x, y) = m X cj φj (x, y) j=1 where φ1 , . . . , φm are linearly independent piecewise-linear polynomials with weighting constants c1 , . . . cm . For a minimum to occur, ∀j = 1, . . . , n ∂F =0 ∂cj This leads to a set of equations which can be written as Ac = b . – p.11/18 Implementation Online software written by Ed Bueler which uses Persson and Strangs mesh generator. Solves the Poisson’s equation ∆u = −f in Ω, u = 0 on Γ (9) 2D hat function as the approximating function Bueler formulates the problem in terms of a reference triangle R = {(ξ1 , ξ2 ) : ξ1 + ξ2 ≤ 1, ξ1 , ξ2 ≥ 0} and computes all the integrals by a change of variable from domain triangles to the reference triangle. . – p.12/18 Numerical Results Solution of (9) on a circular domain of radius 1 with f (x, y) = 4 Average triangle side: h = 0.05 . – p.13/18 Convergence Rate Exact solution of (9) is u(x, y) = 1 − x2 − y 2 . Knowing approximate solutions, ũh (xi , yj ), the error was computed as eh = ||ũh − u||∞ for h = h0 , αh0 , . . . , α12 h0 , where α = 4/5 and h0 = 0.5. Line slope in loglog plot ≈ 2.3, so the error is ≈ O(h2 ). . – p.14/18 Other boundaries Outer circle of radius 2 and inner circle or radius 1 f (x, y) = x + y . – p.15/18 Outer circle or radius 2 and inner square of side 1 f (x, y) = x + y . – p.16/18 Solution of Poisson Equation 0.25 0.2 0.15 0.1 0.05 0 −0.05 −0.1 −0.15 −0.2 −0.25 2 1 0 −1 −2 y −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 x Outer square of side 2 and inner off-centered ellipse f (x, y) = sin(x) cos(y) . – p.17/18 References [1] E. Bueler. Poisson’s Equation by the FEM using a Matlab Mesh Generator, Math 692 Seminar in Finite Elements. 2004 [2] P. Persson, G. Strang. A Simple Mesh Generator in Matlab, SIAM Review, Volume 46 (2), pp. 329-345, June 2004 [3] A. Stahel. Calculus of Variations and Finite Elements, 2005 [4] R.L. Burden, J.D. Faires. Numerical Analysis, Thomson Brooks/Cole, 2005. [5] R.E. Lewis, J.P. Ward. The Finite Element Method: principles and applications, Addison-Wesley, 1991. [6] C. Pozrikidis. Introduction to Finite and Spectral Element Methods using Matlab, Chapman & Hall/CRC, 2005. [7] G.A. Hansen, Rod W. Douglass, A. Zardecki. Mesh Enhancement: selected elliptic0 methods, Foundations and applications, Imperial College Press, 2005 . – p.18/18