Resources Introduction to the finite element method M. M. Sussman sussmanm@math.pitt.edu Office Hours: 11:1AM-12:1PM, Thack 622 May 12 June 19, 214 Strang, G., Fix, G., An Analysis of the Finite Element Method 2nd Edition, Wellesley-Cambridge Press, 28 FEniCS Book: Volume 84 of Springer Lecture Notes in Computational Science and Engineering series: Anders Logg, Kent-Andre Merdal, Garth Wells, Automated Solution of Differential Equations by the Finite Element Method ISBN: 978-3-642-2398-1 (Print) 978-3-642-2399-8 (Online) http://launchpad.net/fenics-book/trunk/final/ +download/fenics-book-211-1-27-final.pdf FreeFem++ Book: http://www.freefem.org/ff++/ftp/freefem++doc.pdf Reference: Hecht, F. New development in freefem++. J. Numer. Math. 2 (212), no. 3-4, 251-265. 65Y15 Zienkiewicz, O. C., The Finite Element Method in Engineering Science, McGraw-Hill, 1971. 1 / 34 2 / 34 Topics History Roots of method found in math literature: Rayleigh-Ritz Popularized in the 195s and 196s by engineers based on engineering insight with an eye toward computer implementation Winning idea: based on low-order piecewise polynomials with increased accuracy coming from smaller pieces, not increasing order. First use of the term Finite element in Clough, R. W., The finite element in plane stress analysis, Proc. 2dn A.S.C.E. Conf. on Elecronic Computation, Pittsburgh, PA, Sept. 196. Strang and Fix, first 5 pages: introduction 3 / 34 4 / 34
Topics Generalized derivatives Definition The space of C (Ω) functions whose support is a compact subset of Ω is denoted C (Ω) If a function f is differentiable, then df Ω dx φdx = Ω f dφ dx for all φ C. Definition If f is a measurable function and if there is a measurable function g satisfying Ω gφdx = Ω f dφ dx for all φ C, then g is said to be the generalized derivative of f. L 2 5 / 34 H k 6 / 34 Suppose Ω is a domain in R n u L 2 (Ω) u 2 = L 2 Ω u 2 < L 2 (Ω) is a Hilbert space with the inner product (u, v) = Ω uv L 2 (Ω) is the completion of C(Ω) under the inner product. L 2 contains functions that are measurable but continuous nowhere. A seminorm is given by u 2 k = D k u 2, where D k is any derivative of total order k H k is the completion of C k under the norm u 2 k = k i= u 2 k H = L 2 In 1D, functions in H 1 are continuous, but derivatives are only measurable. In dimensions higher than 1, functions in H 1 may not be continuous Functions in H 1 (Ω) have well-defined trace on Ω. 7 / 34 8 / 34
Topics A 2-point BVP d dx ( p(x) du ) + q(x)u = f (x) dx u() = du dx (π) = (BVP) Shape of a rotating string Temperature distribution along a rod 9 / 34 1 / 34 Theory Theory Suppose f L 2 (finite energy) Define linear operator L : HB 2 L2 L : u f from (BVP) Suppose f L 2 (finite energy) Define linear operator L : HB 2 L2 L is SPD L is 1-1 L : u f from (BVP) For each f L 2, (BVP) has a unique solution u H 2 B u 2 C f 11 / 34 11 / 34
A solution Variational form: minimization Assume p > and q are constants Orthonormal set of eigenvalues, eigenfunctions Expand λ n = p(n 1 2 )2 + q u n (x) = f (x) = π a n 2 sin(n 1 2 )x n=1 Converges in L 2 since f 2 = a n < f need not satisfy b.c. pointwise! Solution π 2 sin(n 1 2 )x Solving Lu = f is equivalent to minimizing I(v) = (Lv, v) 2(f, v) (f, v) = π f (x)v(x) dx (Lv, v) = π [ (pv ) + qv]v dx u = a n pi u n = λ n 2 a n sin(n 1 2 )x p(n 1 2 )2 + q Variational form: minimization 12 / 34 Variational form: minimization 13 / 34 Solving Lu = f is equivalent to minimizing I(v) = (Lv, v) 2(f, v) (f, v) = π f (x)v(x) dx (Lv, v) = π [ (pv ) + qv]v dx Integrating by parts: (Lv, v) = π [p(v ) 2 + qv 2 ] dx [pv v] π v satisfies b.c. Solving Lu = f is equivalent to minimizing I(v) = (Lv, v) 2(f, v) (f, v) = π f (x)v(x) dx (Lv, v) = π [ (pv ) + qv]v dx Integrating by parts: (Lv, v) = π [p(v ) 2 + qv 2 ] dx [pv v] π v satisfies b.c. [p(x)(v (x)) 2 + q(x)v(x) 2 2f (x)v(x)] dx 13 / 34 13 / 34
Variational form: stationary point Enlarge the search space Solving Lu = f is equivalent to finding u so that (Lu, v) = (f, v) for all v. Integrating by parts: (Lu, v) = π [p u v + q uv] dx [puv ] π Assume u and v satisfy b.c. a(u, v) = π [p u v + q uv] dx = (f, v) Enlarge space to any function that is limit of functions in H 2 B in the sense that I(v v k ) Only need H 1 Only the essential b.c. (v() = ) survives! Admissible space is H 1 E Solution function will satisfy both b.c. Euler equation from minimization of I(u) 14 / 34 15 / 34 Why only essential b.c.? Relaxing space of f f can now come from H 1 Functions whose derivatives are L 2 (also written H ) L : HE 1 H 1 Dirac delta function! From Strang and Fix. 16 / 34 17 / 34
Topics Start from the (minimization) variational form Replace HE 1 with sequence of finite-dimensional subspaces S h HE 1 Elements of S h are called trial functions Ritz approximation is minimizer u h I(u h ) I(v k ) v k S h Example: Eigenvectors as trial functions Assume p, q > are constants [p (v ) 2 + qv 2 2fv] dx Choose eigenfunctions = 1, 2,..., N = 1/h φ (x) = π 2 sin( 1 2 )x with eigenvalues λ = p( 1 2 )2 + q φ (x) 18 / 34 Example: Eigenvectors as trial functions Assume p, q > are constants [p (v ) 2 + qv 2 2fv] dx Choose eigenfunctions = 1, 2,..., N = 1/h φ (x) = π 2 sin( 1 2 )x with eigenvalues λ = p( 1 2 )2 + q φ (x) Plug in I(v k ) = N 1 [(v k ) 2 λ 2 π fv k φ dx] 19 / 34 2 / 34 2 / 34
Example: Eigenvectors as trial functions Assume p, q > are constants [p (v ) 2 + qv 2 2fv] dx Choose eigenfunctions = 1, 2,..., N = 1/h φ (x) = π 2 sin( 1 2 )x with eigenvalues λ = p( 1 2 )2 + q φ (x) Plug in I(v k ) = N 1 [(v k ) 2 λ 2 π fv k φ dx] Example: Eigenvectors as trial functions Assume p, q > are constants [p (v ) 2 + qv 2 2fv] dx Choose eigenfunctions = 1, 2,..., N = 1/h φ (x) = π 2 sin( 1 2 )x with eigenvalues λ = p( 1 2 )2 + q φ (x) Plug in I(v k ) = N 1 [(v k ) 2 λ 2 π fv k φ dx] Minimize: v k = π f φ dx/λ for = 1, 2,..., N Minimize: v k = π f φ dx/λ for = 1, 2,..., N Thus, u h = N 1 (f, φ )φ /λ 2 / 34 2 / 34 Example: Eigenvectors as trial functions Example: Eigenvectors as trial functions Assume p, q > are constants Assume p, q > are constants [p (v ) 2 + qv 2 2fv] dx [p (v ) 2 + qv 2 2fv] dx Choose eigenfunctions = 1, 2,..., N = 1/h φ (x) = π 2 sin( 1 2 )x with eigenvalues λ = p( 1 2 )2 + q Choose eigenfunctions = 1, 2,..., N = 1/h φ (x) = π 2 sin( 1 2 )x with eigenvalues λ = p( 1 2 )2 + q φ (x) φ (x) Plug in I(v k ) = N 1 [(v k ) 2 λ 2 π fv k φ dx] Plug in I(v k ) = N 1 [(v k ) 2 λ 2 π fv k φ dx] Minimize: v k = π f φ dx/λ for = 1, 2,..., N Minimize: v k = π f φ dx/λ for = 1, 2,..., N Thus, u h = N 1 (f, φ )φ /λ These are proections of true solution u = 1 (f, φ )φ /λ Thus, u h = N 1 (f, φ )φ /λ These are proections of true solution u = 1 (f, φ )φ /λ Converges as f /λ f / 2. 2 / 34 2 / 34
Example: Polynomials as trial functions Assume p, q > are constants Choose v k (x) = N =1 v k x v k () = I(v k ) = π [p( v k x 1 ) 2 + q( v k x ) 2 2f v k x ] dx Differentiating I w.r.t. v k gives N N system KV = F Topics where K i = piπi+ 1 i+ 1 + qπi++1 i++1 and F = π fx dx K is like the Hilbert matrix, very bad for n>12 Can be partially fixed using orthogonal polynomials 21 / 34 22 / 34 FEM Stiffness matrix Strang and Fix discuss FEM in terms of minimization form Customary today to use stationary form a(u, v) = π [p u v + q uv] dx (f, v) = π fv dx Find u HE 1(, π) so that a(u, v) = (f, v) for all v H1 (, π). Choose a finite-dimensional subspace S h HE 1 (, π) Find u h S h so that a(u h, v h ) = (f, v h ) for all v h S h. Functions v h are called test functions. Let {φ } N =1 be a basis of Sh u h (x) = n =1 uh φ (x) For each φ i, a(u h, φ i ) = π = [p u h φ φ i + q u h φ φ i ] dx ( π = K i u h = KU h pφ i φ + qφ i φ )u h dx K is the stiffness matrix 23 / 34 24 / 34
FEM: Piecewise linear functions Divide the interval [, π] into N subintervals, each of length h = π/n using N + 1 points x = ( 1)h for = 1,..., N + 1 Construct N hat functions φ φ (x i ) = δ i Piecewise linear φ () = At most 2 φ are nonzero on any element. φ (x) 1 Assembling the system Take p = q = 1 Elementwise computation, for e l = [x l 1, x l ] π Ki h = φ i φ + φ i φ dx = φ i φ + φ i φ dx l e l (f, φ i ) = b i = φ i f (x) dx l e l System becomes K h U h = b h ( 1)h ( +1)h π 25 / 34 26 / 34 First part: κ 1 = e l φ i φ More terms For each element, there is a Left endpoint and a Right endpoint e φ Lφ L = 1 h e φ Lφ R = 1 h e φ Rφ L = 1 h e φ Rφ R = 1 h For the first element, there is only a right endpoint 1 1 1 (h)(κ 1 ) = + 1 1 + + 1 1 1 1 2 1 (κ 1 ) = 1 1 2 1......... h 1 2 1 1 1 The second stiffness term is similar 4 1 (κ 2 ) = h 1 4 1......... 6 1 4 1 1 2 If f is given by its nodal values f i = f (x i ) then b = κ 2 f i. 27 / 34 28 / 34
Integration Topics In more complicated situations, it is better to compute the integrals using Gauß integration. This involves a weighted sum over a few points inside the element. 29 / 34 3 / 34 Error and convergence Theorem Suppose that u minimizes I(v) over the full admissible space H 1 E, and S h is any closed subspace of H 1 E. Then: 1. The minimun of I(v h ) and the minimum of a(u v h, u v h ), as v h ranges over the subspace S h, are achieved by the same function u h. Therefore a(u u h, u u h ) = min v h S ha(u v h, u v h ) 2. With respect to the energy inner product, u h is the proection of u onto S h. Equivalently, the error u u h is orthogonal to S h : a(u u h, v h ) = 3. The minimizing function satisfies a(u h, v h ) = (f, v h ) v h S h v h S h 4. In particular, if S h is the whole space H 1 E, then First error estimate (Cea) a(u u h, v) = (f, v) (f, v) = a(u u h, u u h ) = a(u u h, u v) + a(u u h, v u h ) Since u u h is not in S h, Since p(x) p >, So that a(u u h, u u h ) = a(u u h, u v) p u u h 2 1 ( p + q ) u u h 1 u v 1 u u h 1 p + q p u v 1 (Cea) Choose v to be the linear interpolant of u, so, from Taylor s theorem (integral form) u u h 1 Ch u 2 a(u, v) = (f, v) v H 1 E 31 / 34 32 / 34
Second error estimate (Nitsche) Error estimate steps Let w and w h be the true and approximate solutions of a(w, v) = (u u h, v) Clearly, u u h 2 = a(w, u u h ) And a(u u h, w h ) = So u u h 2 = a(u u h, w w h ) By Cauchy-Schwarz, u u h 2 a(u u h, u u h ) a(w w h, w w h ) 1. Cea tells us the error u u h 1 is smaller than the best approximation error 2. Choice of element tells us approximation error is O(h) in 1 3. Nitsche tells us to error is O(h 2 ) in These results are generally true! Applying first estimate, u u h 2 C 2 h 2 u 2 w 2 From definition of w, w 2 C u u h Finally, u u h Ch 2 u 2 33 / 34 34 / 34