You are on page 1of 9

NUMERICAL SOLUTION OF FLUID FLOW

NGUYEN QUANG KHAI


ID: 201783551
NUMERICAL SOLUTION OF FLUID FLOW
The equations describing fluid flows are of partial differential equations (PDEs).
Finite difference method (FDM) is traditionally used for the numerical solution of the
flow equations

FUNDAMENTALS OF FDM

In FDM, derivatives are replaced by a proper difference formula based on the Taylor
series expansions of a function:

The first derivative can be written by re-arranging the terms:

Denoting all except the first terms by O ( x) yields

The difference formula above is of order 1 with the truncation error being
proportional to x
To obtain higher order difference formula for the first derivative, Taylor series
expansion of the function is used from both side of x

Subtracting the second from the first equation yields

The difference formula above is of order 2 with the truncation error being
proportional to ( x)2
TYPICAL DIFFERENCE FORMULAS
Typical difference formulas Space index form

Forward
First derivatives

Backward
One – dimension (1D)

Centered
derivatives
Second

Centered
Typical difference formula Space index form

Forward
First derivatives

Backward
Two – dimension (2D)

Centered
derivatives
Second

Centered
SOLVING TIME-INDEPENDENT PDES
1. Divide the computational domain into subdomains
2. Derive the difference formulation for the given PDE by replacing all
derivatives with corresponding difference formulas
3. Apply boundary conditions to the points on the domain boundaries
4. Apply the difference formulation to every inner points of the
computational domain
5. Solve the resulting algebraic system of equations

LINEAR SECOND-PHASE DIFFERENTIAL EQUATION


𝑑2 𝑢
− 𝑢 = −𝑥 2 0≤x≤1
𝑑𝑥 2

subject to the boundary conditions:


u(0) = 0 ; u(1) = 0
Solution:
1. Divide the x-domain into 4-subdomain, i.e ∆x = 0.25
∆x = 0.25

𝑢0 𝑢1 𝑢2 𝑢3
𝑢4
2. Using the Centered difference for second derivatives (1D) we have:
𝑑 2 𝑢 𝑢0 − 2𝑢1 + 𝑢2
=
𝑑𝑥 2 ∆𝑥 2
3. 𝑢0 = 0 ; 𝑢4 = 0
4.
𝑢0 − 2𝑢1 + 𝑢2
− 𝑢1 = −𝑥12
∆𝑥 2
𝑢1 − 2𝑢2 + 𝑢3
− 𝑢2 = −𝑥22
∆𝑥 2
𝑢2 − 2𝑢3 + 𝑢4
− 𝑢3 = −𝑥32
∆𝑥 2
−(2 + ∆𝑥 2 ) 1 0 𝑢1 −𝑥12 ∆𝑥 2
( 1 −(2 + ∆𝑥 2 ) 1 ) ( 𝑢2 ) = (−𝑥22 ∆𝑥 2 )
0 1 −(2 + ∆𝑥 2 ) 𝑢3 −𝑥32 ∆𝑥 2
−2.0625 1 0 𝑢1 −0.0039
( 1 −2.0625 1 𝑢
) ( 2 ) = (−0.015625)
0 1 −2.0625 𝑢3 −0.035156
5. Algebraic solution and graph (using Microsoft Excel)
𝑢1 = 0.01722484 𝑢2 = 0.031626232 𝑢3 = 0.032379264

SOLVING TIME-INDEPENDENT PDES


0.04

0.03

0.02
U

0.01

0
0 0.25 0.5 0.75 1
X

SOLVING TIME-DEPENDENT PDES


1. Divide the computational domain into subdomains
2. Derive the difference formulation for the given PDE by replacing all
derivatives with corresponding difference formulas in both space
and time dimensions
3. Apply the initial condition
4. Apply boundary conditions to the points on the domain boundaries
5. Apply the difference formulation to every inner points of the
computational domain
6. Solve the resulting algebraic system of equations

THERMAL CONDUCTIVITY EQUATION

𝜕𝑢 𝜕 2 𝑢
= 0 ≤ 𝑥 ≤ 1, 𝑡 > 0
𝜕𝑡 𝜕𝑥 2
Initial condition: 𝑢(0, 𝑥) = 0
Boundary conditions: 𝑢(𝑡, 0) = 0 , 𝑢(𝑡, 1) = 1

Solution:
1.
2. For time discretization, we use the backward difference for first derivatives:
𝑗+1 𝑗
𝜕𝑢 𝑢𝑖 −𝑢𝑖
= (red arrow)
𝜕𝑡 ∆𝑡

For space discretization, we can use either Explicit method or Implicit method:
• Explicit:
𝑗 𝑗 𝑗
𝜕 2 𝑢 𝑢𝑖−1 − 2𝑢𝑖 + 𝑢𝑖+1
= (𝑝𝑢𝑟𝑝𝑙𝑒 𝑎𝑟𝑟𝑜𝑤)
𝜕𝑥 2 ∆𝑥 2
• Implicit:
𝑗+1 𝑗+1 𝑗+1
𝜕2 𝑢 𝑢𝑖−1 −2𝑢𝑖 +𝑢𝑖+1
= (blue arrow)
𝜕𝑥 2 ∆𝑥 2

3. The initial and boundary conditions are as given above.


4. Let 𝑗 = 0 (𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛). Consider the solutions of the first time step (𝑗 = 1)
EXPLICIT METHOD
𝑢11 − 𝑢10 𝑢00 − 2𝑢10 + 𝑢20
=
∆𝑡 ∆𝑥 2
𝑢21 − 𝑢20 𝑢10 − 2𝑢20 + 𝑢30
=
∆𝑡 ∆𝑥 2
𝑢31 − 𝑢30 𝑢20 − 2𝑢30 + 𝑢40
=
∆𝑡 ∆𝑥 2
Generally,
∆𝑡
𝑢𝑖1 = 𝑢𝑖0 + 𝛼(𝑢𝑖−1
0
− 2𝑢𝑖0 + 𝑢𝑖+1
0 )
, 𝑤ℎ𝑒𝑟𝑒 𝛼 =
∆𝑥 2

Let ∆𝑡 = 0.01 𝑎𝑛𝑑 ∆𝑥 = 0.25, 𝑖. 𝑒 𝛼 = 0.16 we obtain:


𝑢11 = 0, 𝑢21 = 0 𝑎𝑛𝑑 𝑢31 = 𝛼 = 0.16
Comments: The solutions of a particular time step only depend on the previous values
and can be calculated from the equation below:
𝑗+1 𝑗 𝑗 𝑗 𝑗 ∆𝑡
𝑢𝑖 = 𝑢𝑖 + 𝛼(𝑢𝑖−1 − 2𝑢𝑖 + 𝑢𝑖+1 ), 𝑤ℎ𝑒𝑟𝑒 𝛼 = 2
∆𝑥
IMPLICIT METHOD:

𝑢11 − 𝑢10 𝑢01 − 2𝑢11 + 𝑢21


=
∆𝑡 ∆𝑥 2
𝑢21 − 𝑢20 𝑢11 − 2𝑢21 + 𝑢31
=
∆𝑡 ∆𝑥 2
𝑢31 − 𝑢30 𝑢21 − 2𝑢31 + 𝑢41
=
∆𝑡 ∆𝑥 2
1 + 2𝛼 −𝛼 0 𝑢11 𝑢10
( −𝛼 1 + 2𝛼 −𝛼 ) (𝑢21 ) = ( 𝑢20 )
0 −𝛼 1 + 2𝛼 𝑢31 𝑢30 + 𝛼𝑢41
𝑢11 0.00183
1
↔ (𝑢2 ) = ( 0.0151 )
𝑢31 0.1231
Comments: The solutions of a particular time step point depend on both the previous
values (time discretization) and its surrounding space points. Thus, solving the resulting
algebraic system of equations is necessary to obtain the solutions.
5. Using Microsoft Excel with enabled iterative calculation to obtain the numerical
solutions and graphs.
EXPLICIT METHOD

1 Explicit method

0.8
t=0.04
0.6
t=0.08
u

t=0.12
0.4
t=0.16

0.2 t=0.20
t=infinite
0
0 0.25 0.5 0.75 1
x

IMPLICIT METHOD:
x 0 0.25 0.5 0.75 1
n t u(n,0) u(n,1) u(n,2) u(n,3) u(n,4)
0 0 0 0 0 0 1
1 0.01 0 0.001835 0.015137 0.123047 1
2 0.02 0 0.006089 0.038767 0.219128 1
3 0.03 0 0.012698 0.066702 0.295304 1
4 0.04 0 0.021297 0.096338 0.356604 1
5 0.05 0 0.031417 0.126082 0.40665 1

Implicit method
1

0.8
t=0.04
0.6 t=0.08
u

t=0.12
0.4
t=0.16
0.2 t=0.20
t=infinite
0
0 0.25 0.5 0.75 1
x

You might also like