Numerical Solutions to Differential Equations Lecture Notes The Finite Element Method #2 Peter Blomgren, blomgren.peter@gmail.com Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research Center San Diego State University San Diego, CA 92182-7720 http://terminus.sdsu.edu/ Spring 2015 Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (1/24)
Outline 1 The Finite Element Method Recap Looking for Solutions... 2 Identifying a Linear System... Properties of the Stiffness Matrix 3 Building the Toolbox Error Control 4 Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (2/24)
Recap Looking for Solutions... Quick Recap I/III Last time we formulated the Galerkin (variational, (V h )) and Ritz (minimization, (M h )) methods which will give us the finite element solutions to the differential equation (D): u = f, + Dirichlet Boundary Conditions The Function Space V h : Given the basis functions φ i (the tent functions) we can write V h = { v : v = } N η i φ i (x). i=1 Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (3/24)
Recap Looking for Solutions... Quick Recap II/III Inner Products: We defined the two (for now identical) inner products: a(u,v) = I uv dx, (u,v) = Further, we defined the energy functional: F(u) = 1 2 a(v,v ) (f,v). I uv dx. Given these definitions we formulated the Galerkin and Ritz problems... Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (4/24)
Recap Looking for Solutions... Quick Recap III/III Galerkin s Method (Variational Approach) (V h ) Find u h V h so that a(u h,v h ) = (f,v h) v h V h. Ritz Method (Minimization Approach) (M h ) Find u h V h so that F(u h ) F(v h ) v h V h. Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (5/24)
Recap Looking for Solutions... Looking for the Solution... If u h V h is a solution to (V h ), then in particular a(u h,φ j) = (f,φ j ), j = 1,2,...,N. Also, we can write u h in terms of the basis functions: u h (x) = N ξ j φ j (x), ξ j = u h (x j ). j=1 Therefore we can rewrite the above equation N ξ i a(φ i,φ j) = (f,φ j ), j = 1,2,...,N. i=1 Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (6/24)
Identifying a Linear System... Properties of the Stiffness Matrix The Stiffness Matrix and Load Vector From N ξ i a(φ i,φ j) = (f,φ j ), j = 1,2,...,N i=1 we identify the vectors ξ = {ξ 1,ξ 2,...,ξ N } T, and b = {b 1,b 2,...,b N } T, where b i = (f,φ i ), and the matrix A, where A ij = a(φ i,φ j ). We can now write our problem as A ξ = b. For historical reasons (Structural Mechanics) A is known as the stiffness matrix, and b as the load vector. Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (7/24)
Identifying a Linear System... Properties of the Stiffness Matrix Computing the Stiffness Matrix The elements of the stiffness matrix can be computed: First we notice that if the basis is the piecewise linear tent-functions, then if i j > 1, then φ i and φ j are non-overlapping which means a(φ i,φ j ) = 0. The Diagonal Entries, j = 1,2,...,N. a(φ j,φ j) = xj x j 1 1 h 2 j dx + xj+1 1 x j hj+1 2 dx = 1 + 1 h j h j+1 The Super- and Sub-Diagonal Entries, j = 2,3,...,N. a(φ j 1,φ j) = a(φ j,φ j 1) = xj x j 1 1 h j 1 h j dx = 1 h j Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (8/24)
Identifying a Linear System... Properties of the Stiffness Matrix Illustration: Overlapping and Nonoverlapping Tent-Functions 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 0 0 1 2 3 4 5 Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (9/24)
Identifying a Linear System... Properties of the Stiffness Matrix The Stiffness Matrix is Symmetric Positive Definite (SPD) A is symmetric since a(u,v) = a(v,u), and with v(x) = N i=1 η jφ i (x) we get N N N η i a(φ i,φ j)η j = a η i φ i, η j φ j = i,j=1 i=1 j=1 I [v h (x)]2 dx 0 Equality holds if and only if v (x) 0, which implies v(x) 0 by the boundary conditions. Fact: A matrix A is SPD if x T Ax > 0, x R n \{0} Fact: An SPD matrix (i) has positive eigenvalues, (ii) is nonsingular. Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (10/24)
Identifying a Linear System... Properties of the Stiffness Matrix The Special Case h j = h, j = 1,2,...,N If we equi-partition the interval we get the linear system 2 1 0...... 0. 1 2 1... 1. 0.............. h............. ξ = 0.... 1 2 1 0...... 0 1 2 If we divide by h the we recover the standard finite difference method for the problem, where the right hand-side b j = xj+1 x j 1 f(x)φ j dx is a weighted mean of f(x) over the interval [x j 1,x j+1 ]. Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (11/24) b 1 b 2... b N
Building the Toolbox Error Control Estimating the Error for the Model Problem We are now going to look at the error (u u h ) where u is the exact solution of the differential equation, and u h is the solution to the finite element problem (V h ). Since V h V, a(u,v h ) = (f,v h), v h V h a(u h,v h ) = (f,v h), v h V h a((u u h ),v h ) = 0, v h V h That means that the error is orthogonal to the function space V h (as measured by a(, ).) Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (12/24)
Building the Toolbox Error Control Definition and Tools Definition (The L 2 -norm (L 2,a?)) w 2 = a(w,w) = 1 0 w 2 dx Theorem (Cauchy s Inequality) a(v,w) v w Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (13/24)
Building the Toolbox Error Control Cauchy s Inequality: Proof Cauchy s Inequality. Given v and w, define the renormalized functions v = v v and ŵ = w w. Which means v = ŵ = 1. Now Hence, 0 ± v ŵ 2 = a(± v ŵ,± v ŵ) = a( v, v) 2a( v,ŵ)+a(ŵ,ŵ) = 2 2a( v,ŵ). a( v,ŵ) 1. Removing the linear normalization factors give a(v,w) v w. Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (14/24)
Building the Toolbox Error Control Error Control Theorem Theorem For any v h V h we have (u u h ) (u v h ). So, measured in the L 2 -norm of the derivative (also known as the H 1 -seminorm), the solution u h to the discrete problem is closer to the solution u to the original continuous ODE than any other function in the function space V h. Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (15/24)
Building the Toolbox Error Control Error Control Proof Proof. Let v h V h be arbitrary, and set w h = u h v h. Then w h V h and we get: (u u h ) 2 = a((u u h ),(u u h ) )+a((u u h ),w h) }{{} =0 = a((u u h ),(u u h +w h ) ) = a((u u h ),(u v h ) ) {Cauchy s} (u u h ) (u v h ). Dividing through by (u u h ) gives (u u h ) (u v h ). Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (16/24)
Building the Toolbox Error Control Error Control Applying the Theorem From the theorem we can get a quantitative estimate (upper bound) for the error (u u h ) by estimating (u v h ) where v h V h is a suitably chosen function. Let v h be the linear interpolant of u, i.e. v h (x j ) = u(x j ), then u (x) v h (x) hmax x [0,1] u (x) [1] u(x) v h (x) h2 8 max x [0,1] u (x) [2] The first result and the theorem gives Similarly, from [2], we can get (u u h ) C 1 h max x [0,1] u (x). u(x) u h (x) C 2 h 2 max x [0,1] u (x). Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (17/24)
Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... FEM for PDEs the Poisson Equation Consider the following boundary value problem u = f u = 0 in Ω on Γ = Ω, where Ω is a bounded domain in R 2 = {(x 1,x 2 ) : x 1 R,x 2 R}. Γ is the boundary of Ω, f(x 1,x 2 ) a given function, and [ 2 u = x 2 1 ] + 2 x2 2 u(x 1,x 2 ) = u x1 x 1 (x 1,x 2 )+u x2 x 2 (x 1,x 2 ). Physical problems: Our simple 1-D model problems from last lecture carry over to this 2-D model: heat distribution in a plate, the displacement of an elastic membrane fixed at the boundary under transverse load, etc... Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (18/24)
Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... Vector Calculus Review (or Crash Course) I/III We need to generalize integration by parts to higher dimensions... We start with the divergence theorem: ũd x = ũ ñds, Ω where ũ = {u 1,u 2 } T, and ũ = u 1 x 1 + u 2 x 2. ñ = {n 1,n 2 } T is the unit (length-one, outward) normal to Γ. d x denotes area-integration, and ds integration along the boundary. c.f. in 1-D: du [a,b] dx dx = u( 1)ds = u(a)+u(b) {a,b} Γ Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (19/24)
Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... Vector Calculus Review (or Crash Course) II/III If we apply the divergence theorem to the vector functions ũ 1 = (vw,0) and ũ 2 = (0,vw), we find v w +v w d x = vwn i ds, i = 1,2. x i x i Ω Let v denote the gradient v = Γ { v, v } T, x 1 x 2 and use the result above to write Green s Formula Ω v w d x [ ] v w Ω x 1 x 1 + v w x 2 x 2 d x = [ ] Γ v w x 1 n 1 +v w x 2 n 2 ds [ Ω v 2 w x1 2 = Γ v w n ds Ωv w d x. ] + 2 w d x x2 2 Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (20/24)
Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... Vector Calculus Review (or Crash Course) III/III The normal derivative w n = w n 1 + w n 2 = w ñ x 1 x 2 is the derivative in the outward normal direction to the boundary Γ. With this notation we are ready to state the variational formulation corresponding to the differential equation... Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (21/24)
Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... Variational Formulation where (V) Find u V so that a(u,v) = (f,v), v V. V = a(u,v) = Ω (f,v) = u v d x Ω fv d x v : v C(Ω) v x1 and v x2 are piecewise continuous in Ω v = 0 on Γ Note: We have slightly changed the notation of the a(, ) inner-product. This is very common in the PDE framework. The a(, ) innerproduct generically involves integrating the product(s) of derivative(s) of the two arguments over the domain. Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (22/24)
Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... Minimization Formulation u is a solution to (V) if and only if it is also a solution to the following minimization problem. (M) Find u V such that F(u) F(v) v V, where F(v) is the potential energy F(v) = 1 2 a(v,v) (f,v). Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (23/24)
Initial Example: The Poisson Equation Analytical Tools: Vector Calculus Variational Formulation Minimization Formulation The Road Ahead... Next... Constructing a Finite Element Method for this problem... Peter Blomgren, blomgren.peter@gmail.com Numerical Solutions to Differential Equations (24/24)