Platzhalter für Bild, Bild auf Titelfolie hinter das Logo einsetzen Introduction to PDEs and Numerical Methods Lecture 6: Numerical solution of the heat equation with FD method: method of lines, Euler forward, Euler backward, the Theta method, and their stability Dr. Noemi Friedman, 22..207.
Overview of the course Introduction (definition of PDEs, classification, basic math, introductory examples of PDEs) Analytical solution of elementary PDEs (Fourier series/transform, separation of variables, Green s function) Numerical solutions of PDEs: Finite difference method Finite element method 22..207. PDE lecture Seite 2
Overview of this lecture Finite difference operators The heat equation Analytical solution Semidiscretization- Method of Lines (spatial discretization) Time discretization Euler foward Euler backward The theta-method Consisteny, stability, convergence 22..207. PDE lecture Seite 3
We only analyse now the hom. equation - why can we do that? d u = Au(t) + f dt Instead of analyzing stability of the inhomogenous case, we discretize the homogenous one. We can do that, because of the following. Let s take a stationary function u 0 for which the equation: d dt u 0 = Au 0 + f = 0 holds. And let s suppose, that the solution can be written in the form u t = u 0 + v(t) r.h.s: Au t + f = Au 0 + f + Av t = Av t l.h.s: = 0 d dt u t = d dt u 0 + v t = d v t dt d v t = Av t dt 22..207. Dr. Noemi Friedman PDE lecture Seite 4
Heat equation Comparism of the solutions: analytical and method of lines Homogeneous equation (no internal source term): d u = Au(t) dt Analytical solution with hom. BC: u x, t = j d j e ω j 2 βt sin ω j x ω j = jπ l j = 0,,2.. as t u 0 With method of lines: u t = i c i e λ i(t t 0 ) v i λ i = 2β2 h 2 cos iπ N > 0 < as t u 0 23..206.. Dr. Noemi Friedman PDE lecture Seite 5
2.) Euler forward - explicit Euler forward: approximate time derivate with the forward difference u j (t) t = β2 h 2 u j 2u j + u j+ + O(h 2 ) u j,n = u j,n+ u j,n + O() u n = u n+ u n = Au n u j,n+ u j,n = β2 h 2 u j,n 2u j,n + u j+,n + O h 2 + O() Stable? (does it give decaying solution?) B = β2 h 2 2 2 2 2 2 2 + 22..207. Dr. Noemi Friedman PDE lecture Seite 6
2.) Euler forward d-tour on eigenvalues and eigenvectors Stable? (does it give decaying solution?) u n+ = Bu n u n+2 = B 2 u n u n+3 = B 3 u n u n+k = B k u n Some discussion about egienvalues and eigenvectors: Av i = λ i v i AV = DV V AV = D V AV is a diagonal matrix, with the eigenvalues in the diagonal. D = V = λ λ 2 λ n λ n v v 2 v n v n 22..207. Dr. Noemi Friedman PDE lecture Seite 7
Eigenvalues, eigenvectors change of basis (coordinate system) How to write an arbitrary vector, u, in a new basis v (), v (2), v (3) What is V AV? u = u e + u 2 e 2 + u 3 e 3 u = u v () + u 2 v (2) + u 3 v (3) v () () () () = v e + v 2 e2 + v 3 e3 v (2) (2) (2) (2) = v e + v 2 e2 + v 3 e3 v (3) (3) (3) (3) = v e + v 2 e2 + v 3 e3 u = u () () () v e + v 2 e2 + v 3 e3 + + u 2 (2) (2) (2) v e + v 2 e2 + v 3 e3 + + u 3 (3) (3) (3) v e + v 2 e2 + v 3 e3 + v (3) v (2) e 2 u e e 3 u v () u = e u v () + u2 v (2) + u3 v (3) u 2 e 2 () (2) (3) u v 2 + u2 v 2 + u3 v 2 e 3 () (2) (3) u v 3 + u2 v 3 + u3 v 3 + + + 22..207. Dr. Noemi Friedman PDE lecture Seite 8 u 3
Eigenvalues, eigenvectors change of basis (coordinate system) Some discussion about egienvalues and eigenvectors: v () v (2) v (3) u u u 2 u 3 = v () v 2 () v 3 () v (2) v 2 (2) v 3 (2) v (3) v 2 (3) v 3 (2) u u 2 u 3 u = e u v () + u2 v (2) + u3 v (3) u 2 e 2 () (2) (3) u v 2 + u2 v 2 + u3 v 2 e 3 () (2) (3) u v 3 + u2 v 3 + u3 v 3 + + + u = V u u = V u u 3 Let s consider now the respresentation of an operator in the new basis: Au = b AV u = V b V AV is the representationa of the A operator in the new basis defined by v (), v (2), v (3) V AV u = V V b V AV u = b 22..207. Dr. Noemi Friedman PDE lecture Seite 9
2.) Euler forward d-tour on eigenvalues and eigenvectors V AV is the representationa of the A operator in the new basis defined by v (), v (2), v (3) If v (), v (2), v (3) are the eigenvectors of A, this representation is a diagonal matrix. Let s go back to the problem of the Euler forward method used for solving the heat equation Stable? (does it give decaying solution?) u n+ = Bu n u n+2 = B 2 u n u n+k = B k u n Let s check instead in the basis defined by the eigenvectors: u i = V u i u n+ = V BV u n u n+2 = V B 2 V u n u n+k = V B k V u n V B k V = V BB BBV = V BVV BVV VV BVV BV = D k = λ k λ 2 k D D λ n k 22..207. Dr. Noemi Friedman PDE lecture Seite 0
2.) Euler forward stability analysis Stable? (does it give decaying solution?) B = β2 h 2 2 2 2 2 2 2 + When for all the eigenvalues λ i < then response is decaying with time. β2 a = 2 h 2 λ i = a + 2b cos iπ N b = β2 h 2 = 2 β2 h 2 cos iπ N 2 β2 h 2 cos iπ N < i =.. N 22..207. Dr. Noemi Friedman PDE lecture Seite
2.) Euler forward stability analysis Stable? (does it give decaying solution?) When for all the eigenvalues λ i 2 β2 h 2 cos iπ N < i =.. N < then response is decaying with time. 2 β2 h 2 cos iπ N < 2 β2 h 2 cos iπ N < allways satisfied < 2 β2 h 2 cos iπ N 0< 2 Max value: 2 2 β2 h 2 cos iπ N > 2 β2 h 2 cos iπ N < 2 cos iπ N < h2 β 2 2 < h2 β 2 > 22..207. Dr. Noemi Friedman PDE lecture Seite 2 < h2 2β 2 Method is not unconditionally stable, only stable if criteria is satisfied!
2.) Euler forward summary Euler forward: approximate time derivate with the forward difference u j (t) t = β2 h 2 u j 2u j + u j+ + O(h 2 ) u j,n = u j,n+ u j,n + O() u n = u n+ u n = Au n u j,n+ u j,n = β2 h 2 u j,n 2u j,n + u j+,n + O h 2 + O() Stable? (does it give decaying solution?) the absolut values of the eigenvalues of matrix B can not be greater than one. λ j = 2 β2 h 2 cos N π N λ j < h2 2β 2 22..207. Dr. Noemi Friedman PDE lecture Seite 3
3.) Euler backward (implicit) derivation Euler backward: approximate time derivate with the backward difference u j (t) t = β2 h 2 u j 2u j + u j+ + O(h 2 ) u j,n+ = u j,n+ u j,n + O() u n+ = u n+ u n = Au n+ u j,n+ u j,n = β2 h 2 u j,n+ 2u j,n+ + u j+,n+ + O h 2 + O() u n = u n+ Au n+ = (I A)u n+ (Stability criteria: unconditionaly stable, to be shown later) 22..207. Dr. Noemi Friedman PDE lecture Seite 4
4.) Theta method (implicit) derivation Theta method (Crank-Nicolson) u j (t) t = β2 h 2 u j 2u j + u j+ + O(h 2 ) u j,n+θ = u j,n+ u j,n + O( p ) u j,n = u j,n+ u j,n u n = u n+ u n + O() = Au n Euler f. u j,n+ u j,n = θ β2 h 2 u j,n+ 2u j,n+ + u j+,n+ + + θ β2 h 2 u j,n 2u j,n + u j+,n + O h 2 + O( p ) u j,n+ = u j,n+ u j,n u n+ = u n+ u n + O() = Au n+ Euler b. u n+θ = u n+ u n = θau n+ + θ Au n (I θa)u n+ =(I + θ A)u n B B 2 θ = 0 Euler forward θ = Euler backward 22..207. Dr. Noemi Friedman PDE lecture Seite 5
4.) Theta method (implicit) stability analysis Stability criteria: B = (I θa) B u n+ = B 2 u n B 2 = (I + θ A) ) B and B 2 are both tridiagonal sym. matrices B and B 2 have the same eigenvectors v i = v i v i N v i k = sin ikπ N 2) The representation in the basis defined by the eigenvectors V B V u n+ = V B 2 V u n D λ (B ) λ 2 (B ) D 2 λ (B 2 ) λ 2 (B 2 ) u n+ = u n λ n (B ) λ n (B 2 ) 22..207. Dr. Noemi Friedman PDE lecture Seite 6
4.) Theta method (implicit) stability analysis Stability criteria: B u n+ = B 2 u n B = (I θa) a b u n+ = λ (B 2 ) λ (B ) λ 2 (B 2 ) λ 2 (B ) u n B = b a b b a λ n (B 2 ) λ n (B ) B 2 = (I + θ A) a 2 b 2 λ i B = a + 2b cos iπ N = + 2β2 h 2 θ cos iπ N λ i B 2 = a 2 + 2b 2 cos iπ N = 2β2 h 2 θ cos iπ N B 2 = b 2 a 2 b 2 b 2 a 2 22..207. Dr. Noemi Friedman PDE lecture Seite 7
u n+ = Numerical solution of the heat equation 4.) Theta method (implicit) stability analysis λ (B 2 ) λ (B ) λ 2 (B 2 ) λ 2 (B ) λ n (B 2 ) λ n (B ) u n 2r 0< C i 2 2β λ i (B 2 ) 2 λ i (B ) = h 2 θ cos iπ N + 2β2 h 2 θ cos iπ N r β2 h 2 2r 0< C i 2 < < 2r θ C i + 2rθC i < C i cos iπ N 22..207. Dr. Noemi Friedman PDE lecture Seite 8
4.) Theta method (implicit) stability analysis ) Right hand side of the equation: < 2r θ C i + 2rθC i > 0 2rθC i < 2r θ C i / 2 2rθC i < 2rC i + 2rθC i /+2rθC i 2 < 2rC i + 4rθC i > r 2θ C i /: ( 2) r β2 h 2 2) Left hand side of the equation: 2r θ C i + 2rθC i < > 0 2r θ C i < + 2rθC i 2rC i > 0 unconditionally satisfied 2θ 0 (θ 0.5) 2θ > 0 (θ < 0.5) > r 2θ C i < 0 unconditionally satisfied C i 2θ > r h 2 β 2 C i 2θ > max 2 max 22..207. Dr. Noemi Friedman PDE lecture Seite 9 h 2 2β 2 2θ >
Summary: Instationary heat equation what to solve? Stability checking from eigenvalue analysis: Method of lines Euler forward method find the eigenvalues (λ j ) and eigenvectors (v j ) of matrix A u n+ = I + A B u n u n+ = Bu n Euler backward method u n = I A B u n+ Theta method B u n+ = u n Solve system of equations for u n+ I θa u n+ = I + θ A u n B θ u n+ = B 2θ u n B θ B 2θ 22..207. Dr. Noemi Friedman PDE lecture Seite 20