Professional Documents
Culture Documents
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 ∆𝑥 #%&
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.
. ∆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
In this scheme, we just use the steps like in the Euler’s method,
𝑣 ∆𝑡 $ ( * + #
𝜉 $%& 𝑒 ( * + # = 𝜉 $ 𝑒 ( * + # − Q𝜉 𝑒 − 𝜉 $ 𝑒 ( * + (#'&) R
ℎ
𝑣 ∆𝑡
𝜉 =1− Q1 − 𝑒 '( * + R
ℎ
𝑣 ∆𝑡
|𝜉| = ^1 − Q1 − 𝑒 '( * + R^ ≤ 1
ℎ
It implies,
𝑣 ∆𝑡
0< <1
ℎ
𝜕𝑢 𝜕!𝑢
=𝛼
𝜕𝑡 𝜕𝑥 !
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
𝑢#$%& − 𝑢#$ $
𝑢#%& − 2 𝑢#$ + 𝑢#'&
$
=𝛼 ` a
∆𝑡 ∆𝑥 !
𝛼 ∆𝑡 $
𝑢#$%& = 𝑢#$ + Q𝑢 − 2 𝑢#$ + 𝑢#'&
$
R
∆𝑥 ! #%&
Stability:
4 𝛼 ∆𝑡 𝑘ℎ
𝜉 =1− !
sin! c d
ℎ 2
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
: ; ∆0
Implies, +,
≤0
Crank-Nicolson method
𝜕!𝑢 !
𝜕!𝑢
= 𝑐
𝜕𝑡 ! 𝜕𝑥 !
We can use one of the above methods, e.g., Crank-Nicolson, and solve the wave equation.