240 likes | 592 Views
Finite differences. Introduction. 1. 2. j-1. j. j+1. N. N+1. <------------------------------- L ---------------------------------->. Taylor series expansion:. Finite differences approximations. =. forward approximation. Consistent if , ,…. are bounded. =.
E N D
Finite differences Finite differences
Introduction 1 2 j-1 j j+1 N N+1 <------------------------------- L ----------------------------------> Taylor series expansion: Finite differences
Finite differences approximations = forward approximation Consistent if , ,…. are bounded = backward approximation adding both == centered differences Finite differences
Finite differences approximations (2) Also === fourth order approximation to the first derivative === Second order approximation to the second derivative Finite differences
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
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
Space discretization 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
Group velocity Continuous equation Discretized equation =-U0for kΔx=π Approximating the space operator introduces dispersion Finite differences
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) Time discretization first-order forward approx. Try Substituting we get \--v--/ α(Courant-Friedrich-Levy number) ω=a+ib Finite differences Also another dispersion is introduced, as we have approximated the operator ∂/ ∂t
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
Stability analysis Energy method define Periodic boundary conditions Discretized analog : En φn N+1≡φn1 If En=const, stable Finite differences
x j-1 j Example of the energy method upwind if U0>0 downwind if U0<0 α=0 ==> U0=0 no motion α=1 Δt= Δx/U0 En+1=En if if En+1 > En -------> unstable α > 0 ==> U0 > 0 (upwind) α < 1 U0Δt/ Δx < 1 (CFL condition) En+1 < En Finite differences damped
Von Neumann method Consider a single wave if |λk| < 1 the scheme is damping for this wavenumber k if |λk| = 1 k the scheme is neutral if |λk| > 1 for some value of k, the scheme is unstable alternatively if Im(ω) > 0 scheme unstable if Im(ω) = 0 scheme neutral if Im(ω) < 0 scheme damping Vf= ω/k vg=∂ω/∂k Finite differences
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
Stability of some schemes using Von Neumann, we find • Forward in time, centered in space (FTCS) scheme • Upwind or downwind scheme unstable upwind if U0 > 0 downwind if U0 < 0 Using Von Neumann: α < 0 downwind α > 1 CFL limit α(α-1) > 0 ------> unstable Finite differences -1/4 < α(α-1) < 0==> 0 ≤α≤ 1 -------------> stable damped scheme
Stability of some schemes (cont) • Leapfrog Using von Neumann we find |α|≤1 as stability condition Finite differences
Stability of some schemes (cont) (Taylor in t) From • Lax Wendroff Applying Von Neumann we can find that |α| ≤1 -----> stable Equivalent to x Finite differences j j+1/2 j+1
where Stability of some schemes (cont) where • Implicit centered scheme • Krank-Nicholson using von Neumann Always neutral Dispersion worse than leapfrog Always neutral Dispersion better than implicit. No computational mode Finite differences
j-1 j-1 j-1 j j j j+1 j+1 j+1 “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 Interval used for the computation of ∂φ/∂x Upwind scheme o x x ----> α < 1 o ----> α > 1 CFL number ==> fraction of Δx traveled in Δt seconds o x Leapfrog Implicit Finite differences
Dispersion and group velocity Leapfrog vg vf U0 K-N Implicit ωΔt Finite differences π/2 π
Effect of dispersion Initial Leapfrog implicit Finite differences
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