You are on page 1of 11

ADVANCED COMPUTATIONAL FLUID

DYNAMICS

Document Identifier : Solving Example 5.2 – 5.3[1]


Student : Huynh Van Tinh
Student Number : 20205079
School of : Mechanical and Automotive Engineering
Description : HW#4
Date (dd / mm / yyyy) : 15 / 04 / 2020
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

EXAMPLE 5.2
THE UPWIND DIFFERENCING SCHEME

A property ϕ is transported by means of convection and diffusion through


the one-dimensional domain sketched in figure 1. The governing equation is:

d
  u     
d d
dx dx  dx  (1)
The boundary conditions are ϕ0 = 1 at x = 0 and ϕ L = 0 at x = L. Using the
upwind differencing scheme for (i) u = 0.1m/s, (ii) u = 2.5m/s with the coarse five-
point grid. The following data apply: length L = 1.0m, ρ = 1.0kg/m 3, Γ = 0.1kg/m.s
ϕ=1 u ϕ=0

x=0 x=L
Figure 1. The one-dimensional domain sketched
The grid shown in figure 2 is below used here for the discretization.
δx
A 1 2 u 3 u 4 5 B
ϕ=1 ϕ=0

x=0 x=L
W w P e E

δx δx
Figure 2. The grid used
 Interior nodal points 2,3 and 4

Using general form: aPP  a WW  aEE , with:


F: the convective mass flux per unit area, Fe = Fw = F = ρ.u (kg/(s.m2))
D: diffusion conductance, Dw = De = D = Γ/ δx

aW aE aP
Dw + Fw De aW + aE + (Fe - Fw)
 Boundary node 1

Using general form at the boundary nodes: aPP  a WW  aEE  Su , with:
Fe = Fw = F, DA = DB = 2D = 2Γ/ δx

© hvtinh97@gmail.com 1
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

aW aE aP SP Su
0 D aW + aE + (Fe - Fw) - SP - (2D + F) (2D + F)ϕA
 Boundary node 5

Using general form at the boundary nodes: aPP  a WW  aEE  Su , with:
Fe = Fw = F, DA = DB = 2D = 2Γ/ δx

aW aE aP SP Su
D+F 0 aW + aE + (Fe - Fw) - SP -2D 2DϕB
Compare the results with the analytical solution:

  0 exp   ux /    1

L  0 exp   uL /    1
(2)
1. CASE I

F  F  F  0.1 kg
 w

e 
s.m2 

u  0.1 m / s   D w  De  D  0.5 kg


s.m2 
Pe  F  0.2
 D

The discretisation equation at internal nodes 2, 3 and 4, boundary node 1 and 5:

0.61  1.12  0.53 0



 0.62  1.13  0.54 0

 0.63  1.14  0.55  0
1.6  0.5  1.1
 1 2

 0.64  1.65  0

The matrix form of the equation set is:

0.6  1.1 0.5 0 0 1   0


 0  
 0.6  1.1 0.5 0  2 
 0
 
 0 0 0.6  1.1 0.5  3    0 
     
1.6  0.5 0 0 0 4  1.1
 0 0 0 0.6  1.6     0 
 5
The solution matrix form is:

© hvtinh97@gmail.com 2
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

1  0.9337 
  0.7879 
2   
3   0.6130 
   
4  0.4031 
  0.1512 
 5
The resulting matrix equation can be solved with MATLAB software.

Figure 3. Code for solving the matrix (case i)

Figure 4. The solution (case i)


The results are summarised in table 1 shows that the upwind differencing
scheme produces good results at this cell Peclet number. Comparison of the
upwind difference numerical results and the analytical solution for case i.
Table 1
Nod Finite volume Analytical
Distance Percentage error
e solution solution
1 0.1 0.9337 0.9388 0.5432
2 0.3 0.7879 0.7964 1.0673
3 0.5 0.6130 0.6225 1.5261
4 0.7 0.4031 0.4100 1.6829
5 0.9 0.1512 0.1505 -0.4651

The function plot(x,y) generates a plot with the x values_distance (m) on


the horizontal axis and the y values_property ϕ on the vertical axis. The session is:

© hvtinh97@gmail.com 3
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

Figure 5. Code for generating the plot (case i)

u = 0.1 (m/s)

Exact solution

Numerical solution

Figure 6. A graphics window showing the plot (case i)


2. CASE II

 w

e 
F  F  F  2.5 kg
s.m2 

u  2.5  m / s   Dw  De  D  0.5 kg

s.m2 
Pe  F  5
 D

The discretisation equation at internal nodes 2, 3 and 4, boundary node 1 and 5:

© hvtinh97@gmail.com 4
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

31  3.52  0.53 0



 32  3.53  0.54 0

 33  3.54  0.55 0
4  0.5  3.5
 1 2

  34  45 0

The matrix form of the equation set is:

3  3.5 0.5 0 0 1   0 


0  
 3  3.5 0.5 0  2 
 0 
 
0 0 3  3.5 0.5  3    0 
     
 4  0.5 0 0 0 4  3.5 
0 0 0 3 4     0 
 5
The solution matrix form is:

1  0.9998 
  0.9987 
2   
3   0.9921 
   
4  0.9524 
  0.7143 
 5
The resulting matrix equation can be solved with MATLAB software.

Figure 7. Code for solving the matrix (case ii)

Figure 8. The solution (case ii)


The upwind scheme produces a much more realistic solution, however, not
very close to the exact solution near boundary B.

© hvtinh97@gmail.com 5
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

Table 2
Nod Finite volume Analytical
Distance Percentage error
e solution solution
1 0.1 0.9998 1.0000 0.0200
2 0.3 0.9987 1.0000 0.1302
3 0.5 0.9921 0.9999 0.7959
4 0.7 0.9524 0.9994 4.9398
5 0.9 0.7143 0.9179 28.5055

Figure 9. Code for generating the plot (case ii)

Numerical solution

Exact solution

u = 2.5 (m/s)

Figure 10. A graphics window showing the plot (case ii)

© hvtinh97@gmail.com 6
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

EXAMPLE 5.3
THE HYBRID DIFFERENCING SCHEME

Solve the problem considered in case (ii) of example 5.2 using the hybrid
scheme for u = 2.5m/s. Compare a 5-node solution with a 25-node solution.

F  F  F   u  2.5 kg
 w

e
s.m2  

u  0.1 m / s   Dw  De  D  

x
 0.5 kg
s.m2  
Pe  Pe  F  5
 w e D

Since the cell Peclet number Pe is greater than 2 the hybrid scheme uses
the upwind expression for the convective terms and sets the diffusion to zero.
 Interior nodal points 2,3 and 4

Using general form: aPP  a WW  aEE , where:

aW aE aP
F 0 aW + aE + (Fe - Fw)
 Boundary node 1

Using general form at the boundary nodes: aPP  a WW  aEE  Su , where:

aW aE aP SP Su
0 D aW + aE + (Fe - Fw) - SP - (2D + F) (2D + F)ϕA
 Boundary node 5

Using general form at the boundary nodes: aPP  a WW  aEE  Su , where

aW aE aP SP Su
F 0 aW + aE + (Fe - Fw) - SP -2D 2DϕB
Compare the results with the analytical solution equation (2). The
discretisation equation at internal nodes 2, 3 and 4, boundary node 1 and 5:
2.51  2.52 0

 2.52  2.53 0

 2.53  2.54 0
4  0.5  3.5
 1 2

 2.54  3.55 0

© hvtinh97@gmail.com 7
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

The matrix form of the equation set is:

 2.5  2.5 0 0 0 1   0 


 0  
 2.5  2.5 0 0  2 
 0 
 
 0 0 2.5  2.5 0 3    0 
     
 4  0.5 0 0 0 4  3.5 
 0 0 0 2.5  3.5     0 
 5
The solution matrix form is:

1  1.0000 
  1.0000 
2   
3   1.0000 
   
4  1.0000 
  0.7143 
 5
The resulting matrix equation can be solved with MATLAB software.

Figure 11. Code for solving the matrix (5 nodes)

Figure 12. The solution (5 nodes)


The numerical results are compared with the analytical solution in table 3
and, since the cell Peclet number is high, they are the same as those for pure
upwind differencing.
Table 3
Nod Finite volume Analytical
Distance Percentage error
e solution solution
1 0.1 1.0000 1.0000 0.0000

© hvtinh97@gmail.com 8
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

2 0.3 1.0000 1.0000 0.0000


3 0.5 1.0000 0.9999 -0.0004
4 0.7 1.0000 0.9994 -0.0553
5 0.9 0.7143 0.9179 22.1823

When the grid is refined to an extent that the cell Pe < 2, the scheme
reverts to central differencing and produces an accurate solution. This illustrated
by using a 25-node grid with δx = 0.04m so F/D = 2.5.

Numerical solution
(5 cells)

Numerical solution
(25 cells)

Exact solution

u = 2.5 (m/s)

Figure 13. A graphics window showing comparision a 5-node solution with a 25-
node solution

© hvtinh97@gmail.com 9
ADVANCED COMPUTATIONAL FLUID DYNAMICS - HW#4

BIBLIOGRAPHY
[1] H K Versteeg and W Malalasekera, 2007. An Introduction to Computational
Fluid Dynamics (The Finite Volume Method). Second Edition. Pearson Education
Limited.

© hvtinh97@gmail.com 10

You might also like