MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian...

15
MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as the starting point, so global conservation is built into this method: Ω + ∫ ∂Ω = ∫ Γ∇ ∙ ∂Ω + ∫ Ω generic conserved quantity Γ→ diffusion coefficient source term Approximation of Volume Integrals 1) 2 nd order rule: Ω 2) 4 th order bi-quadratic shape function: (, ) = 0 + 1 + 2 + 3 2 + 4 2 + + 5 + 6 2 + 7 2 + 8 2 2 Ω ≈ ∆∆ [ 0 + 3 12 2 + 4 12 2 + + 8 144 2 2 ] Approximation of Surface Integrals = convective flux normal to surface = Γ∇ ∙ diffusive flux normal to surface ∂Ω = ∂Ω We have to estimate (resorting to interpolation) as a function of at the central nodes, as these are the only values that the FV method gives. 1) Midpoint rule (2 nd order): 2) 2D Trapezoid rule (2 nd order): 2 ( + ) 3) 2D Simpson’s rule (4 th order): 6 ( + 4 + ) Note: numerical scheme using 4 th order Simpson is only also 4 th order if one uses 4 th order finite differences for the derivatives (if = ′) and also 4 th order interpolation for the and values (see point 5) below). Interpolation The approximations for the integrals require the value of variables at locations other than the CV central node (the only known value). So, interpolation is necessary. 1) Upwind Interpolation – UDS (1 st order): ={ , > 0 , < 0 low accuracy generates false diffusion never yields oscillatory solutions 2) Linear/Central Interpolation – CDS (2 nd order): 1 2 + 1 2 → uniform grid +1 + ∆ + ∆ +1 → non − uniform grid ( ) → central differences 3) LUDS (2 nd order Upwind): 3 2 , > 0 ( ) − 4 + 3 2∆ , > 0 4) Quadratic Upwind Interpolation – QUICK (3 rd order): ≈{ 6 8 + 3 8 1 8 , > 0 6 8 + 3 8 1 8 , < 0 5) 4 th Order CDS: + 2 + + 16 ( ) 27 − 27 + 24∆ Courant’s number = Diffusive criterion = Γ∆ (∆) 2 Péclet number = rate of transport by convection rate of transport by diffusion = Γ characteristic length

Transcript of MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian...

Page 1: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

MFC – Formulário

Finite Volume Method for Structured Uniform Cartesian Grids

The finite volume method uses the integral form of the conservation law as the starting point, so global conservation is built into this method:

∫𝜕𝜙

𝜕𝑡 𝑑𝒱

Ω

+∫ 𝜌𝜙�⃗� ∙ �⃗� 𝑑𝑆

∂Ω

= ∫ Γ∇𝜙 ∙ �⃗� 𝑑𝑆

∂Ω

+∫𝑞 𝑑𝒱

Ω

𝜙 → generic conserved quantity

Γ → diffusion coefficient

𝑞 → source term

Approximation of Volume Integrals

1) 2nd order rule:

∫ 𝑓 𝑑𝒱

Ω𝑃

≈ 𝑓𝑃𝒱𝑃

2) 4th order bi-quadratic shape function: 𝑓(𝑥, 𝑦) = 𝑎0 + 𝑎1𝑥 + 𝑎2𝑦 + 𝑎3𝑥

2 + 𝑎4𝑦2 +

+𝑎5𝑥𝑦 + 𝑎6𝑥2𝑦 + 𝑎7𝑥𝑦

2 + 𝑎8𝑥2𝑦2

∫ 𝑓 𝑑𝒱

Ω𝑃

≈ ∆𝑥∆𝑦 [𝑎0 +𝑎312∆𝑥2 +

𝑎412∆𝑦2 +

+𝑎8144

∆𝑥2∆𝑦2]

Approximation of Surface Integrals

𝑓 = 𝜌𝜙�⃗� ∙ 𝑛𝑘⃗⃗⃗⃗ → convective flux normal to surface 𝑘 𝑓 = Γ∇𝜙 ∙ 𝑛𝑘⃗⃗⃗⃗ → diffusive flux normal to surface 𝑘

∫ 𝑓 𝑑𝑆

∂Ω𝑃

= ∑ ∫ 𝑓 𝑑𝑆

𝑓𝑎𝑐𝑒 𝑖

∂Ω𝑃 𝑓𝑎𝑐𝑒𝑠

𝑖

→ We have to estimate 𝒇𝒌 (resorting to interpolation) as a function of 𝝓 at the central nodes, as these are the only values that the FV method gives.

1) Midpoint rule (2nd order):

∫ 𝑓 𝑑𝑆

𝑓𝑎𝑐𝑒 𝑒

≈ 𝑓𝑒𝑆𝑒

2) 2D Trapezoid rule (2nd order):

∫ 𝑓 𝑑𝑆

𝑓𝑎𝑐𝑒 𝑒

≈𝑆𝑒2(𝑓𝑛𝑒 + 𝑓𝑠𝑒)

3) 2D Simpson’s rule (4th order):

∫ 𝑓 𝑑𝑆

𝑓𝑎𝑐𝑒 𝑒

≈𝑆𝑒6(𝑓𝑛𝑒 + 4𝑓𝑒 + 𝑓𝑠𝑒)

Note: numerical scheme using 4th order Simpson is only also 4th order if one uses 4th order finite differences for the derivatives (if 𝑓 = 𝑔′) and also 4th order interpolation for the 𝑓𝑛𝑒 and 𝑓𝑠𝑒 values (see point 5) below).

Interpolation → The approximations for the integrals require the value of variables at locations other than the CV central node (the only known value). So, interpolation is necessary.

1) Upwind Interpolation – UDS (1st order):

𝜙𝑒 = {𝜙𝑃 , 𝑖𝑓 𝑢 > 0𝜙𝐸 , 𝑖𝑓 𝑢 < 0

→ low accuracy → generates false diffusion → never yields oscillatory solutions

2) Linear/Central Interpolation – CDS (2nd order):

𝜙𝑒 ≈1

2𝜙𝐸 +

1

2𝜙𝑃 → uniform grid

𝜙𝑒 ≈∆𝑥𝑖+1𝜙𝐸 + ∆𝑥𝑖𝜙𝑃∆𝑥𝑖 + ∆𝑥𝑖+1

→ non − uniform grid

(𝜕𝜙

𝜕𝑥)𝑒≈𝜙𝐸 − 𝜙𝑃∆𝑥

→ central differences

3) LUDS (2nd order Upwind):

𝜙𝑒 ≈3𝜙𝑃 − 𝜙𝑊

2 , 𝑖𝑓 𝑢 > 0

(𝜕𝜙

𝜕𝑥)𝑒≈𝜙𝑊𝑊 − 4𝜙𝑊 + 3𝜙𝑃

2∆𝑥 , 𝑖𝑓 𝑢 > 0

4) Quadratic Upwind Interpolation – QUICK (3rd order):

𝜙𝑒 ≈ {

6

8𝜙𝑃 +

3

8𝜙𝐸 −

1

8𝜙𝑊 , 𝑖𝑓 𝑢 > 0

6

8𝜙𝐸 +

3

8𝜙𝑃 −

1

8𝜙𝐸𝐸 , 𝑖𝑓 𝑢 < 0

5) 4th Order CDS:

𝜙𝑒 ≈𝜙𝑃 + 𝜙𝐸

2+𝜙𝑃 + 𝜙𝐸 − 𝜙𝑊 − 𝜙𝐸𝐸

16

(𝜕𝜙

𝜕𝑥)𝑒≈27𝜙𝐸 − 27𝜙𝑃 + 𝜙𝑊 − 𝜙𝐸𝐸

24∆𝑥

Courant’s number

𝑐 =𝑢∆𝑡

∆𝑥

Diffusive criterion

𝛾 =Γ∆𝑡

(∆𝑥)2

Péclet number

𝑃𝑒 =rate of transport by convection

rate of transport by diffusion=𝑢𝐿

Γ

𝐿 → characteristic length

Page 2: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Finite Differences Schemes (uniform grid)

Approximation of spatial derivatives

1st derivative 1) 1st order Progressive / Forward / Downwind

difference 𝐟𝐨𝐫 𝒖 > 𝟎:

𝜙𝑖′ ≈

𝜙𝑖+1 − 𝜙𝑖∆𝑥

−∆𝑥

2𝜙𝑖′′

𝐅𝐨𝐫 𝒖 < 𝟎: Downwind = Upwind

2) 1st order Regressive / Backward / Upwind difference 𝐟𝐨𝐫 𝒖 > 𝟎:

𝜙𝑖′ ≈

𝜙𝑖 − 𝜙𝑖−1∆𝑥

−∆𝑥

2𝜙𝑖′′

𝐅𝐨𝐫 𝒖 < 𝟎: Upwind = Downwind

3) 2nd order Central difference:

𝜙𝑖′ ≈

𝜙𝑖+1 − 𝜙𝑖−12∆𝑥

−(∆𝑥)2

6𝜙𝑖′′′

4) 2nd order Progressive / Forward / Downwind difference 𝐟𝐨𝐫 𝒖 > 𝟎:

𝜙𝑖′ ≈

−𝜙𝑖+2 + 4𝜙𝑖+1 − 3𝜙𝑖2∆𝑥

−(∆𝑥)2

3𝜙𝑖′′′

𝐅𝐨𝐫 𝒖 < 𝟎: Downwind = Upwind

5) 2nd order Regressive / Backward / Upwind difference 𝐟𝐨𝐫 𝒖 > 𝟎:

𝜙𝑖′ ≈

3𝜙𝑖 − 4𝜙𝑖−1 + 𝜙𝑖−22∆𝑥

−(∆𝑥)2

3𝜙𝑖′′′

𝐅𝐨𝐫 𝒖 < 𝟎: Upwind = Downwind

6) 4th order Central difference:

𝜙𝑖′ ≈

−𝜙𝑖+2 + 8(𝜙𝑖+1 − 𝜙𝑖−1) + 𝜙𝑖−212∆𝑥

+(∆𝑥)4

30𝜙𝑖(5)

2nd derivative 1) 1st order Progressive / Forward / Downwind

difference 𝐟𝐨𝐫 𝒖 > 𝟎:

𝜙𝑖′′ ≈

𝜙𝑖+2 − 2𝜙𝑖−1 + 𝜙𝑖(∆𝑥)2

𝐅𝐨𝐫 𝒖 < 𝟎:Downwind = Upwind

2) 1st order Regressive / Backward / Upwind difference 𝐟𝐨𝐫 𝒖 > 𝟎:

𝜙𝑖′′ ≈

𝜙𝑖 − 2𝜙𝑖−1 + 𝜙𝑖−2(∆𝑥)2

𝐅𝐨𝐫 𝒖 < 𝟎:Upwind = Downwind

3) 2nd order Central difference:

𝜙𝑖′′ ≈

𝜙𝑖+1 − 2𝜙𝑖 + 𝜙𝑖−1(∆𝑥)2

+(∆𝑥)2

12𝜙𝑖(4)

4) 4th order Central difference:

𝜙𝑖′′ ≈

−𝜙𝑖+2 + 16𝜙𝑖+1 − 30𝜙𝑖 + 16𝜙𝑖−1 − 𝜙𝑖−212(∆𝑥)2

Mixed derivatives 1) 2nd order Central mixed difference:

(𝜕2𝜙

𝜕𝑥𝜕𝑦)𝑖,𝑗

=𝜕

𝜕𝑥(𝜕𝜙

𝜕𝑦) ≈

(𝜕𝜙𝜕𝑦)𝑖+1,𝑗

− (𝜕𝜙𝜕𝑦)𝑖−1,𝑗

2∆𝑦=

=(𝜙𝑖+1,𝑗+1 − 𝜙𝑖+1,𝑗−1

2∆𝑦) − (

𝜙𝑖−1,𝑗+1 − 𝜙𝑖−1,𝑗−12∆𝑦

)

2∆𝑥=

=𝜙𝑖+1,𝑗+1 − 𝜙𝑖+1,𝑗−1 −𝜙𝑖−1,𝑗+1 + 𝜙𝑖−1,𝑗−1

4∆𝑥∆𝑦

Approximation of spatial derivatives – 4th order compact Padé scheme

1st derivative

𝜙𝑖+1′ + 4𝜙𝑖

′ + 𝜙𝑖−1′ =

3

∆𝑥(𝜙𝑖+1 − 𝜙𝑖−1)

Close to the boundary:

𝜙1′ + 2𝜙2

′ =1

∆𝑥(−

5

2𝜙1 + 2𝜙2 +

1

2𝜙3)

𝜙𝑛′ + 2𝜙𝑛−1

′ =1

∆𝑥(5

2𝜙𝑛 − 2𝜙𝑛−1 −

1

2𝜙𝑛−2)

2nd derivative

1

12𝜙𝑖+1′′ +

10

12𝜙𝑖′′ +

1

12𝜙𝑖+1′′ =

𝜙𝑖+1 − 2𝜙𝑖 +𝜙𝑖−1(∆𝑥)2

Close to the boundary:

[ ⋱1 4 1

1 4 11 4 1

⋱ ]

{

⋮𝜙𝑖−1′

𝜙𝑖′

𝜙𝑖+1′

⋮ }

=1

∆𝑥

[ ⋱

3 0 33 0

330 3

⋱ ]

{

⋮𝜙𝑖−1𝜙𝑖𝜙𝑖+1⋮ }

⇔ [𝐴]{𝜙′} = [𝐵]{𝜙}

[ ⋱1

12

10

12

1

121

12

10

12

1

121

12

10

12

1

12⋱ ]

{

⋮𝜙𝑖−1′′

𝜙𝑖′′

𝜙𝑖+1′′

⋮ }

=1

(∆𝑥)2

[ ⋱

1 −2 11 −2

11−2 1

⋱ ]

{

⋮𝜙𝑖−1𝜙𝑖𝜙𝑖+1⋮ }

⇔ [𝐶]{𝜙′′} = [𝐷]{𝜙}

Page 3: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Finite Differences Schemes (non-uniform grid)

Approximation of spatial derivatives 𝒉𝒊 = 𝒙𝒊 − 𝒙𝒊−𝟏

𝒅𝒌𝒇

𝒅𝒙𝒌≈∑𝒂𝒋𝒇𝒋

𝒂𝒋 → tables below

𝒇𝒋 → value of 𝒇 at point 𝒋

Page 4: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Central finite difference at 𝒙𝒊

1st order

𝜙𝑖′ ≈

𝜙𝑖+1 − 𝜙𝑖−1∆𝑥𝑖+1 + ∆𝑥𝑖

−∆𝑥𝑖+1 − ∆𝑥𝑖

2𝜙𝑖′′

𝜙𝑖′ ≈

1

2[𝜙𝑖+1 −𝜙𝑖∆𝑥𝑖+1

+𝜙𝑖 − 𝜙𝑖−1∆𝑥𝑖

] −∆𝑥𝑖 + ∆𝑥𝑖+1

4𝜙𝑖′′

2nd order

𝜙𝑖′ ≈

(∆𝑥𝑖)2𝜙𝑖+1 + [(∆𝑥𝑖+1)

2 − (∆𝑥𝑖)2]𝜙𝑖 − (∆𝑥𝑖+1)

2𝜙𝑖−1∆𝑥𝑖∆𝑥𝑖+1(∆𝑥𝑖 + ∆𝑥𝑖+1)

−∆𝑥𝑖+1∆𝑥𝑖

6𝜙𝑖′′′

1st order

𝜙𝑖′′ ≈

∆𝑥𝑖𝜙𝑖+1 − (∆𝑥𝑖+1 + ∆𝑥𝑖)𝜙𝑖 + ∆𝑥𝑖+1𝜙𝑖−1∆𝑥𝑖∆𝑥𝑖+1(∆𝑥𝑖 + ∆𝑥𝑖+1) 2⁄

−∆𝑥𝑖+1 − ∆𝑥𝑖

3𝜙𝑖′′′

Finite Difference Formulas Derivation of order of accuracy 𝒏

(𝒅𝒇

𝒅𝒙)𝒙𝟎

≈∑(𝒅𝑳𝒋

𝒅𝒙)𝒙𝟎

∙ 𝒇𝒋𝒋

(𝒅𝒌𝒇

𝒅𝒙𝒌)𝒙𝟎

≈∑(𝒅𝒌𝑳𝒋

𝒅𝒙𝒌)𝒙𝟎

∙ (𝒅𝒌−𝟏𝒇

𝒅𝒙𝒌−𝟏)𝒙𝒋𝒋

𝐿𝑗(𝑥) = ∏(𝑥 − 𝑥𝑚𝑥𝑗 − 𝑥𝑚

) → Lagrange polinom

𝑛

𝑚=0𝑚≠𝑗

∏(𝑥 − 𝑥𝑚)

𝑛

𝑚=0

= (𝑥 − 𝑥0)(𝑥 − 𝑥1)… (𝑥 − 𝑥𝑛)

𝐂𝐞𝐧𝐭𝐫𝐚𝐥: ∑ =

𝑗

𝑛−12

𝑗=−𝑛−12

𝐅𝐨𝐫𝐰𝐚𝐫𝐝𝐬: ∑ =

𝑗

𝑛

𝑗=0

𝐁𝐚𝐜𝐤𝐰𝐚𝐫𝐝𝐬: ∑ =

𝑗

−𝑛

𝑗=0

Page 5: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Approximation of temporal derivatives – 1st derivative

𝜕𝜙

𝜕𝑡= −𝛁 ∙ (𝝓�⃗⃗� ) + 𝛁 ∙ (𝚪𝛁𝝓) + 𝒒 = 𝒇(𝝓(𝒕)) → generic transport equation

1) Explicit/Forward Euler method (1st order):

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡= 𝑓(𝜙𝑛)

2) Implicit/Backward Euler method (1st order):

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡= 𝑓(𝜙𝑛+1)

3) Midpoint rule (1st order):

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡= 𝑓 (𝜙𝑛+

12)

4) Leapfrog method (2nd order):

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛−1

2∆𝑡= 𝑓(𝜙𝑛)

5) DuFort-Frankel method (2nd order):

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛−1

2∆𝑡= 𝑓 (𝜙𝑛 ≈

𝜙𝑛+1 + 𝜙𝑛−1

2)

6) Crank-Nicolson (2nd order):

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡=1

2𝑓(𝜙𝑛) +

1

2𝑓(𝜙𝑛+1)

7) Fractional-step 𝜽-scheme: 𝜃, 𝛼 ∈ [0,1] 𝜃′ = 1 − 2𝜃

𝐒𝐭𝐞𝐩 𝟏: 𝜙𝑖𝑛+𝜃 = 𝜙𝑖

𝑛 +

+[𝛼𝑓(𝜙𝑛+𝜃) + (1 − 𝛼)𝑓(𝜙𝑛)]𝜃∆𝑡

𝐒𝐭𝐞𝐩 𝟐: 𝜙𝑖𝑛+1−𝜃 = 𝜙𝑖

𝑛+𝜃 +

+[𝛼𝑓(𝜙𝑛+𝜃) + (1 − 𝛼)𝑓(𝜙𝑛+1−𝜃)]𝜃′∆𝑡

𝐒𝐭𝐞𝐩 𝟑: 𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛+1−𝜃

∆𝑡=

= [𝛼𝑓(𝜙𝑛+1) + (1 − 𝛼)𝑓(𝜙𝑛+1−𝜃)]𝜃

8) Adams-Bashforth (2nd order):

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡=3

2𝑓(𝜙𝑛) −

1

2𝑓(𝜙𝑛−1)

9) Runge-Kutta (2nd order):

𝜙𝑛+12∗ = 𝜙𝑖

𝑛 +∆𝑡

2𝑓(𝜙𝑛)

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡= 𝑓 (𝜙𝑛+

12∗)

10) Runge-Kutta (4nd order):

𝜙𝑛+12∗ = 𝜙𝑖

𝑛 +∆𝑡

2𝑓(𝜙𝑛)

𝜙𝑛+12∗∗ = 𝜙𝑖

𝑛 +∆𝑡

2𝑓 (𝜙𝑛+

12∗)

𝜙𝑛+1∗ = 𝜙𝑖𝑛 +

∆𝑡

2𝑓 (𝜙𝑛+

12∗∗)

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡=1

6𝑓(𝜙𝑛) +

1

3𝑓 (𝜙𝑛+

12∗) +

+1

3𝑓 (𝜙𝑛+

12∗∗) +

1

6𝑓(𝜙𝑛+1∗)

11) Predictor Corrector Schemes (2nd order):

𝐏𝐫𝐞𝐝𝐢𝐜𝐭𝐨𝐫: �̃�𝑖𝑛+1 = 𝜙𝑖

𝑛 + 𝑓(𝜙𝑛) ∙ ∆𝑡

𝐂𝐨𝐫𝐫𝐞𝐜𝐭𝐨𝐫: ∎ Backward Euler:

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡= 𝑓(�̃�

𝑛+1)

∎ Crank-Nicolson:

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡=1

2𝑓(𝜙𝑛) +

1

2𝑓(�̃�

𝑛+1)

∎ MacCormack:

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛+1 2⁄

∆𝑡 2⁄= 𝑓(�̃�

𝑛+1) ,

, where 𝜙𝑖𝑛+1 2⁄ = (𝜙𝑖

𝑛 + �̃�𝑖𝑛+1) 2⁄

Approximation of temporal derivatives – 2nd derivative

𝜕𝜙

𝜕𝑡≈𝜙𝑖𝑛+1 − 2𝜙𝑖

𝑛 + 𝜙𝑖𝑛−1

(∆𝑡)2= 𝑓(? )

𝑓(? ) = 𝑓(𝜙𝑛) → explicit scheme

𝑓(? ) = 𝑓(𝜙𝑛+1) → implicit scheme

Page 6: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Example 1 – Explicit Euler in time + CDS in space for the 1D convection-diffusion equation:

𝜕𝜙

𝜕𝑡= −𝑢

𝜕𝜙

𝜕𝑥+ Γ

𝜕2𝜙

𝜕𝑥2 →

𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡= −𝑢

𝜙𝑖+1𝑛 − 𝜙𝑖−1

𝑛

2∆𝑥+ Γ

𝜙𝑖+1𝑛 − 2𝜙𝑖

𝑛 +𝜙𝑖−1𝑛

(∆𝑥)2

Example 2 – 4th order Runge-Kutta in time + CDS in space for the 1D convection-diffusion equation:

𝜕𝜙

𝜕𝑡= −𝒖

𝝏𝝓

𝝏𝒙+ 𝚪

𝝏𝟐𝝓

𝝏𝒙𝟐= 𝒇(𝝓(𝒕)) ≈ (

𝒖

∆𝒙+

𝚪

(∆𝒙)𝟐)𝝓𝒊−𝟏 − (

𝒖

∆𝒙+

𝟐𝚪

(∆𝒙)𝟐)𝝓𝒊 +

𝚪

(∆𝒙)𝟐𝝓𝒊+𝟏 →

→ 𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡=1

6𝑓(𝜙𝑛) +

1

3𝑓 (𝜙𝑛+

12∗) +

1

3𝑓 (𝜙𝑛+

12∗∗) +

1

6𝑓(𝜙𝑛+1∗)

∎ 𝑓 (𝜙𝑛+12∗) = 𝜙𝑖

𝑛 +∆𝑡

2𝑓(𝜙𝑛) = 𝜙𝑖

𝑛 + (𝑐

2+𝛾

2)𝜙𝑖−1

𝑛 − (𝑐

2+ 𝛾)𝜙𝑖

𝑛 +𝛾

2𝜙𝑖+1𝑛

∎ 𝑓 (𝜙𝑛+12∗∗) = 𝜙𝑖

𝑛 +∆𝑡

2𝑓 (𝜙𝑛+

12∗) = 𝜙𝑖

𝑛 + (𝑐

2+𝛾

2)𝜙

𝑖−1

𝑛+12∗− (

𝑐

2+ 𝛾)𝜙

𝑖

𝑛+12∗+𝛾

2𝜙𝑖+1

𝑛+12∗ ,

, where 𝜙𝑋𝑛+

12∗ = 𝜙𝑋

𝑛 + (𝑐

2+𝛾

2)𝜙𝑋−1

𝑛 − (𝑐

2+ 𝛾)𝜙𝑋

𝑛 +𝛾

2𝜙𝑋+1𝑛

∎ 𝑓(𝜙𝑛+1∗∗) = 𝜙𝑖𝑛 +

∆𝑡

2𝑓 (𝜙𝑛+

12∗∗) = 𝜙𝑖

𝑛 + (𝑐

2+𝛾

2)𝜙

𝑖−1

𝑛+12∗∗− (

𝑐

2+ 𝛾)𝜙

𝑖

𝑛+12∗∗+𝛾

2𝜙𝑖+1

𝑛+12∗∗ ,

, where 𝜙𝑋𝑛+

12∗∗ = 𝜙𝑋

𝑛 + (𝑐

2+𝛾

2)𝜙𝑋−1

𝑛+12∗− (

𝑐

2+ 𝛾)𝜙𝑋

𝑛+12∗+𝛾

2𝜙𝑋+1𝑛+

12∗

Example 3 – Crank-Nicolson in time + 4th order compact Padé in space for the Black-Sholes equation:

𝜕𝜙

𝜕𝑡+ 𝑟𝑥

𝜕2𝜙

𝜕𝑥2+1

2𝜎2𝑥2

𝜕2𝜙

𝜕𝑥2= 𝑟𝜙 →

𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡−1

2𝑓(𝜙𝑛) +

1

2𝑓(𝜙𝑛+1) = 0 ,

, where 𝑓(𝜙𝑚) = 𝑟𝜙𝑖𝑚 − 𝑟𝑥𝑖𝜙′′𝑖

𝑚 −1

2𝜎2𝑥𝑖

2𝜙′′𝑖𝑚

𝟏𝐬𝐭 𝐝𝐞𝐫𝐢𝐯𝐚𝐭𝐢𝐯𝐞 (𝐏𝐚𝐝é): 𝜙𝑖+1′ + 4𝜙𝑖

′ + 𝜙𝑖−1′ =

3

∆𝑥(𝜙𝑖+1 − 𝜙𝑖−1)

𝟐𝐧𝐝 𝐝𝐞𝐫𝐢𝐯𝐚𝐭𝐢𝐯𝐞 (𝐏𝐚𝐝é): 1

12𝜙𝑖+1′′ +

10

12𝜙𝑖′′ +

1

12𝜙𝑖+1′′ =

𝜙𝑖+1 − 2𝜙𝑖 + 𝜙𝑖−1(∆𝑥)2

So, in indicial form we have:

𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡−1

2(𝑟𝜙𝑖

𝑛 − 𝑟𝑥𝑖𝜙′𝑖𝑛−1

2𝜎2𝑥𝑖

2𝜙′′𝑖𝑛) −

1

2(𝑟𝜙𝑖

𝑛+1 − 𝑟𝑥𝑖𝜙′𝑖𝑛+1

−1

2𝜎2𝑥𝑖

2𝜙′′𝑖𝑛+1

) = 0

Remember from Padé (pg. above) that {𝝓′} = [𝑨]−𝟏[𝑩]{𝝓} and {𝝓′′} = [𝑪]−𝟏[𝑫]{𝝓} , so putting in

vector form:

[𝐼]

∆𝑡({𝜙}𝑛+1 − {𝜙}𝑛) −

1

2(𝑟[𝐼]{𝜙}𝑛 − 𝑟𝑑𝑖𝑎𝑔(𝑥𝑖){𝝓

′}𝒏 −1

2𝜎2𝑑𝑖𝑎𝑔(𝑥𝑖

2){𝝓′′}𝒏) −

−1

2(𝑟[𝐼]{𝜙}𝑛+1 − 𝑟𝑑𝑖𝑎𝑔(𝑥𝑖){𝝓

′}𝒏+𝟏 −1

2𝜎2𝑑𝑖𝑎𝑔(𝑥𝑖

2){𝝓′′}𝒏+𝟏) = 0

Have fun solving for {𝝓}𝒏+𝟏 .

Page 7: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Flux Limiters → Used to smooth the oscillations that appear in the solution in 2nd order schemes due to convection

(1st derivatives in space 𝜕𝜙 𝜕𝑥⁄ ) → Act like a switch: when spatial gradients 𝜕𝜙 𝜕𝑥⁄ are too steep, they change the discretization of 𝜕𝜙 𝜕𝑥⁄

to smooth the solution

1st derivative in space and 𝝓 value at half nodes (𝒊 − 𝟏 𝟐⁄ , 𝒊 + 𝟏 𝟐⁄ ) discretization using a flux limiter:

(𝜕𝜙

𝜕𝑥)𝑖≈𝜙𝑖+1 2⁄ − 𝜙

𝑖−1 2⁄

∆𝑥

Ψ(𝑟) → flux limiter function (always evaluated at 𝑡𝑛)

𝜙𝑖+1 2⁄ = 𝜙𝑖 +Ψ𝑖𝜙𝑖+1 − 𝜙𝑖

2

𝜙𝑖−1 2⁄ = 𝜙𝑖−1 +Ψ𝑖−1𝜙𝑖 − 𝜙𝑖−1

2

Ψ𝑖 = Ψ(𝑟𝑖) = Ψ(𝜙𝑖 − 𝜙𝑖−1𝜙𝑖+1 − 𝜙𝑖

)

Ψ𝑖−1 = Ψ(𝑟𝑖−1) = Ψ(𝜙𝑖−1 − 𝜙𝑖−2𝜙𝑖 − 𝜙𝑖−1

)

CHARM

Ψ(𝑟) = { 𝑟(3𝑟 + 1)

(𝑟 + 1)2 , 𝑟 > 0

0 , 𝑟 ≤ 0

HCUS

Ψ(𝑟) =3

2

(𝑟 + |𝑟|)

𝑟 + 2

HQUICK

Ψ(𝑟) =2(𝑟 + |𝑟|)

𝑟 + 3

Koren

Ψ(𝑟) = 𝑚𝑎𝑥 [0,𝑚𝑖𝑛 (2𝑟,1 + 2𝑟

3 ,2)]

minmod

Ψ(𝑟) = 𝑚𝑎𝑥[0,𝑚𝑖𝑛(1, 𝑟)]

Osher

Ψ(𝑟) = 𝑚𝑎𝑥[0,𝑚𝑖𝑛(𝛽, 𝑟)]

1 ≤ 𝛽 ≤ 2

MUSCL / monotized central

Ψ(𝑟) = 𝑚𝑎𝑥 [0,𝑚𝑖𝑛 (2𝑟,1 + 𝑟

2𝑟 ,2)]

Swebby

Ψ(𝑟) = 𝑚𝑎𝑥[0,𝑚𝑖𝑛(𝛽𝑟, 1),𝑚𝑖𝑛(𝑟, 𝛽)]

1 ≤ 𝛽 ≤ 2

Smart

Ψ(𝑟) = 𝑚𝑎𝑥 [0,𝑚𝑖𝑛 (2𝑟,1

4+3

4𝑟 ,4)]

Superbee

Ψ(𝑟) = 𝑚𝑎𝑥[0,𝑚𝑖𝑛(2𝑟, 1),𝑚𝑖𝑛(𝑟, 2)]

van Leer

Ψ(𝑟) =𝑟 + |𝑟|

1 + |𝑟|

van Albada 1

Ψ(𝑟) =𝑟2 + 𝑟

𝑟2 + 1

van Albada 2

Ψ(𝑟) =2𝑟

𝑟2 + 1

Example 1 – Finite Volume discretization of the 1D convection-diffusion equation with a flux limiter for the convective flux and CDS for the diffusive flux

𝜕𝜙

𝜕𝑡+ 𝑢

𝜕𝜙

𝜕𝑥− Γ

𝜕2𝜙

𝜕𝑥2= 0

1) Integration in the generic control volume 𝛀𝒊:

∫𝜕𝜙

𝜕𝑡𝑑𝒱

Ω𝑖

+∫ (𝑢𝜕𝜙

𝜕𝑥− Γ

𝜕2𝜙

𝜕𝑥2)

Ω𝑖

𝑑𝒱 = 0

2) Gauss / Gauss-Green Theorem:

∫𝜕𝜙

𝜕𝑡𝑑𝒱

Ω𝑖

+∫ (𝑢𝜙 − Γ𝜕𝜙

𝜕𝑥)

∂Ω𝑖

𝑛𝑥 𝑑𝑆 = 0

3) Discretization of the integrated equations:

→ Midpoint rule for surface integrals:∫ (… )

∂Ω𝑖 𝑑𝑆 ≈

≈ (𝑢𝜙 − Γ𝜕𝜙

𝜕𝑥)𝑖+1 2⁄

− (𝑢𝜙 − Γ𝜕𝜙

𝜕𝑥)𝑖−1 2⁄

Note: 𝑖 + 1 2⁄ and 𝑖 + 1 2⁄ are the boundaries of the control volume Ω𝑖

→ 2nd order rule for volume integrals:

∫ (… )

Ω𝑖

𝑑𝒱 ≈ (𝜕𝜙

𝜕𝑡)𝑖∆𝑥 (

chose a temporaldiscretization scheme

)

4) CDS discretization for the diffusive flux:

Γ (𝜕𝜙

𝜕𝑡)𝑖+1 2⁄

≈𝜙𝑖+1 − 𝜙𝑖2(∆𝑥 2⁄ )

=𝜙𝑖+1 −𝜙𝑖

∆𝑥

Γ (𝜕𝜙

𝜕𝑡)𝑖−1 2⁄

≈𝜙𝑖 − 𝜙𝑖−12(∆𝑥 2⁄ )

=𝜙𝑖 −𝜙𝑖−1

∆𝑥

5) Flux limiter for the diffusive flux:

𝑢𝜙𝑖+1 2⁄ = 𝑢 (𝜙𝑖 +Ψ𝑖𝜙𝑖+1 − 𝜙𝑖

2)

𝑢𝜙𝑖−1 2⁄ = 𝑢 (𝜙𝑖−1 +Ψ𝑖−1𝜙𝑖 − 𝜙𝑖−1

2)

→ The choice of Ψ(𝑟) will be dictated by the flux limiter scheme you pick (minmod, p.ex.)

Page 8: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Lax-Wendroff scheme for the convection equation

1) Expand 𝝓 in time using Taylor (stop at second degree) around 𝒕:

𝜙𝑖𝑛+1 ≈ 𝜙𝑖

𝑛 + ∆𝑡 (𝜕𝜙

𝜕𝑡)𝑖

𝑛

+(∆𝑡)2

2!(𝜕2𝜙

𝜕𝑡2)𝑖

𝑛

2) Transform temporal derivatives into space derivatives using the convection equation:

𝜕𝜙

𝜕𝑡+ 𝑢

𝜕𝜙

𝜕𝑥= 0 ⟹

𝜕𝜙

𝜕𝑡= −𝑢

𝜕𝜙

𝜕𝑥 e

𝜕2𝜙

𝜕𝑡2= −𝑢

𝜕2𝜙

𝜕𝑡𝜕𝑥= −𝑢

𝜕

𝜕𝑥(𝜕𝜙

𝜕𝑡) = −𝑢

𝜕

𝜕𝑥(−𝑢

𝜕𝜙

𝜕𝑥) = 𝑢2

𝜕2𝜙

𝜕𝑥2

3) Substitute the time derivatives in 1) and perform CDS in space:

𝜙𝑖𝑛+1 ≈ 𝜙𝑖

𝑛 + ∆𝑡 (𝜕𝜙

𝜕𝑡)𝑖

𝑛

+(∆𝑡)2

2!(𝜕2𝜙

𝜕𝑡2)𝑖

𝑛

= 𝜙𝑖𝑛 +−𝑢∆𝑡 (

𝜕𝜙

𝜕𝑥)𝑖

𝑛

+𝑢2(∆𝑡)2

2!(𝜕2𝜙

𝜕𝑥2)𝑖

𝑛

→ 𝜙𝑖𝑛+1 ≈ 𝜙𝑖

𝑛 + ∆𝑡𝜙𝑖+1𝑛 − 𝜙𝑖−1

𝑛

2∆𝑥+(∆𝑡)2

2!

𝜙𝑖+1𝑛 − 2𝜙𝑖

𝑛 + 𝜙𝑖−1𝑛

(∆𝑥)2

Beam&Warming scheme for the convection equation

Same as Lax-Wendroff but with 2nd order upwind in space instead of CDS.

Iterative Solvers for Linear Systems of Equations General concepts

[𝐴]{𝑥} = {𝑏} → linear system of equations

{𝑟}(𝑘) = {𝑏} − [𝐴]{𝜙}(𝑘)

{𝑟}(𝑘) → residue at iteration 𝑘

{𝜙}(𝑘) → numerical solution at iteration 𝑘

Error: {휀}(𝑘) = {𝜙}𝑒𝑥𝑎𝑐𝑡 − {𝜙}(𝑘)

Basic Iterative Methods → only use information from previous iterations

Step 1) Splitting of [𝑨]: [𝐴] = [𝑀] + [𝑅]

Step 2) Iterative process:

[𝑀]{𝜙}(𝑘+1) = {𝑏} − [𝑅]{𝜙}(𝑘)

Error: {휀}(𝑘+1) = −[𝑀]−1[𝑅]{휀}(𝑘)

[𝐴] = [𝑳] + [𝑫] + [𝑼] = [∎∎ ∎∎ ∎ ∎

] + [

∎∎

∎∎

] + [

∎ ∎ ∎∎ ∎

∎]

Jacobi’s method

[𝑀] = [𝑫] [𝑅] = −([𝑳] + [𝑼])

[𝑫]{𝜙}(𝑘+1) = {𝑏} − ([𝑳] + [𝑼]){𝜙}(𝑘)

𝑥𝑖(𝑘+1) =

1

𝐴𝑖𝑖(𝑏𝑖 − ∑ 𝐴𝑖𝑗𝑥𝑗

(𝑘)

𝑁

𝑗=𝑖,𝑗≠𝑖

)

Gauss-Siedel method

[𝑀] = [𝑫] + [𝑳] [𝑅] = [𝑼]

([𝑫] + [𝑳]){𝜙}(𝑘+1) = {𝑏} − [𝑼]{𝜙}(𝑘)

𝑥𝑖(𝑘+1) =

1

𝐴𝑖𝑖(𝑏𝑖 −∑𝐴𝑖𝑗𝑥𝑗

(𝑘+1) − ∑ 𝐴𝑖𝑗𝑥𝑗(𝑘)

𝑁

𝑗=𝑖+1

𝑖−1

𝑗=𝑖

)

SOR

[𝑀] = [𝑫] + 𝜔[𝑳] [𝑅] = 𝜔[𝑼] + (1 − 𝜔)[𝑫]

([𝑫] + 𝜔[𝑳]){𝜙}(𝑘+1) = 𝜔{𝑏} − (𝜔[𝑼] + (1 − 𝜔)[𝑫]){𝜙}(𝑘)

𝑥𝑖(𝑘+1) = (1 − 𝜔)𝑥𝑖

(𝑘) −𝜔

𝐴𝑖𝑖(𝑏𝑖 −∑𝐴𝑖𝑗𝑥𝑗

(𝑘+1) − ∑ 𝐴𝑖𝑗𝑥𝑗(𝑘)

𝑁

𝑗=𝑖+1

𝑖−1

𝑗=𝑖

)

→ [𝑨] being diagonally dominant (|𝑨𝒊𝒊| > ∑ |𝑨𝒊𝒋| 𝒋≠𝒊 ) is a sufficient condition for the convergence of these

three methods

Page 9: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Consistency, Stability and Error Analysis for numerical schemes

Consistency: the numerical scheme (discretized equation) must tend to the analytical differential equation when ∆𝑥, ∆𝑡 → 0

Stability: the errors must remain bounded (not explode to infinity) when the iterative process advances

Convergence: the numerical solution must tend to the exact solution when ∆𝑥, ∆𝑡 → 0 Equivalent theorem of Lax: for a well posed initial value problem and a consistent discretization

scheme, stability is the necessary and sufficient condition for convergence.

Methodology – Checking for consistency

1) Discretize the equation (in this example: explicit Euler in time + CDS in space for the 1D convection equation):

𝜕𝜙

𝜕𝑡+ 𝑢

𝜕𝜙

𝜕𝑥= 0 →

𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡+ 𝑢

𝜙𝑖+1𝑛 − 𝜙𝑖−1

𝑛

2∆𝑥= 0

2) Taylor each term around 𝝓𝒊𝒏:

𝜙𝑖𝑛+1 = 𝜙𝑖

𝑛 + (𝜕𝜙

𝜕𝑡)𝑖

𝑛

∆𝑡 + (𝜕2𝜙

𝜕𝑡2)𝑖

𝑛(∆𝑡)2

2!+ (

𝜕3𝜙

𝜕𝑡3)𝑖

𝑛(∆𝑡)3

3!+ ⋯

𝜙𝑖+1𝑛 = 𝜙𝑖

𝑛 + (𝜕𝜙

𝜕𝑥)𝑖

𝑛

∆𝑥 + (𝜕2𝜙

𝜕𝑥2)𝑖

𝑛(∆𝑥)2

2!+ (

𝜕3𝜙

𝜕𝑥3)𝑖

𝑛(∆𝑥)3

3!+ ⋯

𝜙𝑖−1𝑛 = 𝜙𝑖

𝑛 − (𝜕𝜙

𝜕𝑥)𝑖

𝑛

∆𝑥 + (𝜕2𝜙

𝜕𝑥2)𝑖

𝑛(∆𝑥)2

2!− (

𝜕3𝜙

𝜕𝑥3)𝑖

𝑛(∆𝑥)3

3!+ ⋯

3) Substitute the “taylorized” terms in the discretized equation:

(𝜙𝑖𝑛 + (

𝜕𝜙𝜕𝑡)𝑖

𝑛

∆𝑡 + (𝜕2𝜙𝜕𝑡2

)𝑖

𝑛(∆𝑡)2

2!+⋯) − 𝜙𝑖

𝑛

∆𝑡+

+𝑢

(𝜙𝑖𝑛 + (

𝜕𝜙𝜕𝑥)𝑖

𝑛

∆𝑥 + (𝜕2𝜙𝜕𝑥2

)𝑖

𝑛(∆𝑥)2

2!+⋯) − (𝜙𝑖

𝑛 − (𝜕𝜙𝜕𝑥)𝑖

𝑛

∆𝑥 + (𝜕2𝜙𝜕𝑥2

)𝑖

𝑛(∆𝑥)2

2!− ⋯)

2∆𝑥= 0

4) The truncation error 𝜺𝑻 is the difference between the numerical scheme and the differential

equation.

If 𝜺𝑻 → 𝟎 when ∆𝒙, ∆𝒕 → 𝟎, the numerical scheme is consistent:

휀𝑇 = (𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡+ 𝑢

𝜙𝑖+1𝑛 − 𝜙𝑖−1

𝑛

2∆𝑥) − (

𝜕𝜙

𝜕𝑡+ 𝑢

𝜕𝜙

𝜕𝑥)𝑖

𝑛

= (𝜕2𝜙

𝜕𝑡2)𝑖

𝑛∆𝑡

2!+⋯+ 𝑎 (

𝜕3𝜙

𝜕𝑥3)𝑖

𝑛(∆𝑥)2

3!+ ⋯

lim∆𝑥,∆𝑡→0

휀𝑇 = 0 → The numerical scheme is consistent!

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

𝜆𝑚𝑎𝑥=𝜋

𝐿 𝑘𝑚𝑎𝑥 =

2𝜋

𝜆𝑚𝑖𝑛=𝑁𝜋

𝐿

𝜈 =𝑘∗

𝑘→ numerical phase speed

Page 10: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Methodology – Von Newman method for stability analysis 1) In the numerical scheme (discretized equation), replace all terms by a generic Fourier mode:

𝟏𝐃:𝜙𝑋𝑇 = 𝑎𝑇𝑒𝑗𝑋𝜃 𝟐𝐃: 𝜙𝑋,𝑌

𝑇 = 𝑎𝑇𝑒𝑗𝑋∆𝑥𝑒𝑗𝑌∆𝑦 , where 𝑗 = √−1

2) Derive 𝑮 = 𝒂𝒏+𝟏 𝒂𝒏⁄ = 𝒂𝒏 𝒂𝒏−𝟏⁄ from the previous substitution

3) The numerical scheme is unconditionally stable only if |𝑮| < 𝟏 for all frequencies 𝜽 (1D) or for all

resolutions ∆𝒙, ∆𝒚 (2D). Otherwise it may be unconditionally unstable or conditionally stable.

Example 1 – Explicit Euler in time + CDS in space for the 1D convection equation:

𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡+ 𝑢

𝜙𝑖+1𝑛 − 𝜙𝑖−1

𝑛

2∆𝑥= 0 →

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

∆𝑡+ 𝑢

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

2∆𝑥= 0 →

→ 𝐺 =𝑎𝑛+1

𝑎𝑛= 1 − 𝑗𝑐 sin 𝜃 ⟹ |𝐺| ≫ 1 for any value of (𝜃 , 𝑐)

This numerical scheme is unconditionally unstable!

Spectral Error Analysis

Wave number [𝒓𝒂𝒅/𝒎]

𝑘 =2𝜋

𝜆=𝜃

∆𝑥

Wave angular frequency [𝒓𝒂𝒅/𝒔]

𝜔 = 𝑘𝑢 =𝜃𝑐

∆𝑡

𝛿 = 𝑘2Γ =𝛾𝜃2

∆𝑡 𝑗 = √−1

Exact solution (in 1D) of the convection-diffusion equation

𝜕𝜙

𝜕𝑡+ 𝑢

𝜕𝜙

𝜕𝑥= Γ

𝜕2𝜙

𝜕𝑥2

𝜙𝑒𝑥𝑎𝑐𝑡(𝑥, 𝑡) = 𝑎(𝑡)𝑒𝑗𝑘𝑥

𝑎(𝑡) =𝑒𝑗𝑘(𝑥−𝑢𝑡)

𝑒𝑘2Γ𝑡

= 𝑒𝑗𝑘(𝑥−𝑢𝑡)−𝛿𝑡

→ 𝜙𝑒𝑥𝑎𝑐𝑡 is a wave that travels at speed 𝑢 and whose amplitude decays exponentially with time

Pure convection: Γ = 0

Pure diffusion: 𝑢 = 0

Diffusion/Dissipation error

휀𝐷 =|𝐺𝑛𝑢𝑚|

|𝐺𝑒𝑥𝑎𝑐𝑡|

Phase/Dispersion error

Convection dominated flows:

휀𝜔 =𝑎𝑟𝑔(𝐺𝑛𝑢𝑚)

𝑎𝑟𝑔(𝐺𝑒𝑥𝑎𝑐𝑡)

Flows with absence of convection: 휀𝜔 = 𝑎𝑟𝑔(𝐺𝑛𝑢𝑚) − 𝑎𝑟𝑔(𝐺𝑒𝑥𝑎𝑐𝑡)

𝐺𝑒𝑥𝑎𝑐𝑡 =𝑎(𝑡 + ∆𝑡)

𝑎(𝑡)= 𝑒−𝛿∆𝑡𝑒𝑗𝜔∆𝑡

|𝐺𝑒𝑥𝑎𝑐𝑡| = 𝑒−𝛿∆𝑡 = 𝑒−𝛾𝜃

2

𝑎𝑟𝑔(𝐺𝑒𝑥𝑎𝑐𝑡) = −𝜔∆𝑡 = −𝜃𝑐

Example 2 – Explicit Euler in time + upwind in space for the 1D convection equation:

𝜙𝑖𝑛+1 − 𝜙𝑖

𝑛

∆𝑡+ 𝑢

𝜙𝑖𝑛 − 𝜙𝑖−1

𝑛

∆𝑥= 0 →

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

∆𝑡+ 𝑢

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

∆𝑥= 0 → 𝐺𝑛𝑢𝑚 =

𝑎𝑛+1

𝑎𝑛= 1 + 𝑐(cos𝜃 − 1) − 𝑗𝑐 sin𝜃

|𝐺𝑛𝑢𝑚| = √(1 + 𝑐(cos 𝜃 − 1))2+ (−𝑐 sin𝜃)2 𝑎𝑟𝑔(𝐺𝑛𝑢𝑚) = arctan (

−𝑐 sin𝜃

1 + 𝑐(cos 𝜃 − 1))

휀𝐷(𝜃, 𝑐, 𝛾) =√(1 + 𝑐(cos 𝜃 − 1))

2+ (−𝑐 sin 𝜃)2

𝑒−𝛾𝜃2 휀𝜔(𝜃, 𝑐, 𝛾) =

arctan (−𝑐 sin𝜃

1 + 𝑐(cos 𝜃 − 1))

𝜃𝑐

𝑎𝑛+1

𝑎𝑛−1=𝑎𝑛+1

𝑎𝑛𝑎𝑛

𝑎𝑛−1= 𝐺2

Page 11: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

SIMPLE Algorithm for Staggered Grids

Staggered Grid 𝒑 → evaluated at FV centroids (𝐼 , 𝐽)

𝒖 → evaluated at FV (𝑖 ± 1 , 𝐽) boundaries

𝒗 → evaluated at FV (𝐼 , 𝑗 ± 1) boundaries

SIMPLE Algorithm 𝑰 = 𝒊 + 𝟏 𝟐⁄ 𝑱 = 𝒋 + 𝟏 𝟐⁄

1) Guess initial pressure field 𝒑∗ ;

2) Using 𝒑∗, solve the momentum equations to obtain the estimates 𝒖∗ and 𝒗∗ for the velocity field:

𝑎𝑖,𝐽𝑢𝑖,𝐽∗ =∑𝑎𝑛𝑏 𝑢𝑛𝑏

∗ + (𝑝𝐼−1,𝐽∗ − 𝑝𝐼,𝐽

∗ )𝑆𝑖,𝐽 + 𝑏𝑖,𝐽

𝑎𝐼,𝑗𝑣𝐼,𝑗∗ =∑𝑎𝑛𝑏 𝑣𝑛𝑏

∗ + (𝑝𝐼,𝐽−1∗ − 𝑝𝐼,𝐽

∗ )𝑆𝐼,𝑗 + 𝑏𝐼,𝑗

3) Solve the pressure correction equation for 𝒑′ using 𝒖∗ and 𝒗∗:

𝑐𝐼,𝐽𝑝𝐼,𝐽′ = 𝑐𝐼+1,𝐽𝑝𝐼+1,𝐽

′ + 𝑐𝐼−1,𝐽𝑝𝐼−1,𝐽′ + 𝑐𝐼,𝐽+1𝑝𝐼,𝐽+1

′ + 𝑐𝐼,𝐽−1𝑝𝐼,𝐽−1′ + 𝑏𝐼,𝐽

𝑏𝐼,𝐽′ = (𝜌𝑢∗𝑆)𝑖,𝐽 − (𝜌𝑢

∗𝑆)𝑖+1,𝐽 + (𝜌𝑢∗𝑆)𝐼,𝑗 − (𝜌𝑢

∗𝑆)𝐼,𝑗+1

𝑐𝑚,𝑛 = 𝜌𝑑𝑚,𝑛𝑆𝑚,𝑛 𝑑𝑚,𝑛 = 𝑆𝑚,𝑛 𝑎𝑚,𝑛⁄

4) Correct pressure 𝒑 and velocities 𝒖 and 𝒗:

𝑝𝐼,𝐽 = 𝑝𝐼,𝐽∗ + 𝑝𝐼,𝐽

′ 𝑢𝑖,𝐽 ≈ 𝑢𝑖,𝐽

∗ + 𝑑𝑖,𝐽(𝑝𝐼−1,𝐽∗ − 𝑝𝐼,𝐽

∗ )

𝑣𝐼,𝑗 ≈ 𝑣𝐼,𝑗∗ + 𝑑𝑖,𝐽(𝑝𝐼,𝐽−1

∗ − 𝑝𝐼,𝐽∗ )

5) Solve all other discretized transport equations (quantity 𝝓) that may exist ;

6) If the solution has converged, STOP the algorithm. If not, SET (𝒑, 𝒖, 𝒗,𝝓)∗ = (𝒑, 𝒖, 𝒗,𝝓) at the end of step 5) and RESTART the algorithm at the beginning of step 2) .

Page 12: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Finite Volume Method for Structured Algebraic Grids

Example 1A – Translating the Poisson equation (for potential flow) 𝛻2𝜙 = 0 from the Physical Plane to the Computational Plane

Physical Plane (𝒙, 𝒚) Computational Plane (𝝃, 𝜼)

Physical Plane → where our real geometry exists Physical Plane → where the equations that govern our flow will be solved (later the results from those equations will be translated back to the physical plane for analysis)

→ 𝐄𝐪𝐮𝐚𝐭𝐢𝐨𝐧 𝐭𝐨 𝐛𝐞 𝐬𝐨𝐥𝐯𝐞𝐝 (𝐩𝐨𝐭𝐞𝐧𝐭𝐢𝐚𝐥 𝐟𝐥𝐨𝐰 𝐞𝐪𝐮𝐚𝐭𝐢𝐨𝐧): 𝛻2𝜙 =𝜕2𝜙

𝜕𝑥2+𝜕2𝜙

𝜕𝑦2= 0

Transformation from the physical plane (𝒙, 𝒚) to the computational plane (𝝃, 𝜼)

{ 𝜉 =

𝑥

5

𝜂 =10

10 − 𝑥𝑦

Chain rule

𝜕𝜙

𝜕𝑥𝑖= 𝜙𝑥𝑖 =

𝜕𝜙

𝜕𝜉

𝜕𝜉

𝜕𝑥𝑖+𝜕𝜙

𝜕𝜂

𝜕𝜂

𝜕𝑥𝑖

𝜕2𝜙

𝜕𝑥𝑖2 =

𝜕𝜙𝑥𝑖𝜕𝑥𝑖

=𝜕𝜙𝑥𝑖𝜕𝜉

𝜕𝜉

𝜕𝑥𝑖+𝜕𝜙𝑥𝑖𝜕𝜉

𝜕𝜂

𝜕𝑥𝑖=𝜕2𝜙

𝜕𝜉2(𝜕𝜉

𝜕𝑥𝑖)2

+𝜕2𝜙

𝜕𝜂2(𝜕𝜂

𝜕𝑥𝑖)2

Conclusion: equation 𝛻2𝜙 = 0 , which gives us the characteristics of the flow of 𝜙 in the physical plane, has the following structure on the computational plane (where it will be solved):

𝜕𝜉

𝜕𝑥=1

5 𝜕𝜉

𝜕𝑦= 0

𝜕𝜂

𝜕𝑥=

10

(10 − 𝑥)2 𝜕𝜂

𝜕𝑦=

10

10 − 𝑥

𝛻2𝜙 =𝝏𝟐𝝓

𝝏𝒙𝟐+𝝏𝟐𝝓

𝝏𝒚𝟐= [(

𝝏𝝃

𝝏𝒙)𝟐

+ (𝝏𝝃

𝝏𝒚)𝟐

]𝝏𝟐𝝓

𝝏𝝃𝟐+ [(

𝝏𝜼

𝝏𝒙)𝟐

+ (𝝏𝜼

𝝏𝒚)𝟐

]𝝏𝟐𝝓

𝝏𝜼𝟐=

=1

25

𝜕2𝜙

𝜕𝜉2+ [(

10

(10 − 𝑥)2)2

+ (10

10 − 𝑥)2

]𝜕2𝜙

𝜕𝜂2

Remark:

𝒚0

𝜼0

1 −𝑥

101 ⟹

2 −𝑥

202

𝜂 = 𝑘𝑦

, com 𝑘 =2

2 −𝑥20

=10

10 − 𝑥

Example 1B – Finite Volume Method on the Computational Plane

Finite Volume Method:

𝛻2𝜙 = 0 = ∇ ∙ (∇𝜙) = ∫∇ ∙ (∇𝜙)

Ω

𝑑𝒱 =

= ∫ ∇𝜙 ∙ �⃗�

∂Ω

𝑑 ≈ ∑ (∇𝜙 ∙ �⃗� )𝑖𝑆𝑖

∂Ω 𝑓𝑎𝑐𝑒𝑠

𝑖

Finite difference equation (obtained from Finite Volume Method):

(𝜕𝜙

𝜕𝜉 |𝑒−𝜕𝜙

𝜕𝜉 |𝑤)∆𝜂 + (

𝜕𝜙

𝜕𝜂 |𝑛−𝜕𝜙

𝜕𝜂 |𝑠)∆𝜉 = 0 =

, where 𝜕𝜙

𝜕𝜉 |𝑓𝑎𝑐𝑒 𝑖will be discretized by

central differences

Boundary Conditions:

∎ 𝜙𝑥 + 𝜙𝑦 =𝜕𝜙

𝜕𝑥+𝜕𝜙

𝜕𝑦=

=1

5

𝜕𝜙

𝜕𝜉+

10

(10 − 𝑥)2𝜕𝜙

𝜕𝜂+

10

10 − 𝑥

𝜕𝜙

𝜕𝜉= 0

∎ 𝜙(𝑥𝑖 , 𝑦𝑗) = 𝜙(𝜉𝑖 , 𝜂𝑗) = 0

After solving the problem in the computational plane (𝜉, 𝜂), we translate the results back into the physical plane (𝑥, 𝑦):

{𝑥𝑦} = [

1 5⁄ 0

010

10 − 𝑥

]

−1

{𝜉𝜂} = [

5 0

010 − 𝑥

10

] {𝜉𝜂} ⟹

⟹ 𝜙(𝑥𝑖 , 𝑦𝑗) = 𝜙 (5𝜉𝑖 ,10 − 𝑥𝑖10

𝑦𝑗)

Page 13: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Finite Volume Method for Structured Elliptical Grids

Transformation from the computational plane (𝝃, 𝜼) to

the physical plane (𝒙, 𝒚)

𝛼 = (𝜕𝑥

𝜕𝜂)2

+ (𝜕𝑦

𝜕𝜂)2

𝛽 =𝜕𝑥

𝜕𝜉

𝜕𝑥

𝜕𝜂+𝜕𝑦

𝜕𝜉

𝜕𝑦

𝜕𝜂

𝛾 = (𝜕𝑥

𝜕𝜉)2

+ (𝜕𝑦

𝜕𝜉)2

{

𝛼

𝜕2𝑥

𝜕𝜉2− 2𝛽

𝜕2𝑥

𝜕𝜉𝜕𝜂+ 𝛾

𝜕2𝑥

𝜕𝜂2= 0

𝛼𝜕2𝑦

𝜕𝜉2− 2𝛽

𝜕2𝑦

𝜕𝜉𝜕𝜂+ 𝛾

𝜕2𝑦

𝜕𝜂2= 0

Transformation from the

physical plane (𝒙, 𝒚) to the computational plane (𝝃, 𝜼)

{

∇2𝜂 =𝜕2𝜉

𝜕𝑥2+𝜕2𝜉

𝜕𝑦2= 0

∇2𝜂 =𝜕2𝜂

𝜕𝑥2+𝜕2𝜂

𝜕𝑦2= 0

Those equations are difficult to solve by hand, se we use finite differences:

𝛼 = (𝑥𝑖,𝑗+1 − 𝑥𝑖,𝑗−1

2∆𝜂)2

+ (𝑦𝑖,𝑗+1 − 𝑦𝑖,𝑗−1

2∆𝜂)2

𝛽 =𝑥𝑖+1,𝑗 − 𝑥𝑖−1,𝑗

2∆𝜉

𝑥𝑖,𝑗+1 − 𝑥𝑖,𝑗−1

2∆𝜂+𝑦𝑖+1,𝑗 − 𝑦𝑖−1,𝑗

2∆𝜉

𝑦𝑖,𝑗+1 − 𝑦𝑖,𝑗−1

2∆𝜂

𝛼 = (𝑥𝑖+1,𝑗 − 𝑥𝑖−1,𝑗

2∆𝜉)2

+ (𝑦𝑖+1,𝑗 − 𝑦𝑖−1,𝑗

2∆𝜉)2

{

𝛼

𝑥𝑖+1,𝑗 − 2𝑥𝑖,𝑗 + 𝑥𝑖−1,𝑗(∆𝜉)2

− 2𝛽𝑥𝑖+1,𝑗+1 − 𝑥𝑖+1,𝑗−1 − 𝑥𝑖−1,𝑗+1 + 𝑥𝑖−1,𝑗−1

4∆𝜉∆𝜂+ 𝛾

𝑥𝑖,𝑗+1 − 2𝑥𝑖,𝑗 + 𝑥𝑖,𝑗−1(∆𝜂)2

= 0

𝛼𝑦𝑖+1,𝑗 − 2𝑦𝑖,𝑗 + 𝑦𝑖−1,𝑗

(∆𝜉)2− 2𝛽

𝑦𝑖+1,𝑗+1 − 𝑦𝑖+1,𝑗−1 − 𝑦𝑖−1,𝑗+1 + 𝑦𝑖−1,𝑗−1

4∆𝜉∆𝜂+ 𝛾

𝑦𝑖,𝑗+1 − 2𝑦𝑖,𝑗 + 𝑦𝑖,𝑗−1(∆𝜂)2

= 0

Methodology for Elliptical Grid Generation

Example 1 – Mesh the blue area (on the physical plane) bellow using an elliptical grid generation algorithm

1) Set the characteristics of the computational plane (𝝃, 𝜼). P.ex.: 0 ≤ 𝜉, 𝜂 ≤ 1 and ∆𝜉, ∆𝜂 = 0.001

2) Apply Boundary conditions. In this example: 𝑨: 𝜉𝐴 = 0 , 𝜂𝐴 = 𝑦 ℎ⁄

𝑩: 𝜉𝐵 = 𝑥 𝑏⁄ , 𝜂𝐵 = 0

𝑪: 𝜉𝐶 = 1 , 𝜂𝐶 = 𝑦 ℎ⁄

𝑫𝟏,𝑫𝟑: periodic BC →

→ 𝜉𝐷1 = 𝜉𝐷3 , 𝜂𝐷1 = 𝜂𝐷3

𝑫𝟐: 𝜉𝐷2 = 𝑅 cos𝜃

𝜂𝐷2 = ℎ𝐶 + 𝑅 sin𝜃

3) Solve the system of equations (using finite differences) to

determine the position (𝒙𝒊,𝒋 , 𝒚𝒊,𝒋) of the interior nodes

Physical Plane (𝒙, 𝒚) Computational Plane (𝝃, 𝜼)

{

𝛼

𝜕2𝑥

𝜕𝜉2− 2𝛽

𝜕2𝑥

𝜕𝜉𝜕𝜂+ 𝛾

𝜕2𝑥

𝜕𝜂2= 0

𝛼𝜕2𝑦

𝜕𝜉2− 2𝛽

𝜕2𝑦

𝜕𝜉𝜕𝜂+ 𝛾

𝜕2𝑦

𝜕𝜂2= 0

→ Solve for the coordinates

(𝑥𝑖,𝑗 , 𝑦𝑖,𝑗) of the (𝑖, 𝑗) nodes

Note: we can choose the size of 𝑫𝟏,𝑫𝟐 and 𝑫𝟑 (the bigger the more refined the mesh is at those segments).

Page 14: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

Finite Volume Method for Unstructured Grids

Finite volume 𝛀𝑷 with 𝑲 neighbours 𝛀𝑵𝑲

Gradient Estimation at finite volume 𝛀𝑷 centroid

∫ ∇𝜙 𝑑𝒱 =

Ω𝑃

∫ 𝜙 �⃗� 𝑑𝑆

∂Ω𝑃

⟹ 𝛁𝝓𝑷 ≈𝟏

𝓥𝑷∑ 𝝓𝒇,𝒎

𝛛𝛀𝑷 𝒇𝒂𝒄𝒆𝒔

𝒎

𝒏𝒎⃗⃗⃗⃗⃗⃗ 𝑺𝒎

𝜙𝑓,𝑚 → value of 𝜙 at face 𝑚 ∈ ∂Ω𝑃

- Methods for estimating 𝝓𝒇,𝒎:

𝟏) 𝝓𝒇,𝒎 ≈𝟏

𝑵𝒗,𝒎∑ 𝝓𝒗,𝒋

𝒇𝒂𝒄𝒆 𝒎𝒗𝒆𝒓𝒕𝒆𝒙𝒆𝒔

𝒋

𝑁𝑣,𝑚 → total number of face 𝑚 vertexes

𝜙𝑣,𝑗 → value of 𝜙 at vertex 𝑗 ∈ face 𝑚

𝜙𝑣,𝑗 ≈ (∑𝜙𝑁𝐾𝑑𝑗,𝑁𝐾

𝑁𝑗

𝑘

) (∑1

𝑑𝑗,𝑁𝐾

𝑁𝑗

𝑘

)⁄

𝑁𝑗 → vertex 𝑗 neighboring centroids (including 𝑃)

𝑑𝑗,𝑘 → distance between vertex 𝑗 and its

neighboring centroid 𝑁𝐾

𝟐) 𝝓𝒇,𝒎 ≈𝝓𝑷 +𝝓𝑵𝑲

𝟐

𝟑) 𝝓𝒇,𝒎 ≈ 𝜼𝒎,𝑷𝝓𝑷 + 𝜼𝒎,𝑵𝑲𝝓𝑵𝑲

𝜂𝑚,𝑁𝐾 =(𝑓𝑚,𝑐⃗⃗ ⃗⃗ ⃗⃗ ⃗ − �⃗� ) ∙ 𝑛𝑚⃗⃗ ⃗⃗ ⃗

(𝑁𝐾⃗⃗⃗⃗⃗⃗ − �⃗� ) ∙ 𝑛𝑚⃗⃗ ⃗⃗ ⃗

𝜂𝑚,𝑃 = 1 − 𝜂𝑚,𝑁𝐾

𝑓𝑚,𝑐⃗⃗ ⃗⃗ ⃗⃗ ⃗ → face 𝑚 centroid position 𝑛𝑚⃗⃗ ⃗⃗ ⃗ → face 𝑚 exterior normal vector (points from 𝑃 to 𝑁𝐾)

𝑁𝐾⃗⃗⃗⃗⃗⃗ , �⃗� → positions of finite volumes 𝑃 and 𝑁𝐾 centroids

Gradient Estimation at 𝐟𝐚𝐜𝐞 𝒎 ∈ 𝛀𝑷

𝛁𝝓𝒇,𝒎 ≈𝝓𝑵𝑲 −𝝓𝑷

‖�⃗⃗� 𝑷,𝑵𝑲‖(�⃗⃗� 𝑷,𝑵𝑲

‖�⃗⃗� 𝑷,𝑵𝑲‖∙ �⃗⃗� 𝒎)𝑺𝒎

Ω𝑁𝐾 → centroid’s 𝑃 neighboring centroid, adjacent adjacent to 𝑃 through face m

𝑑 𝑃,𝑁𝐾 → distance vector that connects centroid 𝑃 to its neighbor (adjacent to 𝑃 through face m), centroid 𝑁𝐾

When �⃗⃗� 𝑷,𝑵𝑲 and 𝒏𝒎⃗⃗⃗⃗⃗⃗ are not parallel, one should use the corrected 𝛁𝝓𝒇,𝒎 value:

𝛁𝝓𝒇,𝒎 ≈ (𝝓𝑵𝑲 −𝝓𝑷

‖�⃗⃗� 𝑷,𝑵𝑲‖‖∆⃗⃗ ‖ +

𝛁𝝓𝑵𝑲 + 𝛁𝝓𝑷𝟐

∙ 𝒕 )𝑺𝒎

∆⃗⃗ = (𝑛𝑚⃗⃗ ⃗⃗ ⃗ ∙ 𝑛𝑚⃗⃗ ⃗⃗ ⃗

𝑛𝑚⃗⃗ ⃗⃗ ⃗ ∙ 𝑑 𝑃,𝑁𝐾)𝑑 𝑃,𝑁𝐾 𝑡 = 𝑛𝑚⃗⃗ ⃗⃗ ⃗ − ∆⃗⃗

→ ∇𝜙𝑁𝐾 and ∇𝜙𝑃 are estimated by the gradient estimation at finite volume centroid method

Face Value Estimation at 𝐟𝐚𝐜𝐞 𝒎 ∈ 𝛀𝑷

𝝓𝒇,𝒎 ≈ 𝝓𝑷 + �⃗⃗� 𝑷,𝒇𝒎,𝒄 ∙ 𝛁𝝓𝑷

�⃗⃗� 𝑷,𝒇𝒎,𝒄 → distance vector that connects centroid 𝑃 to

the centroid of face m

Gradient Estimation at 𝐯𝐞𝐫𝐭𝐞𝐱 𝒋 ∈ 𝐟𝐚𝐜𝐞 𝒎

𝛁𝝓𝒗,𝒋 ≈𝟏

𝓥𝒙∑ 𝝓𝒇,𝒎

𝛛𝛀𝒙 𝒇𝒂𝒄𝒆𝒔

𝒎

𝒏𝒎⃗⃗⃗⃗⃗⃗ 𝑺𝒎

𝒱𝑥 → volume of the CV created by the dashed lines 𝜙𝑓,𝑚 , 𝑛𝑚⃗⃗ ⃗⃗ ⃗ , 𝑆𝑚 → quantities at dashed lined faces

𝛀𝒙

𝒗𝒋

Page 15: MFC Formulário€¦ · MFC – Formulário Finite Volume Method for Structured Uniform Cartesian Grids The finite volume method uses the integral form of the conservation law as

MATH

�⃗� ⊗ �⃗� = {𝑢𝑤𝑣}⊗ {

𝑢𝑤𝑣} = [

𝑢2 𝑢𝑣 𝑢𝑤𝑣𝑢 𝑣2 𝑣𝑤𝑤𝑢 𝑤𝑣 𝑤2

]

Taylor expansion of 𝒇(𝒙) centered around 𝒙𝟎

𝑓(𝑥) = 𝑓(𝑥0 + ∆𝑥) = ∑(𝑥 − 𝑥0)

𝑛

𝑛!(𝑑𝑛𝑓

𝑑𝑥𝑛)𝑥0

= 𝑓(𝑥0)

𝑛=0

+ (𝑥 − 𝑥0) (𝑑𝑓

𝑑𝑥)𝑥0

+(𝑥 − 𝑥0)

2

2!(𝑑2𝑓

𝑑𝑥2)𝑥0

+⋯

𝑓(𝑥, 𝑦) = 𝑓(𝑥0 + ∆𝑥 , 𝑦0 + ∆𝑦) = 𝑓(𝑥0 , 𝑦0) + (𝑥 − 𝑥0) (𝜕𝑓

𝜕𝑥)𝑥0

+ (𝑦 − 𝑦0) (𝜕𝑓

𝜕𝑦)𝑦0

+

+1

2![(𝑥 − 𝑥0)

2 (𝜕2𝑓

𝜕𝑥2)𝑥0,𝑦0

+ 2(𝑥 − 𝑥0)(𝑦 − 𝑦0) (𝜕2𝑓

𝜕𝑥𝜕𝑦)𝑥0,𝑦0

+ (𝑦 − 𝑦0)2 (𝜕2𝑓

𝜕𝑦2)𝑥0,𝑦0

] + ⋯

Gauss divergence theorem (3D)

∫∇ ∙ 𝑓 𝑑𝒱 =

Ω

∫ 𝑓 ∙ �⃗� 𝑑𝑆

∂Ω

∫∇ ∙ (𝑓 ⊗ 𝑓 )𝑑𝒱 =

Ω

∫ (𝑓 ⊗ 𝑓 ) ∙ �⃗� 𝑑𝑆

∂Ω

(𝑓 ⊗ 𝑓 ) ∙ �⃗� = (𝑓 ∙ �⃗� )𝑓

Gauss divergence theorem / Gauss-Green theorem also applies for individual components

∫ (𝑎𝜕2𝑓

𝜕𝑥2+ 𝑏

𝜕2𝑓

𝜕𝑦2) 𝑑𝒱 = ∫ ∇ ∙ (∇𝑓 ∙ {

𝑎𝑏}) 𝑑𝒱 =

Ω

Ω

= ∫ ∇ ∙ {𝑎𝜕𝑓

𝜕𝑥𝑏𝜕𝑓

𝜕𝑦}𝑑𝒱 =

Ω

∫ (𝑎𝜕𝑓

𝜕𝑥𝑛𝑥 + 𝑏

𝜕𝑓

𝜕𝑦𝑛𝑦 ) 𝑑𝑆

∂Ω

Gauss-Green gradient theorem (3D)

∫∇𝑓 𝑑𝒱 =

Ω

∫ 𝑓 �⃗� 𝑑𝑆

∂Ω

∫𝜕𝑓

𝜕𝑥 𝑑𝒱 = ∫ 𝑓 𝑛𝑥 𝑑𝑆

∂Ω

Ω

1st order schemes have very poor accuracy

2nd order schemes have a much better accuracy than 1st order schemes

2nd order schemes oscillate when slope or function discontinuities are present in the solution

1st order schemes have numerical (false) diffusion, due to the truncation error resembling a diffusive flux: 휀𝑇~𝜕

2𝜙 𝜕𝑥2⁄

2nd order methods still have large errors for high frequencies

“CFD is engineering tool” – José Carlos Fernandes Pereira