Math 7824 Spring 2010 Numerical solution of partial differential equations Classroom notes and homework

Similar documents
Index. higher order methods, 52 nonlinear, 36 with variable coefficients, 34 Burgers equation, 234 BVP, see boundary value problems

Numerical Methods for Partial Differential Equations CAAM 452. Spring 2005

Chapter 10 Exercises

Part 1. The diffusion equation

7 Hyperbolic Differential Equations

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

Last time: Diffusion - Numerical scheme (FD) Heat equation is dissipative, so why not try Forward Euler:

Lecture Notes on Numerical Schemes for Flow and Transport Problems

FDM for wave equations

Lecture Notes on Numerical Schemes for Flow and Transport Problems

Qualifying Examination

Review for Exam 2 Ben Wang and Mark Styczynski

Index. C 2 ( ), 447 C k [a,b], 37 C0 ( ), 618 ( ), 447 CD 2 CN 2

MATH 333: Partial Differential Equations

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

MIT (Spring 2014)

Numerical Methods for Conservation Laws WPI, January 2006 C. Ringhofer C2 b 2

Numerical Methods for PDEs

NUMERICAL METHODS FOR ENGINEERING APPLICATION

PDEs, part 3: Hyperbolic PDEs

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

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

Mathematics Qualifying Exam Study Material

Numerical Solutions for Hyperbolic Systems of Conservation Laws: from Godunov Method to Adaptive Mesh Refinement

Preface. 2 Linear Equations and Eigenvalue Problem 22

Numerical Solution of partial differential equations

Math 660-Lecture 23: Gudonov s method and some theories for FVM schemes

A THEORETICAL INTRODUCTION TO NUMERICAL ANALYSIS

Applied Mathematics 205. Unit III: Numerical Calculus. Lecturer: Dr. David Knezevic

FDM for parabolic equations

Ordinary Differential Equations II

Numerical Algorithms for Visual Computing II 2010/11 Example Solutions for Assignment 6

CS205B / CME306 Homework 3. R n+1 = R n + tω R n. (b) Show that the updated rotation matrix computed from this update is not orthogonal.

Preliminary Examination, Numerical Analysis, August 2016

ENO and WENO schemes. Further topics and time Integration

Conservation of Mass (Eulerian Framework)

Problem Set 4 Issued: Wednesday, March 18, 2015 Due: Wednesday, April 8, 2015

Design of optimal Runge-Kutta methods

Final Exam May 4, 2016

Syllabus for Applied Mathematics Graduate Student Qualifying Exams, Dartmouth Mathematics Department

Final exam (practice) UCLA: Math 31B, Spring 2017

Ordinary Differential Equations II

4 Stability analysis of finite-difference methods for ODEs

MATH-UA 263 Partial Differential Equations Recitation Summary

Iterative Methods for Linear Systems

Applied Math for Engineers

Tyn Myint-U Lokenath Debnath. Linear Partial Differential Equations for Scientists and Engineers. Fourth Edition. Birkhauser Boston Basel Berlin

Selected HW Solutions

Notes: Outline. Shock formation. Notes: Notes: Shocks in traffic flow

Finite difference method for elliptic problems: I

ME Computational Fluid Mechanics Lecture 5

MTH 452/552 Homework 3

CS 323: Numerical Analysis and Computing

Partial differential equations

Numerical Mathematics

CS412: Introduction to Numerical Methods

Final exam (practice) UCLA: Math 31B, Spring 2017

Math 106: Calculus I, Spring 2018: Midterm Exam II Monday, April Give your name, TA and section number:

[2] (a) Develop and describe the piecewise linear Galerkin finite element approximation of,

Partial Differential Equations

LECTURE # 0 BASIC NOTATIONS AND CONCEPTS IN THE THEORY OF PARTIAL DIFFERENTIAL EQUATIONS (PDES)

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

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

Ordinary Differential Equations

Finite Difference Methods for Boundary Value Problems

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

High-Order Finite-Volume Methods! Phillip Colella! Computational Research Division! Lawrence Berkeley National Laboratory!

Tutorial 2. Introduction to numerical schemes

Chapter 5 HIGH ACCURACY CUBIC SPLINE APPROXIMATION FOR TWO DIMENSIONAL QUASI-LINEAR ELLIPTIC BOUNDARY VALUE PROBLEMS

Finite difference methods for the diffusion equation

Numerical Solutions to Partial Differential Equations

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

A very short introduction to the Finite Element Method

CS 323: Numerical Analysis and Computing

MATH 2083 FINAL EXAM REVIEW The final exam will be on Wednesday, May 4 from 10:00am-12:00pm.

Boundary Value Problems and Iterative Methods for Linear Systems

Preliminary Examination in Numerical Analysis

10. e tan 1 (y) 11. sin 3 x

Numerical methods Revised March 2001

You may not use your books, notes; calculators are highly recommended.

Basics of Discretization Methods

Solving Differential Equations on 2-D Geometries with Matlab

Sung-Ik Sohn and Jun Yong Shin

Time stepping methods

VISCOUS FLUX LIMITERS

Numerical Analysis of Differential Equations Numerical Solution of Parabolic Equations

A recovery-assisted DG code for the compressible Navier-Stokes equations

Applied Math Qualifying Exam 11 October Instructions: Work 2 out of 3 problems in each of the 3 parts for a total of 6 problems.

ACM/CMS 107 Linear Analysis & Applications Fall 2017 Assignment 2: PDEs and Finite Element Methods Due: 7th November 2017

Numerical Solutions to Partial Differential Equations

MAT 211, Spring 2015, Introduction to Linear Algebra.

Numerical Solutions to Partial Differential Equations

NUMERICAL SOLUTION OF ODE IVPs. Overview

Scientific Computing WS 2017/2018. Lecture 18. Jürgen Fuhrmann Lecture 18 Slide 1

Divergence Formulation of Source Term

MB4018 Differential equations

The one-dimensional equations for the fluid dynamics of a gas can be written in conservation form as follows:

1 Upwind scheme for advection equation with variable. 2 Modified equations: numerical dissipation and dispersion

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

3.4. Monotonicity of Advection Schemes

Transcription:

Math 7824 Spring 2010 Numerical solution of partial differential equations Classroom notes and homework Jan Mandel University of Colorado Denver May 12, 2010 1/20/09: Sec. 1.1, 1.2. Hw 1 due 1/27: problems 1.1, 1.3, geometric interpretation (sec. 1.6) 1/25/10: If you use a laptop, please bring it. At 11am, the class will continue by Chris Harder s PhD defense. 1/27/10: Sec. 1.3, integration by parts - justification of eq. (1.18) 2/1/10: Sec. 1.4, motivation of Sobolev spaces from minimization of energy 2/3/10: Sec. 1.5 Sobolev spaces Hw 2 due 2/10: problems 1.8, 1.12. Make sure Matlab works on your laptops. 2/8/10 Sec. 2.1-2.3: Abstract formulation and error estimates, regularity 2/10/10 Sec. 4.7 - L 2 estimate by duality (Nitsche s trick) 2/15/10 Difference formulas - LeVeque ch. 1. Hw 3 due 2/22: write a function c=d5(x) to compute the coefficients of a finite difference formula to evaluate u (5) (x 0 ) from x = [x 0,..., x 5 ]. (See the book p. 11). Write a script test d5 that will test the coefficients and verify the differencing is exact for all polynomial of appropriate order. test d5 should run alone, with no input of any kind. I will test your d5 on both uniform and nonuniform grids. 2/17/10 Solving the laplace equation in 1D, l 2 error estimate - sec. 2.1-2.9. Greens function 2/22/10 Solution of homework problem 1.3 (quadratic elements in 1D).Max error estimate for the Laplace equation in 1D - 2.11 1

2/24/10 Neumann problem - FE Johnson 1.7, FD Le Veque 2.12. Hw 4 due 3/3: 1. Find the variational solution of the Laplace equation d 2 u/dx 2 = δ y in (0, 1), u (0) = u (1) = 0, for a fixed y (0, 1) Use the weak formulation d 2 u/dx 2 vdx = v (y) for all suitable test functions v and integration by parts to find continuous and piecewise smooth u. Summarize and graph the resulting Green s function u (x, y). 2. Write Matlab function u=neumann fd(f,a,b,sigma0,sigma1) to solve the Neumann problem u = f in (a, b), u (a) = σ 0, u (b) = σ 1. Here f and u are vector of length n + 2 of values at the nodes of uniform mesh x 0 = a,..., x n+1 = b, with the boundary condition discretized by finite differences (2nd order inside the interval, 1st order for the boundary conditions) as in the book. Then write the function u=neumann fe(f,a,b,sigma0,sigma1) for the same problem discretized by linear finite elements on the same mesh. Test on the interval (0, 1) for the right-hand side and the boundary conditions given by the exact solution u (x) = x (1 x). Plot the numerical solutions and the exact solution, and compare in the 2 norm and the maximum norm. The solution is determined only up to an additive constant, so for the comparison, add a constant vector to the solution to make the average zero. Print n, h, and the norms of the error divided by h and h 2 to verify the rate of convergence for n = 2, 4, 8,..., 1024. Store the system matrix as sparse. Hint: The solution is determined only up to a constant. To solve the singular system of equations, take an arbitrary lnear equation with zero right hand side, which is not satisfied by the constant, for example u k = 0, and add it to one of the equations in the system. Turn in 1. matlab codes 2. your report with all graphs and printout including the source as a single file or hardcopy. 3/1 Nonlinear equation - 2.16, singular perturbation - 2.17, reading: 2.13, 2.14, 2.15 3/3 Laplace equation in 2D (3.1-3.4). Hw 5 due 3/10. 1. Write matlab code to find the solution of the nonlinear pendulum equation θ = sin θ in (0, 2π) with boundary conditions u (0) = a, u (2π) = b on a uniform mesh as Matlab function pendulum(tol,maxit,theta0) where tol is the stopping tolerance in the max norm, maxit is the maximum number of iterations for Newton s method, and theta0 is the initial approximation on your mesh. Graph the Newton iterates to get the same pictures as in the book. The boundary values are the first and the last entries of theta0. Use this code to find the solution starting from constant theta0=0.7, and at least one other solution with the same boundary values. Turn in the matlab code and your report with graphs, listing of the code, and description of the code and the results. 2. Write matlab code to solve the equation εu + u = 1 in (a, b), u (a) = u (b) = 0, on a uniform mesh x 0 = a,..., x n+1 = b and approximation of u by central difference, as u=advection(a,b,epsilon,n) returning vector u of length n + 1. Compare the solution with the exact solution, which you find analytically, and create a table and mesh plot of the max error as a function of log ε and log h, h = 1/n. for small ε > 0 and large n. Explore numerically the question how large n has to be for some given error tolerance and given small ε. Repeat for approximations of u by left and right 2

one-sided differences. Turn in the matlab code and your report with graphs, listing of the code, and description of the code and the results as a single file or hardcopy. Project 1, due 4/12. Construct example of solutions u of the homogeneous Dirichlet problem for the Laplace equation on unit square, u = f in Ω = (0, 1) (0, 1), u = 0 on Ω, such that f is smooth but u is not; in particular, 4 u/ x 4 and 4 u/ y 4 are not in L 2 (Ω) and u is not in H β (Ω). For which β > 0 do you get such examples? Consider w = Im z a ln z, show that w = 0, and choose a so that w is zero on one axis and polynomial on the other. Then find v such that w = v on the axes, and v = 0 or is smooth, and consider u = (v w) ϕ, where ϕ is a smooth cut-off function to force u = 0 on the other two sides of Ω. Discuss if it possible to guarantee that u H 4 (Ω) by assuming that f is sufficiently smooth and the implications for the l 2 estimate of the error of the finite difference method. 3/8 Solved some older hw problems. Initial value problems (5.1-5.2) 3/10 Basic methods for IVP: notes ch. 11 3/17 Midterm. Review questions: Using integration by parts, derive the variational formulation of the Laplace equation in 1D. (Assume all functions are smooth enough.) Using integration by parts, derive the variational formulation of the Laplace equation in 2D. (Assume all functions are smooth enough.) Define the Sobolev space H 1 (Ω). Write the Sobolev inequality for functions in H 1 (Ω), Ω a bounded domain with piecewise smooth boundary (and no zero angles). For which d does it hold that H 1 (Ω) C ( Ω ) for a (suitable) domain Ω R d? Show that the variational formulation and minimization energy (in abstract form) are equivalent. Formulate and prove the Lax-Milgram theorem. Formulate and prove Cea s lemma. Formulate and prove L 2 error estimate using duality (Nitsche s trick) Derive the truncation error of the 3-point central difference formula for second derivative. Write the discretization of u = f in (0, 1), u (0) = u (1) = 0 by finite differences as a linear system AU = b. Find all eigenvalues and eigenvectors of the matrix A above. Bound A 1 independently of h (in the specral norm). 3

Given a bound on the truncation error and on A 1, find a bound on the error of the solution. Derive a finite difference discretization of the equation u = f (u) in (0, 1), u (0) = u (1) = 0 and state the Newton s method for the solution of the discretized equations. 3/19 Midterm 3/29 Convergence of basic methods for IVP: notes 11.4 3/31 Runge-Kutta methods: notes 11.5 4/5 Revisited Project 1. Leap-frog method (notes 11.6); absolute stability revisited. Homework 6 due April 12: Test the Euler method, Backward Euler method, Leapfrog method, the Trapezoidal method, and the modified Trapezoidal method u n+1 = u n + h ((1 h) f 2 n + (1 + h) f n+1 ) on the problem u (t) = λ (u cos t) sin (t), u (0) = 1.5. The exact solution is given by (8.2) in the book. For each method, print a square table of max errors for h = 10 1, 10 2,...,10 6 and λ = 1, 10, 10 2,..., 10 6. Explain the results. Plot at least 3 appropriate graphs of the solution. For each method, make also Matlab mesh plot of the error. Label all axes correctly and annotate the plots and make sure the tables have clear headings so that your results make sense. Submit all matlab files with a single script go.m that will produce your table and graphs with no input. Submit your report as a single pdf file or hardcopy. 4/7 A-stability (8.3.1), stiff problems, L-stability (8.3.2). Diffusion equation in 1D: method of lines, stability, stiffness (9.2-9.4) 4/12 truncation error (9.1), convergence, Lax equivalence theorem (9.5), ADI method. Homework 7 due April 19: Write code to solve the heat equation u t = κ (u xx + u yy ) for x Ω = (0, 1) (0, 1), t (0, 1), u (t, x, y) = 0 for (x, y) Ω, u (0, x, y) = f (x, y) by 1. Euler method, 2. Crank-Nicholson method, 3. ADI, with space mesh step h = 0.2, 0.1, 0.05, 0.025 and appropriate time step, for κ = 1 and 0.1. You may use Matlab sparse Choleski for the Crank-Nicholson method, if you do, decompose the matrix only once. Use f (x, y) = sin (5πx) sin (2πy), compute exact solution, compare your numerical result with the exact solution at t = 1, and tabulate the max norm of the error. If any computation takes more than 20 minutes you may leave the table entry blank. Submit matlab code with a single script go.m that will produce your tables and (optionally) graphs with no input, and a report with code, tables, and all other work (statement or derivation of the methods and of the exact solution). 4/14 Advection equation, Euler method, von Neumann stability, leapfrog method, Lax-Friedrichs method (10.1-10.2). 4

4/19 Lax-Wendroff method, upwind method (derived from the C-I-R method) (10.4, for C-I-R: LeVeque, Numerical Methods for Conservation Laws, Birkhauser, 1992 (NMCL), 13.1), stability (10.5), CFL condition (10.6-7) Homework 8 due April 26: Program the leapfrog method, Lax-Friedrichs method, Lax-Wendroff method, and the upwind method for the equation u t +au x = 0 with a = 2 on the interval ( 1, 1) with periodic boundary conditions, and 0 t 0.9. Choose mesh step h = 0.05 and time step such that ak/h = 0.9. Plot the exact solution and the numerical solutions on the rectangle ( 1, 1) (0, 0.9), for these choices of the initial value: u 0 (x) = 0 in ( 1, 1) \ ( 0.2, 0.2), and in ( 0.2, 0.2) a) smooth function by shifting and scaling of cos so that u 0 (0) = 1, u 0 (±0.2) = u 0 (±0.2) = 0 b) piecewise linear function such that u 0 (0) = 1, u 0 (±0.2) = 0 c) piecewise constant function equal to 1 on the nodes inside ( 0.2, 0.2). That is total 4 times 3 = 12 figures. For each method and initial value, compute the max error and organize them in 4 times 3 table. Comment on the error and the figures using analysis of the methods in the book. Turn in matlab code and a report with the code and the results. Project 2, due at the time of the final exam. Choose one of the equations in section 11.1 and write a code for an explicit finite difference method for its solution. Or talk to me to pick another problem. Use the code to find and visualize an interesting nontrivial solution of the equation. Turn in matlab code and a report with the code, its derivation, explanation of the problem and the method, and the results and their explanation. 4/21: Dispersion (E.3), modified equations (10.9) (upwinding only) 4/26 Modified equations for Lax-Friedrichs (rest of 10.9). Hyperbolic systems (10.10-10.11), upwinding for initial BVP (10.12.1), implicit-explicit methods (11.5), demo: fire spotting.m 4/28 Systems of conservation laws, conservative methods, nonlinear Lax-Wendroff method, demo: waterwave.m (from R. Leveque, Numerical Methods for Conservation Laws, Birkäuser 1992, pp. 1 3, 14 16, 124 125, and C. Moller, Shallow Water Equations (pdf)) 5/3 q&a: implementing the matrix for 2D Laplace equation. Upwind method as example of conservative method. Characteristics, Burger s equation, weak solution, jump conditions. 5/5 Lax-Wendroff theorem, Riemann s problem and its solution for Burger s equation, entropy condition, Godunov s method, monotone methods, convergence of monotone methods. I am available for consultations: Friday 5/7 before 9:30; after 2pm with appointment; Monday 5/10 before 11:30 and 12:30-2:15; after 2:15 with appointment one day in advance. 5

Final: Wednesday 5/12 10-11:15. Review questions for the final 1. Derive the truncation error for one of the covered methods (Euler, Backward Euler, Trapezoidal, Heun, Leapfrog) 2. Derive the region of absolute stability for those same methods. 3. Define A-stability and L-stability. Define all terms in the definition starting from the differential equation. 4. Derive the truncation error for the Crank-Nicholson method for the heat equation. 5. State the Lax-Richtmyer equivalence theorem. 6. Derive the stability restriction on the time step of the Euler method for the heat equation using the Fourier mode analysis on a rectangle. 7. State the upwind method for the advection equation and perform von Neumann stability analysis to derive the CFL condition. The same for Lax-Friedrichs, Lax- Wendroff. 8. Derive the modified equation for the upwind method; the same for Lax-Wendroff and Leapfrog method. 9. Perform the von-neumann analysis for the modified equation of the upwind method; the same for Lax-Wendroff and Leapfrog method. Identify dissipation and dispersion, compute the group velocity. 10. Define a system of hyperbolic conservation laws. 11. Show that the upwind method is a conservative scheme. 12. Solve the Burger s equation for a given an initial value by the method of characteristics. 6