Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Numerical Methods

Similar presentations

Presentation on theme: "An Introduction to Numerical Methods"— Presentation transcript:

1 An Introduction to Numerical Methods
For Weather Prediction by Joerg Urban office 012 Based on lectures given by Mariano Hortal Numerical methods

2 Shallow water equations in 1 dimension
Non linear equations h advection adjustement diffusion u … velocity along x direction h … absolute height g … acceleration due to gravity K …diffusion coefficient Velocity is equal in layers vertical direction (shallow) Numerical methods

3 Linearization u=U0+u’ h=H +h’
Const. + perturb. in the x-comp. of velocity Const. + perturb. in the height of the free surface Small perturbations Substitute and drop products of perturbations Numerical methods

4 Classification of PDE’s
Boundary value problems D open domain ΓD f, g: known function; L, B: differential operator φ: unknown function of x boundary Initial value problems (most important to us) φ: unknown function of t t t=0 Numerical methods

5 Classification of PDE’s (II)
Initial and boundary value problems Eigenvalue problems φ: unknown eigenfunction λ: eigenvalue of operator L Numerical methods

6 Existence and uniqueness of solutions
; y(t0)=y (initial value problem) Does it have a solution? Does it have only one solution? Do we care? If it has one and only one solution it is called a well posed problem Numerical methods

7 Picard’s Theorem Let and be continuous in the rectangle
then, the initial-value problem Has a unique solution y(t) on the interval Finding the solution (not analytical) Numerical methods (finite dimensions) Numerical methods

8 Discretization Finite differences Spectral Finite elements
Transform the continuous differential equation into a system of ordinary algebraic equations where the unknowns are the numbers fj Numerical methods

9 The Lax-Richtmeyer theorem
Convergence Consistency Stability Lax-Richtmeyer theorem Discretized solution > continuous solution discretization finer and finer Discretized equation > continuous equation Discretized solution bounded If a discretization scheme is consistent and stable then it is convergent, and vice versa Numerical methods

10 Finite Differences - Introduction
1 2 j-1 j j+1 N N+1 < L > Taylor series expansion: Numerical methods

11 Finite differences approximations
forward approximation Consistent if … are bounded backward approximation adding both centered differences Consistent if … are bounded Numerical methods

12 Finite differences approximations (2)
Also fourth order approximation to the first derivative Using the Taylor expansion again we can easily get the second derivative: second order approximation of the second derivative Numerical methods

13 The linear advection equation
+ initial and boundary conditions We start with a guess: Substituting we get: Eigenvalue problems for With periodic B.C. λ can only have certain (imaginary) values where k is the wave number The general solution is a linear combination of several wave numbers Numerical methods

14 The linear advection equation (2)
The analytic solution is then: Propagating with speed U0 No dispersion For a single wave of wave number k the frequency is ω=kU0 Energy: For periodic B.C.: Numerical methods

15 Space discretization centered second-order approximation Try:
results in whose solution is with c The phase speed c depends on k dispersion U0 kΔx= π ---> λ=2Δx ==> c=0 kΔx π Numerical methods

16 Group velocity =-U0 for kΔx=π
Continuous equation Discretized equation =-U0 for kΔx=π Approximating the space operator introduces dispersion Numerical methods

17 Time discretization Try Substituting we get
In addition to our 2nd order centered approx. for the space derivative we use a 1st order forward approx. for the time derivative: Try Courant-Friedrich- Levy number Substituting we get 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 Numerical methods Also another dispersion is introduced, as we have approximated the operator ∂/ ∂t

18 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 Numerical methods

19 Stability analysis Energy method We have defined
We have discretized t and hence the discretized analog of E(t) is En For periodic boundary conditions φn N+1≡ φn1 If En=const, than the scheme is stable Numerical methods

20 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 En+1 > En unstable α > 0 => U0 > upwind α < U0 Δt/ Δx < 1 CFL cond. damped En+1 < En if Numerical methods

21 Von Neumann method Consider a single wave if |λk| < the scheme is damping for this wave number 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 Numerical methods

22 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, we find α < downwind α > CFL limit α(α-1) > unstable -1/4 < α(α-1) < 0 => 0 ≤ α ≤ stable damped scheme Numerical methods

23 Stability of some schemes (cont)
Leapfrog Using von Neumann we find |α|≤1 as stability condition As a reminder α is the Courant-Friedrich-Levy number: Numerical methods

24 Stability of some schemes (cont)
Lax Wendroff scheme From a Taylor expansion in t we get: Substitution the advection equation we: Discretization: Applying Von Neumann we can find that |α| ≤ > stable Numerical methods

25 Stability of some schemes (cont)
Implicit centered scheme We replace the space derivation by the average value of the centred space derivation at time level n-1 and n+1 using von Neumann Always neutral, however an Expensive implicit equation need to solved Dispersion worse than leapfrog Numerical methods

26 “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 Downwind scheme (unstable) x, x’ … point where the information comes from (xj-U0Δt) Interval used for the computation of ∂φ/∂x U0Δt j-1 j j+1 x Upwind scheme (conditionally stable) x if α < 1 x’ if α > 1 x’ x j-1 j j+1 Leapfrog (conditionally stable) CFL number ==> fraction of Δx traveled in Δt seconds x’ x Implicit (unconditionally stable) j-1 j j+1 Numerical methods

27 Dispersion and group velocity
Vf= ω/k vg=∂ω/∂k Leapfrog vg vf U0 K-N ωΔt Implicit Numerical methods π/2 π

28 Effect of dispersion Initial Leapfrog implicit Numerical methods

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

30 Non linear advection equation Continuous form
u(x,t) u(x,0) x x Change in shape even for the continuous form One Fourier component ukeikx no longer moving with constant speed but interacting with other components Fourier decomposition valid at each individual time but it changes amplitude with time No analytical solution! Numerical methods

31 Energy conservation Define again: == Discretization in space
periodic B.C. First attempt: Second attempt: terms joined by arrows cancel from consecutive j’s Numerical methods

32 Aliassing Consider the product Minimum wavelength
Aliasing occurs when the non-linear interactions in the advection term produce a wave which is too short to be represented on the grid. Consider the product in the interval 0≤x ≤2π Minimum wavelength 1 2 n N+1 Maximum wave number representable with the discretized grid < L > Numerical methods

33 Aliassing (cont.) wave number k  wave number 2kM-k
Trigonometrical manipulations lead to: sin(kxj)=-sin[(2kM-k)xj] Therefore, it is not possible to distinguish wave numbers k and (2kM-k) on the grid. wave number k  wave number 2kM-k x x x Numerical methods

34 Non-linear instability
If k1+k2 is misrepresented as k1 there is positive feedback, which causes instability k1 = 2kM - (k1+k2) > 2k1=2kM-k2 2kM 2k1  kM 2Δx ≤ λ1 ≤ 4Δx These wavelengths keep storing energy and total energy is not conserved We can remove energy from the smallest wavelengths by - Fourier filtering - Smoothing - Diffusion - Use some other discretization (e.g. semi-Lagrangian) Numerical methods

Download ppt "An Introduction to Numerical Methods"

Similar presentations

Ads by Google