Accuracy

of 6
11 views
PDF
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Document Description
MATH3203 Lecture 5 Accuracy of Finite Difference Schemes Dion Weatherley Earth Systems Science Computational Centre, University of Queensland March 15, 2006 Abstract Contents 1 Determining the Accuracy of a FD scheme 1.1 Taylor series expansion for F (x, t + ∆t) . . . . . . . 1.2 Accuracy of forward/backward finite differences . . 1.3 Accuracy of centred finite differences . . . . . . . . 1.4 Accuracy of the FD scheme for 1D Diffusion . . . . 1.5 Improving the temporal accuracy - Leapfrog scheme 1.6
Document Share
Document Tags
Document Transcript
  MATH3203 Lecture 5Accuracy of Finite Difference Schemes Dion Weatherley Earth Systems Science Computational Centre,University of Queensland March 15, 2006 Abstract Contents 1 Determining the Accuracy of a FD scheme2 1.1 Taylor series expansion for F  ( x,t + ∆ t ). . . . . . . . . . . . . . . . . . . . 21.2 Accuracy of forward/backward finite differences. . . . . . . . . . . . . . . 21.3 Accuracy of centred finite differences. . . . . . . . . . . . . . . . . . . . . 31.4 Accuracy of the FD scheme for 1D Diffusion. . . . . . . . . . . . . . . . . 31.5 Improving the temporal accuracy - Leapfrog scheme. . . . . . . . . . . . . 41.6 A note on Neumann Boundary Conditions. . . . . . . . . . . . . . . . . . 41  1 Determining the Accuracy of a FD scheme In the previous lecture we derived a formula for solving the 1D diffusion equation usingthe Finite Difference approximation for derivatives, namely u n +1 k = u nk + ν  ∆ t ∆ x 2 ( u nk +1 − 2 u nk + u nk − 1 ) . (1)This equation defines an explicit scheme for solving the 1D diffusion problem. We can usethis scheme to explicitly compute all u n +1 k given values from the previous timestep ( u nk ).From the definition of a partial derivative, it is obvious that the finite differenceapproximation will be a better approximation to the derivative for smaller values of ∆ x or ∆ t . Since we do not have the luxury of making these quantities arbitrarily small, wemust attempt to quantify the accuracy of the scheme in terms of ∆ x and ∆ t .In the study of  convergence of a numerical scheme, there are two issues to be consid-ered. Firstly, whether the numerical approximation is consistent  with the partial differen-tial equation we wish to solve. By consistency, we mean that the numerical approximationconverges to the srcinal PDE as ∆ x, ∆ t → 0. In this lecture we prove the consistency of our FD scheme for the 1D diffusion equation. In the next we will consider the second is-sue: whether the numerical solution is convergent  to the solution of the partial differentialequation. 1.1 Taylor series expansion for F  ( x,t + ∆ t ) In order to determine the accuracy of the FD approximation for derivatives, we will usethe Taylor series expansion: F  ( x,t + ∆ t ) = F  ( x,t ) +∆ t 1! δF δt ( x,t ) +∆ t 2 2! δ 2 F δt 2 ( x,t ) + ... (2) 1.2 Accuracy of forward/backward finite differences We used the forward finite difference approximation for temporal derivatives, which wecan re-write using the Taylor series expansion: U  ( x,t + ∆ t ) − U  ( x,t )∆ t =1∆ t  ∆ t 1! δU δt ( x,t ) +∆ t 2 2! δ 2 U δt 2 ( x,t )  + ... (3)= δU δt ( x,t ) +∆ t 2 δ 2 U δt 2 ( x,t ) + ... (4)= δU δt ( x,t ) + O (∆ t ) (5)(6)where the O is read as “of the order of” and denotes the error of the approximation. Sowe can see that our FD approximation is accurate only to order ∆ t . If we solve problemswhere the solution has sharp changes in time (i.e. δ 2 U δt 2 is large) then the error may bevery large. In those cases, we may need to find an alternative numerical scheme.In a similar fashion we can show that the forward and backward FD approximationsfor spatial derivatives are accurate to O (∆ x ) e.g. for backward differences:2  U  ( x,t ) − U  ( x − ∆ x,t )∆ x =1∆ x  ∆ x 1! δU δx ( x,t ) − ∆ x 2 2! δ 2 U δx 2 ( x,t )  + ... (7)= δU δx ( x,t ) − ∆ x 2 δ 2 U δx 2 ( x,t ) + ... (8)= δU δx ( x,t ) + O (∆ x ) (9)(10) 1.3 Accuracy of centred finite differences In the last lecture, we argued on geometrical grounds, that the centred FD approximationis a better approximation to the spatial derivative than either the forward or backwarddifferences. By using the Taylor series expansion we can prove this quantitatively: U  ( x + ∆ x/ 2 ,t ) − U  ( x − ∆ x/ 2 ,t )∆ x =1∆ x  ∆ x 2 × 1! δU δx +∆ x 2 4 × 2! δ 2 U δx 2 +∆ x 3 8 × 3! δ 3 U δx 3  (11) − 1∆ x  − ∆ x 2 × 1! δU δx +∆ x 2 4 × 2! δ 2 U δx 2 + − ∆ x 3 8 × 3! δ 3 U δx 3  (12)+ ... (13)= δU δx ( x,t ) +∆ x 2 24 δ 3 U δx 3 ( x,t ) + ... (14)= δU δx ( x,t ) + O (∆ x 2 ) (15)(16)It is left as an exercise to show that the approximation for the second-order spatial deriva-tive is also accurate to O (∆ x 2 ). 1.4 Accuracy of the FD scheme for 1D Diffusion We decided to approximate the 1D diffusion equation, at discrete points and times( k ∆ x,n ∆ t ), by using the forward approximation in time and the centred approximationin space. From the formulae derived above we can see that: u t ( k ∆ x,n ∆ t ) − νu xx ( k ∆ x,n ∆ t ) = u n +1 k − u nk ∆ t (17) − ν  ∆ x 2 ( u nk +1 − 2 u nk + u nk − 1 ) (18)+ O (∆ t ) + O (∆ x 2 ) (19)In other words, our finite difference approximation for the 1D diffusion equation is accurateto O (∆ t ) and O (∆ x 2 ). In practise, this means we can discretise the spatial domain quitecoarsely but we must discretise the time interval more finely in order to achieve a requiredaccuracy.This analysis shows how well the finite difference scheme approximates the srcinalpartial differential equation. It must be emphasised that this does not show how well the 3  numerical solution approximates the solution to the PDE  . This topic will be investigatedin some detail in the next lecture. 1.5 Improving the temporal accuracy - Leapfrog scheme It is easy to show that if we use the centred FD approximation for the temporal derivatives,we obtain a numerical scheme that is second-order accurate both spatially and temporally.The scheme would be written: u n +1 k = u n − 1 k +2 ν  ∆ t ∆ x 2 ( u nk +1 − 2 u nk + u nk − 1 ) (20)Carefull inspection shows that this scheme now includes values of the numerical solutionat time ( n − 1)∆ t as well as values from time n ∆ t . This difference scheme is called the leapfrog scheme and is a three-level scheme.Special consideration must be given to starting the leapfrog scheme and other multi-level schemes in general. For example, when specifying the initial condition, we nowneed an initial condition for both u 0 k and u − 1 k . If the PDE involves advection or wavepropagation, the initial condition must be carefully chosen to be consistent with thePDE. 1.6 A note on Neumann Boundary Conditions In the previous lecture, the difficulties with finding numerical approximations for Neu-mann BCs was briefly mentioned. When using the centred FD approximation for spatialderivatives in 1D, we often need to consider values of the numerical solution that lieoutside the numerical domain in order to compute spatial derivatives on the boundaries.For example, the centred approximation for the first-order spatial derivative at boundary x = 0 is: δuδx (0 ,n ∆ t ) ≈ 1∆ x ( u n 1 / 2 − u n − 1 / 2 ) (21)involving the out-of-bounds point x = − ∆ x/ 2.We have two courses of action to treat Neumann BCs: one-way derivatives or ghost points . The first method (one-way derivatives) uses either forward or backward differencesfor boundary points, thus avoiding values at points outside the domain. In practise, thisis often sufficient for solving a problem. The inconsistency with using this approximationalong with the rest of the scheme lies in the accuracy of the one-way approximation;first-order accurate along boundaries, as opposed to second-order accurate within thedomain. Potentially the inaccuracy at the boundaries may propagate to every point inthe domain, leaving us with a scheme that is only first-order accurate everywhere inthe domain, instead of second-order accurate. In other words, one-way derivatives atboundaries may contaminate the entire numerical solution.The second method is somewhat more complicated and involves the introduction of  ghost points that lie outside the domain. The advantage of this technique is that weobtain a boundary condition that is consistent with the numerical scheme within thedomain. The disadvantage is that we have introduced extra gridpoints so we must alsointroduce one extra equation for each ghost point added. The usual approach is to usethe boundary condition and the numerical scheme for the domain, to eliminate the valuesat ghost points.4
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x