290 likes | 741 Views
Introduction to Numerical Methods I. Finite difference approximation to derivatives. Consider a smooth function g(x). Taylor’s theorem reads:. In particular:. Short course on: Numerical methods for hyperbolic equations and applications-Trento, Italia-June 7 th to 18 th , 2004.
E N D
Consider a smooth function g(x). Taylor’s theorem reads: In particular: Short course on: Numerical methods for hyperbolic equations and applications-Trento, Italia-June 7th to 18th, 2004
Finite difference approximation of PDEs: FTCS Discretise the x-t domain into a finite number of M+1 points, I=0,…,M
Now approximate partial derivatives. Use finite differences: Then the PDE is replaced by a finite difference approximate operator:
Introduce the dimensionless number: The Courant-Friedrichs-Lewy number or CFL number, or Courant number Note that c is a dimensionless quantity, it is the ratio of two velocities: Finally, the FTCS scheme reads: Stencil This formula allows us to calculate explicitly the evolution in time of discrete approximate values of the solution at every point, except for i=0 and i=M.
Convergence Our ultimate goal is to construct schemes that converge, that is schemes that approach the true solution of the PDE when the mesh size tends to zero. Lax’s Equivalence theoremsays that: the only schemes that are CONVERGENT are those that are CONSISTENT and STABLE We must therefore work on CONSISTENCY AND STABILITY.
Local truncation error Consider a particular scheme: FTCS. The numerical analogue of the PDE is the approximate operator: We define the local truncation error:
Assuming the solution is sufficiently smooth we Taylor expand and obtain: Noting that: The FTCS is a first-order scheme In general, if the local truncation error of a scheme is of the form: Then the scheme is said to be k-th order accurate in time and l-th order accurate in space.
Consistency A numerical scheme is said to be consistent with the PDE being discretized if the local truncation error tends to zero as the mesh size tends to zero. For example, for the FTCS scheme we have Therefore FTCS is consistent wit the PDE
Stability of a numerical method. If a method is consistent with the PDE, then all we need to bother is stability. One view of stability is that of unbounded growth of errors as the numerical scheme evolves the solution in time. Another view of stability is that of controlling spurious oscillations Stability in the sense on unbounded growth can be analysed by a variety of methods A popular method is the von Neumann method One performs a Fourier decomposition of the error. It is sufficient to consider a single component.
Stability analysis of the FTCS Thus FTCS is unstable under all circumstances: UNCONDITIONALLY UNSTABLE (useless).
Godunov’s first-order upwind scheme • Approximate derivatives in by then • The scheme reads Illustrate the stencil
Local truncation error: The finite difference operator is: Substitution of the exact solution into the approximate opetaror gives: Assuming sufficient smoothness and Taylor expanding: The scheme is first-order accurate in space and time
Stability analysis and the stability condition becomes The CFL condition of Courant condition Given wave speed and mesh spacing the time step is determined from the stability condition
The stencil (upwind) t n+1 o n o o x True domain of dependency Numerical domain of dependency The exact solution is the value on the characteristic where is the foot of the characteristic at time
For appropriate choices of the point lies between and • Assume a linear interpolation between and • Evaluation of gives which is the Godunov scheme
The “downwind” scheme • Approximate derivatives in by then • The scheme reads Exercise: derive the local truncation error. Is the scheme consistent ? Exercise: show that this scheme is unconditionally unstable.
General Form of the First-Order Upwind Scheme • For the upwind scheme is • For both and define: • The scheme reads: Exercise: show that the upwind scheme for negative speed is conditionally stable
Fully discrete and semi-discrete schemes Fully discrete If the time derivative is left in its continuous form Semi-discrete The method of lines
Explicit scheme and implicit schemes Explicit Implicit Exercise: construct the fully discrete implicit version of FTCS
Monotone Schemes A monotone scheme satisfies: Monotone schemes for the linear advection equation with constant speed of propagation are those whose coefficients are non-negative. Example: The Godunov upwind scheme.
More Schemes The Lax-Friedrichs scheme (LF) • Conditionally stable • Monotone • Modified equation has LF may also be seen as the FTCS scheme (unstable) with replaced by Note the shape of the stencil.
The Godunov Centred Scheme Stencil • Conditionally stable • Monotone for • Oscillatory for This is an interesting example of a first-order scheme that is NOT MONOTONE.
The Lax-Wendroff Scheme (LW) Stencil • Conditionally stable • Non-monotone (verify by inspection)
The FORCE scheme stencil • Conditionally stable: • Monotone • Modified equation: © Toro 2004