Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finite differences Finite differences.

Similar presentations

Presentation on theme: "Finite differences Finite differences."— Presentation transcript:

1 Finite differences Finite differences

2 Introduction 1 2 j-1 j j+1 N N+1 < L > Taylor series expansion: Finite differences

3 Finite differences approximations
= forward approximation Consistent if , ,…. are bounded = backward approximation adding both == centered differences Finite differences

4 Finite differences approximations (2)
Also === fourth order approximation to the first derivative === Second order approximation to the second derivative Finite differences

5 The linear advection equation
+ initial and boundary conditions Analytical solution Substituting we get Eigenvalue problems for the operators With periodic B.C. λ can only have certain (imaginary) values where k is the wavenumber The general solution is a linear combination of several wavenumbers Finite differences

6 The linear advection equation (2)
The solution is then: Propagating with speed U0 No dispersion For a single wave of wavenumber k, the frequency is ω=kU0 Energy conservation If periodic B.C. Finite differences

7 Space discretization ; substituting whose solution is with c
centered second-order approximation ; substituting whose solution is with c U0 The phase speed c depends on k; dispersion kΔx= π ---> λ=2Δx ==> c=0 kΔx Finite differences

8 Group velocity =-U0 for kΔx=π
Continuous equation Discretized equation =-U0 for kΔx=π Approximating the space operator introduces dispersion Finite differences

9 Time discretization Try Substituting we get
first-order forward approx. Try Substituting we get \--v--/ α (Courant-Friedrich-Levy number) If b>0, φjn increases exponentially with time (unstable) If b<0, φjn decreases exponentially with time (damped) If b=0, φjn maintains its amplitude with time (neutral) ω=a+ib Finite differences Also another dispersion is introduced, as we have approximated the operator ∂/ ∂t

10 Three time level scheme (leapfrog)
This scheme is centered (second order accurate) in both space and time exponential Try a solution of the form If |λk| > 1 solution unstable if |λk| = 1 solution neutral if |λk| < 1 solution damped Substituting physical mode Δx--->0 Δt --->0 computational mode Finite differences

11 Stability analysis Energy method define Discretized analog : En
Periodic boundary conditions Discretized analog : En φn N+1≡ φn1 If En=const, stable Finite differences

12 Example of the energy method
upwind if U0>0 downwind if U0<0 x j-1 j α=0 ==> U0= no motion α= Δt= Δx/U0 En+1=En if if En+1 > En > unstable α > 0 ==> U0 > (upwind) α < U0 Δt/ Δx < 1 (CFL condition) En+1 < En Finite differences damped

13 Von Neumann method Consider a single wave if |λk| < the scheme is damping for this wavenumber k if |λk| = k the scheme is neutral if |λk| > for some value of k, the scheme is unstable alternatively if Im(ω) > scheme unstable if Im(ω) = scheme neutral if Im(ω) < scheme damping Vf= ω/k vg=∂ω/∂k Finite differences

14 Matrix method Let for a two-time-level scheme
is called the amplification matrix And call the eigenvectors of Expanding the initial condition In terms of these eigenvectors and applying n times the amplification matrix exponential therefore Finite differences

15 Stability of some schemes
Forward in time, centered in space (FTCS) scheme Upwind or downwind using Von Neumann, we find scheme unstable upwind if U0 > 0 downwind if U0 < 0 Using Von Neumann: α < downwind α > CFL limit α(α-1) > > unstable Finite differences -1/4 < α(α-1) < 0==> 0 ≤ α ≤ > stable damped scheme

16 Stability of some schemes (cont)
Leapfrog Using von Neumann we find |α|≤1 as stability condition Finite differences

17 Stability of some schemes (cont)
Lax Wendroff (Taylor in t) From Applying Von Neumann we can find that |α| ≤ > stable Equivalent to x Finite differences j j+1/2 j+1

18 Stability of some schemes (cont)
Implicit centered scheme Krank-Nicholson where using von Neumann Always neutral Dispersion worse than leapfrog where Always neutral Dispersion better than implicit. No computational mode Finite differences

19 “Intuitive” look at stability
If the information for the future time step “comes from” inside the interval used for the computation of the space derivative, the scheme is stable Otherwise it is unstable U0Δt Downwind scheme x--> point where the information comes from (xj-U0Δt) x j-1 j j+1 Interval used for the computation of ∂φ/∂x Upwind scheme o x x ----> α < 1 o ----> α > 1 j-1 j j+1 CFL number ==> fraction of Δx traveled in Δt seconds o x Leapfrog Implicit j-1 j j+1 Finite differences

20 Dispersion and group velocity
Leapfrog vg vf U0 K-N Implicit ωΔt Finite differences π/2 π

21 Effect of dispersion Initial Leapfrog implicit Finite differences

22 Two-dimensional advection equation
Using von Neumann, assuming a solution of the form we obtain using we obtain, for |λ| to be ≤1 the condition where Δs= Δx= Δy This is more restrictive than in one dimension by a factor Finite differences

Download ppt "Finite differences Finite differences."

Similar presentations

Ads by Google