Download as pdf or txt
Download as pdf or txt
You are on page 1of 205

COMPUTATIONAL FLUID MECHANICS

Exercises - Block 2
by
José C. F. Pereira / José M. Chaves Pereira / Duarte M. S. Albuquerque
Mech. Eng. Dept. / LASEF / Pav. Mecânica I
jcfpereira@tecnico.ulisboa.pt / jose.chaves@tecnico.ulisboa.pt / duartealbuquerque@tecnico.ulisboa.pt

IST, MFC, 2022 Exercises 1


Von Neumann Stability Analysis

IST, MFC, 2022 Exercises 2


What should you know
in the end of the forth lecture?

1 – Prove the Von Neumann stability limit when it exists.

2 – Understand its influence for time and spatial schemes combinations.


Including: two dimensions, explicit vs implicit, three or more time levels.

IST, MFC, 2022 Exercises 3


Mathematical Skills:
Solving Inequalities with
Complex Numbers

IST, MFC, 2022 Exercises 4


Exercise 4.1: Von Neumann stability analysis for the
diffusive equation with an explicit time scheme.
2
Let 𝜕𝜙 = 𝑣 𝜕 𝜙 be discretized with central differences and Forward or Explicit Euler in time.
𝜕𝑡 2 𝜕𝑥
Find the stability range with von Neumann linear stability analysis.

The discretization of the differential equation should be evident by now as follows:

𝜙𝑗𝑛+1 − 𝜙𝑗𝑛 𝑛
𝜙𝑗+1 − 2𝜙𝑗𝑛 + 𝜙𝑗−1
𝑛
For space we will use index 𝑗,
=𝑣 𝑖 𝑜𝑟 𝐼 will be the imaginary complex
∆𝑡 ∆𝑥 2
Consider at the central grid point a periodic perturbation with a wavenumber of 2∆𝑥

lowest
𝜙𝑗𝑛 = 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝜙𝑗𝑛+1 = 𝑎𝑛+1 𝑒 𝑖𝜃𝑗 𝑘𝑚𝑖𝑛 = 𝜋/∆𝑥
wavenumber

𝑛+1
𝑛+1
𝜙𝑗+1 = 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1) = 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 −𝑖𝜃 𝜙𝑗+1 = 𝑎𝑛 𝑒 𝑖𝜃(𝑗+1) = 𝑎 𝑛 𝑒 𝑖𝜃𝑗 𝑒 +𝑖𝜃

𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 +𝑖𝜃 − 2𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 −𝑖𝜃


=𝑣
∆𝑡 ∆𝑥 2

IST, MFC, 2022 Exercises 5


Exercise 4.1: Von Neumann stability analysis for the
diffusive equation with an explicit time scheme.
𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 +𝑖𝜃 − 2𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 −𝑖𝜃
=𝑣
∆𝑡 ∆𝑥 2

𝑣∆𝑡 𝑖𝜃
𝑎𝑛+1 𝑒 𝑖𝜃𝑗 = 𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑎𝑛 𝑒 𝑖𝜃𝑗 2 (𝑒 − 2 + 𝑒 −𝑖𝜃 )
∆𝑥
d𝐢𝐯𝐢𝐝𝐢𝐧𝐠 𝐛𝐲 𝒆𝒊𝜽𝒋 diffusive criterion 𝛾

𝑎𝑛+1 = 𝑎𝑛 + 𝑎𝑛 𝛾(𝑒 𝑖𝜃 − 2 + 𝑒 −𝑖𝜃 )]

𝒂𝒏+𝟏
Amplification Factor 𝑮 = 𝒏 = 1 + 𝛾(𝑒 𝑖𝜃 − 2 + 𝑒 −𝑖𝜃 ) 𝒆𝒊𝜽 + 𝒆−𝒊𝜽 = 𝟐𝒄𝒐𝒔[𝜽]
𝒂

𝑒 𝑖𝜃 = cos 𝜃 + 𝑖 sin(𝜃) 𝑒 −𝑖𝜃 = cos −𝜃 + 𝑖 sin −𝜃 = cos 𝜃 − 𝑖 sin(𝜃)

IST, MFC, 2022 Exercises 6


Exercise 4.1: Von Neumann stability analysis for the
diffusive equation with an explicit time scheme.
𝒆𝒊𝜽 + 𝒆−𝒊𝜽 = 𝟐𝒄𝒐𝒔[𝜽] Not forget that!

𝑎𝑛+1
𝐺= = 1 + 𝛾 𝑒 +𝑖𝜃 − 2 + 𝑒 −𝑖𝜃 = 1 + 𝛾( −2 + 2𝑐𝑜𝑠 𝜃 )
𝑎𝑛

Von Neumann Stability Theorem


𝐺 ≤1 or −1 ≤ 𝐺 ≤ 1
Fourier Errors cannot grow in time

−1 ≤ 1 + 𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 )
| 1 + 𝛾( −2 + 2𝑐𝑜𝑠 𝜃 ) | ≤ 1 ⟺
1 + 𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 ) ≤ 1

−2 ≤ 𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 )

𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 ) ≤ 0

IST, MFC, 2022 Exercises 7


Exercise 4.1: Von Neumann stability analysis for the
diffusive equation with an explicit time scheme.
−2 ≤ 𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 )
−𝟏 ≤ 𝒄𝒐𝒔 𝜽 ≤ 𝟏 Not forget that!
𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 ) ≤ 0

𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 ) ≤ 0 𝛾( − 2 − 2) ≤ 0 ⟺ 0 ≤ 𝛾 The second branch


is always true
𝛾( − 2 + 2) ≤ 0 ⟺ 0 ≤ 0

−2 ≤ 𝛾( − 2 + 2𝑐𝑜𝑠 𝜃 ) ⟺ 2 ≥ 𝛾( 2 − 2𝑐𝑜𝑠 𝜃 ) Worst scenario 𝑐𝑜𝑠 𝜃 = −1

1 ∆𝑡 1
4𝛾 ≤ 2 ⟺ 𝛾 ≤ ⟺ 𝑣 2 ≤ Diffusive Criterion for stability
2 ∆𝑥 2

∆𝑥 2 Time step must be reduced


∆𝑡 ≤ quadratically with grid size
2𝜈

IST, MFC, 2022 Exercises 8


Exercise 4.1: Von Neumann stability analysis for the
diffusive equation with an explicit time scheme.
Alternative approach
using this special (1 − 𝑐𝑜𝑠 2𝜃 ) = 2 𝑠𝑖𝑛2 𝜃
trigonometric equation

𝑎𝑛+1
𝐺= = 1 + 𝛾( −2 + 2𝑐𝑜𝑠 𝜃 ) = 1 + 𝛾(−4 𝑠𝑖𝑛2 𝜃/2 )
𝑎𝑛

Von Neumann Stability Theorem


𝐺 ≤1 or −1 ≤ 𝐺 ≤ 1
Fourier Errors cannot grow in time

−1 ≤ 1 − 4 𝛾 𝑠𝑖𝑛2 𝜃/2
| 1 − 4 𝛾 𝑠𝑖𝑛2 𝜃/2 | ≤ 1 ⟺
1 − 4 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ 1

4 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ 2

−4 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ 0

IST, MFC, 2022 Exercises 9


Exercise 4.1: Von Neumann stability analysis for the
diffusive equation with an explicit time scheme.
4 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ 2
0 ≤ 𝑠𝑖𝑛2 𝜃/2 ≤ 1 Not forget that!
−4 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ 0

−4 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ 0 ⟺ 0 ≤ 4 𝛾 𝑠𝑖𝑛2 𝜃/2 ⟺ 0 ≤ 𝛾


The second branch is always true

1
4 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ 2 ⟺ 𝛾 𝑠𝑖𝑛2 𝜃/2 ≤ Worst scenario 𝑠𝑖𝑛2 𝜃/2 = 1
2

1 ∆𝑡 1 Diffusive Criterion for stability


𝛾≤ ⟺𝑣 2≤
2 ∆𝑥 2 Classic Result

∆𝑥 2 Time step must be reduced


∆𝑡 ≤ quadratically with grid size
2𝜈

IST, MFC, 2022 Exercises 10


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
Let 𝜕𝜑 = 𝛻 ∙ 𝜗𝛻𝜑 be discretized with the FVM, central differences in space
𝜕𝑡
and Explicit forward Euler in time. Consider a 2D domain spaced in each direction with different
grid sizes ∆𝑥 and ∆𝑦. Find the stability range with Von Neumann linear stability analysis

∆𝑥
Volume 𝜕𝜑
𝑑𝑉 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉
integration 𝑉 𝜕𝑡 𝑉
𝜑𝑖,𝑗+1
∆𝑦

𝜕𝜑
Gauss theorem 𝑑𝑉 = 𝜗𝛻𝜑 ∙ 𝑛𝑑𝑆
𝑉 𝜕𝑡 𝑆
𝜑𝑖−1,𝑗 𝜑𝑖,𝑗 𝜑𝑖+1,𝑗
𝜑𝑛+1 − 𝜑𝑛
Second Order ∆𝑉 = 𝜗𝛻𝜑𝑓𝑛 ∙ 𝑛𝑓 𝐴𝑓
∆𝑡
𝑓∈𝑓𝑎𝑐𝑒𝑠

𝑛+1 𝑛 𝑛 𝑛 𝑛 𝑛
𝜑𝑖,𝑗 − 𝜑𝑖,𝑗 𝜑𝑖+1,𝑗 − 𝜑𝑖,𝑗 𝜑𝑖,𝑗 − 𝜑𝑖−1,𝑗
∆𝒙∆𝒚/𝝑 = ∆𝑦 − ∆𝑦 +
∆𝑡 ∆𝑥 ∆𝑥
𝜑𝑖,𝑗−1
𝑛 𝑛 𝑛 𝑛
𝜑𝑖,𝑗+1 − 𝜑𝑖,𝑗 𝜑𝑖,𝑗 − 𝜑𝑖,𝑗−1
+ ∆𝑥 − ∆𝑥
∆𝒙 ≠ ∆𝒚 ∆𝑦 ∆𝑦

IST, MFC, 2022 Exercises 11


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
Let 𝜕𝜑 = 𝛻 ∙ 𝜗𝛻𝜑 be discretized with the FVM, central differences in space
𝜕𝑡
and Explicit forward Euler in time. Consider a 2D domain spaced in each direction with different
grid sizes ∆𝑥 and ∆𝑦. Find the stability range with Von Neumann linear stability analysis

∆𝑥
Volume 𝜕𝜑
𝑑𝑉 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉
integration 𝑉 𝜕𝑡 𝑉
𝜑𝑖,𝑗+1
∆𝑦

𝜕𝜑
Gauss theorem 𝑑𝑉 = 𝜗𝛻𝜑 ∙ 𝑛𝑑𝑆
𝑉 𝜕𝑡 𝑆
𝜑𝑖−1,𝑗 𝜑𝑖,𝑗 𝜑𝑖+1,𝑗
𝜑𝑛+1 − 𝜑𝑛
Second Order ∆𝑉 = 𝜗𝛻𝜑𝑓𝑛 ∙ 𝑛𝑓 𝐴𝑓
∆𝑡
𝑓∈𝑓𝑎𝑐𝑒𝑠

𝑛+1 𝑛 𝑛 𝑛 𝑛 𝑛
𝜑𝑖,𝑗 − 𝜑𝑖,𝑗 𝜑𝑖+1,𝑗 − 𝜑𝑖,𝑗 𝜑𝑖,𝑗 − 𝜑𝑖−1,𝑗
∆𝒙∆𝒚/𝝑 = ∆𝑦 − ∆𝑦 +
∆𝑡 ∆𝑥 ∆𝑥
𝜑𝑖,𝑗−1
𝑛 𝑛 𝑛 𝑛
𝜑𝑖,𝑗+1 − 𝜑𝑖,𝑗 𝜑𝑖,𝑗 − 𝜑𝑖,𝑗−1
+ ∆𝑥 − ∆𝑥
∆𝒙 ≠ ∆𝒚 ∆𝑦 ∆𝑦

IST, MFC, 2022 Exercises 12


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
∆𝑥 𝑛+1 𝑛 𝑛 𝑛 𝑛 𝑛
𝜑𝑖,𝑗 − 𝜑𝑖,𝑗 𝜑𝑖+1,𝑗 − 𝜑𝑖,𝑗 𝜑𝑖,𝑗 − 𝜑𝑖−1,𝑗
∆𝒙∆𝒚/𝝑 = ∆𝑦 − ∆𝑦 +
∆𝑡 ∆𝑥 ∆𝑥
𝜑𝑖,𝑗+1
∆𝑦 𝑛
𝜑𝑖,𝑗+1 𝑛
− 𝜑𝑖,𝑗 𝑛
𝜑𝑖,𝑗 𝑛
− 𝜑𝑖,𝑗−1
+ ∆𝑥 − ∆𝑥
∆𝑦 ∆𝑦

𝜑𝑖−1,𝑗 𝜑𝑖,𝑗 𝜑𝑖+1,𝑗 𝑛+1 𝑛 𝜗∆𝑡 𝑛 𝑛 𝑛 𝜗∆𝑡 𝑛 𝑛 𝑛


𝜑𝑖,𝑗 − 𝜑𝑖,𝑗 = 2
𝜑𝑖+1,𝑗 − 2𝜑𝑖,𝑗 + 𝜑𝑖−1,𝑗 + 2
𝜑𝑖,𝑗+1 − 2𝜑𝑖,𝑗 + 𝜑𝑖,𝑗−1
∆𝑥 ∆𝑦

Each direction will have its own


𝜗∆𝑡 𝜗∆𝑡
𝜑𝑖,𝑗−1 diffusive criterion 𝛾𝑥 = and 𝛾𝑦 =
∆𝑥 2 ∆𝑦 2

∆𝒙 ≠ ∆𝒚 𝑛+1
𝜑𝑖,𝑗 𝑛
= 𝜑𝑖,𝑗 𝑛
+ 𝛾𝑥 𝜑𝑖+1,𝑗 𝑛
− 2𝜑𝑖,𝑗 𝑛
+ 𝜑𝑖−1,𝑗 𝑛
+ 𝛾𝑦 𝜑𝑖,𝑗+1 𝑛
− 2𝜑𝑖,𝑗 𝑛
+ 𝜑𝑖,𝑗−1

In two dimensional problems, two minimum wavelenghts


𝑛
𝜑𝑖,𝑗 = 𝑎𝑛 𝒆𝒊𝜽𝒊 𝑰 𝒆𝒋𝜽𝒋 𝑰 in each direction will be used for the Fourier series
𝑰 will our imaginary number to avoid confusion with 𝑖

IST, MFC, 2022 Exercises 13


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
𝑛+1 𝑛 𝑛 𝑛 𝑛 𝑛 𝑛 𝑛
𝜑𝑖,𝑗 = 𝜑𝑖,𝑗 + 𝛾𝑥 𝜑𝑖+1,𝑗 − 2𝜑𝑖,𝑗 + 𝜑𝑖−1,𝑗 + 𝛾𝑦 𝜑𝑖,𝑗+1 − 2𝜑𝑖,𝑗 + 𝜑𝑖,𝑗−1

𝑛
𝑛
𝜑𝑖,𝑗 = 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗 𝐼 𝜑𝑖+1,𝑗 = 𝑎𝑛 𝑒 (𝑖+1)𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 𝑛+1
𝜑𝑖,𝑗−1 = 𝑎𝑛+1 𝑒 𝑖𝜃𝑖𝐼 𝑒 (𝑗+1)𝜃𝑗𝐼

𝑎𝑛+1 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 = 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗 𝐼 +


+𝛾𝑥 𝑎𝑛 𝒆 𝒊+𝟏 𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 + 𝑎𝑛 𝒆 𝒊−𝟏 𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼
+ 𝛾𝑦 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆 𝒋+𝟏 𝜽𝒋 𝑰 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 + 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆 𝒋−𝟏 𝜽𝒋 𝑰

𝑎 𝑛+1 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 = 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼


+𝛾𝑥 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 + 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆−𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼
+ 𝛾𝑦 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 𝒆𝜽𝒋 𝑰 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗 𝐼 + 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 𝒆−𝜽𝒋 𝑰

IST, MFC, 2022 Exercises 14


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
𝑛+1 𝑛 𝑛 𝑛 𝑛 𝑛 𝑛 𝑛
𝜑𝑖,𝑗 = 𝜑𝑖,𝑗 + 𝛾𝑥 𝜑𝑖+1,𝑗 − 2𝜑𝑖,𝑗 + 𝜑𝑖−1,𝑗 + 𝛾𝑦 𝜑𝑖,𝑗+1 − 2𝜑𝑖,𝑗 + 𝜑𝑖,𝑗−1

𝑛
𝑛
𝜑𝑖,𝑗 = 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗 𝐼 𝜑𝑖+1,𝑗 = 𝑎𝑛 𝑒 (𝑖+1)𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 𝑛+1
𝜑𝑖,𝑗−1 = 𝑎𝑛+1 𝑒 𝑖𝜃𝑖𝐼 𝑒 (𝑗+1)𝜃𝑗𝐼

𝑎𝑛+1 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 = 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗 𝐼 +


+𝛾𝑥 𝑎𝑛 𝒆 𝒊+𝟏 𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 + 𝑎𝑛 𝒆 𝒊−𝟏 𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼
+ 𝛾𝑦 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆 𝒋+𝟏 𝜽𝒋 𝑰 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 + 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆 𝒋−𝟏 𝜽𝒋 𝑰
𝑒 𝑖𝜃𝑖𝐼
𝑎 𝑛+1 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 = 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 𝑒 𝑗𝜃𝑗 𝐼
+𝛾𝑥 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 + 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝒆−𝜽𝒊 𝑰 𝑒 𝑗𝜃𝑗𝐼
+ 𝛾𝑦 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 𝒆𝜽𝒋 𝑰 − 2𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗 𝐼 + 𝑎𝑛 𝑒 𝑖𝜃𝑖𝐼 𝑒 𝑗𝜃𝑗𝐼 𝒆−𝜽𝒋 𝑰

𝑎𝑛+1 = 𝑎𝑛 + 𝛾𝑥 𝑎𝑛 𝑒 +𝜃𝑖𝐼 − 2𝑎𝑛 + 𝑎 𝑛 𝑒 −𝜃𝑖𝐼 + 𝛾𝑦 𝑎𝑛 𝑒 +𝜃𝑗𝐼 − 2𝑎𝑛 + 𝑎𝑛 𝑒 −𝜃𝑗𝐼

IST, MFC, 2022 Exercises 15


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
𝑎𝑛+1 = 𝑎𝑛 + 𝛾𝑥 𝑎𝑛 𝑒 𝜃𝑖 𝐼 − 2𝑎𝑛 + 𝑎𝑛 𝑒 −𝜃𝑖𝐼 + 𝛾𝑦 𝑎𝑛 𝑒 𝜃𝑗 𝐼 − 2𝑎𝑛 + 𝑎𝑛 𝑒 −𝜃𝑗 𝐼

𝑎𝑛+1 = 𝑎𝑛 + 𝒂𝒏 𝛾𝑥 𝑒 𝜃𝑖𝐼 − 2 + 𝑒 −𝜃𝑖𝐼 + 𝒂𝒏 𝛾𝑦 𝑒 𝜃𝑗 𝐼 − 2 + 𝑒 −𝜃𝑗 𝐼

𝑎𝑛+1
𝐺 = 𝑛 = 1 + 𝛾𝑥 𝑒 𝜃𝑖𝐼 − 2 + 𝑒 −𝜃𝑖𝐼 + 𝛾𝑦 𝑒 𝜃𝑗 𝐼 − 2 + 𝑒 −𝜃𝑗 𝐼 𝑒 𝑖𝜃 = cos 𝜃 + 𝑖 sin(𝜃)
𝑎

𝑎𝑛+1
𝐺 = 𝑛 = 1 + 𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 + 𝐼𝑠𝑖𝑛 𝜃𝑖 − 2 + 𝑐𝑜𝑠 𝜃𝑖 − 𝐼𝑠𝑖𝑛 𝜃𝑖 +
𝑎
Amplification
Factor +𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 + 𝐼𝑠𝑖𝑛 𝜃𝑗 − 2 + 𝑐𝑜𝑠 𝜃𝑗 − 𝐼𝑠𝑖𝑛 𝜃𝑗

𝑎𝑛+1
𝐺 = 𝑛 = 1 + 𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 2 + 𝑐𝑜𝑠 𝜃𝑖 + 𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 2 + 𝑐𝑜𝑠 𝜃𝑗
𝑎

𝑎𝑛+1
𝐺 = 𝑛 = 1 + 2𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 2𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 A real number
𝑎

IST, MFC, 2022 Exercises 16


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
Let’s assume that 𝑎𝑛+1
directional grid 𝛾𝑥 = 𝛾𝑦 = 𝛾 𝐺 = 𝑛 = 1 + 4𝛾 𝑐𝑜𝑠 𝜃 − 1
𝑎
sizes are equal
First alternative
∆𝑥 = ∆𝑦 = ∆ 𝐺 ≤ 1 ⇔ 𝐺 ≤ 1 ∩ 𝐺 ≥ −1 approach: test
conditions for
different 𝜃 values
𝜃=0 𝐺=1≤1 𝛾∈ℝ

1
𝜋 𝐺 = 1 − 4𝛾 ≥ −1 𝛾≤
𝜃= 2
2 𝐺 = 1 − 4𝛾 ≤ 1 𝛾≥0

1 Most restricted
𝐺 = 1 − 8𝛾 ≥ −1 𝛾≤ condition
𝜃=𝜋 4
𝐺 = 1 − 8𝛾 ≤ 1 𝛾≥0

IST, MFC, 2022 Exercises 17


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
𝛾 = 0.1 𝜸 = 𝟎. 𝟐𝟓 Second alternative
approach: plot 𝐺 in
the complex plane
for different 𝛾

𝑎𝑛+1
𝐺 = 𝑛 = 1 + 4𝛾 𝑐𝑜𝑠 𝜃 − 1
𝑎

𝛾 = 0.5

𝐼𝑚𝑎𝑔 (𝐺)

Blue circle represents


𝑅𝑒𝑎𝑙 (𝐺) the stability condition
limit 𝐺 ≤ 1

IST, MFC, 2022 Exercises 18


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
Classic approach:
Unfortunately the problem is 𝛾𝑥 ≠ 𝛾𝑦 Solve directly the
inequality.
−1 ≤ 𝑮 ≤ 𝟏

Considering the second branch

𝑎𝑛+1
𝐺 = 𝑛 = 1 + 2𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 2𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≤ 1
𝑎

2𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 2𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≤ 0

𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≤ 0

worst case scenario 0𝛾𝑥 + 0𝛾𝑦 ≤ 0 TRUE!!


𝑐𝑜𝑠 𝜃 = 1

IST, MFC, 2022 Exercises 19


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
Classic approach:
Unfortunately the problem is 𝛾𝑥 ≠ 𝛾𝑦 Solve directly the
inequality.
−𝟏 ≤ 𝑮 ≤ 1

Considering the first branch


𝑎𝑛+1
𝐺 = 𝑛 = 1 + 2𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 2𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≥ −1
𝑎

2𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 2𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≥ −2


Dimensionality reduces
𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≥ −1 stability range and has
anisotropic behaviour!!!

worst case scenario −2𝛾𝑥 − 2𝛾𝑦 ≥ −1


𝑐𝑜𝑠 𝜃 = −1
1 𝜐Δ𝑡 𝜐Δ𝑡 1
𝛾𝑥 + 𝛾𝑦 < ⟺ + <
2 Δ𝑥 2 Δ𝑦 2 2

IST, MFC, 2022 Exercises 20


Exercise 4.2: Von Neumann stability analysis
for 2D diffusive equation with an explicit scheme.
Classic approach:
Unfortunately the problem is 𝛾𝑥 ≠ 𝛾𝑦 Solve directly the
inequality.
−𝟏 ≤ 𝑮 ≤ 1

Considering the first branch


𝑎𝑛+1
𝐺 = 𝑛 = 1 + 2𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 2𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≥ −1
𝑎

2𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 2𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≥ −2


Dimensionality reduces
𝛾𝑥 𝑐𝑜𝑠 𝜃𝑖 − 1 + 𝛾𝑦 𝑐𝑜𝑠 𝜃𝑗 − 1 ≥ −1 stability range and has
anisotropic behaviour!!!

worst case scenario −2𝛾𝑥 − 2𝛾𝑦 ≥ −1


𝑐𝑜𝑠 𝜃 = −1 Question: Can anisotropic
1 𝜐Δ𝑡 𝜐Δ𝑡 1
𝛾𝑥 + 𝛾𝑦 < ⟺ + < viscosity affect this result?
2 Δ𝑥 2 Δ𝑦 2 2
𝝊𝒙 and 𝝊𝒚
IST, MFC, 2022 Exercises 21
Exercise 4.3: Von Neumann stability analysis
1D Convection with CDS and explicit scheme.
𝜕𝜙 𝜕𝜙
Let +𝑢 = 0 be discretized with central differences in space and explicit Euler in time.
𝜕𝑡 𝜕𝑥
Find the stability range with von Neumann linear stability analysis.

The discretization of the differential equation is now evident and is as follows

𝜙𝑗𝑛+1 − 𝜙𝑗𝑛 𝑛
𝜙𝑗+1 𝑛
− 𝜙𝑗−1 here we use an index j because
+𝑢 =0 i will be the complex imaginary
∆𝑡 2∆𝑥
To perform the stability analysis one has to replace the numerical variables by a correspondent
'generic' Fourier mode:
𝜙𝑗𝑛+1 = 𝑎𝑛+1 𝑒 𝑖𝜃𝑗 𝜙𝑗𝑛 = 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑛
𝜙𝑗+1 = 𝑎𝑛 𝑒 𝑖𝜃(𝑗+1)
Thus, substituting:

𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎 𝑛 𝑒 𝑖𝜃𝑗 𝑎 𝑛 𝑒 𝑖𝜃(𝑗+1) − 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1)


+𝑢 =0
∆𝑡 2∆𝑥

IST, MFC, 2022 Exercises 22


Exercise 4.3: Von Neumann stability analysis
1D Convection with CDS and explicit scheme.
𝑢∆𝑡
working on the expression... Courant number 𝑐 (or CFL number) 𝑐=
∆𝑥
𝑢∆𝑡 1 𝑛 𝑖𝜃(𝑗+1)
𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑎 𝑒 − 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1) = 0
∆𝑥 2
𝑐 𝑛 𝑖𝜃(𝑗+1)
𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑎 𝑒 − 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1) = 0
2
𝑐
𝑎𝑛+1 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 +𝑖𝜃 − 𝑒 −𝑖𝜃 = 0
2
d𝐢𝐯𝐢𝐝𝐢𝐧𝐠 𝐛𝐲 𝒆𝒊𝜽𝒋

𝑐 𝑛 𝑖𝜃
𝑎𝑛+1 − 𝑎𝑛 + 𝑎 𝑒 − 𝑒 −𝑖𝜃 = 0
2

𝑐 𝑛 𝑖𝜃 𝑐 𝑖𝜃
𝑎𝑛+1 = 𝑎𝑛 − 𝑎 𝑒 − 𝑒 −𝑖𝜃 𝑎𝑛+1 = 𝑎𝑛 1 − 𝑒 − 𝑒 −𝑖𝜃
2 2

IST, MFC, 2022 Exercises 23


Exercise 4.3: Von Neumann stability analysis
1D Convection with CDS and explicit scheme.
𝑐 𝑖𝜃
𝑛
Now dividing by 𝑎 , one obtain the amplification factor G 𝑎𝑛+1 = 𝑎𝑛 1 − 𝑒 − 𝑒 −𝑖𝜃
2

𝑎𝑛+1 𝑐 𝑖𝜃
𝐺 = 𝑛 = 1 − 𝑒 − 𝑒 −𝑖𝜃 𝑒 𝑖𝜃 = cos 𝜃 + 𝑖 sin(𝜃)
𝑎 2

Changing the complex form, from exponential to 𝑥 + 𝑖𝑦: 𝑒 −𝑖𝜃 = cos −𝜃 + 𝑖 sin −𝜃 =
= cos 𝜃 − 𝑖 sin(𝜃)

𝑐
𝐺 = 1 − cos 𝜃 + 𝑖𝑠𝑖𝑛[𝜃] − cos 𝜃 − 𝑖𝑠𝑖𝑛[𝜃]
2

𝑐
𝐺 =1− cos 𝜃 + 𝑖𝑠𝑖𝑛 𝜃 − cos 𝜃 + 𝑖𝑠𝑖𝑛[𝜃]
2

𝐺 = 1 − 𝑖 𝑐 𝑠𝑖𝑛 𝜃

IST, MFC, 2022 Exercises 24


Exercise 4.3: Von Neumann stability analysis
1D Convection with CDS and explicit scheme.
𝑎 + 𝑏𝑖 = (𝑎)2 + 𝑏 2 Modulus of a Complex Number Classic approach:
Solve the inequality.

−𝑎 − 𝑏𝑖 = (−𝑎)2 + −𝑏 2 = 𝑎2 + 𝑏 2 = 𝑎 + 𝑏𝑖

For Von Neumann stability we need to have 𝐺 ≤1


𝐺 ≤1⟺ 𝐺 2 ≤1
for all frequencies 𝜃

𝐺 = 1 − 𝑖 𝑐 𝑠𝑖𝑛 𝜃 Remember this

𝐺 = 12 + 𝑐 2 𝑠𝑖𝑛 𝜃 2 → 𝐺 2 = 12 + 𝑐 2 𝑠𝑖𝑛 𝜃 2 ≥1

We conclude this combination of schemes is Unconditionally unstable

IST, MFC, 2022 Exercises 25


Exercise 4.3: Von Neumann stability analysis
1D Convection with CDS and explicit scheme.
Alternative approach:
𝐼𝑚𝑎𝑔 (𝐺) 𝐺 = 1 − 𝑖 𝑐 𝑠𝑖𝑛 𝜃 plot 𝐺 in the complex
plane for different 𝑐
𝑅𝑒𝑎𝑙 (𝐺) 0 ≤ 𝜃 ≤ 2𝜋 (polar diagram)

𝑐 = 0.5 𝑐 = 1.5
Blue circle represents
the stability condition
limit 𝐺 ≤ 1

Obviously for any 𝑐 value


𝐺 is always outside of the
stability region

IST, MFC, 2022 Exercises 26


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
𝜕𝜙 𝜕𝜙
Let +𝑢 = 0 be discretized with central differences in space and Leap-Frog in time.
𝜕𝑡 𝜕𝑥
Find the stability range with von Neumann linear stability analysis.

Level 𝑛 − 1
𝑛−1
𝜙1𝑛−1 𝜙2𝑛−1 𝑛−1
𝜙𝑖−1 𝜙𝑖𝑛−1 𝜙𝑖+1
𝑛−1 𝑛−1
𝜙𝑁−1 𝜙𝑁

Level 𝑛 𝐹(𝜙 𝑛 )
𝜙1𝑛 𝜙2𝑛 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁

Level 𝑛 + 1
𝜙1𝑛+1 𝜙2𝑛+1 𝑛+1
𝜙𝑖−1 𝜙𝑖𝑛+1 𝜙𝑖+1
𝑛+1 𝑛+1
𝜙𝑁−1 𝑛+1
𝜙𝑁

Leap-Frog Time Scheme 𝜙𝑗𝑛+1 − 𝝓𝒏−𝟏


𝒋
uses three time levels = 𝐹(𝑡 𝑛 , 𝝓𝒏 )
𝟐∆𝑡

IST, MFC, 2022 Exercises 27


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
𝜕𝜙 𝜕𝜙
Let +𝑢 = 0 be discretized with central differences in space and Leap-Frog in time.
𝜕𝑡 𝜕𝑥
Find the stability range with von Neumann linear stability analysis.

Level 𝑛 − 1
𝑛−1
𝜙1𝑛−1 𝜙2𝑛−1 𝑛−1
𝜙𝑖−1 𝜙𝑖𝑛−1 𝜙𝑖+1
𝑛−1 𝑛−1
𝜙𝑁−1 𝜙𝑁

Level 𝑛 𝐹(𝜙 𝑛 )
𝜙1𝑛 𝜙2𝑛 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁

Level 𝑛 + 1 𝐹(𝜙 𝑛+1 )


𝜙1𝑛+1 𝜙2𝑛+1 𝑛+1
𝜙𝑖−1 𝜙𝑖𝑛+1 𝜙𝑖+1
𝑛+1 𝑛+1
𝜙𝑁−1 𝑛+1
𝜙𝑁

Level 𝑛 +2
𝜙1𝑛+2 𝜙2𝑛+2 𝑛+2
𝜙𝑖−1 𝜙𝑖𝑛+2 𝜙𝑖+1
𝑛+2 𝑛+2 𝑛+2
𝜙𝑁−1 𝜙𝑁

Leap-Frog Time Scheme 𝜙𝑗𝑛+1 − 𝝓𝒏−𝟏


𝒋
uses three time levels = 𝐹(𝑡 𝑛 , 𝝓𝒏 )
𝟐∆𝑡

IST, MFC, 2022 Exercises 28


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
𝜕𝜙 𝜕𝜙
Let +𝑢 = 0 be discretized with central differences in space and Leap-Frog in time.
𝜕𝑡 𝜕𝑥
Find the stability range with von Neumann linear stability analysis.

𝜙𝑗𝑛+1 − 𝝓𝒏−𝟏
𝒋 𝑛
= 𝐹(𝑡 𝑛 , 𝝓𝒏 )
𝑛
𝜙𝑗+1 = 𝑎𝑛 𝑒 𝑖𝜃(𝑗+1) = 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 +𝑖𝜃 𝜙𝑗−1 = 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1) = 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑒 −𝑖𝜃
𝟐∆𝑡

Using Leap-Frog for time and following the same procedure as before:

𝜙𝑗𝑛+1 − 𝜙𝑗𝑛−1 𝑛
𝜙𝑗+1 𝑛
− 𝜙𝑗−1
+𝑢 =0 𝑎𝑛+1 𝑒 𝑖𝜃𝑗 = 𝑎𝑛−1 𝑒 𝑖𝜃𝑗 − 𝑐 𝑎𝑛 𝑒 𝑖𝜃(𝑗+1) − 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1)
2∆𝑡 2∆𝑥

𝜙𝑗𝑛+1 = 𝜙𝑗𝑛−1 − 𝑐 𝜙𝑗+1


𝑛 𝑛
− 𝜙𝑗−1 𝑎𝑛+1 = 𝑎𝑛−1 − 𝑐 𝑎𝑛 𝑒 𝑖𝜃 − 𝑎𝑛 𝑒 −𝑖𝜃

𝑎𝑛+1
To compute 𝐺 = we can 𝑎𝑛+1 = 𝑎𝑛−1 − 𝑐𝑎𝑛 𝑒 𝑖𝜃 − 𝑒 −𝑖𝜃
𝑎𝑛
use two distinct approaches

IST, MFC, 2022 Exercises 29


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
First Von Neumann 𝑎𝑛+1 𝑎𝑛
Assume that the amplification factor
approach for three or
is similar between consecutive time levels 𝐺 = 𝑛 ≃ 𝑛−1
more time levels. 𝑎 𝑎

𝑎𝑛+1 = 𝑎 𝑛−1 − 𝑐𝑎𝑛 𝑒 𝑖𝜃 − 𝑒 −𝑖𝜃

Now we will divide by 𝑎𝑛−1 in order to obtain positive powers of the amplification factor

𝑎 𝑛+1 𝑎𝑛−1 𝑎𝑛
= − 𝑐 𝑛−1 2𝑖 sin(𝜃) 𝐺 2 = 1 − 𝑐𝐺2𝑖 sin(𝜃)
𝑎 𝑛−1 𝑎𝑛−1 𝑎

𝐺 2 + 𝐺2𝑐𝑖 sin 𝜃 − 1 = 0

Then we have an algebraic equation for the quadratic polynomial of G whose solutions are:

−2𝑐𝑖 sin 𝜃 ± −4𝑐 2 sin 𝜃 2 +4


𝐺=
2

IST, MFC, 2022 Exercises 30


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
Second Von Neumann
approach for three or Consider an Amplification Matrix 𝑮
more time levels.
𝑎𝑛+1 = 𝑎 𝑛−1 − 𝑐𝑎𝑛 𝑒 𝑖𝜃 − 𝑒 −𝑖𝜃 = 𝑎𝑛−1 −𝑐𝑎𝑛 2𝑖 sin(𝜃)

𝐴 = −2𝑖 sin(𝜃) 𝑎𝑛+1 𝐴 1 𝑎𝑛


𝑎 𝑛+1 = 𝑨𝑎𝑛 + 𝑎𝑛−1
=
𝑎𝑛 1 0 𝑎𝑛−1
Assuming that 𝑎𝑛 = 𝑎𝑛 + (𝟎)𝑎𝑛−1

Amplification Matrix 𝐺

𝐴−𝜆 1
Compute the eigenvalues = 𝜆2 − 𝐴𝜆 − 1 = 0 = 𝜆2 + 𝜆(2𝑐𝑖 sin 𝜃 ) − 1 = 0
of the matrix 1 −𝜆

same equation
−2𝑐𝑖 sin 𝜃 ± −4𝑐 2 sin 𝜃 2 +4
𝜆1,2 = from first approach
2

IST, MFC, 2022 Exercises 31


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
−2𝑐𝑖 sin 𝜃 ± −4𝑐 2 sin 𝜃 2 +4 −𝑐𝑖 sin 𝜃 + −𝑐 2 sin 𝜃 2 +1
𝐺= 𝐺=
2 −𝑐𝑖 sin 𝜃 − −𝑐 2 sin 𝜃 2 +1

In this kind of situations we have to ensure the more restrictive of the solutions.

Looking to the solutions we clearly have an imaginary part (𝑐𝑖 sin 𝜃 ) and a term that can be real
or imaginary ( −𝑐 2 sin 𝜃 2 + 1). This second term can create two or three branches:

If c>1 then the square root can give an imaginary value which, in the second solution makes G>1
and then the scheme is unstable

If c=1 (a special case), both solutions are in the boundary of a circle with radius G=1 and a stable
scheme is obtained. It would give −𝑖𝑠𝑖𝑛(𝜃) ± cos(𝜃)

If c < 1 will be explained in the next slide.

IST, MFC, 2022 Exercises 32


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
−2𝑐𝑖 sin 𝜃 ± −4𝑐 2 sin 𝜃 2 +4 −𝑐𝑖 sin 𝜃 + −𝑐 2 sin 𝜃 2 +1
𝐺= 𝐺=
2 −𝒄𝒊 𝒔𝒊𝒏 𝜽 − −𝒄𝟐 𝒔𝒊𝒏 𝜽 𝟐 +𝟏

In this kind of situations we have to ensure the more restrictive of the solutions.

Looking to the solutions we clearly have an imaginary part (𝑐𝑖 sin 𝜃 ) and a term that can be real
or imaginary ( −𝑐 2 sin 𝜃 2 + 1). This second term can create three branches:

𝒊𝒇 𝒄 > 𝟏 ⟹ −𝑐 2 sin 𝜃 2 +1<0 −𝑐 2 sin 𝜃 2 + 1 = 𝑘𝑖 , 𝑘 > 0

𝐺2 = −𝑐𝑖 sin 𝜃 − 𝑘𝑖 = −𝑖(𝑐 sin 𝜃 + 𝑘) pure imaginary number


without real part

𝜃 = 𝜋/2 |𝐺2 | > 1 Unstable for


0 ≤ sin 𝜃 2 ≤1
𝒄>𝟏

IST, MFC, 2022 Exercises 33


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
−2𝑐𝑖 sin 𝜃 ± −4𝑐 2 sin 𝜃 2 +4 −𝑐𝑖 sin 𝜃 + −𝑐 2 sin 𝜃 2 +1
𝐺= 𝐺=
2 −𝒄𝒊 𝒔𝒊𝒏 𝜽 − −𝒄𝟐 𝒔𝒊𝒏 𝜽 𝟐 +𝟏

𝒊𝒇 𝒄 = 𝟏 ⟹ −𝑐 2 sin 𝜃 2 + 1 = − sin 𝜃 2 + 1 = 𝑐𝑜𝑠 𝜃 2

𝑐𝑜𝑠 𝜃 2 + sin 𝜃 2 =1
−𝑐𝑖 𝑠𝑖𝑛 𝜃 + 𝑐𝑜𝑠 𝜃
𝐺= 𝐺 =1
−𝑐𝑖 𝑠𝑖𝑛 𝜃 − 𝑐𝑜𝑠 𝜃

Both solutions are at the circle with radius 1!

Stable for 𝒄 = 𝟏

IST, MFC, 2022 Exercises 34


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
−2𝑐𝑖 sin 𝜃 ± −4𝑐 2 sin 𝜃 2 +4 −𝑐𝑖 sin 𝜃 + −𝑐 2 sin 𝜃 2 +1
𝐺= 𝐺=
2 −𝒄𝒊 𝒔𝒊𝒏 𝜽 − −𝒄𝟐 𝒔𝒊𝒏 𝜽 𝟐 +𝟏

𝒊𝒇 𝒄 < 𝟏 −𝑐 2 sin 𝜃 2 + 1 will be a real number without any imaginary part

𝑎 + 𝑏𝑖 = (𝑎)2 + 𝑏 2 Modulus of a Complex Number


𝐺 ≤1⟺ 𝐺 2 ≤1
−𝑎 − 𝑏𝑖 = (−𝑎)2 + −𝑏 2 = 𝑎2 + 𝑏 2 = 𝑎 + 𝑏𝑖

2 𝑐 2 sin 𝜃 2 − 𝑐 2 sin 𝜃 2+1≤1 2 Only true due the


𝐺 = 2 2 − 𝑐 2 sin 𝜃 2+1≤1⟺ 𝐺 =1≤1 real part contribution
𝑐 sin 𝜃

Concluding that the scheme is stable for 𝑐 ≤ 1

Leap-frog time-scheme stabilized the CDS convection scheme!!!

IST, MFC, 2022 Exercises 35


Exercise 4.4: Von Neumann stability analysis
1D Convection with CDS and Leap-Frog.
Alternative approach:
−𝑐𝑖 sin 𝜃 + −𝑐 2 sin 𝜃 2 +1 plot 𝐺 in the complex
𝐺= plane for different 𝑐
−𝑐𝑖 sin 𝜃 − −𝑐 2 sin 𝜃 2 +1 (polar diagram)

Mathematica file for these


plots is available: 𝑐 = 1.1
𝑐 = 0.5
VonNeumann_Lecture4.nb

𝐼𝑚𝑎𝑔 (𝐺)

𝑅𝑒𝑎𝑙 (𝐺)

IST, MFC, 2022 Exercises 36


Exercise 4.5: Von Neumann stability analysis
1D Convection with Upwind and Implicit Scheme.
𝜕𝜙 𝜕𝜙
Let +𝑢 = 0 be discretized with first order upwind in space and Euler implicit in time.
𝜕𝑡 𝜕𝑥
Find the stability range with von Neumann linear stability analysis.

𝜙𝑗𝑛+1 − 𝜙𝑗𝑛 𝜙𝑗𝑛+1 − 𝜙𝑗−1


𝑛+1 𝑢∆𝑡 𝑛+1
+𝑢 =0 𝜙𝑗𝑛+1 − 𝜙𝑗𝑛 = − 𝑛+1
𝜙𝑗 − 𝜙𝑗−1
∆𝑡 ∆𝑥 ∆𝑥

𝑛
𝜑𝑗𝑛 = 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝜑𝑗−1 = 𝑎 𝑛 𝑒 𝑖𝜃(𝑗−1) Courant number 𝑐 (or CFL number)

𝑎𝑛+1 𝑒 𝑖𝜃𝑗 = 𝑎𝑛 𝑒 𝑖𝜃𝑗 − 𝑐 𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛+1 𝑒 𝑖𝜃(𝑗−1) 𝑎𝑛+1 = 𝑎𝑛 − 𝑐 𝑎𝑛+1 − 𝑎𝑛+1 𝑒 −𝑖𝜃

𝑛+1 𝑛+1 𝑛+1 −𝑖𝜃 𝑛 𝑛+1 −𝑖𝜃 𝑛


𝑎𝑛+1 1
𝑎 +𝑐 𝑎 −𝑎 𝑒 =𝑎 𝑎 1 + 𝑐 − 𝑐𝑒 =𝑎 𝐺= 𝑛 =
𝑎 1 + 𝑐 − 𝑐𝑒 −𝑖𝜃

IST, MFC, 2022 Exercises 37


Exercise 4.5: Von Neumann stability analysis
1D Convection with Upwind and Implicit Scheme.
1 𝑒 −𝑖𝜃 = cos −𝜃 + 𝑖 sin −𝜃 =
𝐺=
1 + 𝑐 − 𝑐𝑒 −𝑖𝜃 = cos 𝜃 − 𝑖 sin(𝜃)

1 Multiply by the ratio


𝐺=
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 − 𝑖 𝑠𝑖𝑛 𝜃 of the complex conjugate,
to take out the imaginary
part from the denominator

1 1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛 𝜃
𝐺= ∗
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑖 𝑠𝑖𝑛 𝜃 1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛 𝜃

1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛 𝜃 Prove Again?


𝐺= 2 2
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃 𝐺 ≤1

IST, MFC, 2022 Exercises 38


Exercise 4.5: Von Neumann stability analysis
1D Convection with Upwind and Implicit Scheme.
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛 𝜃 Plot 𝐺 in the complex
𝐺= 2 2 plane for different 𝑐
𝐼𝑚𝑎𝑔 (𝐺) 1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃 (polar diagram)

𝑅𝑒𝑎𝑙 (𝐺) Always inside of the circle so


0 ≤ 𝜃 ≤ 2𝜋 it is always stable, normally
full implicit schemes are.

𝑐 = 0.5 𝑐 = 1.5 𝑐 = 50

IST, MFC, 2022 Exercises 39


Exercise 4.5: Von Neumann stability analysis
1D Convection with Upwind and Implicit Scheme.
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛 𝜃 Prove Again?
𝐺= 2 2
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃 𝐺 ≤1

2 2
2
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃
𝐺 = 2 ≤1 |𝐺|2 ≤ 1
2 2
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃

2
1 2 2
𝐺 = 2 2 ≤1 ⇔ 1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃 ≥1
1 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃

2 2 2
1+𝑐 − 2 1 + 𝑐 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 𝑠𝑖𝑛 𝜃 ≥1

2
1+𝑐 − 2 1 + 𝑐 𝑐 𝑐𝑜𝑠 𝜃 + 𝑐 2 ≥ 1

1 + 𝑐 2 + 2𝑐 − 2𝑐 𝑐𝑜𝑠 𝜃 − 2𝑐 2 𝑐𝑜𝑠 𝜃 + 𝑐 2 ≥ 1

IST, MFC, 2022 Exercises 40


Exercise 4.5: Von Neumann stability analysis
1D Convection with Upwind and Implicit Scheme.
1 + 𝑐 2 + 2𝑐 − 2𝑐 𝑐𝑜𝑠 𝜃 − 2𝑐 2 𝑐𝑜𝑠 𝜃 + 𝑐 2 ≥ 1

2𝑐 2 + 2𝑐 − 2𝑐 𝑐𝑜𝑠 𝜃 − 2𝑐 2 𝑐𝑜𝑠 𝜃 ≥ 0

𝑐 2 + 𝑐 − 𝑐 𝑐𝑜𝑠 𝜃 − 𝑐 2 𝑐𝑜𝑠 𝜃 ≥ 0

𝑐 2 1 − 𝑐𝑜𝑠 𝜃 + 𝑐 1 − 𝑐𝑜𝑠 𝜃 ≥0

1 − 𝑐𝑜𝑠 𝜃 𝑐2 + 𝑐 ≥ 0
𝑐≠0
1 − 𝑐𝑜𝑠 𝜃 ≥ 0 ⟺ 1 ≥ 𝑐𝑜𝑠 𝜃

𝑐𝑜𝑠 𝜃 ≤ 1 ∀ 𝜃 TRUE

IST, MFC, 2022 Exercises 41


Spectral Error Analysis

IST, MFC, 2022 Exercises 42


Mathematical Skills:
Solving Inequalities with
Complex Numbers

IST, MFC, 2022 Exercises 43


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.
Let
𝜕𝜙 𝜕𝜙
+𝑢 =0
𝜕𝑡 𝜕𝑥
be discretized with upwind differences in space and forward Euler in time.
Find the amplitude and phase errors as a function of the frequency and Courant number.

𝜙𝑗𝑛+1 − 𝜙𝑖𝑛 𝜙𝑗𝑛 − 𝜙𝑗−1


𝑛
+𝑢 =0
∆𝑡 ∆𝑥

𝜙𝑖𝑛 = 𝑎𝑛 𝑒 𝑖𝜃𝑗

𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 𝑎𝑛 𝑒 𝑖𝜃(𝑗) − 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1)


+𝑢 =0
∆𝑡 ∆𝑥

IST, MFC, 2022 Exercises 44


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.
working on the expression... Courant number c (or CFL number)

𝑣∆𝑡 𝑛 𝑖𝜃(𝑗)
𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑎 𝑒 − 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1) = 0
∆𝑥

𝑎𝑛+1 𝑒 𝑖𝜃𝑗 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑐 𝑎𝑛 𝑒 𝑖𝜃(𝑗) − 𝑎𝑛 𝑒 𝑖𝜃(𝑗−1) = 0

𝑎 𝑛+1 − 𝑎𝑛 𝑒 𝑖𝜃𝑗 + 𝑐𝑎𝑛 𝑒 𝑖𝜃(𝑗) − 𝑒 𝑖𝜃(𝑗−1) = 0

dividing by 𝑒 𝑖𝜃𝑗

𝑎 𝑛+1 − 𝑎𝑛 + 𝑐𝑎𝑛 1 − 𝑒 −𝑖𝜃 = 0

𝑎𝑛+1 = 𝑎𝑛 − 𝑐𝑎𝑛 1 − 𝑒 −𝑖𝜃

𝑎𝑛+1 = 𝑎𝑛 1 − 𝑐 1 − 𝑒 −𝑖𝜃

IST, MFC, 2022 Exercises 45


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.
Now dividing by 𝑎𝑛 , one obtain the amplification factor G

𝑎𝑛+1
𝐺 = 𝑛 = 1 − 𝑐 1 − 𝑒 −𝑖𝜃
𝑎

Changing the complex form, from exponential to 𝑥 + 𝑖𝑦

𝐺 = 1 − 𝑐 1 − cos 𝜃 − 𝑖 𝑠𝑖𝑛[𝜃]

𝐺 = 1 − 𝑐 1 − cos 𝜃 + 𝑖 𝑠𝑖𝑛[𝜃]

𝐺 = 1 − 𝑐 + 𝑐 cos 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛[𝜃]

IST, MFC, 2022 Exercises 46


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.

𝑎𝑛+1
Θ𝑒𝑥 = −𝑐𝜃 𝐺𝑒𝑥 = 𝑛 =1 From Hirish Book
𝑎

For convection equation,


diffusion and dispersion
errors are computed from:

Other differential equations may


𝜀𝐷 = 𝐺 𝜀𝜙 = 𝐴𝑟𝑔 𝐺 /(−𝑐𝜃) have diferent functions for exact
amplification factor and phase

IST, MFC, 2022 Exercises 47


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.
𝐺 = 1 − 𝑐 + 𝑐 cos 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛[𝜃]

𝜀𝐷 = 𝐺 = 1 − 𝑐 + 𝑐 cos 𝜃 2 + −𝑐 𝑠𝑖𝑛[𝜃] 2 𝑐 2 𝑐𝑜𝑠 2 𝜃 + 𝑐 2 𝑠𝑖𝑛2 𝜃

𝜀𝐷 = 𝐺 = 1 − 𝑐 + 𝑐 cos 𝜃 1 − 𝑐 + 𝑐 cos 𝜃 + 𝑐 𝑠𝑖𝑛[𝜃] 2

𝜀𝐷 = 𝐺 = 1 − 𝑐 + 𝑐 cos 𝜃 − 𝑐 + 𝑐 2 − 𝑐 2 cos 𝜃 + c cos 𝜃 − 𝑐 2 cos 𝜃 + 𝑐 2

𝜀𝐷 = 𝐺 = 1 − 2𝑐 + 2𝑐 2 + 2 1 − 𝑐 𝑐 cos 𝜃

Relative Diffusion or Dissipation Error

IST, MFC, 2022 Exercises 48


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.
𝐺 = 1 − 𝑐 + 𝑐 cos 𝜃 − 𝑐 𝑖 𝑠𝑖𝑛[𝜃]

−𝑐 sin 𝜃
𝐴𝑟𝑔 𝐺 = 𝐴𝑟𝑐𝑇𝑎𝑛
1 − 𝑐 + 𝑐 cos 𝜃

−𝑐 sin 𝜃
𝜀𝜙 = 𝐴𝑟𝑔 𝐺 /(−𝑐𝜃) = 𝐴𝑟𝑐𝑇𝑎𝑛 /(−𝑐𝜃)
1−𝑐+𝑐 cos 𝜃

Relative Dispersion Error Hirish has a different definition


for the complex number angle

IST, MFC, 2022 Exercises 49


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.

Diffusion Error 𝐶 = 0.1 Dispersion Error

−𝑐 sin 𝜃
𝜀𝐷 = 𝐺 = 1 − 2𝑐 + 2𝑐 2 + 2 1 − 𝑐 𝑐 cos 𝜃 𝜀𝜙 = 𝐴𝑟𝑐𝑇𝑎𝑛 /(−𝑐𝜃)
1 − 𝑐 + 𝑐 cos 𝜃

0≤𝜃≤𝜋

IST, MFC, 2022 Exercises 50


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.

Diffusion Error 𝐶 = 0.6 > 0.5 Dispersion Error

−𝑐 sin 𝜃
𝜀𝐷 = 𝐺 = 1 − 2𝑐 + 2𝑐 2 + 2 1 − 𝑐 𝑐 cos 𝜃 𝜀𝜙 = 𝐴𝑟𝑐𝑇𝑎𝑛 /(−𝑐𝜃)
1 − 𝑐 + 𝑐 cos 𝜃

0≤𝜃≤𝜋

IST, MFC, 2022 Exercises 51


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.

Diffusion Error 𝐶 = 1.0 Dispersion Error

−𝑐 sin 𝜃
𝜀𝐷 = 𝐺 = 1 − 2𝑐 + 2𝑐 2 + 2 1 − 𝑐 𝑐 cos 𝜃 𝜀𝜙 = 𝐴𝑟𝑐𝑇𝑎𝑛 /(−𝑐𝜃)
1 − 𝑐 + 𝑐 cos 𝜃

0≤𝜃≤𝜋

IST, MFC, 2022 Exercises 52


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.

Diffusion Error 𝐶 = 1.0 Dispersion Error


This result can be used for
verification of the second
computational work:
The train should remain
intacted for 𝐶 = 1.0

−𝑐 sin 𝜃
𝜀𝐷 = 𝐺 = 1 − 2𝑐 + 2𝑐 2 + 2 1 − 𝑐 𝑐 cos 𝜃 𝜀𝜙 = 𝐴𝑟𝑐𝑇𝑎𝑛 /(−𝑐𝜃)
1 − 𝑐 + 𝑐 cos 𝜃

0≤𝜃≤𝜋

IST, MFC, 2022 Exercises 53


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.

Diffusion Error 𝐶 = 1.1 Dispersion Error

Mathematica file for these


plots is available:
SpectralError_Lecture4.nb

−𝑐 sin 𝜃
𝜀𝐷 = 𝐺 = 1 − 2𝑐 + 2𝑐 2 + 2 1 − 𝑐 𝑐 cos 𝜃 𝜀𝜙 = 𝐴𝑟𝑐𝑇𝑎𝑛 /(−𝑐𝜃)
1 − 𝑐 + 𝑐 cos 𝜃

0≤𝜃≤𝜋

IST, MFC, 2022 Exercises 54


Exercise 5.1: Dissipative and Dispersion Error for
1D Convection with Upwind and Explicit Scheme.
Diffusion Error Dispersion Error

Also it is possible to plot the diagram for different


Courant number and make a better comparison

Upwind with 𝐶 = 0.5


has zero dispersion error

IST, MFC, 2022 Exercises 55


From the other Professors
article concerning Stability:
Fourier_Pereira_Pereira.pdf

RK4 in time Except for LF and Q

IST, MFC, 2022 Exercises 56


From the other Professors
article concerning Stability:
Fourier_Pereira_Pereira.pdf

RK4 in time Except for LF and Q

IST, MFC, 2022 Exercises 57


Exercise 5.2: Dissipative and Dispersion Error for
First Order Upwind and MacCormark Schemes.
Let
𝜕𝜙 𝜕𝜙
+𝑢 =0
𝜕𝑡 𝜕𝑥
be discretized with upwind differences in space and MacCormak-like in time.
Find the amplitude and phase errors as a function of the frequency and Courant number.

This is not the classic


MacCormak time scheme

IST, MFC, 2022 Exercises 58


Exercise 5.2: Dissipative and Dispersion Error for
First Order Upwind and MacCormark Schemes.

𝑢
𝑓 𝜑𝑖𝑛 = − 𝜑𝑖𝑛 − 𝜑𝑖−1
𝑛
∆𝑥

∆𝑡 𝑢
𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + − 𝜑𝑖𝑛 − 𝜑𝑖−1
𝑛
1 ∆𝑥

𝜑𝑖𝑛+1 = 𝝋𝒏𝒊 + 𝒄 −𝝋𝒏𝒊 + 𝝋𝒏𝒊−𝟏

∆𝑡 𝑢 𝑢
𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + − 𝑛 𝑛
𝜑𝑖 − 𝜑𝑖−1 − 𝜑𝑖𝑛+1 − 𝜑𝑖−1
𝑛+1
2 ∆𝑥 ∆𝑥
∆𝑡 𝑢 𝑢
𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + − 𝜑𝑖𝑛 − 𝜑𝑖−1
𝑛
− 𝝋𝒏𝒊 + 𝒄 −𝝋𝒏𝒊 + 𝝋𝒏𝒊−𝟏 − 𝝋𝒏𝒊−𝟏 + 𝒄 −𝝋𝒏𝒊−𝟏 + 𝝋𝒏𝒊−𝟐
2 ∆𝑥 ∆𝑥

IST, MFC, 2022 Exercises 59


Exercise 5.2: Dissipative and Dispersion Error for
First Order Upwind and MacCormark Schemes.
∆𝑡 𝑢 𝑢
𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + − 𝜑𝑖𝑛 − 𝜑𝑖−1
𝑛
− 𝝋𝒏𝒊 + 𝒄 −𝝋𝒏𝒊 + 𝝋𝒏𝒊−𝟏 − 𝝋𝒏𝒊−𝟏 + 𝒄 −𝝋𝒏𝒊−𝟏 + 𝝋𝒏𝒊−𝟐
2 ∆𝑥 ∆𝑥

𝑐 𝑐 𝒏 𝑐2 𝑐 𝒏 𝑐2
𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 − 𝜑𝑖𝑛 − 𝜑𝑖−1
𝑛
− 𝝋𝒊 + −𝝋𝒏𝒊 + 𝝋𝒏𝒊−𝟏 − 𝝋𝒊−𝟏 + −𝝋𝒏𝒊−𝟏 + 𝝋𝒏𝒊−𝟐
2 2 2 2 2

𝑐2
𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 +𝑐 𝑛
𝜑𝑖−1 − 𝜑𝑖𝑛 + 𝑛
−2𝜑𝑖−1 + 𝜑𝑖𝑛 + 𝜑𝑖−2
𝑛
2
Do this as homework to confirm the result from previous year!

𝑐2 𝑐2 𝑐2
𝐺 = 1 + 𝑐 𝐶𝑜𝑠 𝜃 − 𝑐 + − 𝐶𝑜𝑠 𝜃 + 𝐶𝑜𝑠 2𝜃 +
2 1 2
𝑐2 𝑐2
𝑗 −𝑐 𝑆𝑖𝑛 𝜃 + 𝑆𝑖𝑛 𝜃 − 𝑆𝑖𝑛 2𝜃
1 2

IST, MFC, 2022 Exercises 60


Exercise 5.2: Dissipative and Dispersion Error for
First Order Upwind and MacCormark Schemes.

Diffusion 𝐶 = 0.5 Dispersion

𝜀𝐷 = 𝐺 𝜀𝜙 = 𝐴𝑟𝑔 𝐺 /(−𝑐𝜃)

IST, MFC, 2022 Exercises 61


Exercise 5.2: Dissipative and Dispersion Error for
First Order Upwind and MacCormark Schemes.

Diffusion 𝐶 = 1.0 Dispersion

𝜀𝐷 = 𝐺 𝜀𝜙 = 𝐴𝑟𝑔 𝐺 /(−𝑐𝜃)

IST, MFC, 2022 Exercises 62


Exercise 5.2: Dissipative and Dispersion Error for
First Order Upwind and MacCormark Schemes.

Diffusion 𝐶 = 0.9 Dispersion

𝜀𝐷 = 𝐺 𝜀𝜙 = 𝐴𝑟𝑔 𝐺 /(−𝑐𝜃)

IST, MFC, 2022 Exercises 63


Exercise 5.2: Dissipative and Dispersion Error for
First Order Upwind and MacCormark Schemes.
Mathematica file for these
plots is available:
Diffusion SpectralError_Lecture4_v2.nb Dispersion

𝜀𝐷 = 𝐺 𝜀𝜙 = 𝐴𝑟𝑔 𝐺 /(−𝑐𝜃)

Contrary to the First Order Upwind previous example (exercise 4.6),


the Courant number increasses the diffusion and dispersion error

IST, MFC, 2022 Exercises 64


IST, MFC, 2022 Exercises 65
Exercise 5.3: Convection Diffusion Euler

Let
𝜕𝜑 𝜕𝜑 𝜕2 𝜑
+𝑢 =𝜗 2
𝜕𝑡 𝜕𝑥 𝜕𝑥
be discretized with upwind differences for convection, central differences for diffusion and first
order Euler explicit in time.
Find the amplitude and phase errors as a function of the frequency and Courant number.

𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 − 𝑐 𝜑𝑖𝑛 − 𝜑𝑖−1


𝑛 𝑛
+ 𝛾 𝜑𝑖+1 − 2𝜑𝑖𝑛 + 𝜑𝑖−1
𝑛

𝐺 = 1 − 𝑐 1 − 𝑒 −𝑗𝜃 + 𝛾 𝑒 𝑗𝜃 − 2 + 𝑒 −𝑗𝜃

𝐺 = 1 − 𝑐 1 − 𝐶𝑜𝑠 𝜃 + 𝑗𝑆𝑖𝑛(𝜃) + 𝛾 𝐶𝑜𝑠 𝜃 + 𝑗𝑆𝑖𝑛 𝜃 − 2 + 𝐶𝑜𝑠 𝜃 − 𝑗𝑆𝑖𝑛(𝜃)

𝐺 = 1 − 𝑐 1 − 𝐶𝑜𝑠 𝜃 + 𝑗𝑆𝑖𝑛(𝜃) + 𝛾 𝐶𝑜𝑠 𝜃 − 2 + 𝐶𝑜𝑠 𝜃

𝐺 = 1 − 𝑐 1 − 𝐶𝑜𝑠 𝜃 + 𝛾 2𝐶𝑜𝑠 𝜃 − 2 − 𝑗 𝑐𝑆𝑖𝑛(𝜃)


IST, MFC, 2022 Exercises 66
Exercise 5.3: Convection Diffusion Euler

𝜃 = 𝑘∆𝑥
𝛿 = 𝑘 2 𝜗∆𝑡
𝜗∆𝑡
𝛾= 2
∆𝑥
𝛿 = 𝛾𝜃 2 𝜃
𝑤 = 𝑘𝑣∆𝑡 = 𝑣∆𝑡 = 𝑐𝜃
∆𝑥
IST, MFC, 2022 Exercises 67
Exercise 5.3: Convection Diffusion Euler

Amplification Factor

Amplitude error Exact amplitude


Amplification factor in the previous slide

Phase error

IST, MFC, 2022 Exercises 68


Exercise 5.3: Convection Diffusion Euler

Amplification Factor

Exact amplitude
Amplitude error Amplification factor in the previous slide

Phase error

IST, MFC, 2022 Exercises 69


Exercise 5.3: Convection Diffusion Euler

IST, MFC, 2022 Exercises 70


Exercise 5.3: Convection Diffusion Euler

Some more...

IST, MFC, 2022 Exercises 71


Exercise 5.3: Convection Diffusion Euler

Some more...

IST, MFC, 2022 Exercises 72


Example 2: Convection Euler

IST, MFC, 2022 Exercises 73


Example 2: Convection Euler

Wavelength 𝜆𝑚𝑖𝑛 = 2∆𝑥 𝜆𝑚𝑎𝑥 = 𝐿

Wavenumber 2𝜋 𝜋 2𝜋 2𝜋
𝑘𝑚𝑎𝑥 = = 𝑘𝑚𝑖𝑛 = =
𝜆𝑚𝑖𝑛 ∆𝑥 𝜆𝑚𝑎𝑥 𝐿

𝐿 𝜋𝑁 Se atingir esse wavenumber a solução terá um


∆𝑥 = 𝑘𝑚𝑎𝑥 =
𝑁 L erro significativo pois não é possível resolver
os maiores números de onda.

IST, MFC, 2022 Exercises 74


Example 2: Convection Euler
central differences:
𝜕𝜑 𝜑𝑗+1 − 𝜑𝑗−1 𝑒 𝑖𝑘∆𝑥(𝑗+1) − 𝑒 𝑖𝑘∆𝑥(𝑗−1)
= =
𝜕𝑥 𝑗
2∆𝑥 2∆𝑥
𝑖𝑘𝑥𝑗
𝑒 𝑖𝑘∆𝑥−𝑒 −𝑖𝑘∆𝑥 𝑒
=
2∆𝑥
1
= cos 𝑘∆𝑥 + 𝑖𝑠𝑖𝑛(𝑘∆𝑥) − cos 𝑘∆𝑥 − 𝑖𝑠𝑖𝑛(𝑘∆𝑥) 𝑒 𝑖𝑘𝑥𝑗
2∆𝑥
𝑠𝑖𝑛(𝑘∆𝑥) 𝑖𝑘𝑥
=𝑖 𝑒 𝑗 The difference to the exact solution, 𝑠𝑖𝑛(𝑘∆𝑥)
∆𝑥 𝑘 ∗ =
presented below, is related to k* ∆𝑥
= 𝑖𝑘 ∗ 𝑒 𝑖𝑘𝑥𝑗
𝑖𝑘𝑒 𝑖𝑘𝑥

falta a velocidade 𝑎 a multiplicar pela derivada, por simplificação, o


teórico viria alterado da mesma forma -> nada muda!

IST, MFC, 2022 Exercises 75


Example 2: Convection Euler
upwind differences:
𝜕𝜑 𝜑𝑗 − 𝜑𝑗−1 𝑒 𝑖𝑘∆𝑥(𝑗) − 𝑒 𝑖𝑘∆𝑥(𝑗−1)
= =
𝜕𝑥 𝑗
∆𝑥 ∆𝑥
𝑖𝑘𝑥𝑗
1−𝑒 −𝑖𝑘∆𝑥 𝑒
=
∆𝑥
1
= 1 − cos 𝑘∆𝑥 − 𝑖𝑠𝑖𝑛(𝑘∆𝑥) 𝑒 𝑖𝑘𝑥𝑗
∆𝑥
= 𝑖𝑘 ∗ 𝑒 𝑖𝑘𝑥𝑗

1 − cos 𝑘∆𝑥 + 𝑖𝑠𝑖𝑛(𝑘∆𝑥)


𝑖𝑘 ∗ =
∆𝑥

IST, MFC, 2022 Exercises 76


Example 2: Convection Euler
forward differences:
𝜕𝜑 𝜑𝑗+1 − 𝜑𝑗 𝑒 𝑖𝑘∆𝑥(𝑗+1) − 𝑒 𝑖𝑘∆𝑥(𝑗)
= =
𝜕𝑥 𝑗
∆𝑥 ∆𝑥
𝑖𝑘𝑥𝑗
𝑒 𝑖𝑘∆𝑥−1 𝑒
=
∆𝑥
1
= cos 𝑘∆𝑥 + 𝑖𝑠𝑖𝑛(𝑘∆𝑥) − 1 𝑒 𝑖𝑘𝑥𝑗
∆𝑥
= 𝑖𝑘 ∗ 𝑒 𝑖𝑘𝑥𝑗

cos 𝑘∆𝑥 + 𝑖𝑠𝑖𝑛 𝑘∆𝑥 − 1


𝑖𝑘 ∗ =
∆𝑥

IST, MFC, 2022 Exercises 77


Example 2: Convection Euler

O factor exacto é unitário

O Courant entraria de forma linear e igual para todos os esquemas.


mas podemos analizar o numero de onda modificado, escalado, ou efectivo...

central differences:
𝑖𝑘 ∗ ∆𝑥 = 𝑖𝑠𝑖𝑛(𝑘∆𝑥) 𝐸𝑟𝑟𝑜 = 0

upwind differences:
𝑖𝑘 ∗ ∆𝑥 = 1 − cos 𝑘∆𝑥 + 𝑖𝑠𝑖𝑛(𝑘∆𝑥) 𝐸𝑟𝑟𝑜~1 − cos 𝑘∆𝑥

forward differences:
𝑖𝑘 ∗ ∆𝑥 = cos 𝑘∆𝑥 + 𝑖𝑠𝑖𝑛 𝑘∆𝑥 − 1 𝐸𝑟𝑟𝑜~ cos 𝑘∆𝑥 − 1

O maior erro de aplitude, em módulo, é para as diferenças não centrais, qq q seja

IST, MFC, 2022 Exercises 78


Example 2: Convection Euler

IST, MFC, 2022 Exercises 79


Example 2: Convection Euler

IST, MFC, 2022 Exercises 80


Flux Limiters
Some more about Convection and Time Discretization Schemes

IST, MFC, 2022 Exercises 81


Time Discretization Schemes
Level 𝑛
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Level 𝑛 + 1 0 1
𝜑1𝑛+1 𝜑2𝑛+1 𝑛+1
𝜑𝑖−1 𝜑𝑖𝑛+1 𝜑𝑖+1
𝑛+1 𝑛+1
𝜑𝑁−1 𝑛+1
𝜑𝑁

IST, MFC, 2022 Exercises 82


Time Discretization Schemes
Level 𝑛
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Level 𝑛 + 1 0 1
𝜑1𝑛+1 𝜑2𝑛+1 𝑛+1
𝜑𝑖−1 𝜑𝑖𝑛+1 𝜑𝑖+1
𝑛+1 𝑛+1
𝜑𝑁−1 𝑛+1
𝜑𝑁

𝜑𝑖𝑛+1 − 𝜑𝑖𝑛 𝜑𝑖𝑛+1 − 𝜑𝑖𝑛


= 𝐹(𝜙 𝑛 , 𝑡 𝑛 ) = 𝐹(𝜙 𝑛+1 , 𝑡 𝑛+1 )
∆𝑡 ∆𝑡

Progressive Regressive Finite


Finite Difference Difference

IST, MFC, 2022 Exercises 83


Time Discretization Schemes
Level 𝑛
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Level 𝑛 + 1 0 1
𝜑1𝑛+1 𝜑2𝑛+1 𝑛+1
𝜑𝑖−1 𝜑𝑖𝑛+1 𝜑𝑖+1
𝑛+1 𝑛+1
𝜑𝑁−1 𝑛+1
𝜑𝑁

𝜑𝑖𝑛+1 − 𝜑𝑖𝑛 𝜑𝑖𝑛+1 − 𝜑𝑖𝑛


= 𝐹(𝜙 𝑛 , 𝑡 𝑛 ) = 𝐹(𝜙 𝑛+1 , 𝑡 𝑛+1 )
∆𝑡 ∆𝑡

Progressive Regressive Finite


Finite Difference Difference

IST, MFC, 2022 Exercises 84


Time Discretization Schemes
Level 𝑛
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Level 𝑛 + 1 0 1
𝜑1𝑛+1 𝜑2𝑛+1 𝑛+1
𝜑𝑖−1 𝜑𝑖𝑛+1 𝜑𝑖+1
𝑛+1 𝑛+1
𝜑𝑁−1 𝑛+1
𝜑𝑁

𝜑𝑖𝑛+1 − 𝜑𝑖𝑛 Mixed Schemes 𝜑𝑖𝑛+1 − 𝜑𝑖𝑛


= 𝐹(𝜙 𝑛 , 𝑡 𝑛 ) = 𝐹(𝜙 𝑛+1 , 𝑡 𝑛+1 )
∆𝑡 Crank-Nicolson ∆𝑡

Progressive 𝜑𝑖𝑛+1 − 𝜑𝑖𝑛 Regressive Finite


Finite Difference = 0.5 𝐹(𝜙 𝑛 , 𝑡 𝑛 ) + 𝐹(𝜙 𝑛+1 , 𝑡 𝑛+1 ) Difference
∆𝑡

IST, MFC, 2022 Exercises 85


Exercise 6.1: Temporal FD

Consider the transient convection-diffusion equation with constant coefficients in a uniform grid.
Use upwind differences for the first derivative and central differences for the second derivative.
Obtain the discrete equations for 2 grid points using both Euler explicit and implicit methods for
temporal discretization.
𝜕𝜑 𝜕𝜑 𝜕2 𝜑 𝜑 𝑥, 𝑡 : 𝜑 0, 𝑡 = 𝜑𝐷 , 𝜑 1, 𝑡 = 1, 𝜑 𝑥, 0 = 𝜑𝐷
+𝑢 =𝜗 2 +𝑓
𝜕𝑡 𝜕𝑥 𝜕𝑥
𝑢>0 𝑓=0

𝑛
In terms of discrete points we have 𝜑1𝑛 = 0 𝜑𝑁 =1
u
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Thus for Explicit Euler


𝜑𝑖𝑛+1 − 𝜑𝑖𝑛 𝜑𝑖𝑛 − 𝜑𝑖−1
𝑛 𝑛
𝜑𝑖−1 − 2𝜑𝑖𝑛 + 𝜑𝑖+1
𝑛
+𝑢 =𝜗
∆𝑡 ∆𝑥 ∆𝑥 2
Remark: no need for matrix of coefficients
IST, MFC, 2022 Exercises 86
Exercise 6.1: Temporal FD
u
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝑢∆𝑡 𝜗∆𝑡
𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + −𝜑𝑖𝑛 + 𝜑𝑖−1
𝑛
+ 𝜑 𝑛
𝑖−1 − 2𝜑 𝑛
𝑖 + 𝜑 𝑛
𝑖+1
∆𝑥 ∆𝑥 2
𝑐 𝛾
Where Courant number and Diffusive Criterion are highlighted.

𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + 𝑐 −𝜑𝑖𝑛 + 𝜑𝑖−1


𝑛 𝑛
+ 𝛾 𝜑𝑖−1 − 2𝜑𝑖𝑛 + 𝜑𝑖+1
𝑛

𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 1 − 𝑐 − 2𝛾 + 𝜑𝑖−1


𝑛 𝑛
𝑐 + 𝛾 + 𝜑𝑖+1 𝛾

The stability limits must be taken


into account for the numerical
predictions
1 for convective transport only

IST, MFC, 2022 Exercises 87


Exercise 6.1: Temporal FD
u
Level 𝑛
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Level 𝑛 + 1 0 1
𝜑1𝑛+1 𝜑2𝑛+1 𝑛+1
𝜑𝑖−1 𝜑𝑖𝑛+1 𝜑𝑖+1
𝑛+1 𝑛+1
𝜑𝑁−1 𝑛+1
𝜑𝑁

For n=1 with Explicit Euler time scheme and computational time =∆𝑡

𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 1 − 𝑐 − 2𝛾 + 𝜑𝑖−1


𝑛 𝑛
𝑐 + 𝛾 + 𝜑𝑖+1 𝛾
where:

𝜑11 = 𝜑𝐷 𝑢∆𝑡
𝑐=
𝜑21 = 1 − 𝑐 − 2𝛾 𝜑20 + 𝜑𝐷 𝑐 + 𝛾 + 𝛾𝜑30 ∆𝑥

𝜑31 = 1 − 𝑐 − 2𝛾 𝜑30 + 𝑐 + 𝛾 𝜑20 + 𝛾𝜑40 𝜗∆𝑡


. 𝛾=
∆𝑥 2
.
1 𝜑𝑖0 = 𝜑 𝑥𝑖 , 0 = 𝑥𝑖
𝜑𝑁 = 𝜑𝐷

IST, MFC, 2022 Exercises 88


Exercise 6.1: Temporal FD
u
Level 𝑛
0 1
𝜑𝑜𝑛 𝜑1𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝑛
𝜑𝑖+1 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Level 𝑛 + 1 0 1
𝜑1𝑛+1 𝜑2𝑛+1 𝑛+1
𝜑𝑖−1 𝜑𝑖𝑛+1 𝜑𝑖+1
𝑛+1 𝑛+1
𝜑𝑁−1 𝑛+1
𝜑𝑁

For Implicit Euler


Transient Scheme 𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + 𝑐 −𝜑𝑖𝑛+1 + 𝜑𝑖−1
𝑛+1 𝑛+1
+ 𝛾 𝜑𝑖−1 − 2𝜑𝑖𝑛+1 + 𝜑𝑖+1
𝑛+1

Only the time 𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 + 𝜑𝑖𝑛+1 −𝑐 − 2𝛾 + 𝜑𝑖−1


𝑛+1 𝑛+1
𝑐 + 𝛾 + 𝜑𝑖+1 𝛾
derivative
contributes
to level 𝑛 𝑛+1
𝜑𝑖−1 −𝑐 − 𝛾 + 𝜑𝑖𝑛+1 1 + 𝑐 + 2𝛾 + 𝜑𝑖+1
𝑛+1
−𝛾 = 𝜑𝑖𝑛

𝑨𝝋𝑛+1 = 𝝋𝑛 + 𝒃

IST, MFC, 2022 Exercises 89


Exercise 6.1: Temporal FD
where:
n=0 𝜑11 −𝑐 − 𝛾 + 𝜑21 1 + 𝑐 + 2𝛾 + 𝜑31 −𝛾 = 𝜑20 𝑢∆𝑡
i=2 𝑐=
∆𝑥
n=0 𝜗∆𝑡
i=3
𝜑21 −𝑐 − 𝛾 + 𝜑31 1 + 𝑐 + 2𝛾 + 𝜑41 −𝛾 = 𝜑30 𝛾=
∆𝑥 2

𝜑𝑖0 = 𝜑 𝑥𝑖 , 0 = 𝑥𝑖

1 + 𝑐 + 2𝛾 −𝛾 0 0 ⋯ 𝜑21 (𝑐 + 𝛾)𝜑𝐷 𝜑20


−𝑐 − 𝛾 1 + 𝑐 + 2𝛾 −𝛾 0 ⋯ 𝜑31 0 𝜑30
= +
⋱ ⋮ ⋮ ⋮

−𝑐 − 𝛾 1 + 𝑐 + 2𝛾 0
𝜑𝑁−1 +𝛾𝜑𝐷 0
𝜑𝑁−1

Contribution from the Contribution from


imposed boundaries previous values

IST, MFC, 2022 Exercises 90


Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
Regarding the convection-diffusion equation, apply the finite volume method to obtain the
discrete equations in a 1D uniform grid for steady and unsteady problems.
Use first order upwind for convective fluxes, central differences for diffusive fluxes and first order
Euler implicit for time.
Compare the result obtained with that using finite differences.
𝜕𝜑 𝜕𝜑 𝜕2 𝜑 𝜑 𝑥, 𝑡 : 𝜑 0, 𝑡 = 𝜑𝐷 , 𝜑 1, 𝑡 = 𝜑𝐷 , 𝜑 𝑥, 0 = 30𝑥 + 2
+𝑢 =𝜗 2 𝑢>0 𝑓=0
𝜕𝑡 𝜕𝑥 𝜕𝑥
u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁
Starting with the vectorial (conservative) form of the equation,

𝜕𝜑 𝜕𝜑
+ 𝛻 ∙ 𝑢𝜑 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉 + 𝛻 ∙ 𝑢𝜑 𝑑𝑉 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉
𝜕𝑡 𝜕𝑡
𝑉 𝑉 𝑉
integrating
𝝏𝝋
𝒅𝑽 + 𝒖𝝋 ∙ 𝒏𝒅𝑺 = 𝜗𝛻𝜑 ∙ 𝑛𝑑𝑆
Gauss theorem 𝑽 𝝏𝒕 𝑺 𝑆

IST, MFC, 2022 Exercises 91


Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝜕𝜑 𝜕𝜑
𝑑𝑉 + 𝑢𝜑 ∙ 𝑛𝑑𝑆 = 𝜗𝛻𝜑 ∙ 𝑛𝑑𝑆 𝜑𝑢 ∙ 𝑛𝑑𝑠 = 𝜗 ∙ 𝑛𝑑𝑠
𝑉 𝜕𝑡 𝑆 𝑆 𝑆 𝑆 𝜕𝑥
Back to 1D steady

𝜕𝜑 𝜕 2𝜑
Starting with the steady version of the equation: 𝑢 =𝜗 2
𝜕𝑥 𝜕𝑥
𝜕𝜑
𝜑𝑢 ∙ 𝑛𝑑𝑠 = 𝜗 ∙ 𝑛𝑑𝑠 −𝐹𝐶𝑤 + 𝐹𝐶𝑒 = −𝐹𝐷𝑤 + 𝐹𝐷𝑒
𝑆 𝑆 𝜕𝑥
fluxes

𝜕𝜑 𝜕𝜑
−𝑢𝜑𝑤 + 𝑢𝜑𝑒 = −𝜗 +𝜗 𝑓𝑜𝑟 𝑖 = 1, ⋯
𝜕𝑥 𝑤
𝜕𝑥 𝑒

IST, MFC, 2022 Exercises 92


Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Upwind Central differences


𝜑𝑤 = 𝜑𝑖−1 𝑖𝑓 𝑢 > 0 𝜕𝜑 𝜑𝑖 − 𝜑𝑖−1
=
𝜕𝑥 𝑤
∆𝑥
𝜑𝑤 = 𝜑𝑖 𝑖𝑓 𝑢 < 0

𝜗 𝜗
−𝑢𝜑𝑖−1 + 𝑢𝜑𝑖 = − 𝜑𝑖 − 𝜑𝑖−1 + 𝜑 − 𝜑𝑖
∆𝑥 ∆𝑥 𝑖+1
𝜗 2𝜗 𝜗
−𝑢 − 𝜑𝑖−1 + 𝑢 + 𝜑𝑖 + − 𝜑 =0
∆𝑥 ∆𝑥 ∆𝑥 𝑖+1

For cell i=2


𝜗 2𝜗 𝜗 And the matrix’s coefficients
−𝑢 − 𝜑1 + 𝑢 + 𝜑2 + − 𝜑 =0 corresponding to the inner
∆𝑥 ∆𝑥 ∆𝑥 3 points can then be easily
d assembled.
a b c
IST, MFC, 2022 Exercises 93
Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝜕𝜑 𝜕𝜑
For cell i=1 lets recover the fluxes: −𝑢𝜑𝑤 + 𝑢𝜑𝑒 = −𝜗 +𝜗 𝑓𝑜𝑟 𝑖 = 1, ⋯
𝜕𝑥 𝑤
𝜕𝑥 𝑒

Progressive difference
Hence,
𝜑1 − 𝜑𝐷 𝜑2 − 𝜑1
−𝑢𝜑𝐷 + 𝑢𝜑1 = −𝜗 ∆𝑥
+𝜗
∆𝑥
2

3𝜗 𝜗 2𝜑𝐷
𝑢+ 𝜑1 − 𝜑2 = 𝜗 + 𝜑𝐷 𝑢
∆𝑥 ∆𝑥 ∆𝑥
a'
b’ c' d'

Remark: different matrix’ coefficients close to the boundaries


IST, MFC, 2022 Exercises 94
Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
𝜕𝜑 𝜕𝜑 𝜕2𝜑
Following, the unsteady version: +𝑢 =𝜗 2
𝜕𝑡 𝜕𝑥 𝜕𝑥

Here one needs 𝜕𝜑 𝜑𝑖𝑛+1 − 𝜑𝑖𝑛 1


𝑑𝑉 = 𝑑𝑉 = 𝜑𝑖𝑛+1 𝑑𝑉 − 𝜑𝑖𝑛 𝑑𝑉
𝑉 𝜕𝑡 𝑉 ∆𝑡 ∆𝑡 𝑉 𝑉

𝑛
but 𝜑𝑖𝑛 𝑑𝑉 is ‘naturally’ replaced by 𝜑𝑖 ∆𝑉 under spatial discretizations with order up to 2
𝑉

Recovering the numerical equation for the interior points, adding the temporal contribution and
identifying the time index, the Euler implicit discrete equations is following:

Δ𝑥 𝑛+1 𝑛 𝜗 𝑛+1 2𝜗 𝑛+1 𝜗 𝑛+1


𝜑𝑖 − 𝜑𝑖 + −𝑢 − 𝜑𝑖−1 + 𝑢 + 𝜑𝑖 + − 𝜑𝑖+1 =0
Δ𝑡 ∆𝑥 ∆𝑥 ∆𝑥

Remark 1D: ∆𝑉 = ∆𝑥

IST, MFC, 2022 Exercises 95


Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
where:
Cell 𝑖 = 1 𝜑𝐷 −𝑐 − 2𝛾 + 𝜑11 1 + 𝑐 + 3𝛾 + 𝜑21 −𝛾 = 𝜑10 𝑢∆𝑡
𝑐=
∆𝑥
Cell 𝑖 = 2 𝜑11 −𝑐 − 𝛾 + 𝜑21 1 + 𝑐 + 2𝛾 + 𝜑31 −𝛾 = 𝜑30
𝜗∆𝑡
𝛾=
1
𝜑𝑁−1 1
−𝑐 − 𝛾 + 𝜑𝑁 0
1 + 𝑐 + 3𝛾 + 𝜑𝐷 −2𝛾 = 𝜑𝑁 ∆𝑥 2
Cell 𝑖 = 𝑁
𝜑𝑖0 = 𝜑 𝑥𝑖 , 0 = 𝑥𝑖

1 + 𝑐 + 3𝛾 −𝛾 0 0 ⋯ 𝜑11 1
𝑐 + 2𝛾 𝜑𝐷 𝜑10
−𝑐 − 𝛾 1 + 𝑐 + 2𝛾 −𝛾 0 ⋯ 𝜑21 0 𝜑20
= +
⋱ ⋮ ⋮ ⋮
1 1 0
−𝑐 − 𝛾 1 + 𝑐 + 3𝛾 𝜑𝑁 +2𝛾𝜑𝐷 𝜑𝑁

Contribution from the Contribution from


imposed boundaries previous values

IST, MFC, 2022 Exercises 96


Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
where:
Cell 𝑖 = 1 𝜑𝐷 −𝑐 − 𝛾 + 𝜑11 1 + 𝑐 + 3𝛾 + 𝜑21 −2𝛾 = 𝜑10 𝑢∆𝑡
𝑐=
∆𝑥
Cell 𝑖 = 2 𝜑11 −𝑐 − 𝛾 + 𝜑21 1 + 𝑐 + 2𝛾 + 𝜑31 −𝛾 = 𝜑30
𝜗∆𝑡
𝛾=
1
𝜑𝑁−1 1
−𝑐 − 𝛾 + 𝜑𝑁 0
1 + 𝑐 + 3𝛾 + 𝜑𝐷 −2𝛾 = 𝜑𝑁 ∆𝑥 2
Cell 𝑖 = 𝑁
𝜑𝑖0 = 𝜑 𝑥𝑖 , 0 = 𝑥𝑖

1 + 𝑐 + 3𝛾 −𝛾 0 0 ⋯ 𝜑11 1
𝑐 + 2𝛾 𝜑𝐷 𝜑10
−𝑐 − 𝛾 1 + 𝑐 + 2𝛾 −𝛾 0 ⋯ 𝜑21 0 𝜑20
= +
⋱ ⋮ ⋮ ⋮
1 1 0
−𝑐 − 𝛾 1 + 𝑐 + 3𝛾 𝜑𝑁 +2𝛾𝜑𝐷 𝜑𝑁

Question: How would be the matrix, if


the boundaries were periodic? Contribution from the Contribution from
imposed boundaries previous values

IST, MFC, 2022 Exercises 97


Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁
Periodic Boundary Conditions

Question: How would be the matrix, if


the boundaries were periodic?

Cell 𝑖 = 2 𝜑11 −𝑐 − 𝛾 + 𝜑21 1 + 𝑐 + 2𝛾 + 𝜑31 −𝛾 = 𝜑30

IST, MFC, 2022 Exercises 98


Exercise 6.2: Finite Volume Discretization for
Convection-Diffusion Equation
u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁
Periodic Boundary Conditions

Question: How would be the matrix, if


the boundaries were periodic?

Cell 𝑖 = 2 𝜑11 −𝑐 − 𝛾 + 𝜑21 1 + 𝑐 + 2𝛾 + 𝜑31 −𝛾 = 𝜑30

1 + 𝑐 + 2𝛾 −𝛾 0 0 ⋯ −𝑐 − 𝛾 𝜑11 0 𝜑10
−𝑐 − 𝛾 1 + 𝑐 + 2𝛾 −𝛾 0 ⋯ 𝜑21 0 𝜑20
= +
⋱ ⋮ ⋮ ⋮

−𝛾 −𝑐 − 𝛾 1 + 𝑐 + 2𝛾 1 0
𝜑𝑁 0 𝜑𝑁

𝑨𝝋𝑛+1 = 𝝋𝑛 + 𝒃

IST, MFC, 2022 Exercises 99


Convection Schemes in Finite Volume
u
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑊 𝜑𝑃𝑛 𝜑𝐸𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝛻 ∙ 𝑢𝜑 𝑑𝑉 = 𝜑𝑓 (𝑢)𝑓 ∙ 𝑛𝑑𝑠
𝑉 𝑆

𝜑𝑒 = 𝜑𝑃 𝑖𝑓 𝑢 > 0 𝜑𝑒 = 0.5(𝜑𝐸 + 𝜑𝑃 ) 𝜕𝜑
𝜑𝑒 = 𝜑𝑃 + ∆𝑥/2
𝜕𝑥 𝑃
𝜑𝑒 = 𝜑𝐸 𝑖𝑓 𝑢 < 0
Linear Interpolation 𝜑𝑃 − 𝜑𝑊
Or Central Differences 𝜑𝑒 = 𝜑𝑃 +
2
Upwind
3𝜑𝑃 𝜑𝑊
𝜑𝑒 = −
2 2

Linear Upwind
if 𝑢 > 0

IST, MFC, 2022 Exercises 100


Convection Schemes in Finite Volume
u
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑊 𝜑𝑃𝑛 𝜑𝐸𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝛻 ∙ 𝑢𝜑 𝑑𝑉 = 𝜑𝑓 (𝑢)𝑓 ∙ 𝑛𝑑𝑠
𝑉 𝑆

𝜑𝑒 = 𝜑𝑃 𝑖𝑓 𝑢 > 0 𝜑𝑒 = 0.5(𝜑𝐸 + 𝜑𝑃 ) 𝜕𝜑
𝜑𝑒 = 𝜑𝑃 + ∆𝑥/2
𝜕𝑥 𝑃
𝜑𝑒 = 𝜑𝐸 𝑖𝑓 𝑢 < 0
Linear Interpolation 𝜑𝑃 − 𝜑𝑊
Or Central Differences 𝜑𝑒 = 𝜑𝑃 +
2
Upwind
3𝜑𝑃 𝜑𝑊
𝜑𝑒 = −
2 2

Linear Upwind
if 𝑢 > 0

IST, MFC, 2022 Exercises 101


Wiggles and Stability with Convection Schemes
Velocity 𝑢 = 0.1 𝑚/𝑠 Velocity 𝑢 = 2.5 𝑚/𝑠

Upwind
Scheme

Linear
Interpolation

IST, MFC, 2022 Exercises 102


Blending Schemes
u
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑊 𝜑𝑃𝑛 𝜑𝐸𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝜑𝑃 − 𝜑𝑊
𝜑𝑒 = 𝜑𝑃 + 0.5𝜓 (𝑟𝑒 )[𝜑𝐸 − 𝜑𝑃 ] 𝑟𝑒 = if 𝒖 > 𝟎 𝑟𝑒 < 1
𝜑𝐸 − 𝜑𝑃

The Gradients are


Difusive Term Anti-Difusive Term
Ratio of Regressive Increasing in the
Gradients Velocity Direction

𝜓=0 Upwind

Linear Interpolation
𝜓=1
Or Central Differences

𝜓=𝑟 Linear Upwind

IST, MFC, 2022 Exercises 103


TVD Schemes
u
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑊 𝜑𝑃𝑛 𝜑𝐸𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝜑𝑒 = 𝜑𝑃 + 0.5𝜓 (𝑟𝑒 )[𝜑𝑒 − 𝜑𝑃 ]

𝜑𝑃 − 𝜑𝑊 𝑟 + 𝑟2
𝑟𝑒 = 𝜓=
𝜑𝐸 − 𝜑𝑃 1 + 𝑟2

List of Flux Limiters for Finite Volume Methods

IST, MFC, 2022 Exercises 104


Exercise 6.3: Application of a Flux Limiter (FL)
Apply to the previous exercise 3.2 two distinct flux limiters, Van Albada and Min-Mod, to the
convective scheme. Show the two obtained finite difference formula for cell P.
𝜕𝜑 𝜕𝜑 𝜕2 𝜑 𝜑 𝑥, 𝑡 : 𝜑 0, 𝑡 = 𝜑𝐷 , 𝜑 1, 𝑡 = 𝜑𝐷 , 𝜑 𝑥, 0 = 30𝑥 + 2
+𝑢 =𝜗 2 𝑢>0 𝑓=0
𝜕𝑡 𝜕𝑥 𝜕𝑥

u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝑟 + 𝑟2 0, 𝑟<0
𝜑𝑒 = 𝜑𝑃 + 0.5𝜓 (𝑟𝑒 )[𝜑𝐸 − 𝜑𝑃 ] 𝜓(𝑟) = 𝜓(𝑟) = 𝑟, 0<𝑟<1
1 + 𝑟2
1, 𝑟>1
𝜑𝑃 − 𝜑𝑊
𝑟𝑒 = Van Albada FL Min-Mod FL
𝜑𝐸 − 𝜑𝑃

Remembering the
Convective Term 𝜑𝑢 ∙ 𝑛𝑑𝑠 = −𝑢𝜑𝑤 + 𝑢𝜑𝑒
From Exercise 6.2 𝑆

IST, MFC, 2022 Exercises 105


Exercise 6.3: Application of a Flux Limiter (FL)
Apply to the previous exercise 3.2 two distinct flux limiters, Van Albada and Min-Mod, to the
convective scheme. Show the two obtained finite difference formula for cell P.
𝜕𝜑 𝜕𝜑 𝜕2 𝜑 𝜑 𝑥, 𝑡 : 𝜑 0, 𝑡 = 𝜑𝐷 , 𝜑 1, 𝑡 = 𝜑𝐷 , 𝜑 𝑥, 0 = 30𝑥 + 2
+𝑢 =𝜗 2 𝑢>0 𝑓=0
𝜕𝑡 𝜕𝑥 𝜕𝑥

u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

−𝑢𝜑𝑤 + 𝑢𝜑𝑒 = 𝑢(𝜑𝑃 + 0.5𝜓(𝑟𝑒 )[𝜑𝐸 − 𝜑𝑃 ] − 𝜑𝑊 − 0.5𝜓(𝑟𝑤 )[𝜑𝑃 − 𝜑𝑊 ]) (𝐵𝑎𝑠𝑒)

𝜑𝑃 − 𝜑𝑊 This means that Flux Limiters


𝜑𝑊 − 𝜑𝑊𝑊
𝑟𝑒 = 𝑟𝑤 = are third-order schemes
𝜑𝐸 − 𝜑𝑃 𝜑𝑃 − 𝜑𝑊 that use two points of the
upwind side.

IST, MFC, 2022 Exercises 106


Exercise 6.3: Application of a Flux Limiter (FL)
Apply to the previous exercise 3.2 two distinct flux limiters, Van Albada and Min-Mod, to the
convective scheme. Show the two obtained finite difference formula for cell P.
𝜕𝜑 𝜕𝜑 𝜕2 𝜑 𝜑 𝑥, 𝑡 : 𝜑 0, 𝑡 = 𝜑𝐷 , 𝜑 1, 𝑡 = 𝜑𝐷 , 𝜑 𝑥, 0 = 30𝑥 + 2
+𝑢 =𝜗 2 𝑢>0 𝑓=0
𝜕𝑡 𝜕𝑥 𝜕𝑥

u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

−𝑢𝜑𝑤 + 𝑢𝜑𝑒 = 𝑢(𝜑𝑃 + 0.5𝜓(𝑟𝑒 )[𝜑𝐸 − 𝜑𝑃 ] − 𝜑𝑊 − 0.5𝜓(𝑟𝑤 )[𝜑𝑃 − 𝜑𝑊 ]) (𝐵𝑎𝑠𝑒)

𝜑𝑃 − 𝜑𝑊 This means that Flux Limiters


𝜑𝑊 − 𝜑𝑊𝑊
𝑟𝑒 = 𝑟𝑤 = are third-order schemes
𝜑𝐸 − 𝜑𝑃 𝜑𝑃 − 𝜑𝑊 that use two points of the
upwind side.

𝑟 + 𝑟2
Let’s apply now the Van Albada Flux Limiter 𝜓(𝑟) =
1 + 𝑟2

IST, MFC, 2022 Exercises 107


Exercise 6.3: Application of a Flux Limiter (FL)
Apply to the previous exercise 3.2 two distinct flux limiters, Van Albada and Min-Mod, to the
convective scheme. Show the two obtained finite difference formula for cell P.
𝜕𝜑 𝜕𝜑 𝜕2 𝜑 𝜑 𝑥, 𝑡 : 𝜑 0, 𝑡 = 𝜑𝐷 , 𝜑 1, 𝑡 = 𝜑𝐷 , 𝜑 𝑥, 0 = 30𝑥 + 2
+𝑢 =𝜗 2 𝑢>0 𝑓=0
𝜕𝑡 𝜕𝑥 𝜕𝑥

u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

𝑟𝑒 + 𝑟𝑒 2 𝑟𝑤 + (𝑟𝑤 )2
−𝑢𝜑𝑤 + 𝑢𝜑𝑒 = 𝑢(𝜑𝑃 + 0.5 [𝜑𝐸 − 𝜑𝑃 ] − 𝜑𝑊 − 0.5 [𝜑 − 𝜑𝑊 ])
1 + 𝑟𝑒 2 1 + (𝑟𝑤 )2 𝑃

𝜑𝑃 − 𝜑𝑊 𝜑𝑊 − 𝜑𝑊𝑊
𝑟𝑒 = 𝑟𝑤 =
𝜑𝐸 − 𝜑𝑃 𝜑𝑃 − 𝜑𝑊

As you can notice it is hard to simplify more by hand Try Mathematica

Flux Limiters present non-linear terms so they must be


iterated in the case of implicit time schemes

IST, MFC, 2022 Exercises 108


Exercise 6.3: Application of a Flux Limiter (FL)
With Explicit Euler time scheme is simple to apply the Flux Limiters:

𝜑𝑖𝑛+1 = 𝜑𝑖𝑛 1 − 𝑐 − 2𝛾 + 𝜑𝑖−1


𝑛 𝑛
𝑐 + 𝛾 + 𝜑𝑖+1 𝛾 + (−𝒄)𝑭𝑳𝒊
𝟐
𝒓𝒊+𝟏/𝟐 + 𝒓𝒊+𝟏/𝟐
𝜑11 = 1 − 𝑐 − 3𝛾 𝜑10 + 𝑐 + 2𝛾 𝝋𝟎𝑫 + 𝛾𝜑20 + −𝒄 𝟎. 𝟓 𝟐
[𝝋𝒊+𝟏 − 𝝋𝒊 ]
𝟏 + 𝒓𝒊+𝟏/𝟐
𝜑21 = 1 − 𝑐 − 2𝛾 𝜑20 + 𝑐 + 𝛾 𝜑10 + 𝛾𝜑30 + (−𝒄)𝑭𝑳𝟐
.
.
.
𝒓 + (𝒓 )𝟐
𝒊−𝟏/𝟐 𝒊−𝟏/𝟐
1
𝜑𝑁 0
= 1 − 𝑐 − 3𝛾 𝜑𝑁 0
+ 𝑐 + 𝛾 𝜑𝑁−1 + 2𝛾𝝋𝟎𝑫 + +𝒄 𝟎. 𝟓 [𝝋𝒊 − 𝝋𝒊−𝟏 ])
𝟏 + (𝒓𝒊−𝟏/𝟐 )𝟐
2
𝑟𝑖+1/2 + 𝑟𝑖+1/2 𝑟𝑖−1/2 + (𝑟𝑖−1/2 )2
𝑭𝑳𝒊 = 0.5 2 [𝜑𝑖+1 − 𝜑𝑖 ] − 0.5 [𝜑𝑖 − 𝜑𝑖−1 ])
1 + 𝑟𝑖+1/2 1 + (𝑟𝑖−1/2 )2

𝜑𝑖 − 𝜑𝑖−1 𝜑𝑖−1 − 𝜑𝑖−2


𝑟𝑖+1/2 = 𝑟𝑖−1/2 =
𝜑𝑖+1 − 𝜑𝑖 𝜑𝑖 − 𝜑𝑖−1

IST, MFC, 2022 Exercises 109


Exercise 6.3: Application of a Flux Limiter (FL)
With Implicit Euler time scheme is way more complicate to apply the Flux Limiters:
1 + 𝑐 + 3𝛾 −𝛾 0 0 ⋯ 𝜑11 𝑐 + 𝛾 𝜑𝐷0 𝜑10 (−𝑐)𝐹𝐿𝑘1
−𝑐 − 𝛾 1 + 𝑐 + 2𝛾 −𝛾 0 ⋯ 𝜑21 0 𝜑20 (−𝑐)𝐹𝐿𝑘2
= + +
⋱ ⋮ ⋮ ⋮ ⋮

−𝑐 − 𝛾 1 + 𝑐 + 3𝛾 1
𝜑𝑁 +𝛾𝜑𝐷0 0
𝜑𝑁 (−𝑐)𝐹𝐿𝑘𝑁

2
𝑟𝑖+1/2 + 𝑟𝑖+1/2 𝑟𝑖−1 + (𝑟𝑖−1 )2
𝐹𝐿𝑘𝑖 = 0.5 2 [𝜑𝑖+1 − 𝜑𝑖 ] − 0.5 2 [𝜑𝑖 − 𝜑𝑖−1 ]) This vector is
1 + 𝑟𝑖+1/2 1 + (𝑟𝑖−1 ) iterated with last
computed 𝜑𝑛+1

In boundaries one of these terms is cut out 𝑘 iteration number

𝜑𝑖 − 𝜑𝑖−1 𝜑𝑖−1 − 𝜑𝑖−2


𝑟𝑖+1/2 = 𝑟𝑖−1/2 = The system is solved
𝜑𝑖+1 − 𝜑𝑖 𝜑𝑖 − 𝜑𝑖−1 in each 𝑘 iteration

𝑟𝑒 + 𝑟𝑒 2 𝑟𝑤 + (𝑟𝑤 )2
−𝑢𝜑𝑤 + 𝑢𝜑𝑒 = 𝑢(𝜑𝑃 + 0.5 [𝜑𝐸 − 𝜑𝑃 ] − 𝜑𝑊 − 0.5 [𝜑 − 𝜑𝑊 ])
1 + 𝑟𝑒 2 1 + (𝑟𝑤 )2 𝑃

IST, MFC, 2022 Exercises 110


Exercise 6.3: Application of a Flux Limiter (FL)
Apply to the previous exercise 3.2 two distinct flux limiters, Van Albada and Min-Mod, to the
convective scheme. Show the two obtained finite difference formula for cell P.
𝜕𝜑 𝜕𝜑 𝜕2 𝜑 𝜑 𝑥, 𝑡 : 𝜑 0, 𝑡 = 𝜑𝐷 , 𝜑 1, 𝑡 = 𝜑𝐷 , 𝜑 𝑥, 0 = 30𝑥 + 2
+𝑢 =𝜗 2 𝑢>0 𝑓=0
𝜕𝑡 𝜕𝑥 𝜕𝑥

u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

0, 𝑟<0 0, 𝑟𝑒 < 0
𝑈𝐷𝑆 , 𝑟 < 0 𝜑𝑖 −𝜑𝑖−1
𝜓(𝑟) = 𝐿𝑈𝐷𝑆 , 0 < 𝑟 < 1 𝜓(𝑟) = 𝑟, 0<𝑟<1 𝜎(𝑟𝑒 ) = , 0 < 𝑟𝑒 < 1
2
𝐿𝐼𝑁 , 𝑟 > 1 1, 𝑟>1 𝜑𝑖+1 −𝜑𝑖
, 𝑟𝑒 > 1
2

𝜑𝑒 = 𝜑𝑃 + 0.5𝜓 (𝑟𝑒 )[𝜑𝐸 − 𝜑𝑃 ] Min-Mod Flux Limiter Development of the


anti-difusive contribution
Min-Mod FL has 3 brunches for each faces, since is 1D
Linear Interpolation is
and cells 2 faces we get 9 possible combinations
unstable for the matrix structured
(zero main diagonal)

IST, MFC, 2022 Exercises 111


Exercise 6.3: Application of a Flux Limiter (FL)
u ∆𝑥
w e 𝑛(𝑖)𝑒
0 1
𝜑1𝑛 𝜑2𝑛 𝑛
𝜑𝑖−1 𝜑𝑖𝑛 𝜑𝑖+1
𝑛 𝑛
𝜑𝑁−1 𝑛
𝜑𝑁

Each face has a flux limiter contribution.

0, 𝑟𝑖−1/2 < 0 0, 𝑟𝑖+1/2 < 0


𝜑𝑖−1 −𝜑𝑖−2 𝜑𝑖 −𝜑𝑖−1
𝜎(𝑟𝑖−1/2 ) = ,0 < 𝑟𝑖−1/2 < 1 𝜎(𝑟𝑖+1/2 ) = , 0 < 𝑟𝑖+1/2 < 1
2 2
𝜑𝑖 −𝜑𝑖−1 𝜑𝑖+1 −𝜑𝑖
, 𝑟𝑖−1/2 > 1 , 𝑟𝑖+1/2 > 1
2 2

𝜑𝑖−1 − 𝜑𝑖−2 𝜑𝑖 − 𝜑𝑖−1


𝑭𝑳𝒊 = 𝜎 𝑟𝑖+1/2 − 𝜎(𝑟𝑖−1/2 ) 𝑟𝑖−1/2 = 𝑟𝑖+1/2 =
𝜑𝑖 − 𝜑𝑖−1 𝜑𝑖+1 − 𝜑𝑖

The rest of the problem is similar to the previous flux limiter,


the system is still non-linear because of the branches switching of the MinMod FL
and also the linear scheme cannot be solved with a matrix (null main diagonal).

IST, MFC, 2022 Exercises 112


Exercise CT B1
Problem B1 (2+2+2+2=8 values)
Consider the Black-Scholes equatuion, where u(t; S) represents the buy option at time instant t for the
active value dependent to S, where  is the active’s volatility and r the interest rate:

a) Discretize the equation with the finite differences method for a generic point i and time instance
n+1. Use an explicit euler for time and central discretization scheme for the space derivatives. Assume
 and r as positive constants.

b) Analyze with the Von Neumann stability theorem the finite difference equation obtained in a).

c) Obtain the comple finite diference formula using the MinMod flux limiter for the derivative:

d) Discretize the equation using the Crank-Nicolson for the time derivative and a forth order compact
Padé for the spatial derivatives. (This type of schemes will not be covered during this course!)

IST, MFC, 2022 Exercises 113


Exercise CT B1
a) Discretize the equation with the finite differences method for a generic point i and time instance
n+1. Use an explicit euler for time and central discretization scheme for the space derivatives.
Assume  and r as positive constants.

𝜕𝜙 𝜎 2 2 𝜕 2 𝜙 𝜕𝜙
+ 𝑥 + 𝑟𝑥 − 𝑟𝜙 = 0
𝜕𝑡 2 𝜕𝑥 2 𝜕𝑥

Assuming uniform grid: ∆𝑥 = ℎ 𝑥>0


First time we see a source term
We will obtained the following: that depends of the solution 𝜙

r𝑥 ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁

IST, MFC, 2022 Exercises 114


Exercise CT B1
a) Discretize the equation with the finite differences method for a generic point i and time instance
n+1. Use an explicit euler for time and central discretization scheme for the space derivatives.
Assume  and r as positive constants.

𝜕𝜙 𝜎 2 2 𝜕 2 𝜙 𝜕𝜙
+ 𝑥 + 𝑟𝑥 − 𝑟𝜙 = 0
𝜕𝑡 2 𝜕𝑥 2 𝜕𝑥

Assuming uniform grid: ∆𝑥 = ℎ 𝑥>0


First time we see a source term
We will obtained the following: that depends of the solution 𝜙

𝜙𝑖𝑛+1 − 𝜙𝑖𝑛 𝜎 2 2 𝜙𝑖−1


𝑛
− 2𝜙𝑖𝑛 +𝜙𝑖+1
𝑛 𝑛
𝜙𝑖+1 𝑛
− 𝜙𝑖−1
+ 𝑥𝑖 2 + 𝑟𝑥𝑖 − 𝑟𝜙𝑖𝑛 = 0
∆𝑡 2 ℎ 2ℎ

r𝑥 ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁

IST, MFC, 2022 Exercises 115


Exercise CT B1
b) Analyze with the Von Neumann stability theorem the finite difference equation obtained in a).

From the previous finite difference formula:

𝜙𝑖𝑛+1 − 𝜙𝑖𝑛 𝜎 2 2 𝜙𝑖−1


𝑛
− 2𝜙𝑖𝑛 +𝜙𝑖+1
𝑛 𝑛
𝜙𝑖+1 𝑛
− 𝜙𝑖−1 𝑛
+ 𝑥𝑖 + 𝑟𝑥𝑖 − 𝑟𝜙𝑖 =0
∆𝑡 2 ℎ2 2ℎ
𝑛+1
We can replace the fourier terms from Von Neumann analysis: 𝜙𝑖−1 = 𝑎𝑛+1 𝑒 𝐼𝜃 𝑖−1 ℎ

𝑎𝑛+1𝑒 𝐼𝜃 𝑖
− 𝑎𝑛 𝑒 𝐼𝜃 𝑖
𝜎 2 2 𝑎𝑛 𝑒 𝐼𝜃 𝑖−1
− 2𝑎𝑛 𝑒 𝐼𝜃 𝑖
+ 𝑎𝑛 𝑒 𝐼𝜃 𝑖+1
𝑎𝑛 𝑒 𝐼𝜃 𝑖+1
− 𝑎𝑛 𝑒 𝐼𝜃 𝑖−1
+ 𝑥 + 𝑟𝑥𝑖 − 𝑟𝑎𝑛 𝑒 𝐼𝜃 𝑖 =0
∆𝑡 2 𝑖 ℎ2 2ℎ

𝒂𝒏+𝟏
Dividing by 𝑎𝑛 𝑒 𝐼𝜃 𝑖 The amplification factor is thus
𝒂𝒏

𝑎𝑛+1
− 1 𝜎2 𝑒 𝐼𝜃 −1 − 2 + 𝑒 𝐼𝜃 1 𝑒 𝐼𝜃 1 − 𝑒 𝐼𝜃 −1
𝑎𝑛 + 𝑥𝑖 2 + 𝑟𝑥𝑖 −𝑟 =0
∆𝑡 2 ℎ2 2ℎ

IST, MFC, 2022 Exercises 116


Exercise CT B1
Simplifying,

𝑎𝑛+1 𝜎 2 ∆𝑡 2 𝐼𝜃 −1
𝑟𝑥𝑖 ∆𝑡 𝐼𝜃
−1+ 𝑥 𝑒 −2+ 𝑒 𝐼𝜃 1 + 𝑒 1 − 𝑒 𝐼𝜃 −1 − 𝑟∆𝑡 = 0
𝑎𝑛 2ℎ2 𝑖 2ℎ
Remember that the fourier terms can be simplified in the following form:

𝑒 𝐼𝜃 1 + 𝑒 𝐼𝜃 −1 = 𝐶𝑜𝑠 𝜃 + 𝐼𝑆𝑖𝑛 𝜃 + 𝐶𝑜𝑠 −𝜃 + 𝐼𝑆𝑖𝑛 −𝜃 =


= 𝐶𝑜𝑠 𝜃 + 𝐼𝑆𝑖𝑛 𝜃 + 𝐶𝑜𝑠 𝜃 − 𝐼𝑆𝑖𝑛 𝜃 = 2𝐶𝑜𝑠 𝜃

𝑒 𝐼𝜃 1 − 𝑒 𝐼𝜃 −1 = 𝐶𝑜𝑠 𝜃 + 𝐼𝑆𝑖𝑛 𝜃 − 𝐶𝑜𝑠 −𝜃 − 𝐼𝑆𝑖𝑛 −𝜃 =


= 𝐶𝑜𝑠 𝜃 + 𝐼𝑆𝑖𝑛 𝜃 − 𝐶𝑜𝑠 𝜃 + 𝐼𝑆𝑖𝑛 𝜃 = 2𝐼𝑆𝑖𝑛 𝜃
Further development of the previous equation:

𝑎𝑛+1 𝜎 2 ∆𝑡 2 𝑟𝑥𝑖 ∆𝑡
= 1 + 𝑟∆𝑡 − 𝑥 𝐶𝑜𝑠 𝜃 − 1 − 𝐼𝑆𝑖𝑛 𝜃
𝑎𝑛 ℎ2 𝑖 ℎ

IST, MFC, 2022 Exercises 117


Exercise CT B1
𝑎𝑛+1 𝜎 2 ∆𝑡 2 𝑟𝑥𝑖 ∆𝑡
= 1 + 𝑟∆𝑡 − 𝑥 𝐶𝑜𝑠 𝜃 − 1 − 𝐼𝑆𝑖𝑛 𝜃
𝑎𝑛 ℎ2 𝑖 ℎ
From the previous exercise it was stated that  and r as positive constants.

If 𝜃 = 0, is easy to check that the real part of 𝐺 will be:

𝑟𝑒𝑎𝑙 𝐺 = 1 + 𝑟∆𝑡 > 1


because 𝑟 > 0 and Δ𝑡 > 0

So you can say that this combination of schemes is unstable.

IST, MFC, 2022 Exercises 118


Exercise CT B1
c) Obtain the complete finite diference formula using the MinMod flux limiter for the derivative:

𝜙𝑖𝑛+1 − 𝜙𝑖𝑛 𝜎 2 2 𝜙𝑖−1 𝑛


− 2𝜙𝑖𝑛 +𝜙𝑖+1
𝑛 𝑛
𝜙𝑖+1 𝑛
− 𝜙𝑖−1 𝑛
+ 𝑥𝑖 + 𝑟𝑥𝑖 − 𝑟𝜙𝑖 =0
∆𝑡 2 ℎ2 2ℎ
𝜕𝜙 𝑛
To apply the flux limiter in FD: 𝜕𝑥 𝑖
Since 𝑟𝑥𝑖 is positive, the upwind points will be only regressive to the left.
To apply the MinMod flux limiter to the finite differences we have to use a nomenclature similar to
the finite volume by using auxiliar faces between the computational points:

𝜙𝑛 1 − 𝜙𝑛 1
𝜕𝜙 𝑛 𝑖+
2
𝑖−
2
=
𝜕𝑥 𝑖

r𝑥 ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

IST, MFC, 2022 Exercises 119


Exercise CT B1
r𝑥 ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

According to our flux limiters: MinMod FL: 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


𝜎𝑟 𝑛
𝜙𝑛 1 = +𝜙𝑖𝑛 𝜙𝑖+1 − 𝜙𝑖𝑛 𝑟 = 𝑖 + 1/2 𝑛
𝜙𝑖−1 𝑛
− 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝑖+
2 2 𝜃𝑙 = 𝑛 𝜃𝑟 = 𝑛
𝑛
𝜎𝑙 𝑛 𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛
𝜙𝑛 1 𝑛
= 𝜙𝑖−1 + 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝑙 = 𝑖 − 1/2
𝑖−
2 2

𝜙𝑛 1 − 𝜙𝑛 1 𝜎𝑟 𝑛
𝜙𝑖𝑛 +
𝜙𝑖+1 − 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛 𝜎
− 𝑙 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
So: 𝜕𝜙 𝑛 𝑖+
2
𝑖−
2 2 2
= =
𝜕𝑥 𝑖
ℎ ℎ
𝜎𝑟 𝑛 𝜎
𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛 𝜙𝑖+1 − 𝜙𝑖𝑛 − 𝑙 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
= + 2 2
ℎ ℎ

IST, MFC, 2022 Exercises 120


Exercise CT B1
𝜕𝜙𝑛
For each point compute the corresponding 𝜃𝑟 and 𝜃𝑙 in order to compute and so our final
𝜕𝑥 𝑖
equation can be defined by:

𝜎𝑟 𝑛 𝜎
𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝑛
𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛 − 𝑙 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
= + 2 2
𝜕𝑥 𝑖
ℎ ℎ

Since the “convective velocity” 𝑟𝑥𝑖 is always positive, each auxiliary face has three branches which
results in nine combinations:

IST, MFC, 2022 Exercises 121


Exercise CT B1

𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1


𝑛 Left: Upwind
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 ℎ
𝑖

𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 2𝜙𝑖−1


𝑛 𝑛
+ 𝜙𝑖+1 Left: Upwind
= Right: CDS
𝜕𝑥 2ℎ
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝑖

𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝑛
𝜕𝜙 𝑛 −3𝜙𝑖−1 + 3𝜙𝑖𝑛 Left: Upwind
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖
2ℎ

IST, MFC, 2022 Exercises 122


Exercise CT B1
𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛 Left: Upwind
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 ℎ
𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


First order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 123


Exercise CT B1
𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛 Left: Upwind
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 ℎ
𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


First order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 124


Exercise CT B1
𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 2𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖+1 Left: Upwind
= Right: CDS
𝜕𝑥 2ℎ
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

Slope obtained by central


differences plus half the
upwind (green) MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]

𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛 𝑛
𝜙𝑖+1 𝑛
− 𝜙𝑖−1 𝑛 𝑛
= + 𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜕𝑥 2ℎ 2ℎ 𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝑖 𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 125


Exercise CT B1
𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 2𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖+1 Left: Upwind
= Right: CDS
𝜕𝑥 2ℎ
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

Slope obtained by central


differences plus half the
upwind (green) MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]

𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛 𝑛
𝜙𝑖+1 𝑛
− 𝜙𝑖−1 𝑛 𝑛
= + 𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜕𝑥 2ℎ 2ℎ 𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝑖 𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 126


Exercise CT B1
𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝑛
𝜕𝜙 𝑛 −3𝜙𝑖−1 + 3𝜙𝑖𝑛 Left: Upwind
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


Mixed between
𝑛 𝑛
First order upwind 𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
And Second order upwind 𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 127


Exercise CT B1
𝜃𝑙 < 0 → 𝜎𝑙 𝜃𝑙 = 0 𝑛
𝜕𝜙 𝑛 −3𝜙𝑖−1 + 3𝜙𝑖𝑛 Left: Upwind
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


Mixed between
𝑛 𝑛
First order upwind 𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
And Second order upwind 𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 128


Exercise CT B1

𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1


𝑛
Left: CDS
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 2ℎ
𝑖

𝑛 𝑛
𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 −𝜙𝑖−1 + 𝜙𝑖+1 Left: CDS
= Right: CDS
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝜕𝑥 𝑖
2ℎ

𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1


𝑛 Left: CDS
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖

IST, MFC, 2022 Exercises 129


Exercise CT B1
𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
Left: CDS
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 2ℎ
𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


NOT First order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 130


Exercise CT B1
𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
Left: CDS
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 2ℎ
𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


NOT First order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 131


Exercise CT B1
𝑛 𝑛
𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 −𝜙𝑖−1 + 𝜙𝑖+1 Left: CDS
= Right: CDS
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


Second order central
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 132


Exercise CT B1
𝑛 𝑛
𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 −𝜙𝑖−1 + 𝜙𝑖+1 Left: CDS
= Right: CDS
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


Second order central
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 133


Exercise CT B1
𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
Left: CDS
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


First order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 134


Exercise CT B1
𝜃𝑙 > 1 → 𝜎𝑙 𝜃𝑙 = 1 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
Left: CDS
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


First order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 135


Exercise CT B1

0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙 Left: LUD


𝜕𝜙 𝑛 2𝜙𝑖𝑛 − 3𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖−2
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 𝑖
2ℎ

0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 3𝜙𝑖−1


𝑛 𝑛
+ 𝜙𝑖+1 𝑛
+ 𝜙𝑖−2 Left: LUD
= Right: CDS
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝜕𝑥 𝑖
2ℎ

0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙 𝜕𝜙 𝑛 3𝜙𝑖𝑛 − 4𝜙𝑖−1


𝑛 𝑛
+ 𝜙𝑖−2 Left: LUD
=
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖
2ℎ Right: LUD

IST, MFC, 2022 Exercises 136


Exercise CT B1
0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙
𝜕𝜙 𝑛 2𝜙𝑖𝑛 − 3𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖−2 Left: LUD
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


NOT Second order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 137


Exercise CT B1
0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙
𝜕𝜙 𝑛 2𝜙𝑖𝑛 − 3𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖−2 Left: LUD
= Right: Upwind
𝜃𝑟 < 0 → 𝜎𝑟 𝜃𝑟 = 0 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


NOT Second order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 138


Exercise CT B1
0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 3𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖+1 𝑛
+ 𝜙𝑖−2 Left: LUD
= Right: CDS
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


NOT third order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 139


Exercise CT B1
0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙 𝜕𝜙 𝑛 𝜙𝑖𝑛 − 3𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖+1 𝑛
+ 𝜙𝑖−2 Left: LUD
= Right: CDS
𝜃𝑟 > 1 → 𝜎𝑟 𝜃𝑟 = 1 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


NOT third order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 140


Exercise CT B1
0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙 𝜕𝜙 𝑛 3𝜙𝑖𝑛 − 4𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖−2 Left: LUD
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


Second order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 141


Exercise CT B1
0 < 𝜃𝑙 < 1 → 𝜎𝑙 𝜃𝑙 = 𝜃𝑙 𝜕𝜙 𝑛 3𝜙𝑖𝑛 − 4𝜙𝑖−1
𝑛 𝑛
+ 𝜙𝑖−2 Left: LUD
= Right: LUD
0 < 𝜃𝑟 < 1 → 𝜎𝑟 𝜃𝑟 = 𝜃𝑟 𝜕𝑥 𝑖
2ℎ

𝜙𝑜𝑛 𝜙1𝑛 𝑛
𝜙𝑖−2 𝑛
𝜙𝑖−1 𝜙𝑖𝑛 𝑛
𝜙𝑖+1 𝑛
𝜙𝑁−1 𝑛
𝜙𝑁
𝜙𝑛 1 𝜙𝑛 1
𝑖− 𝑖+
2 2

MinMod 𝜎 𝜃 = max[0, 𝑚𝑖𝑛 𝜃, 1 ]


Second order upwind
𝑛 𝑛
𝜙𝑖−1 − 𝜙𝑖−2 𝜙𝑖𝑛 − 𝜙𝑖−1
𝑛
𝜃𝑙 = 𝑛 𝑛 𝜃𝑟 = 𝑛
𝜙𝑖 − 𝜙𝑖−1 𝜙𝑖+1 − 𝜙𝑖𝑛

IST, MFC, 2022 Exercises 142


IST, MFC, 2022 Exercises 143
IST, MFC, 2022 Exercises 144
IST, MFC, 2022 Exercises 145
𝑼
It asks for all
combinations of
west face

Formula for positive velocity

𝜓 𝑟
𝜙𝑤 = 𝜙𝐶 + (𝜙𝑊 − 𝜙𝐶 ) Formula for negative velocity
2

IST, MFC, 2022 Exercises 146


Book from Moukalled (2016)

This nomenclature can help


when velocity is changed
like in this exercise

IST, MFC, 2022 Exercises 147


𝜓 𝑟𝑤
𝜙𝑤 = 𝜙𝐶 + (𝜙𝑊 − 𝜙𝐶 )
2 C = P used in book from
𝜓 𝑟𝑤 = max(0, min(1, 𝑟𝑤 )) Moukalled (2016)

𝜙𝐶 − 𝜙𝐸 Velocity is negative so the


𝑟𝑤 = formula is shifted
𝜙𝑊 − 𝜙𝐶
Yes!!! Our three classic
MinMod combinations!
𝑟𝑤 < 0 ⇒ 𝜓 = 0 ⟹ 𝜙𝑤 = 𝜙𝐶

1 3 1
0 < 𝑟𝑤 < 1 ⟹ 𝜓 = 𝑟𝑤 ⟹ 𝜙𝑤 = 𝜙𝐶 + (𝜙𝐶 − 𝜙𝐸 ) = 𝜙𝐶 − 𝜙𝐸
2 2 2
1 1
𝑟𝑤 > 1 ⟹ 𝜓 = 1 ⟹ 𝜙𝑤 = 𝜙𝐶 + (𝜙𝑊 − 𝜙𝐶 ) = (𝜙𝐶 + 𝜙𝑊 )
2 2

IST, MFC, 2022 Exercises 148


Only combinations in west point
𝑼

IST, MFC, 2022 Exercises 149


Check Chapter 12 from
Moukalled (2016) for NVF

𝝓𝒘 − 𝜙𝐸
𝜙𝑓 = ⟹ 𝝓𝒘 = 𝜙𝑓 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸
𝜙𝑊 − 𝜙𝐸

Equivalent to 𝝓𝑪 but with 𝜙𝐶 − 𝜙𝐸


negative velocity we get
𝜙𝐶 =
𝜙𝑊 − 𝜙𝐸

IST, MFC, 2022 Exercises 150


List of NVF formulas at Attention: Some of these
page 441 from the book formulas can be different,
with a positive velocity!

𝜙𝐶 − 𝜙𝐸
This one is Upwind 𝜙𝐶 =
𝜙𝑊 − 𝜙𝐸
𝝓𝒘 − 𝜙𝐸
𝜙𝑓 = ⟹ 𝝓𝒘 = 𝜙𝑓 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 Main Equation
𝜙𝑊 − 𝜙𝐸

IST, MFC, 2022 Exercises 151


List of NVF formulas at Attention: Some of these
page 441 from the book formulas can be different,
with a positive velocity!

𝜙𝐶 − 𝜙𝐸
This one is Upwind 𝜙𝐶 =
𝜙𝑊 − 𝜙𝐸
𝝓𝒘 − 𝜙𝐸
𝜙𝑓 = ⟹ 𝝓𝒘 = 𝜙𝑓 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 Main Equation
𝜙𝑊 − 𝜙𝐸

𝜙𝐶 −𝜙𝐸
𝝓𝑪 < 𝟎 𝒐𝒓 𝝓𝑪 > 𝟏 ⇒ 𝜙𝑓 = 𝜙𝐶 ⇒ 𝝓𝒘 = 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 𝜙𝐶
𝜙𝑊 −𝜙𝐸

IST, MFC, 2022 Exercises 152


List of NVF formulas at Attention: Some of these
page 441 from the book formulas can be different,
with a positive velocity!

𝜙𝐶 − 𝜙𝐸
This one is Upwind 𝜙𝐶 =
𝜙𝑊 − 𝜙𝐸
𝝓𝒘 − 𝜙𝐸
𝜙𝑓 = ⟹ 𝝓𝒘 = 𝜙𝑓 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 Main Equation
𝜙𝑊 − 𝜙𝐸

𝟑
< 𝝓𝑪 < 𝟏 ⇒ 𝜙𝑓 = 1 ⇒ 𝝓𝒘 = 1 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 𝜙𝑊
𝟒

𝜙𝐶 −𝜙𝐸
𝝓𝑪 < 𝟎 𝒐𝒓 𝝓𝑪 > 𝟏 ⇒ 𝜙𝑓 = 𝜙𝐶 ⇒ 𝝓𝒘 = 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 𝜙𝐶
𝜙𝑊 −𝜙𝐸

IST, MFC, 2022 Exercises 153


List of NVF formulas at Attention: Some of these
page 441 from the book formulas can be different,
with a positive velocity!

𝜙𝐶 − 𝜙𝐸
This one is Upwind 𝜙𝐶 =
𝜙𝑊 − 𝜙𝐸
𝝓𝒘 − 𝜙𝐸
𝜙𝑓 = ⟹ 𝝓𝒘 = 𝜙𝑓 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 Main Equation
𝜙𝑊 − 𝜙𝐸

𝟏 𝜙𝐶 −𝜙𝐸
𝟎 < 𝝓𝑪 < ⇒ 𝜙𝑓 = 2𝜙𝐶 ⇒ 𝝓𝒘 = 2 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 2𝜙𝐶 − 𝜙𝐸
𝟒 𝜙𝑊 −𝜙𝐸

𝟑
< 𝝓𝑪 < 𝟏 ⇒ 𝜙𝑓 = 1 ⇒ 𝝓𝒘 = 1 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 𝜙𝑊
𝟒

𝜙𝐶 −𝜙𝐸
𝝓𝑪 < 𝟎 𝒐𝒓 𝝓𝑪 > 𝟏 ⇒ 𝜙𝑓 = 𝜙𝐶 ⇒ 𝝓𝒘 = 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 𝜙𝐶
𝜙𝑊 −𝜙𝐸

IST, MFC, 2022 Exercises 154


List of NVF formulas at Attention: Some of these
page 441 from the book formulas can be different,
with a positive velocity!

𝜙𝐶 − 𝜙𝐸
This one is Upwind 𝜙𝐶 =
𝜙𝑊 − 𝜙𝐸
𝝓𝒘 − 𝜙𝐸
𝜙𝑓 = ⟹ 𝝓𝒘 = 𝜙𝑓 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 Main Equation
𝜙𝑊 − 𝜙𝐸

𝟏 𝜙𝐶 −𝜙𝐸
𝟎 < 𝝓𝑪 < ⇒ 𝜙𝑓 = 2𝜙𝐶 ⇒ 𝝓𝒘 = 2 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 2𝜙𝐶 − 𝜙𝐸
𝟒 𝜙𝑊 −𝜙𝐸

𝟏 𝟑 1 𝜙𝐶 −𝜙𝐸 1
< 𝝓𝑪 < ⇒ 𝜙𝑓 = 𝜙𝐶 + ⇒ 𝝓𝒘 = [ + ] 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸
𝟒 𝟒 4 𝜙𝑊 −𝜙𝐸 4

1 1 1
𝝓𝒘 = (𝜙𝐶 −𝜙𝐸 ) + (𝜙𝑊 − 𝜙𝐸 ) + 𝜙𝐸 = 𝜙𝑊 + 𝜙𝐶 − 𝜙𝐸
4 4 4

𝟑
< 𝝓𝑪 < 𝟏 ⇒ 𝜙𝑓 = 1 ⇒ 𝝓𝒘 = 1 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 𝜙𝑊
𝟒

𝜙𝐶 −𝜙𝐸
𝝓𝑪 < 𝟎 𝒐𝒓 𝝓𝑪 > 𝟏 ⇒ 𝜙𝑓 = 𝜙𝐶 ⇒ 𝝓𝒘 = 𝜙𝑊 − 𝜙𝐸 + 𝜙𝐸 = 𝜙𝐶
𝜙𝑊 −𝜙𝐸

IST, MFC, 2022 Exercises 155


Page 431 from the book

Homework: Check if you can convert


classic schemes by applying NVF formulas.

IST, MFC, 2022 Exercises 156


Former T1 Revisited

IST, MFC, 2022 Exercises 157


IST, MFC, 2022 Exercises 158
IST, MFC, 2022 Exercises 159
IST, MFC, 2022 Exercises 160
IST, MFC, 2022 Exercises 161
IST, MFC, 2022 Exercises 162
IST, MFC, 2022 Exercises 163
IST, MFC, 2022 Exercises 164
IST, MFC, 2022 Exercises 165
IST, MFC, 2022 Exercises 166
IST, MFC, 2022 Exercises 167
IST, MFC, 2022 Exercises 168
IST, MFC, 2022 Exercises 169
IST, MFC, 2022 Exercises 170
IST, MFC, 2022 Exercises 171
IST, MFC, 2022 Exercises 172
IST, MFC, 2022 Exercises 173
IST, MFC, 2022 Exercises 174
IST, MFC, 2022 Exercises 175
Some \alpha were incorrectly included -> see the

IST, MFC, 2022 Exercises 176


IST, MFC, 2022 Exercises 177
IST, MFC, 2022 Exercises 178
IST, MFC, 2022 Exercises 179
IST, MFC, 2022 Exercises 180
IST, MFC, 2022 Exercises 181
IST, MFC, 2022 Exercises 182
IST, MFC, 2022 Exercises 183
IST, MFC, 2022 Exercises 184
IST, MFC, 2022 Exercises 185
IST, MFC, 2022 Exercises 186
IST, MFC, 2022 Exercises 187
IST, MFC, 2022 Exercises 188
IST, MFC, 2022 Exercises 189
IST, MFC, 2022 Exercises 190
IST, MFC, 2022 Exercises 191
IST, MFC, 2022 Exercises 192
IST, MFC, 2022 Exercises 193
IST, MFC, 2022 Exercises 194
IST, MFC, 2022 Exercises 195
IST, MFC, 2022 Exercises 196
IST, MFC, 2022 Exercises 197
IST, MFC, 2022 Exercises 198
IST, MFC, 2022 Exercises 199
IST, MFC, 2022 Exercises 200
IST, MFC, 2022 Exercises 201
IST, MFC, 2022 Exercises 202
IST, MFC, 2022 Exercises 203
IST, MFC, 2022 Exercises 204
IST, MFC, 2022 Exercises 205

You might also like