Finite difference methods

Similar documents
Mathematics for chemical engineers

Math 225 Scientific Computing II Outline of Lectures

Ordinary Differential Equations

Euler s Methods (a family of Runge- Ku9a methods)

Module 2: Single Step Methods Lecture 4: The Euler Method. The Lecture Contains: The Euler Method. Euler's Method (Analytical Interpretations)

Simulation in Computer Graphics. Particles. Matthias Teschner. Computer Science Department University of Freiburg

ODE IVP. An Ordinary Differential Equation (ODE) is an equation that contains a function having one independent variable:

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

x n x n stepnumber k order r error constant C r+1 1/2 5/12 3/8 251/720 abs. stab. interval (α,0) /11-3/10

Asymptotic Error Analysis

(Part - 1) P. Sam Johnson. April 14, Numerical Solution of. Ordinary Differential Equations. (Part - 1) Sam Johnson. NIT Karnataka.

Let be a function. We say, is a plane curve given by the. Let a curve be given by function where is differentiable with continuous.

over The idea is to construct an algorithm to solve the IVP ODE (8.1)

The listing says y(1) = How did the computer know this?

CS205b/CME306. Lecture 9

Quasilinear First-Order PDEs

ODEs occur quite often in physics and astrophysics: Wave Equation in 1-D stellar structure equations hydrostatic equation in atmospheres orbits

1.2 Numerical Solutions of Flow Problems

Review Initial Value Problems Euler s Method Summary

37 Self-Assessment. 38 Two-stage Runge-Kutta Methods. Chapter 10 Runge Kutta Methods

Discontinuous Galerkin Sparse Grid method for Maxwell s equations

Chapter 13. Boundary Value Problems for Partial Differential Equations* Linz 2002/ page

Mathematical Methods and Modeling Laboratory class. Numerical Integration of Ordinary Differential Equations

Module1: Numerical Solution of Ordinary Differential Equations. Lecture 6. Higher order Runge Kutta Methods

Index. C m (Ω), 141 L 2 (Ω) space, 143 p-th order, 17

Parameterization of triangular meshes

COMPUTER VISION > OPTICAL FLOW UTRECHT UNIVERSITY RONALD POPPE

The Jello Cube Assignment 1, CSCI 520. Jernej Barbic, USC

The jello cube. Undeformed cube. Deformed cube

PROPERTIES OF NATURAL ELEMENT COORDINATES ON ANY POLYHEDRON

A Study on Numerical Exact Solution of Euler, Improved Euler and Runge - Kutta Method

Ordinary differential equations solving methods

MATH2071: LAB 2: Explicit ODE methods

4 Visualization and. Approximation

Computer Simulations

Computer Vision I. Announcements. Fourier Tansform. Efficient Implementation. Edge and Corner Detection. CSE252A Lecture 13.

An Investigation into Iterative Methods for Solving Elliptic PDE s Andrew M Brown Computer Science/Maths Session (2000/2001)

Homework Set #2-3, Math 475B

Surface Parameterization

Mid-Year Report. Discontinuous Galerkin Euler Equation Solver. Friday, December 14, Andrey Andreyev. Advisor: Dr.

Geometric Modeling Assignment 3: Discrete Differential Quantities

over The idea is to construct an algorithm to solve the IVP ODE (9.1)

Shape Modeling and Geometry Processing

Meshless Modeling, Animating, and Simulating Point-Based Geometry

Lecture 22: Rules for Solving IVP

METU Mechanical Engineering Department ME 582 Finite Element Analysis in Thermofluids Spring 2018 (Dr. C. Sert) Handout 12 COMSOL 1 Tutorial 3

Fully discrete Finite Element Approximations of Semilinear Parabolic Equations in a Nonconvex Polygon

Announcements. Edges. Last Lecture. Gradients: Numerical Derivatives f(x) Edge Detection, Lines. Intro Computer Vision. CSE 152 Lecture 10

Using Modified Euler Method (MEM) for the Solution of some First Order Differential Equations with Initial Value Problems (IVPs).

Mass-Spring Systems. Last Time?

Digital Geometry Processing Parameterization I

Surfaces and Integral Curves

ChE 400: Applied Chemical Engineering Calculations Tutorial 6: Numerical Solution of ODE Using Excel and Matlab

COMPUTING AND DATA ANALYSIS WITH EXCEL. Numerical integration techniques

Intensity Transformations and Spatial Filtering

Chapter 6 Visualization Techniques for Vector Fields

An ε-uniform Initial Value Technique For Convection-Diffusion Singularly Perturbed Problems

Semi-Conservative Schemes for Conservation Laws

On a nested refinement of anisotropic tetrahedral grids under Hessian metrics

Homework Set 5 (Sections )

Lecture 6: Chain rule, Mean Value Theorem, Tangent Plane

Parameterization. Michael S. Floater. November 10, 2011

AP Calculus BC Course Description

本讲内容 5.1 概述 5.2 FEM 5.3 FDM 5.4 DEM. 5.5 Case study

The Immersed Interface Method

AMS527: Numerical Analysis II

Numerical Methods for Differential Equations Contents Review of numerical integration methods Rectangular Rule Trapezoidal Rule Simpson s Rule How to

Thursday 1/8 1 * syllabus, Introduction * preview reading assgt., chapter 1 (modeling) * HW review chapters 1, 2, & 3

Computation of Velocity, Pressure and Temperature Distributions near a Stagnation Point in Planar Laminar Viscous Incompressible Flow

Problem #3 Daily Lessons and Assessments for AP* Calculus AB, A Complete Course Page Mark Sparks 2012

Numerical Methods for Hyperbolic and Kinetic Equations

Interpolation and Splines

4.2 and 4.6 filled in notes.notebook. December 08, Integration. Copyright Cengage Learning. All rights reserved.

Module 1: Introduction to Finite Difference Method and Fundamentals of CFD Lecture 6:

Treewidth and graph minors

Inverse and Implicit functions

Cloth Simulation. Tanja Munz. Master of Science Computer Animation and Visual Effects. CGI Techniques Report

Math 485, Graph Theory: Homework #3

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

CHAPTER 1. Introduction

arxiv: v1 [math.na] 20 Sep 2016

Computer Vision I. Announcement. Corners. Edges. Numerical Derivatives f(x) Edge and Corner Detection. CSE252A Lecture 11

On the order of accuracy and numerical performance of two classes of finite volume WENO schemes

Finite Element Analysis Prof. Dr. B. N. Rao Department of Civil Engineering Indian Institute of Technology, Madras. Lecture - 36

An introduction to mesh generation Part IV : elliptic meshing

Communications in Applied Mathematics and Computational Science

Maximizing an interpolating quadratic

Von Neumann Analysis for Higher Order Methods

PTE 519 Lecture Note Finite Difference Approximation (Model)

Numerical Methods for Solving Optimal Control Problems

= f (a, b) + (hf x + kf y ) (a,b) +

LAB #8 Numerical Methods

7.8. Approximate Integration

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

Nodal Basis Functions for Serendipity Finite Elements

In what follows, we will focus on Voronoi diagrams in Euclidean space. Later, we will generalize to other distance spaces.

Validated Solution of Initial Value Problem for Ordinary Differential Equations based on Explicit and Implicit Runge-Kutta Schemes

Semester Final Report

Development of a Maxwell Equation Solver for Application to Two Fluid Plasma Models. C. Aberle, A. Hakim, and U. Shumlak

1. Two double lectures about deformable contours. 4. The transparencies define the exam requirements. 1. Matlab demonstration

Transcription:

Finite difference methods Siltanen/Railo/Kaarnioja Spring 8 Applications of matrix computations Applications of matrix computations Finite difference methods Spring 8 /

Introduction Finite difference methods (FDM) are numerical methods for solving (partial) differential equations, where (partial) derivatives are approximated by finite differences. Example For < h, we have the approximations (i) f f (x + h) f (x) (x), h (ii) f f (x) f (x h) (x), h (iii) f f (x + h) f (x h) (x), and h (iv) f f (x + h) f (x) + f (x h) (x) h. Applications of matrix computations Finite difference methods Spring 8 /

Let a = x < x < < x n = b be a uniform partition of the interval [a, b], where x k = a + hk, k {,,..., n}, and h = (b a)/n. The formulae on the previous page can be used to derive discrete approximations for (i) [f (x ), f (x ),..., f (x n )] T = Af, (ii) [f (x ), f (x ),..., f (x n )] T = Bf, (iii) [f (x ), f (x ),..., f (x n )] T = Cf, and (iv) [f (x ), f (x ),..., f (x n )] T = Df using the point values f = [f (x ), f (x ),..., f (x n )] T. Proof. Homework! :) Note: By using a suitable quadrature rule (e.g., the left-, mid-, or right-point rule or the trapezoidal rule), one can obtain a discretized approximation for the antiderivative as well! Applications of matrix computations Finite difference methods Spring 8 3 /

Finite difference methods for the equation y (t) = f (t, y(t)) Applications of matrix computations Finite difference methods Spring 8 /

Let s consider the IVP { y (t) = f (t, y(t)), t, y() = y. To ensure (local) unique solvability, it is assumed that f is continuous and that f (t, ) is Lipschitz-continuous [Picard Lindelöf theorem]. How do we get rid of the derivative? By integration: t y(t) = y + f (τ, y(τ)) dτ. Bad news: We have just turned our differential equation into an integral equation, which we still need to solve for y(t). Good news: We know how to do numerical integration! Applications of matrix computations Finite difference methods Spring 8 /

We are interested in solving the IVP for t [, T ], T >. Let = t < t < < t n = T be an equispaced partition of the interval [, T ], t k = hk, k {,,..., n}, and h = T /n. Let us denote y(t k ) = y k. We can recast the integral equation on the previous page as y k+ = y k + t k+ t k f (t, y(t)) dt for k =,,..., n. Let s try different quadratures for approximating the integral above! Remark. We omit the detailed error analysis of the resulting formulae and focus on some heuristics of the solution methods. Applications of matrix computations Finite difference methods Spring 8 6 /

One-point Riemann sum approximations over [t k, t k+ ] Left-point rule: y k+ y k + hf (t k, y k ). (Euler s method) Right-point rule: y k+ y k + hf (t k+, y k+ ). (Implicit Euler s method) Midpoint rule: y k+ y k + hf (t k + h, y k + h f (t k, y k )). (Runge Kutta method) Applications of matrix computations Finite difference methods Spring 8 7 /

Two-point trapezoidal rule over [t k, t k+ ] y k+ y k + h (f (t k, y k ) + f (t k+, y k+ )) y k + h f (t k, y k ) + h f (t k + h, y k + hf (t k, y k )). Applications of matrix computations Finite difference methods Spring 8 8 /

Two-point trapezoidal rule over [t k, t k+ ] y k+ y k + h (f (t k, y k ) + f (t k+, y k+ )) y k + h f (t k, y k ) + h f (t k + h, y k + hf (t k, y k )). Applications of matrix computations Finite difference methods Spring 8 8 /

Two-point trapezoidal rule over [t k, t k+ ] k = hf (t k, y k ), y k+ y k + k + h f (t k + h, y k + k ). Applications of matrix computations Finite difference methods Spring 8 8 /

Two-point trapezoidal rule over [t k, t k+ ] k = hf (t k, y k ), y k+ y k + k + h f (t k + h, y k + k ). Applications of matrix computations Finite difference methods Spring 8 8 /

Two-point trapezoidal rule over [t k, t k+ ] k = hf (t k, y k ), k = hf (t k + h, y k + k ), y k+ y k + k + k. This is the second order Runge Kutta method (RK). Applications of matrix computations Finite difference methods Spring 8 8 /

There is a similar relationship between the famous fourth order Runge Kutta method (RK) and Simpson s rule: k = hf (t k, y k ), k = hf (t k + h, y k + k ), k 3 = hf (t k + h, y k + k ), k = hf (t k+, y k + k 3 ), y k+ y k + 6 (k + k + k 3 + k ). The RK rule can be derived by first applying Simpson s rule and then balancing the midstep (here y k+/ = y(t k+/ ) and t k+/ = t k + h/) f (t k+/, y k+/ ) = f (t k+/, y k+/ ) + f (t k+/, y k+/ ) by using two different methods: f (t k+/, y k+/ ) f (t k + h, y k + k ), f (t k+/, y k+/ ) f (t k + h, y k + k ). (left-point rule) (right-point rule) Applications of matrix computations Finite difference methods Spring 8 9 /

In summary There exists a wide range of literature on FD methods for first order IVPs and the theory extends nicely to first order systems of ODEs as well. The examples on pg. 7 highlight a couple of canonical cases: (A) Explicit methods, (B) Implicit methods. While simple and intuitive, explicit methods are never unconditionally stable. For example, when working with [stiff equations], certain implicit methods are able to capture the asymptotics of the solution regardless of the step size. Another class of FD methods is represented by Runge Kutta methods, where the FD solution is adjusted based on point evaluations at additional intermediate points between the discretization mesh. Applications of matrix computations Finite difference methods Spring 8 /

For an introduction into the approximation and stability theory of first order FD methods, I highly recommend the monograph [Griffiths and Higham]! Applications of matrix computations Finite difference methods Spring 8 /

Finite difference methods for Poisson s equation u = f Applications of matrix computations Finite difference methods Spring 8 /

Let denote the Laplacian. u(x, y) = u(x, y) + u(x, y) x y In the following, we discuss the solution of Poisson s equation u = f in a bounded domain Ω R with the Dirichlet boundary condition u = g on Ω. where f and g are given functions. Applications of matrix computations Finite difference methods Spring 8 3 /

We need to discretize Poisson s equation in order to find a suitable matrix approximation Au = m, which we can then solve numerically. We can obtain an approximate formula for u near (x, y) by developing Taylor expansions of u(x, y) with respect to x and y variables, respectively. Assuming sufficient smoothness, we obtain u(x + h, y) = u(x, y) + h x u(x, y) + h x u(x, y) + 6 h3 3 x u(x, y) + O(h ), u(x h, y) = u(x, y) h x u(x, y) + h x u(x, y) 6 h3 3 x u(x, y) + O(h ). The sum of these is u(x + h, y) + u(x h, y) = u(x, y) + h x u(x, y) + O(h ) Applications of matrix computations Finite difference methods Spring 8 /

Developing the Taylor expansion w.r.t. the x variable yielded u(x + h, y) + u(x h, y) = u(x, y) + h x u(x, y) + O(h ). () Proceeding analogously with the other component: u(x, y + h) = u(x, y) + h y u(x, y) + h y u(x, y) + 6 h3 3 y u(x, y) + O(h ), u(x, y h) = u(x, y) h y u(x, y) + h y u(x, y) 6 h3 3 y u(x, y) + O(h ) u(x, y + h) + u(x, y h) = u(x, y) + h y u(x, y) + O(h ). () By summing () and () together, we obtain u(x + h, y) + u(x h, y) + u(x, y + h) + u(x, y h) = u(x, y) + h u(x, y) + O(h ) u(x, y) = u(x + h, y) + u(x h, y) + u(x, y + h) + u(x, y h) u(x, y) h + O(h ). Applications of matrix computations Finite difference methods Spring 8 /

Five-point stencil (quincunx): u (x,y+h) u (x-h,y) u (x,y) u (x+h,y) u (x,y-h) u(x, y) u(x + h, y) + u(x h, y) + u(x, y + h) + u(x, y h) u(x, y) h Applications of matrix computations Finite difference methods Spring 8 6 /

Recovering missing pixels During the lecture, we discussed the example presented in Poisson FD v.pdf (see course page). Figure: Image by Samuli Siltanen. Applications of matrix computations Finite difference methods Spring 8 7 /

For a given (polygonal) computational domain, we could attempt to create a quincunx mesh where, for each individual mesh element (x, y), the neighbouring coordinates (x ± h, y) and (x, y ± h) are either Other mesh elements, Boundary points. 3 3 3 3 Applications of matrix computations Finite difference methods Spring 8 8 /

6-6 - - -3 - - -3 3 3 6 6 unknowns u(x i) boundary values g i Example Let s solve the Dirichlet problem { u = in Ω, u Ω = g on Ω, where the computational domain Ω is the L-shaped domain on the left, the discretization mesh is denoted by black dots, and the boundary values of g are given in red at the discretization nodes lying on the boundary. Applications of matrix computations Finite difference methods Spring 8 9 /

Let s give a numbering to the unknowns! 6-6 - - -3 6-6 - - -3 - - - -3 3 - -3 3 6 3 3 6 6 7 8 9 3 6 3 6 unknowns u(xi) boundary values gi 6 Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 6 3 u(x ) u(x ) + u(x 3 ) u(x ) h [ ] u(x ) h u(x ) = h u(x 3 ) 6 Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 6 3 u(x ) u(x ) + u(x ) u(x ) h [ ] u(x ) u(x ) h u(x 3 ) = [ ] h 6 u(x ) 6 Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - 3-3 6 3 7 8 9 3 6 3 6 6 u(x 3 ) u(x )+u(x )+u(x ) u(x 3 ) h u(x ) u(x ) h u(x 3 ) u(x ) = u(x ) h 6 Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,,,,,,,,,,,,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,, 3,,,,,,,,,,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,, 3,,,,,,,,,,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,, 3,,,,,,,,,,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,, 3,,,,,,,,,,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,, 3,,,,,,,,,,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 =: A m := [, 6,,, 3,,,,,,,,,,, ] T u(x ) h A. = h m u(x 6 ) Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 =: A m := [, 6,,, 3,,,,,, 6,,,,, ] T u(x ) h A. = h m u(x 6 ) Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 =: A m := [, 6,,, 3,,,,,, 6,,,,, ] T u(x ) h A. = h m u(x 6 ) Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,, 3,,,,,, 6,,,,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := [, 6,,, 3,,,,,, 6,,, 3,, ] T u(x ) h A. = h m u(x 6 ) =: A Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := =: A [, 6,,, 3,,,,,, 6,,, 3,, ] T u(x ) h A. = h m u(x 6 ) Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m := =: A [, 6,,, 3,,,,,, 6,,, 3,, ] T u(x ) h A. = h m u(x 6 ) Applications of matrix computations Finite difference methods Spring 8 /

6-6 - - -3 - - -3 3 6 3 7 8 9 3 6 3 6 6 m = = A [, 6,,, 3,,,,,, 6,,, 3,, ] T u(x ) h A. = h m u(x 6 ) Applications of matrix computations Finite difference methods Spring 8 /

Numerical solution: >> A\m should give [u(x ),..., u(x 6 )] T = [, 3, 3,,,,,,,, 3,,,, 3, ] T. Compare this with the analytical solution u(x, y) = x y. (They are exactly the same!) Applications of matrix computations Finite difference methods Spring 8 /

Numerical experiment Let s return to the isospectral drums discussed earlier during the course. 3 3 3 3 Figure: Isospectral drum shapes in D [Gordon, Webb, and Wolpert]. Two drums with clamped boundaries give the same sound if they have the same set of (Dirichlet) eigenvalues λ satisfying u = λu in D, u D =, D R bounded domain. Applications of matrix computations Finite difference methods Spring 8 3 /

The quincunx pattern has extremely important applications in statistics as well! https://www.youtube.com/watch?v=ausktk9enzg Applications of matrix computations Finite difference methods Spring 8 /

Bibliography C. Gordon, D. Webb, and S. Wolpert. Isospectral plane domains and surfaces via Riemannian orbifolds. Inventiones Mathematicae ():, 99. DOI:.7/BF33 D. F. Griffiths and D. J. Higham. Numerical Methods for Ordinary Differential Equations. Springer,. Applications of matrix computations Finite difference methods Spring 8 /