Download presentation
Presentation is loading. Please wait.
Published byBonnie O’Connor’ Modified over 9 years ago
1
Numerical Methods for Partial Differential Equations CAAM 452 Spring 2005 Lecture 9 Instructor: Tim Warburton
2
CAAM 452 Spring 2005 Today Introduction to a very basic finite volume method
3
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 In detail: The time rate of change 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 pipe per unit time
6
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 Note that the units of each variable are consistent. Basic calculus: From which we obtain:
10
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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 t Slope =
12
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 1)Let’s consider the advection equation: 2)Next we take a finite portion of the real line from x 1 to x N divided into N-1 equal length sections 3)In each section we will approximate the density by a constant value Building a Finite Volume Solver x1x1 xNxN dx
14
CAAM 452 Spring 2005 In the n’th section the density will be approximated by the constant: Piecewise Constant Approximation x1x1 xNxN
15
CAAM 452 Spring 2005 Choosing a = x i, b=x i+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
CAAM 452 Spring 2005 Upwind Treatment for Flux Terms Recall that the solution shifts from left to right as time increases. Idea: use the upwind values t Slope =
17
CAAM 452 Spring 2005 Basic Upwind Finite Volume Method simplify Note we must supply a value for the left most average at each time step:
18
CAAM 452 Spring 2005 Basic Upwind Finite Volume Method Approximate time derivative and look for solution Note we must supply a value for the left most average at each time step: Recall Approximate fluxes with upwind flux
19
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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 x i,t n with Taylor series:
23
CAAM 452 Spring 2005 Estimating Truncation Error Inserting the formulas for the expanded q’s:
24
CAAM 452 Spring 2005 Estimating Truncation Error Removing canceling terms:
25
CAAM 452 Spring 2005 Estimating Truncation Error Simplifying:
26
CAAM 452 Spring 2005 Final Form Using the definition of q Using that:
27
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 Estimating Error in Terms of Initial Error and Cumulative Truncation Error
31
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 Stability in the Discrete 1-norm So here’s the interesting story. In the case of a zero boundary condition then we automatically observe that the operator is a contraction operator.
34
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 Relaxation on Stability Condition In this case the stability analysis yields:
37
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 Homework 2 Due on Friday Recall report presentation policy Time will be given in class on Wednesday to go over questions.
39
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 Homework 2 cont Q4) Implement the numerical approximation of: By:
41
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 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
CAAM 452 Spring 2005 Homework 2 correction Q4) Implement the numerical approximation of: By:
44
CAAM 452 Spring 2005 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:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.