Docsity

Finite Difference Methods - Numerical Methods for Partial Differential Equations - Lecture Slides, Slides of Mathematical Methods for Numerical Analysis and Optimization

Partial preview of the text

Download Finite Difference Methods - Numerical Methods for Partial Differential Equations - Lecture Slides and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Numerical Methods for Partial

Differential Equations

Note on textbook for finite difference methods

  • Due to the difficulty some students have experienced in obtaining Gustafasson-Kreiss-Oliger I will try to find appropriate and equivalent sections in the online finite- difference book by Trefethen:

Recall: the Advection Equation

  • We wills start with a specific Fourier mode as the initial condition:
  • We try to find a solution of the same type:

( ) [ ) [ ]

( ) ( ) [ )

  1. Find 2 -periodic , such that 0, 2 , 0,

0

given

(^1) ˆ ( ,0) = 0, 2 2

where is a smooth 2 -periodic function of one frequency

i x

u x t x t T

u u c t x

u x f x e f x

f

ω

π π

ω π π

π ω

∀ ∈ ∈

∂ ∂ − = ∂ ∂

= ∀ ∈

1 , ˆ , 2

i x u x t e u t

ω ω π

=

cont

  • Substituting in this type of solution the PDE:
  • Becomes an ODE:
  • With initial condition

u u c t x

( )

(^1 1) ˆ ˆ , ˆ 2 2

ˆ ˆ^0

u u (^) i x i x du c c e u t e i cu t x t x dt

du i cu dt

ω ω ω ω π π

ω

∂ ∂ (^)  ∂ ∂ (^)      − = (^)  − (^)    = (^)  −  ∂ ∂ (^)  ∂ ∂  (^)    

⇒ − =

u ˆ (^) ( ω,0) = f ˆ( ω)

Note on Fourier Modes

  • Note that since the function should be 2pi

periodic we are able to deduce:

  • We can also use the superposition principle

for the more general case when the initial

condition contains multiple Fourier modes:

( )

i x

i x ct

f x e f

u x t e f f x t

ω ω ω ω ω ω

=∞

=−∞ =∞

=−∞

∑

∑

cont

  • Let’s back up a minute – the crucial part was

when we reduced the PDE to an ODE:

  • The advantage is: we know how to solve ODE’s

both analytically and numerically (more about

this later on).

u u c t x

ˆ^0

du i cu dt

cont

  • Again, we can solve this trivial ODE:

( )

du i c d u dt

ic d t u u e

ω ω

−

( ) 2 ˆ ,

i ct x d t u u e e

ω ω

  • − =

cont

  • The solution tells a story:
  • The original profile travels in the direction of

decreasing x (first term)

  • As the profile travels it decreases in amplitude

(second exponential term)

( )

( ) 2 ˆ ,

i ct x (^) d t u u e e

ω ω

  • (^) − =

( )

d^2 t u f ct x e

− ω = +

Categorizing a Linear ODE

Re ( μ)

Im ( μ)

Exponential decay Exponential growth 

Increasingly^ oscillatory

Increasingly 

oscillatory

Here we plot the dependence of the solution to the top left ODE on mu’s position in the complex plane

du (^) t u u u e dt

μ

Categorizing a Linear ODE

Re ( μ)

Im ( μ)

Here we plot the behavior of the solution for 5 different choices of mu

Solving the Scalar ODE Numerically

  • We know the solution to the scalar ODE
  • However, it is also reasonable to ask if we can solve it

approximately.

  • We have now simplified as far as possible.
  • Once we can solve this model problem numerically, we will apply

this technique using the method of lines to approximate the solution of the PDE.

du u dt

Stage 1: Discretizing the Time Axis

  • It is natural to divide the time interval [0,T]

into shorted subintervals, with width often

referred to as:

  • We start with the initial value of the solution

u(0) (and possibly u(-dt),u(-2dt),..) and build a

recurrence relation which approximates u(dt)

in terms of u(0) and early values of u.

dt , ∆ t or k

du f u dt

Example cont

  • Rearranging:
  • We introduce notation for the approximate

solution after the n’th time step:

  • Our intention is to compute
  • We convert the above equation into a scheme to

compute an approximate solution:

( ) ( ) ( (^ ))

0 0

u dt u f u dt

− ≅ u dt (^^ )^ ≅^ u^ (^0 )^ + dtf^ (^ u (^0 ))

u n

( )

( )

0

1 0 0

u u 0

u u dtf u

=

= +

un ≅ u ndt ( )

Docsity.com

Example cont

  • We can repeat the following step from t=dt to t=2dt and so on:
  • This is commonly known as the:
    • Euler-forward time-stepping method
    • or Euler’s method

( )

( )

( )

( )

0

1 0 0

2 1 1

1

0

n n n

u u

u u dtf u

u u dtf u

u (^) + u dtf u

=

= +

= +

= +