1 / 44

Numerical Methods for Partial Differential Equations

Numerical Methods for Partial Differential Equations. CAAM 452 Spring 2005 Lecture 9 Instructor: Tim Warburton. Today. Introduction to a very basic finite volume method. Mass Conservation.

eithne
Download Presentation

Numerical Methods for Partial Differential Equations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Today • Introduction to a very basic finite volume method

  3. Mass Conservation • For the following we are going to consider a 1-dimensional domain which we parameterize with the variable x. • Now imagine that this line is a figurative representation of a pipe which contains fluid. • At every point on the line the fluid has a density measured in mass per meter ( with units kgm-1 ) • We define a new function which is a non-negative, real valued function defined on the space-time domain. x

  4. Derivation of Mass Conservation Law • Next we consider an arbitrary section of the pipe, say [a,b] • We now assume that the fluid is not created or destroyed at any point inside the section and is traveling with velocity u (which is a function of space and time). For the moment we will assume that u is positive (i.e. the fluid is flowing in the direction of positive x) • This allows us to state the following: • The time rate of change of the total fluid inside the section [a,b] changes only due to the flux of fluid into and out of the pipe at the ends x=a and x=b. • A simple formula relating these two quantities is:

  5. In detail: The time rate ofchange of total mass in the section of pipe [a,b] The flux out of the section at the right end of the section of pipe per unit time The flux into the section at the left end of the section of pipeper unit time

  6. Use the Fundamental Theorem of Calculus • Look carefully at the right hand side: • Clearly we may rewrite this as: • From which we may deduce:

  7. Finally… • Assuming that the integrand of:is continuous and noting that this relation holds for all choices of a,b then we may deduce: • In short hand:

  8. Advection Equation • Let’s choose a simple, constant, fluid velocity • Then the pde reduces to the advection equation: • This is a pretty easy equation to solve . Consider the change of variables:

  9. Note that the units of each variable are consistent. • Basic calculus: • From which we obtain:

  10. Solution and Interpretation • So we know: • Which we can instantly solve: where: • So an interesting property of the advection equation is the way that the profile of the solution does not change shape but it does shift in the positive x direction with constant velocity

  11. t Slope = Space Time Diagram • Let’s track the information: • The dashed lines are which are known as characteristics of the equation. • If we choose a point on one of these dashed lines and track back down to t=0 and we will find the value of the density which applies at all points on the dashed line x

  12. Recall • Assuming that the integrand of:is continuous and noting that this relation holds for all choices of a,b then we may deduce: • Well – this does not hold if the density is discontinuous and the integral equation is the appropriate representation:

  13. Building a Finite Volume Solver • Let’s consider the advection equation: • Next we take a finite portion of the real line fromx1 to xN divided into N-1 equal length sections • In each section we will approximate the density by a constant value dx x1 xN

  14. Piecewise Constant Approximation x1 xN In the n’th section the density will be approximated by theconstant:

  15. Choosing a = xi, b=xi+1, • Is approximated (to first order in time) by: where the time axis has been divided into sections of length dt and the i’th cell average at time n*dt is represented by • Outstanding question: Now we have to figure out how to evaluate the density at the interval end points given the cell averages.

  16. t Slope = Upwind Treatment for Flux Terms • Recall that the solution shifts from left to right as time increases. • Idea: use the upwind values

  17. Basic Upwind Finite Volume Method simplify Note we must supply a value for the left most average at each time step:

  18. Recall Basic Upwind Finite Volume Method Approximate fluxes with upwind flux Approximate time derivative and look forsolution Note we must supply a value for the left most average at each time step:

  19. Convergence • We have constructed a physically reasonable numerical scheme to approximate the advection equation. • However, we need to do some extra analysis to determine how good at approximating the true PDE the discrete scheme is. • Let us suppose that the i’th subinterval cell average of the actual solution to the PDE at time T=n*dt is denoted by

  20. Error Equation • The goal is to estimate the difference of the exact solution and the numerically obtained solution at some time T=n*dt. • So we are interested in the error: • For the given finite volume scheme dt and dx will be related in a fixed manner (i.e. dt = Cdx for some C, independent of dx). • Suppose we let and then the scheme is said to be of order s.

  21. Norms and Definitions • We define the discrete p-norms: • We say that the scheme is convergent at time T in the norm ||.|| if: • It is said to be accurate of order s if:

  22. Local Truncation Error • Suppose at the beginning of a time step we actually have the exact solution -- one question we can ask is how large is the error committed in the evaluation of the approximate solution at the end of the time step. • i.e. choose • Then • We expand about xi,tn with Taylor series:

  23. Estimating Truncation Error • Inserting the formulas for the expanded q’s:

  24. Estimating Truncation Error • Removing canceling terms:

  25. Estimating Truncation Error • Simplifying:

  26. Final Form • Using the definition of q Using that:

  27. Interpretation of Consistency So the truncation error is O(dx) under the assumption that dt/dx is a constant.. This essentially implies that the numerical solution diverges from the actual solution by an error of O(dx) every time step. If we assume that the solution q is smooth enough then the truncation error converges to zero with decreasing dx. This property is known as consistency.

  28. Error Equation • We define the error variable: • We next define the numerical iterator N: • Then: • So the new error consists of the action of the numerical scheme on the previous error and the error commited in the approximation of the derivatives.

  29. Abstract Scheme • Without considering the specific construction of the scheme suppose that the numerical N operator satisfies: • i.e. N is a contraction operator in some norm then…

  30. Estimating Error in Terms of Initial Error and Cumulative Truncation Error

  31. Error at a Time T (independent of dx,dt) • If the method is consistent (and the actual solution is smooth enough) then: • As dx -> 0 the initial error ->0 and consequently the numerical error at time T tends to zero with decreasing dx (and dt).

  32. Specific Case: Stability and Consistency for the Upwind Finite Volume Scheme • We already proved that the upwind FV scheme is consistent. • We still need to prove stability of.

  33. Stability in the Discrete 1-norm So here’s the interesting story. In the case of a zero boundarycondition then we automatically observe that the operator is a contraction operator.

  34. Boundary Condition • Suppose are two numerical solutions with • Then: • i.e. if we are spot on with the left boundary condition the N iterator is indeed a contraction.

  35. Relaxation on Stability Condition • Previous contraction condition on the numerical iterator N • A less stringent condition is: • Where alpha is a constant independent of dt as dt->0

  36. Relaxation on Stability Condition • In this case the stability analysis yields:

  37. Interpretation • Relaxing the stability yields a possible exponential growth – but this growth is independent of T so if we reduce dt (and dx) then the error will decay to zero for fixed T.

  38. Homework 2 • Due on Friday • Recall report presentation policy • Time will be given in class on Wednesday to go over questions.

  39. Homework 2 Q1) Solve the pde analytically on the domain Q2) Solve the pde analytically. Q3) Solve the pde analytically and explain what happens to the density along the characteristics. PTO

  40. Homework 2 cont Q4) Implement the numerical approximation of: By:

  41. Homework 2 cont Q4 cont) For N=10,40,160,320,640,1280 run to t=100, with: dx = (8/(N-1)) dt = dx/6 On the same graph, plot t on the horizontal axis and error on the vertical axis. The graph should consist of a sequence of 6 curves – one for each choice of dx. Comment on the curves. NOTE: For the purposes of this test we define error as:

  42. Lecture 5 • We will define stability for a numerical scheme and investigate stability for the upwind scheme. • We will compare this scheme with a finite difference scheme. • We will consider alternative ways to approximate the flux functions.

  43. Homework 2 correction Q4) Implement the numerical approximation of: By:

  44. Homework 2 cont Q4 cont) For N=10,40,160,320,640,1280 run to t=10, with: dx = (8/(N-1)) dt = dx/6 Use On the same graph, plot t on the horizontal axis and error on the vertical axis. The graph should consist of a sequence of 6 curves – one for each choice of dx. Comment on the curves. NOTE: For the purposes of this test we define error as:

More Related