Numerical Methods for Partial Differential Equations. CAAM 452 Spring 2005 Lecture 2 Instructor: Tim Warburton

Similar documents
Numerical Methods for Partial Differential Equations. CAAM 452 Spring 2005 Lecture 3 AB2,AB3, Stability, Accuracy Instructor: Tim Warburton

Numerical Methods for Partial Differential Equations CAAM 452. Spring 2005

Numerical Methods for Partial Differential Equations

25 Self-Assessment. 26 Eigenvalue Stability for a Linear ODE. Chapter 7 Eigenvalue Stability

Euler s Method, Taylor Series Method, Runge Kutta Methods, Multi-Step Methods and Stability.

What we ll do: Lecture 21. Ordinary Differential Equations (ODEs) Differential Equations. Ordinary Differential Equations

Class Meeting # 2: The Diffusion (aka Heat) Equation

Lecture 21: Numerical Solution of Differential Equations

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Chapter 5 Exercises. (a) Determine the best possible Lipschitz constant for this function over 2 u <. u (t) = log(u(t)), u(0) = 2.

Math 312 Lecture Notes Linear Two-dimensional Systems of Differential Equations

REVIEW: The Matching Method Algorithm

Exponential integrators and functions of the matrix exponential

MASSACHUSETTS INSTITUTE OF TECHNOLOGY DEPARTMENT OF MECHANICAL ENGINEERING CAMBRIDGE, MASSACHUSETTS NUMERICAL FLUID MECHANICS FALL 2011

Part 1. The simple harmonic oscillator and the wave equation

8. Introduction and Chapter Objectives

MAE/MSE502 Partial Differential Equations in Engineering. Spring 2019 Mon/Wed 6:00-7:15 PM Classroom: CAVC 101

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

Finite Differences for Differential Equations 28 PART II. Finite Difference Methods for Differential Equations

Calculus for the Life Sciences

NUMERICAL SOLUTION OF ODE IVPs. Overview

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9

Finite Difference and Finite Element Methods

Midterm 1 Review. Distance = (x 1 x 0 ) 2 + (y 1 y 0 ) 2.

Damped harmonic motion

MIT (Spring 2014)

4 Stability analysis of finite-difference methods for ODEs

Outline Calculus for the Life Sciences II. Pollution in a Lake 1. Introduction. Lecture Notes Numerical Methods for Differential Equations

Partial differential equations

A Fifth Order Flux Implicit WENO Method

Lab #2 - Two Degrees-of-Freedom Oscillator

Linearization of Differential Equation Models

Advection / Hyperbolic PDEs. PHY 604: Computational Methods in Physics and Astrophysics II

MITOCW watch?v=dztkqqy2jn4

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

MAE502/MSE502 Partial Differential Equations in Engineering. Spring 2012 Mon/Wed 5:00-6:15 PM

Time-Parallel Algorithms for Weather Prediction and Climate Simulation

Matrix-Exponentials. September 7, dx dt = ax. x(t) = e at x(0)

Linear Second-Order Differential Equations LINEAR SECOND-ORDER DIFFERENTIAL EQUATIONS

Analysis III (BAUG) Assignment 3 Prof. Dr. Alessandro Sisto Due 13th October 2017

Introduction to First Order Equations Sections

10 Motivation for Fourier series

Ordinary Differential Equations

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of

Final Exam May 4, 2016

3.3. Phase and Amplitude Errors of 1-D Advection Equation

Relevant self-assessment exercises: [LIST SELF-ASSESSMENT EXERCISES HERE]

MITOCW watch?v=pqkyqu11eta

Separation of Variables

Basics Quantum Mechanics Prof. Ajoy Ghatak Department of physics Indian Institute of Technology, Delhi

Initial value problems for ordinary differential equations

We will begin by first solving this equation on a rectangle in 2 dimensions with prescribed boundary data at each edge.

Homework 7 Solutions

Lecture 10: Powers of Matrices, Difference Equations

The family of Runge Kutta methods with two intermediate evaluations is defined by

Kasetsart University Workshop. Multigrid methods: An introduction

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

CS520: numerical ODEs (Ch.2)

Chaotic motion. Phys 420/580 Lecture 10

Heat Equation, Wave Equation, Properties, External Forcing

Physics 115/242 Comparison of methods for integrating the simple harmonic oscillator.

Table of contents. d 2 y dx 2, As the equation is linear, these quantities can only be involved in the following manner:

Ordinary Differential Equations

Elliptic Problems / Multigrid. PHY 604: Computational Methods for Physics and Astrophysics II

Multistep Methods for IVPs. t 0 < t < T

Math 164 (Lec 1): Optimization Instructor: Alpár R. Mészáros

FINITE VOLUME METHODS FOR ONE-DIMENSIONAL SCALAR CONSERVATION LAWS

The 1-D Heat Equation

Linear Multistep Methods I: Adams and BDF Methods

Numerical Modelling in Fortran: day 10. Paul Tackley, 2016

Designing Information Devices and Systems I Spring 2016 Official Lecture Notes Note 21

Butcher tableau Can summarize an s + 1 stage Runge Kutta method using a triangular grid of coefficients

Copyright (c) 2006 Warren Weckesser

Scientific Computing: An Introductory Survey

Selected Topics in Physics a lecture course for 1st year students by W.B. von Schlippe Spring Semester 2007

Dispersion relations, linearization and linearized dynamics in PDE models

Topic: Primal-Dual Algorithms Date: We finished our discussion of randomized rounding and began talking about LP Duality.

Chapter 9 Implicit Methods for Linear and Nonlinear Systems of ODEs

Properties of Linear Transformations from R n to R m

Numerical Solutions to Partial Differential Equations

The 1-D Heat Equation

Preliminary Examination, Numerical Analysis, August 2016

12 The Heat equation in one spatial dimension: Simple explicit method and Stability analysis

Name of the Student: Unit I (Solution of Equations and Eigenvalue Problems)

Differential Analysis II Lectures 22-24

18.325: Vortex Dynamics

Bindel, Fall 2011 Intro to Scientific Computing (CS 3220) Week 6: Monday, Mar 7. e k+1 = 1 f (ξ k ) 2 f (x k ) e2 k.

Math 164-1: Optimization Instructor: Alpár R. Mészáros

Numerical solution of ODEs

Partial Differential Equations

Math 411 Preliminaries

10. Operators and the Exponential Response Formula

Computational Modeling for Physical Sciences

12.1. Exponential shift. The calculation (10.1)

Class Note #14. In this class, we studied an algorithm for integer multiplication, which. 2 ) to θ(n

Integration of Ordinary Differential Equations

ODE Homework 1. Due Wed. 19 August 2009; At the beginning of the class

Lecture 16: Relaxation methods

Lecture 19 IIR Filters

Math 251 December 14, 2005 Answer Key to Final Exam. 1 18pt 2 16pt 3 12pt 4 14pt 5 12pt 6 14pt 7 14pt 8 16pt 9 20pt 10 14pt Total 150pt

Transcription:

Numerical Methods for Partial Differential Equations CAAM 452 Spring 2005 Lecture 2 Instructor: Tim Warburton

Note on textbook for finite difference methods Due to the difficulty some students have experienced in obtaining Gustafasson-Kreiss-Oliger I will try to find appropriate and equivalent sections in the online finitedifference book by Trefethen: http://web.comlab.ox.ac.uk/oucl/work/nick.trefethen/pdetext.html

Recall Last Lecture We considered the model advection PDE: u t u c = x defined on the periodic interval [0,2pi) We recalled that any 2pi periodic, C 1 function could be represented as a uniformly convergent Fourier series, so we considered the evolution of the PDE with a single Fourier mode as initial condition. This converted the above PDE into a simpler ODE for the time-dependent coefficient (i.e. amplitude) of a Fourier mode: duˆ 0 i ω cu ˆ = 0

Recall: the Advection Equation We wills start with a specific Fourier mode as the initial condition: [ π ) [ ] 1) Find 2π -periodic u x, t such that x 0,2, t 0, T u u c = t x given 0 1 u( x,0) = f x = e fˆ x 0,2 2π iω x ( ω) [ π ) where f is a smooth 2π -periodic function of one frequency ω We try to find a solution of the same type: 1 u x t e u t 2π iω x (, ) = ˆ ( ω, )

cont Substituting in this type of solution the PDE: u u c = 0 t x Becomes an ODE: u u 1 ˆ (, ) 1 iω x iω x du c = c e u ω t e ˆ iωcu = ˆ t x t x 2π 2π duˆ i ω cu ˆ = 0 With initial condition û ˆ ( ω,0) = f ( ω)

cont We have Fourier transformed the PDE into an ODE. We can solve the ODE: duˆ i ω cu ˆ = 0 uˆ t = e u = e fˆ uˆ ( ω,0) = fˆ ( ω) And it follows that the PDE solution is: iωct iωct ( ω, ) ˆ ( ω,0) ( ω) 1 iω x ansatz : u( x, t) = e uˆ ( ω, t) 2π iωct 1 solution : ˆ (, ) ˆ iω x+ ct u ω t = e f ( ω) u( x, t) = e fˆ ω = f x + ct 2π 1 iω x initial condition: f ( x) = e fˆ ( ω) 2π

Note on Fourier Modes Note that since the function should be 2pi periodic we are able to deduce: ω We can also use the superposition principle for the more general case when the initial condition contains multiple Fourier modes: ω= 1 f x e fˆ 2π iω x = ( ω) (, ) ω= ω= 1 iω( x+ ct ) ˆ ( ω) u x t = e f = f x + t 2π ω=

cont Let s back up a minute the crucial part was when we reduced the PDE to an ODE: u u duˆ c = 0 i ω cu ˆ = 0 t x The advantage is: we know how to solve ODE s both analytically and numerically (more about this later on).

Add Diffusion Back In So we have a good handle on the advection equation, let s reintroduce the diffusion term: c = d t x x 2 u u u Again, let s assume 2-pi periodicity and assume the same ansatz: 2 This time: 1 iω x u = e uˆ t 2π ( ω, ) c = d t x x 2 u u u 2 du ˆ i cu d 2 u duˆ ω ˆ = ω ˆ ( 2 = icω dω ) uˆ

cont Again, we can solve this trivial ODE: duˆ ( 2 ω ω ) = i c d uˆ ( 2 ω,0 ) ic d t uˆ = uˆ e ω ω ( ω,0) 2 ( + ) ω ω u = uˆ e e i ct x d t

cont The solution tells a story: 2 ( + ) ω ω u = uˆ ω,0 e e i ct x d t d t u = f ct + x e ω The original profile travels in the direction of decreasing x (first term) 2 As the profile travels it decreases in amplitude (second exponential term)

What Did Diffusion Do?? Advection: u t u c = x 0 duˆ i ω cu ˆ = 0 Diffusion: c = d t x x 2 u u u 2 duˆ ( 2 ω ω ) = i c d uˆ Adding the diffusion term shifted the multiplier on the right hand side of the Fourier transformed PDE (i.e. the ODE) into the left half plane. We summarize the role of the multiplier

Categorizing a Linear ODE duˆ ( 0) = µ uˆ uˆ = uˆ e µ t Exponential decay Increasingly oscillatory Im ( µ ) Exponential growth Re ( µ ) Increasingly oscillatory Here we plot the dependence of the solution to the top left ODE on mu s position in the complex plane

Categorizing a Linear ODE Im ( µ ) Re ( µ ) Here we plot the behavior of the solution for 5 different choices of mu

Summary duˆ µ t Re( µ ) t = µ uˆ uˆ = uˆ ( 0) e = uˆ ( 0) e ( cos( Im( µ ) t) + isin ( Im( µ ) t) ) When the real part of mu is negative the solution decays exponentially fast in time (rate determined by the magnitude of the real part of mu). When the real part of mu is positive the solution grows exponentially fast in time (rate determined by the magnitude of the real part of mu). If the imaginary part of mu is non-zero the solution oscillates in time. The larger the imaginary part of mu is, the faster the solution oscillates in time.

Solving the Scalar ODE Numerically We know the solution to the scalar ODE duˆ = µ uˆ However, it is also reasonable to ask if we can solve it approximately. We have now simplified as far as possible. Once we can solve this model problem numerically, we will apply this technique using the method of lines to approximate the solution of the PDE.

Stage 1: Discretizing the Time Axis du = f u It is natural to divide the time interval [0,T] into shorted subintervals, with wih often referred to as:, t or k We start with the initial value of the solution u(0) (and possibly u(-),u(-2),..) and build a recurrence relation which approximates u() in terms of u(0) and early values of u.

Example Using the following approximation to the time derivative: du u t + u t We write down an approximation to the ODE: du = f u u u 0 f u 0 ( )

Example cont Rearranging: u u 0 f ( u( 0) ) We introduce notation for the approximate solution after the n th time step: Our intention is to compute u u 0 + f u 0 We convert the above equation into a scheme to compute an approximate solution: u 0 = u u n 0 un u = u + f u 1 0 0 u n

Example cont We can repeat the following step from t= to t=2 and so on: u 0 = u 0 u = u + f u 1 0 0 u = u + f u 2 1 1 u = u + f u n+ 1 n n This is commonly known as the: Euler-forward time-stepping method or Euler s method

Euler-Forward Time Stepping It is natural to ask the following questions about this time-stepping method: u 0 n+ 1 n n Does the answer get better if is reduced? (i.e. we take more timesteps between t=0 and t=t) Does the numerical solution behave in the same way as the exact solution for general f? (for the case of f(u) = mu*u does the numerical solution decay and/or oscillate as the exact solution) How close to the exact solution is the numerical solution? = u As we decrease does the end iterate converge to the solution at t=t 0 u = u + f u

Experiments Before we try this analytically, we can code it up and see what happens. This is some matlab code for Euler forward applied to: u 0 = u 0 u = u + µ u n+ 1 n n http://www.caam.rice.edu/~caam452/codesnippets/eulerforwardode.m

What can we use? With =0.1, T=3, uo=1, mu=-1-2*i Matlab The error is quite small.

Larger =0.5 With =0.5, T=3, uo=1, mu=-1-2*i The error is visible but the trend is not wildly wrong.

Even Larger =1 With =1, T=3, uo=1, mu=-1-2*i The solution is not remotely correct but is at least bounded.

=2 With T=30, =2, uo=1, mu=-1-i Boom the approximate solution grows exponentially fast, while the true solution decays!

Observations When is small enough we are able to nicely approximate the solution with this simple scheme. As grew the solution became less accurate When =1 we saw that the approximate solution did not resemble the true solution, but was at least bounded. When =2 we saw the approximate solution grew exponentially fast in time.

cont Our observations indicate two qualities of time stepping we should be interested in: stability: i.e. is the solution bounded in a similar way to the actual solution? accuracy: can we choose small enough for the error to be below some threshold?

Geometric Interpretation: u 0 = u ( 0) u = u + f u n+ 1 n n We can interpret Euler-forward as a shooting method. We suppose that u n is the actual solution, compute the actual slope f ( u n ) and shift the approximate solution by f u n Note: u n t n u n + 1 t n + 1 f ( u n ) the blue line is not the exact solution, but rather the same ODE started from the last approximate value of u computed. in this case we badly estimated the behavior of even the approximately started solution in the interval two kinds of error can accumulate!.

Interpolation Interpretation: u 0 = u ( 0) u = u + f u n+ 1 n n We start with the ODE: du = f u Integrate both sides from over a interval: tn+ 1 tn+ 1 du = f ( u ) tn tn Use the fundamental theorem of calculus: t n+ 1 t n du [ ] t u n+ 1 = = t u n+ 1 u n Finally, replace f with a constant which interpolates f at the beginning of the interval n

cont t n+ 1 t n du = u = t u t n+ 1 u t n tn+ 1 [ ] t t t n+ 1 n+ 1 n+ 1 ( ) ( ) ( ) n n n t t t n n n n+ 1 n n n f u t f u t = f u t = f u t u t u t f u t Again, we have recovered Euler s method.

Stability Let s choose f(u) = mu*u u = u 0 0 u = u + µ u = 1+ µ u We can solve this immediately: u = u 0 0 n+ 1 n+ 1 n n n n u = 1+ µ u = 1+ µ + u 0 n Next suppose Re(mu)<=0 then we expect the actual solution to be bounded in time by u(0). For this to be true of the approximate solution we require: 1+ µ 1 1

Stability Condition for Euler Forward Since mu is fixed we are left with a condition which must be met by 1+ µ 1 which is true if and only if: 1+ Re µ 2 + Im µ 2 1 ( ) The region of the complex plane which satisfies this condition is the interior of the unit circle centered at Im -1+0*i x Re

cont i.e. µ will not blow up if it is located inside the unit disk: Im x -1+0i Re Notice: the exact solutions corresponding to Re(mu)<0 all decay. However, only the numerical solutions corresponding to the interior of the yellow circle decay.

Disaster for Advection!!! Now we should be worried. The stability region: Im x -1+0i Re only includes one point on the imaginary axis (the origin) but our advection equation for the periodic interval has mu which are purely imaginary!!!. du ˆ i ω cu ˆ = 0 µ = i ω c Conclusion the Euler-Forward scheme applied to the Fourier transform of the advection equation will generate exponentially growing solutions.

Nearly a Disaster for Advection-Diffusion!!! duˆ ( 2 ω ω ) = i c d uˆ This time the stability region must contain: ( 2 ) µ = iωc ω d Im x -1+0i Re Because the eigenvalues are shifted into the left half part of the complex plane, we will be able to choose small enough to force the mu* into the stability region. We can estimate how small has to be in this case

cont (estimate of for advection-diffusion) For stability we require: µ + 1 1 ( 2 iωc ω ) d + 1 1 ( 2 ω d ) ( ωc ) ( 2 2 2 ω ) 2 2 1 + 1 2 2 2 2 2 d d c 0 d + c 2d ω + ω + ω = 0 or ω = 0 or

cont The only interesting condition for stability is: 2d ω d + c 2 2 2 What does this mean?, volunteer? ω, d, c i.e. how do influence the maximum stable? Hint: consider i) d small, c large ii) d large, c small

Multistep Scheme (AB2) Given the failure of Euler-Forward for our goal equation, we will consider using the solution from 2 previous time steps. i.e. we consider u = u + af u + bf u n+ 1 n n n 1 Recall the integral based interpretation of Euler- Forward: tn+ 1 u( t ) ( ) ( ) n+ 1 u tn = f u t f u tn t n

cont We interpolate through f(u n-1 )and f(u n ) then integrate between t n and t n+1 f Linear interpolant of the f values f(u n ) If n+1 f(u n-1 ) t n-1 t n t n+1 Approximate integral

cont This time we choose to integrate under the interpolant of f which agrees with f at t n and t n-1 The unique linear interpolant in this case is: t t t t I f = f u + f u n n 1 1 n n 1 tn t n 1 tn 1 t n We need to compute the following integral of the interpolant..: t n I f 1 t n

t n+ 1 n+ 1 t n t cont t t t t I f = f u + f u n n 1 1 n n 1 tn t t n 1 tn 1 t n n n tn+ 1 tn+ 1 f un f un 1 = ( t tn 1) ( t tn ) t t tn t f ( u ) f un t = t t tnt 2 2 2 2 n 1 n 1 t 3 1 = f un f u 2 2 Last step: homework exercise n + 1 n+ 1 n 1 n t t n

Adams-Bashford 2 The resulting AB2 scheme requires the solution at two levels to compute the update: n+ 1 u = u + If n+ 1 n 1 t t n 3 1 = u + f u f u 2 2 n n n 1

Next Time Stability region for AB2 Generalization to AB3, AB4 (use more historical data to compute update) Accuracy/consistency of Euler-Forward, AB2,AB3,AB4 Convergence. Runge-Kutta schemes (if time permits) READING: http://web.comlab.ox.ac.uk/oucl/work/nick.trefethen/1all.pdf p10-p55 (do not do exercises)