0% found this document useful (0 votes)
22 views6 pages

Lecture 5

The document discusses numerical methods for solving partial differential equations: 1) Explicit and implicit methods are described for solving the diffusion equation numerically, with stability analyses deriving conditions like the time step needing to be less than half the spatial step squared divided by the diffusivity for explicit methods. 2) Upwind and implicit schemes are presented for solving advection-diffusion equations, with the upwind scheme requiring the Courant-Friedrichs-Lewy condition for stability. 3) Von Neumann analysis is used to show the instability of directly applying central differencing to the first-order wave equation.

Uploaded by

Debayan Biswas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views6 pages

Lecture 5

The document discusses numerical methods for solving partial differential equations: 1) Explicit and implicit methods are described for solving the diffusion equation numerically, with stability analyses deriving conditions like the time step needing to be less than half the spatial step squared divided by the diffusivity for explicit methods. 2) Upwind and implicit schemes are presented for solving advection-diffusion equations, with the upwind scheme requiring the Courant-Friedrichs-Lewy condition for stability. 3) Von Neumann analysis is used to show the instability of directly applying central differencing to the first-order wave equation.

Uploaded by

Debayan Biswas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Computational Physics: Lecture – V

Partial differential equation

In general, we encounter the following partial differential equations in various concepts in


Physics and Engineering.

Wave equation:

𝜕!𝑢 !
𝜕!𝑢
=𝑐
𝜕𝑡 ! 𝜕𝑥 !

Diffusion equation:

𝜕𝑢 𝜕!𝑢
=𝛼
𝜕𝑡 𝜕𝑥 !

Laplacian equation:

In 3D:
!
𝜕!𝑢 𝜕!𝑢 𝜕!𝑢
∇ 𝑢= + + =0
𝜕𝑥 ! 𝜕𝑦 ! 𝜕𝑧 !

In 2D:
𝜕!𝑢 𝜕!𝑢
∇! 𝑢 = + =0
𝜕𝑥 ! 𝜕𝑦 !

Poisson equation:

∇! 𝑢 = 𝛽

Where 𝛽 can be a constant or a function 𝛽(𝑟⃗, 𝑡). For example, we see this Poisson equation in
the Electrostatics ∇! 𝑢 = 𝜌/𝜀" , where 𝜌 is the charge and 𝜀" is the permittivity of free
space.

Question: How to solve the partial differential equations using numerical schemes?

The partial derivative is exactly written in the same way like that of any ordinary derivative.
Let us start with a simple partial differential equation

𝜕𝑢 𝜕𝑢
+𝑣 =0
𝜕𝑡 𝜕𝑥

Here 𝑢 → 𝑢(𝑥, 𝑡). We can express the time derivative part using the explicit method (Forward
Euler’s scheme) as

𝜕𝑢 𝑢(𝑥, ∆𝑡 + 𝑡) − 𝑢(𝑥) 𝑢#$%& − 𝑢#$


= =
𝜕𝑡 ∆𝑡 ∆𝑡

Note that here 𝑗 index represent the spatial coordinate and 𝑛 represent the temporal (time)
coordinate. Similarly, using the central difference scheme, we can express the spatial derivative
part as
$ $
𝜕𝑢 𝑢(𝑥 + ∆𝑥, 𝑡) − 𝑢(𝑥 − ∆𝑥, 𝑡) 𝑢#%& − 𝑢#'&
= =
𝜕𝑥 2 ∆𝑥 2 ∆𝑥

𝑢#$%& − 𝑢#$ $
𝑢#%& $
− 𝑢#'&
+𝑣 =0
∆𝑡 2 ∆𝑥
𝑣 ∆𝑡 $
𝑢#$%& = 𝑢#$ − $
Q𝑢 − 𝑢#'& R
2 ∆𝑥 #%&

Von Neumann stability analysis

The value of the function 𝑢 at any spatial and temporal coordinate may be expanded in a
finite Fourier series as 𝑢#$ = 𝜉 $ 𝑒 ( * + # . Here 𝑘 𝑗 represent wave number and ℎ is the
increment in the spatial coordinate (∆𝑥).

Substituting 𝑢#$ = 𝜉 $ 𝑒 ( * + # in the above equation we get the following equation. Note that
for a stable method |𝜉| ≤ 1.

𝜉 $%& 𝑒 ( * + # = 𝜉 $ 𝑒 ( * + # − 𝜆 Q𝜉 $ 𝑒 ( * + (#%&) − 𝜉 $ 𝑒 ( * + (#'&)R ,

. ∆0
where 𝜆 = !+
. After some simplification, we get

𝜉 = 1 − 𝜆 Q 𝑒 ( * + − 𝑒 '( * + R

𝑣 ∆𝑡
𝜉 =1− 𝑖 sin(𝑘ℎ)
2ℎ

As |𝜉| ≤ 1 condition needs to be satisfied for the stability of the program, it leads to

. ∆0 ! . ∆0 !
\ ! + ] sin! (𝑘ℎ) ≤ 0 or \!+] ≤ 0

Which is not possible!


Upwind scheme:

In this scheme, we just use the steps like in the Euler’s method,

𝑢#$%& − 𝑢#$ 𝑢#$ − 𝑢#'&


$
+𝑣 =0
∆𝑡 ∆𝑥
This implies,
𝑣 ∆𝑡 $
𝑢#$%& = 𝑢#$ − $
Q𝑢 − 𝑢#'& R
∆𝑥 #

Stability of this scheme is

𝑣 ∆𝑡 $ ( * + #
𝜉 $%& 𝑒 ( * + # = 𝜉 $ 𝑒 ( * + # − Q𝜉 𝑒 − 𝜉 $ 𝑒 ( * + (#'&) R

𝑣 ∆𝑡
𝜉 =1− Q1 − 𝑒 '( * + R

To maintain the stability condition |𝜉| ≤ 1,

𝑣 ∆𝑡
|𝜉| = ^1 − Q1 − 𝑒 '( * + R^ ≤ 1

It implies,

𝑣 ∆𝑡
0< <1

It is called Courant- Friedrichs-Lewy (CFL) condition. It a necessary condition for convergence


while solving certain partial differential equations (usually hyperbolic PDEs) numerically. It
helps us to choose the time step and spatial step such a way that that our numerical scheme is
stable and the corresponding results may be valid.

Solving one-dimensional diffusion equation

𝜕𝑢 𝜕!𝑢
=𝛼
𝜕𝑡 𝜕𝑥 !

Explicit method

In this method, the numerical scheme would be the following. The first derivative of the
spatial term can be expressed as
$
12 2!"# '2!$ 2!$ ' 2!%#
$

13
= 𝑢#4 = ∆3
4
and 𝑢#'& = ∆3

And the corresponding second derivative as

𝜕!𝑢 𝑢#4 − 𝑢#'&


4 $
𝑢#%& − 2 𝑢#$ + 𝑢#'&
$
= =
𝜕𝑥 ! ∆𝑥 ∆𝑥 !

It implies, the numerical scheme for the diffusion equation reads

𝑢#$%& − 𝑢#$ $
𝑢#%& − 2 𝑢#$ + 𝑢#'&
$
=𝛼 ` a
∆𝑡 ∆𝑥 !

𝛼 ∆𝑡 $
𝑢#$%& = 𝑢#$ + Q𝑢 − 2 𝑢#$ + 𝑢#'&
$
R
∆𝑥 ! #%&

Stability:

Take 𝑢#$ = 𝜉 $ 𝑒 ( * + # , and substitute it in the above equation

4 𝛼 ∆𝑡 𝑘ℎ
𝜉 =1− !
sin! c d
ℎ 2

To maintain the stability condition |𝜉| ≤ 1, it implies, −1 < 𝜉 < 1.

4 𝛼 ∆𝑡 𝑘ℎ
−1 < 1 − !
sin! c d < 1
ℎ 2
It gives the condition,

𝛼 ∆𝑡 1
0< !
<
ℎ 2

Implies that the time step should obey the following condition

ℎ!
∆𝑡 ≤
2𝛼

Implicit method
In this method, the numerical scheme can be expressed as

𝑢#$%& − 𝑢#$ $%&


𝑢#%& − 2 𝑢#$%& + 𝑢#'&
$%&
=𝛼 ` a
∆𝑡 ∆𝑥 !
𝛼 ∆𝑡 $%&
𝑢#$ = 𝑢#$%& − Q𝑢 − 2 𝑢#$%& + 𝑢#'&
$%&
R
∆𝑥 ! #%&
&
The corresponding stability analysis leads to the following condition 𝜉 = & ( ∆* -+ .
&% , 567, 8 9
+ ,

: ; ∆0
Implies, +,
≤0

Which is not possible!

Crank-Nicolson method

It is the combination of Explicit and Implicit methods. It reads,

𝑢#$%& − 𝑢#$ 𝛼 𝑢#%&


$
− 2 𝑢#$ + 𝑢#'&
$ $%&
𝛼 𝑢#%& − 2 𝑢#$%& + 𝑢#'&
$%&
= ` a + ` a
∆𝑡 2 ∆𝑥 ! 2 ∆𝑥 !

For this scheme,


4 𝛼 ∆𝑡
1− [1 − cos (𝑘ℎ)]
𝜉= ℎ!
4 𝛼 ∆𝑡
1+ [1 + cos (𝑘ℎ)]
ℎ!

This method is unconditionally stable.


The grid with spatial and temporal steps:

Solving the wave equation

Consider the wave equation

𝜕!𝑢 !
𝜕!𝑢
= 𝑐
𝜕𝑡 ! 𝜕𝑥 !

The numerical scheme for the complete wave equation reads,

𝑢#$%& − 2 𝑢#$ + 𝑢#$'& 𝑢$ − 2 𝑢#$ + 𝑢#'&


! #%&
$
= 𝑐
∆𝑡 ! ∆𝑥 !

We can use one of the above methods, e.g., Crank-Nicolson, and solve the wave equation.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy