Introduction to PDEs and Numerical Methods Tutorial 5. Finite difference methods equilibrium equation and iterative solvers

Similar documents
Introduction to PDEs and Numerical Methods Lecture 7. Solving linear systems

Introduction to PDEs and Numerical Methods Tutorial 1: Overview of essential linear algebra and analysis

Platzhalter für Bild, Bild auf Titelfolie hinter das Logo einsetzen

Introduction to PDEs and Numerical Methods Tutorial 4. Finite difference methods stability, concsistency, convergence

Introduction to PDEs and Numerical Methods Tutorial 11. 2D elliptic equations

Numerical methods for PDEs FEM convergence, error estimates, piecewise polynomials

Numerical methods for PDEs FEM convergence, error estimates, piecewise polynomials

Platzhalter für Bild, Bild auf Titelfolie hinter das Logo einsetzen

Department of Mathematics California State University, Los Angeles Master s Degree Comprehensive Examination in. NUMERICAL ANALYSIS Spring 2015

LU Factorization. LU Decomposition. LU Decomposition. LU Decomposition: Motivation A = LU

Linear Algebraic Equations

Numerical Linear Algebra

Scientific Computing

1.Chapter Objectives

Introduction to PDEs and Numerical Methods: Exam 1

Finite Difference Methods for Boundary Value Problems

Numerical Linear Algebra

DEN: Linear algebra numerical view (GEM: Gauss elimination method for reducing a full rank matrix to upper-triangular

Numerical Linear Algebra

Program Lecture 2. Numerical Linear Algebra. Gaussian elimination (2) Gaussian elimination. Decompositions, numerical aspects

Numerical Methods I Solving Square Linear Systems: GEM and LU factorization

COURSE Numerical methods for solving linear systems. Practical solving of many problems eventually leads to solving linear systems.

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit VII Sparse Matrix

Introduction to PDEs and Numerical Methods Lecture 1: Introduction

Direct Methods for Solving Linear Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

Numerical Analysis: Solving Systems of Linear Equations

Preliminary/Qualifying Exam in Numerical Analysis (Math 502a) Spring 2012

SOLVING ELLIPTIC PDES

Iterative Methods for Linear Systems

Background. Background. C. T. Kelley NC State University tim C. T. Kelley Background NCSU, Spring / 58

Practical Linear Algebra: A Geometry Toolbox

Today s class. Linear Algebraic Equations LU Decomposition. Numerical Methods, Fall 2011 Lecture 8. Prof. Jinbo Bi CSE, UConn

Gaussian Elimination without/with Pivoting and Cholesky Decomposition

CS412: Lecture #17. Mridul Aanjaneya. March 19, 2015

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Linear Systems of Equations. ChEn 2450

MATHEMATICS FOR COMPUTER VISION WEEK 2 LINEAR SYSTEMS. Dr Fabio Cuzzolin MSc in Computer Vision Oxford Brookes University Year

Direct Methods for Solving Linear Systems. Matrix Factorization

Scientific Computing WS 2018/2019. Lecture 9. Jürgen Fuhrmann Lecture 9 Slide 1

Numerical Analysis of Differential Equations Numerical Solution of Elliptic Boundary Value

Computational Linear Algebra

2.1 Gaussian Elimination

Review of matrices. Let m, n IN. A rectangle of numbers written like A =

Numerical Methods - Numerical Linear Algebra

Cheat Sheet for MATH461

Numerical Solution Techniques in Mechanical and Aerospace Engineering

Gaussian Elimination and Back Substitution

Introduction to PDEs and Numerical Methods Tutorial 10. Finite Element Analysis

9. Numerical linear algebra background

7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix

Scientific Computing: Solving Linear Systems

lecture 2 and 3: algorithms for linear algebra

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Multi-Factor Finite Differences

Chapter 2. Solving Systems of Equations. 2.1 Gaussian elimination

Introduction to numerical schemes

LINEAR SYSTEMS (11) Intensive Computation

Example: Current in an Electrical Circuit. Solving Linear Systems:Direct Methods. Linear Systems of Equations. Solving Linear Systems: Direct Methods

Solving Linear Systems of Equations

AMS526: Numerical Analysis I (Numerical Linear Algebra)

LU Factorization. Marco Chiarandini. DM559 Linear and Integer Programming. Department of Mathematics & Computer Science University of Southern Denmark

Next topics: Solving systems of linear equations

The Solution of Linear Systems AX = B

Fundamentals of Engineering Analysis (650163)

Numerical Analysis Fall. Gauss Elimination

Math 471 (Numerical methods) Chapter 3 (second half). System of equations

Scientific Computing: Dense Linear Systems

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 13

5. Direct Methods for Solving Systems of Linear Equations. They are all over the place...

Chapter 2 - Linear Equations

lecture 3 and 4: algorithms for linear algebra

5.7 Cramer's Rule 1. Using Determinants to Solve Systems Assumes the system of two equations in two unknowns

A Review of Matrix Analysis

Chapter Two: Numerical Methods for Elliptic PDEs. 1 Finite Difference Methods for Elliptic PDEs

Finite Difference Methods (FDMs) 1

Pivoting. Reading: GV96 Section 3.4, Stew98 Chapter 3: 1.3

Boundary Value Problems and Iterative Methods for Linear Systems

LU Factorization. A m x n matrix A admits an LU factorization if it can be written in the form of A = LU

Solving linear equations with Gaussian Elimination (I)

Math/Phys/Engr 428, Math 529/Phys 528 Numerical Methods - Summer Homework 3 Due: Tuesday, July 3, 2018

LECTURES IN BASIC COMPUTATIONAL NUMERICAL ANALYSIS

Chapter 3. Linear and Nonlinear Systems

. =. a i1 x 1 + a i2 x 2 + a in x n = b i. a 11 a 12 a 1n a 21 a 22 a 1n. i1 a i2 a in

Finite Difference Methods (FDMs) 2

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

CS227-Scientific Computing. Lecture 4: A Crash Course in Linear Algebra

AIMS Exercise Set # 1

Quiz ) Locate your 1 st order neighbors. 1) Simplify. Name Hometown. Name Hometown. Name Hometown.

Dense LU factorization and its error analysis

Cache Oblivious Stencil Computations

Numerical Linear Algebra

Partial Differential Equations

Implicit Scheme for the Heat Equation

Math 102, Winter Final Exam Review. Chapter 1. Matrices and Gaussian Elimination

Finite Difference Methods for

Lecture 16 Methods for System of Linear Equations (Linear Systems) Songting Luo. Department of Mathematics Iowa State University

Computational Techniques Prof. Sreenivas Jayanthi. Department of Chemical Engineering Indian institute of Technology, Madras

Matrix Algebra for Engineers Jeffrey R. Chasnov

Lecture 11. Linear systems: Cholesky method. Eigensystems: Terminology. Jacobi transformations QR transformation

Transcription:

Platzhalter für Bild, Bild auf Titelfolie hinter das Logo einsetzen Introduction to PDEs and Numerical Methods Tutorial 5. Finite difference methods equilibrium equation and iterative solvers Dr. Noemi Friedman, 13.12.2013.

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+1 = I + ΔtA u n u n+1 = Bu n B Euler backward method u n = I ΔtA u n+1 B 1 Theta method I θδta u n+1 = I + 1 θ ΔtA B 1θ B 2θ u n B 1 u n+1 = u n B 1θ u n+1 = B 2θ u n Solve system of equations Gx = b solve for x 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 2

Instationary heat equation what to solve? u n = I ΔtA u n+1 I θδta u n+1 = I + 1 θ ΔtA B 1 B 1θ B 2θ u n B 1 u n+1 = u n B 1θ u n+1 = B 2θ u n What do we know about the matrices B 1 and B 1θ? Recall 1D instationary heat equation with three point stencil: d dt u 1 (t) u j 1 (t) u j (t) u j+1 (t) u N 1 (t) = β2 h 2 u j (t) t = β2 h 2 u j+1 2u j + u j 1 + O(h 2 ) u 1 (t) u j 1 (t) u j (t) u j+1 (t) u N 1 (t) 1 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 3

Instationary heat equation what to solve? A: triangular matrix B 1 = I ΔtA B 1θ = I θδta tridiagonal matrices Recall 2D instationary heat equation : (See Tutorial 3.) If dx=dy: After time discr. with theta method: n + 1 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 4 n

Instationary heat equation what to solve? f 0 Δt β2 h 2 : = r u n+1 j,l rθ 4u n+1 j,l + u n+1 j 1,l + u n+1 j+1,l + u n+1 j,l 1 + u n+1 j,l+1 = = u n j,l + r 1 θ 4u n j,l + u n j 1,l + u n j+1,l + u n j,l 1 + u n j,l+1 θ = 1 Euler backward method u n+1 j,l r 4u n+1 j,l + u n+1 j 1,l + u n+1 j+1,l + u n+1 j,l 1 + u n+1 j,l+1 = u n j,l 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 5

Instationary heat equation what to solve? (0, N) (M, N) n = u n 1,1 u n 2,1 u n 3,1 u n M 1,1 u n 1,2 u n 2,2 u n M 1,2 u n 1,N 1 u n M 1,N 1 u n = u n 1,1 u n 2,1 u n 3,1 u n 4,1 u n 1,2 u n 2,2 u n 3,2 u n 4,2 u n 1,3 u n 2,3 u n 3,3 u n 4,3 l = 1.. N y = lδy (0,1) (1,1) (2,1) (3,1) (M, 1) (0,0) (1,0) (2,0) (3,0) x = jδx (2,3) (1,2) (2,2) (3,2) j = 1.. M (M, 1) with homogenous Dirichlet BC. u n+1 j,l r 4u n+1 j,l + u n+1 j 1,l + u n+1 j+1,l + u n+1 j,l 1 + u n+1 j,l+1 = u n j,l 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 6

Instationary heat equation what to solve? u n+1 j,l r 4u n+1 j,l + u n+1 j 1,l + u n+1 j+1,l + u n+1 j,l 1 + u n+1 j,l+1 = u n j,l with homogenous Dirichlet BC. 4 1 1 1 4 1 1 1 4 1 1 1 4 1 1 4 1 1 +r 0 1 0 0 1 4 1 0 0 1 0 0 1 1 4 1 1 1 1 4 1 1 4 1 1 1 4 1 1 1 4 1 1 1 4 u n+1 1,1 u n+1 2,1 u n+1 3,1 u n+1 4,1 u n+1 1,2 u n+1 2,2 u n+1 3,2 u n+1 4,2 u n+1 1,3 u n+1 2,3 u n+1 3,3 u n+1 4,3 Sparse matrix with bandwidth: 2M-1 (here 9) BUT the band itself is sparse, only five diagonals are nonzero 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 7

Instationary heat equation what to solve? u n+1 j,l r 4u n+1 j,l + u n+1 j 1,l + u n+1 j+1,l + u n+1 j,l 1 + u n+1 j,l+1 = u n j,l B 1 u n+1 = u n where B 1 = B C C B C C B B = 1 + 4r r r 1 + 4r r r 1 + 4r C = r r r 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 8

Stationary heat equation what to solve? Instationary heat equation with constant BC, and source term approaches a stationary state: (parabolic) Equilibrium equation (stationary heat equation): Discretised form: (elliptic) 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 9

Stationary heat equation what to solve? Conclusion instationary heat equation with implicit FD System of linear equations: methods (Euler backward, Theta method) stationary heat equation Gx = b solve for x Where the G matrix is in general sparse, banded can get very large with refined spatial and temporal discretisation for 1D heat equation with three-point-stencils: tridiagonal for 1D heat equation with five-point-stencils: pentadiagonal for 2D heat equation: banded with sparse band 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 10

Stationary and instationary heat equation how to solve? 1.) Solve system of equation directly Gx = b Calculate inverse from Cramer-rule: x i = det (A i) det (A) 2 n + 1! operations Gauß-Jordan elimination Gauß elimination, LU decomposition (Cholesky decomp. If G is symmetric and pos.def., Thomas algorithm, if matrix is tridiagonal) G = L U 2n 2 operations Gx = L Ux y Ly = b Ux = y = b forward substitution back substitution 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 11

Stationary and instationary heat equation how to solve? Direct solve G = LL LL factorisation with Gauß method g 11 g 12 g 21 g 22 = l 11 0 l 21 l 22 u 11 u 12 0 u 22 g 11 = l 11 u 11 g 12 = l 11 u 12 g 21 = l 21 u 11 g 22 = l 21 u 12 + l 22 u 22 4 equations 6 unknowns 1 0 l 21 1 u 11 u 12 0 u 22 g 11 = 1u 11 g 12 = 1u 12 1 0 l 21 1 g 11 g 12 0 u 22 g 21 = l 21 g 11 g 22 = l 21 g 12 + 1u 22 1 0 g 21 g 11 1 g 11 g 12 0 g 22 l 21 g 12 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 12

Stationary and instationary heat equation how to solve? Direct solve Gauß factorization G = LL in general n 2 equations n 2 l + n unknowns ii = 1 General algorithm fff i = k + 1 n l ii = g ii (k) g kk (k) fff j = k + 1.. n g ii (k+1) = g ij (k) l ii g kj (k) ~ 2n3 3 operations But even if the matrix is nonsingular the elements g kk (k) (pivot elements) can be zero Pivoting (flip rows or columns) can be also important for reducing roundoff errors g kk (k) won t be zero if the matrix is positivive definit or if it is diagonally dominant 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 13

Stationary and instationary heat equation how to solve? Direct solve If G is positive definit+symmetric G = LL = HH T Tridiagonal system: G = a 1 c 1 e 2 a 2 c 2 e n a n L = LL factorisation with Cholesky decomposition Thomas algorithm 1 β 2 1 β n 1 U = ~ n3 3 operations (half of the Gauß method) α 1 c 1 α 2 c 2 α n α 1 = a 1 β i = e i α 1 1 α i = a i β i c i 1 i = 2 n What happens with the roundoff errors in G = LL = G + δδ G Gx = b G + δδ x = b + δb x x x λ mmm λ mmm δδ b O(n) operations λ mmm λ mmm = K(A) 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 14

Stationary and instationary heat equation how to solve? Iterative methods If G is too large, and/or banded but the band is sparse iterative solvers Gx = b x (k+1) = BB (k) + g (1) B depends on G (iteration matrix) g depends on G and b such that it must satisfy the relation: x = BB + g How do I know that my iterative solver converges to x? x = G 1 b g = G 1 b BG 1 b = I B G 1 b (2) x = BB + g (1)-(2): e (k+1) = BB (k) eith the error: e (k) = x x (k) If B is symmetric and pos.def. e (k+1) = BB (k) ρ(b) e (k) ρ B = λ mmm (spectral radius) e (k) ρ(b) k e (0) if ρ B < 1 convergence 13. 12. 2013. Dr. Noemi Friedman PDE tutorial Seite 15