
An Introduction to the Finite Element Method (FEM) for Differential Equations in 1D Mohammad Asadzadeh June 24, 2015 Contents 1 Introduction 1 1.1 Ordinarydifferentialequations(ODE) . 1 1.2 Partialdifferentialequations(PDE) . 2 1.2.1 Exercises.......................... 8 2 PolynomialApproximationin1d 9 2.1 Overture.............................. 9 2.1.1 Basis function in nonuniform partition . 14 2.2 Variationalformulationfor(IVP) . 17 2.3 Galerkinfiniteelementmethodfor(2.1.1) . 19 2.4 AGalerkinmethodfor(BVP) . 21 2.4.1 Thenonuniformversion . 26 2.5 Exercises.............................. 27 3 Interpolation,NumericalIntegrationin1d 31 3.1 Preliminaries ........................... 31 3.2 Lagrangeinterpolation . 39 3.3 Numericalintegration,Quadraturerules . 41 3.3.1 Composite rules for uniform partitions . 44 3.3.2 Gaussquadraturerule . 48 4 Two-pointboundaryvalueproblems 53 4.1 ADirichletproblem ....................... 53 4.2 Thefiniteelementmethod(FEM). 58 4.3 Errorestimatesintheenergynorm . 59 4.4 FEM for convection–diffusion–absorption BVPs . 65 4.5 Exercises.............................. 72 iii iv CONTENTS 5 ScalarInitialValueProblems 81 5.1 Solutionformulaandstability . 82 5.2 Finitedifferencemethods. 83 5.3 GalerkinfiniteelementmethodsforIVP . 86 5.3.1 ThecontinuousGalerkinmethod . 87 5.3.2 ThediscontinuousGalerkinmethod . 90 5.4 Exercises.............................. 92 6 InitialBoundaryValueProblemsin1d 95 6.1 Heatequationin1d........................ 95 6.1.1 Stabilityestimates . 96 6.1.2 FEMfortheheatequation. .100 6.1.3 Exercises..........................104 6.2 Thewaveequationin1d . .106 6.2.1 WaveequationasasystemofPDEs . 107 6.2.2 The finite element discretization procedure . 108 6.2.3 Exercises..........................111 A Answers to Exercises 115 BAlgorithmsandMATLABCodes 121 Table of Symbols and Indices 135 CONTENTS v Preface and acknowledgments. This text is an elementary approach to finite element method used in numerical solution of differential equations in one space dimension. The purpose is to introduce students to piecewise poly- nomial approximation of solutions using a minimum amount of theory. The presented material in this note should be accessible to students with knowl- edge of calculus of single- and several-variables and linear algebra. The theory is combined with approximation techniques that are easily implemented by Matlab codes presented at the end. During several years, many colleagues have been involved in the design, presentation and correction of these notes. I wish to thank Niklas Eriksson and Bengt Svensson who have read the entire material and made many valu- able suggestions. Niklas has contributed to a better presentation of the text as well as to simplifications and corrections of many key estimates that has substantially improved the quality of this lecture notes. Bengt has made all xfig figures. The final version is further polished by John Bondestam Malm- berg and Tobias Geb¨ack who, in particular, have many useful input in the Matlab codes. vi CONTENTS void Chapter 1 Introduction In this lecture notes we present an introduction to approximate solutions for differential equations. A differential equation is a relation between a function and its derivatives. In case the derivatives that appear in a differential equa- tion are only with respect to one variable, the differential equation is called ordinary. Otherwise it is called a partial differential equation. For example, du u(t)=0, (1.0.1) dt − is an ordinary differetial equation, whereas ∂u ∂2u =0, (1.0.2) ∂t − ∂x2 ∂u ∂2u is a partial differential (PDE) equation. In (1.0.2) ∂t , ∂x2 denote the partial derivatives. Here t denotes the time variable and x is the space variable. We shall only study one space dimentional equations that are either stationary (time-independent) or time dependent. Our focus will be on the following equations: 1.1 Ordinary differential equations (ODE) An example of population dynamic as in (1.0.1) • du λu(t)= f(t), (1.1.1) dt − 1 2 CHAPTER 1. INTRODUCTION where λ is a constant and f is a source function. A stationary (time-independent) heat equation as • d2u = f(x), (1.1.2) −dx2 A stationary convection-diffusion equation • d2u du + = f(x), (1.1.3) −dx2 dx where f(x) is a source function. 1.2 Partial differential equations (PDE) The heat equation • ∂u ∂2u = f(x). (1.2.1) ∂t − ∂x2 The wave equation • ∂2u ∂2u = f(x). (1.2.2) ∂t2 − ∂x2 The time depending convection-diffusion or reaction-diffusion equation • ∂u ∂2u ∂u + = f(x). (1.2.3) ∂t − ∂x2 ∂x Some notation. For convenince we shall use the following notation: ∂u ∂2u ∂u ∂2u u˙ = , u¨ = , u′ = , u′′ = . ∂t ∂t2 ∂x ∂x2 Example 1.1 (Initial Conditions). Consider the simple equation u˙(t)= t. Evidently, u(t) = t2/2, is a solution. But, for any constant C, t2/2+ C is also a solution. In this way we have infintely many solutions (one for each constant C). To determine a unique solution we need to supply the equation with one extra condition. Since the time variable t is always assumed to be t 0, if we know the value of u(t), e.g., at the beginning, i.e., the initial ≥ value e.g., u(0) = 3, then u(t)= t2/2+3 is the unique solution to the initial value problem: u˙(t) = t, u(0) = 3. A differential equation associated with initial conditions is an initial value problem. 1.2. PARTIAL DIFFERENTIAL EQUATIONS (PDE) 3 Example 1.2 (Boundary Conditions). Likewise u(x)= x2/2 is a solu- 2 − tion to u′′(x)=1. But also all u(x) = x /2+ Ax + B are solutions, for all arbitrary− constants A and B. Therefore,− to determine a unique solution u(x) we need to determine some fixed values for A and B, hence we need to supply two conditions. Here if e.g., x belongs to a bounded interval, say, [0, 1], then given the boundary values u(0) = 1 and u(1) = 0, we get from u(x) = x2/2+ Ax + B that B = 1 and A = 1/2. Thus the solution to − − the the initial boundary value problem: u′′(x)=1, u(0) = 1, u(1) = 0 is: u(x) = x2/2 x/2+1. The generale− rule is that one should supply as many conditions− as− the highest ordre of the derivative in each variable. So, for example, for the hear equation u˙ u′′ = 0, to get a unique solution we − nedd to supply one initial condition (there is one time derivative in the equa- tion) and two boundary conditions (there are two derivatives in x), whereas for the wave equation u¨ u′′ = 0 we have to give two conditions in each variable x and t. A differential− equation with supplied boundary conditions is a boundary value problem. Objectives: For f being a simple elementary function (a polynomial, a trigonometric, or exponential type function or a combination of them), the equations (1.1.1)-(1.2.3), associated with suitable initial and boundary condi- tions, have often closed form analytic solutions. But real problems: general two and three dimensional problems, modeled by equations with variable cefficients and in complex geometry, are seldom analytically solvable. In this note our objective is to introduce numerical methods that ap- proximate solutions for differential equations by polynomials. To check the quality (reliability and efficiency) of these numerical methods, we choose to apply them to the equations (1.1.1)-(1.2.3), where we already know their an- alytic solutions. Below we shall give examples of analytic solutions to ODEs: (1.1.1)-(1.1.3). For examples on analytic solutions for the PDEs: (1.2.1)- (1.2.3), we refer to the separation of variables technique introduced in the second part of our course. Example 1.3. Determine the solution to the initial value problem u˙(t) λu(t)=0, u(0) = u , (1.2.4) − 0 assuming that u(t) > 0, for all t, λ =1 and u0 =2. Solution. Since u(t) = 0, for all t, we may divide the equation (1.2.4) by 6 4 CHAPTER 1. INTRODUCTION u˙ (t) u(t) and get u(t) = λ. Relabeling t by s and integrating over (0,t) we get t t t u˙(s) t ds = λ ds = ln u(s) = λ[s]0. (1.2.5) 0 u(s) 0 ⇒ 0 Z Z h i Hence we have u(t) ln u(t) ln u(0) = λt or ln = λt. (1.2.6) − u(0) Thus u(t) = eλt, i.e. u(t)= u eλt. (1.2.7) u(0) 0 t Consequently, with λ = 1 and u0 = 2 we have u(t)=2e . To derive solutions to our examples on a systematic way, we recall the pro- cedure for determining a particular solution up to a second order differential equation with constant coefficiets of the form: u′′(x)+ au′(x)+ bu(x)= f(x). (1.2.8) 1. If f(x) = a polynomial of degree n. Set i) u (x)= a + a x + + a xn, if b =0 p 0 1 ··· n 6 ii) u (x)= x(a + a x + + a xn), if b =0,a =0 p 0 1 ··· n 6 2. If f(x) = (polynom) eσx. Set × σx i) up(x)= z(x)e . This gives a new differential equation for z solved by 1). σx ii) up(x)= Ae , if polynom = constant. This works if σ2 + aσ + b = 0: i.e. σ is not a root to the characteristic equation. 6 3. If f(x)= p cos(ωx)+ q sin(ωx). Set 2 i) up(x) = C cos(ωx)+ D sin(ωx), for ω + aiω + b = 0, i.e., if iω is not a root to the characteristic− equation.6 ii) u (x)= x(C cos(ωx)+D sin(ωx)), if ω2 +aiω +b = 0. p − 1.2. PARTIAL DIFFERENTIAL EQUATIONS (PDE) 5 Example 1.4. Find all solutions to the differential equation u′′(x) u(x) = cos(x).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages142 Page
-
File Size-