0% found this document useful (0 votes)
7 views

Week3 Lecture Notes

Material on CFD

Uploaded by

jofred
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Week3 Lecture Notes

Material on CFD

Uploaded by

jofred
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Finite Difference Method 2.

33

This signifies that no perturbation effect is carried upstream. In other words, the
upwind method maintains unidirectional flow of information. In conclusion, it
can be said that while space centred differences are more accurate than upwind
differences, as indicated by the Taylor series expansion, the whole system is not
more accurate if the criteria for accuracy includes the transportive property as
well.

2.5.4 Upwind Differencing and Artificial Viscosity


Consider the model Burger’s equation. (2.80) and focus the attention on the
inertia terms
∂ζ ∂ζ ∂2ζ
+u =ν 2
∂t ∂x ∂x
As seen, the simple upwind scheme gives

ζin+1 − ζin u ζ n − u ζi−1


n
=− i + ··· for u > 0
∆t ∆x
ζin+1 − ζin u ζ n − u ζin
= − i+1 + ··· for u < 0
∆t ∆x
From Taylor series expansion, we can write
n 2 n
∂ζ (∆t) ∂ 2 ζ
ζin+1 = ζin + ∆t + + ··· (2.101)
∂t i 2 ∂t2 i
n 2 n
n ∂ζ (∆x) ∂ 2 ζ
ζi±1 = ζin ± ∆x + ± ··· (2.102)
∂x i 2 ∂x2 i

Substituting Eqns. (2.101) and (2.102) into (2.96) gives (dropping the subscript
i and superscript n)
" #
2
1 ∂ζ (∆t) ∂ 2 ζ
∆t + + O(∆t)3
∆t ∂t 2 ∂t2
" #
u ∂ζ (∆x)2 ∂ 2 ζ 3
=− ∆x − + O(∆x) + [Diffusive term]
∆x ∂x 2 ∂x2

or  2
∂2ζ
 
∂ζ ∂ζ 1 u ∆t ∂ ζ
= −u + u ∆x 1 − + ν + O(∆x)2
∂t ∂x 2 ∆x ∂x2 ∂x2
which may be rewritten as

∂ζ ∂ζ ∂2ζ ∂2ζ
= −u + ν 2 + νe 2 + higher-order terms (2.103)
∂t ∂x ∂x ∂x
where
1 u ∆t
νe = [u ∆x (1 − C)], C (Courant number) =
2 ∆x
2.34 Computational Fluid Dynamics

In deriving Eq. (2.103), ∂ 2 ζ/∂t2 was taken as u2 ∂ 2 ζ/∂x2 . However, the non-
physical coefficient νe leads to a diffusion like term which is dependent on the
discretization procedure. This νe is known as the numerical or artificial viscosity.
Let us look at the expression.
1
νe =[u ∆x (1 − C)] for u > 0 (2.104)
2
somewhat more critically. On one hand we have considered that u > 0 and
on the other CFL condition demands that C < 1 (so that the algorithm can
work). As a consequence, νe is always a positive non-zero quantity (so that the
algorithm can work). If, instead of analysing the transient equation, we put
∂ζ/∂t = 0 in Eq. (2.96) and expand it in Taylor series, we obtain
1
νe = u ∆x (2.105)
2
Let us now consider a two-dimensional convective-diffusive equation with viscous
diffusion in both directions(Eq. (2.67) but with ω = ζ). For ui , vi > 0, upwind
differencing gives
n+1 n n n n n
ζi,j − ζi,j u ζi,j − u ζi−1,j v ζi,j − v ζi,j−1
=− −
∆t ∆x ∆y
 n n n
ζi+1,j − 2ζi,j + ζi−1,j

(∆x)2
n n n
ζi,j+1 − 2ζi,j + ζi,j−1

+ (2.106)
(∆y)2
The Taylor series procedure as was done for Eq. (2.103) will produce
∂ζ ∂ζ ∂ζ ∂2ζ ∂2ζ
= −u −v + (ν + νex ) 2 + (ν + νey ) 2 (2.107)
∂t ∂x ∂y ∂x ∂y
where
1
νex = [u ∆x(1 − Cx )],
2
1 u ∆t v ∆t
νey = [v ∆y(1 − Cy )]; with Cx = , Cy =
2 ∆x ∆y
As such for u ≈ v and ∆x = ∆y, CFL condition is Cx = Cy ≤ (1/2). This
indicates that for a stable calculation, artificial viscosity will necessarily be
present. However, for a steady-state analysis, we get
1 1
νex = u ∆x; νey = v ∆y (2.108)
2 2
We have observed that some amount of upwind effect is indeed necessary to
maintain transportive property of flow equations while the computations based
on upwind differencing often suffer from false diffusion (inaccuracy!). One of
the plausible improvements is the usage of higher-order upwind method of dif-
ferencing. Next subsection discusses this aspect of improving accuracy.
Finite Difference Method 2.35

2.5.5 Second Upwind Differencing or Hybrid Scheme


According to the second upwind differencing, if u is the velocity in x direction
and ζ is any property which can be convected or diffused, then

∂(uζ) uR ζR − uL ζL
= (2.109)
∂x i,j ∆x

One point to be carefully observed from Eq. (2.109) is that the second upwind
should be written in conservative form. However, the definition of uR and uL
are (see Fig. 2.9):
ui,j + ui+1,j ui,j + ui−1,j
uR = ; uL = (2.110)
2 2
Now,

ζR = ζi,j for uR > 0 ; ζR = ζi+1,j for uR < 0 (2.111)

and

ζL = ζi−1,j for uL > 0 ; ζL = ζi,j for uL < 0 (2.112)

Finally, for uR > 0 and uL > 0, we get


    
∂(uζ) 1 ui,j + ui+1,j ui,j + ui−1,j
= ζi,j − ζi−1,j (2.113)
∂x ∆x 2 2

Let us discretize the second term of the convection part of unsteady x-direction
momentum equation. We have chosen this in order to cite a meaningful example
of second upwind differencing. Using Eq. (2.113), we can write

∂u2
    
1 ui,j + ui+1,j ui,j + ui−1,j
= ui,j − ui−1,j
∂x i,j ∆x 2 2
  
1 ui,j + ui+1,j ui,j + ui+1,j + ui,j − ui+1,j
=
∆x 2 2
  
ui,j + ui−1,j ui−1,j + ui,j + ui−1,j − ui,j

2 2
1
= [(ui,j + ui+1,j )[(ui,j + ui+1,j ) + (ui,j − ui+1,j )]
4∆x
− (ui−1,j + ui,j )[(ui−1,j + ui,j ) + (ui−1,j − ui,j )]]

1
= (ui,j + ui+1,j )2 + (u2i,j − u2i+1,j )
4∆x

− (ui−1,j + ui,j )2 − (u2i−1,j − u2i,j )
(2.114)
2.36 Computational Fluid Dynamics

uL uR

i−2,j i−1,j i,j i+1,j i+2,j

Figure 2.9: Definition of uR and uL .

Here we introduce a factor η which can express Eq. (2.114) as a weighted


average of central and upwind differencing. Invoking this weighted average
concept in Eq. (2.114), we obtain
∂u2

1
= = (ui,j + ui+1,j )2 + η|(ui,j + ui+1,j )|(ui,j − ui+1,j )
∂x i,j 4∆x

2
− (ui−1,j + ui,j ) − η|(ui−1,j + ui,j )|(ui−1,j − ui,j )
(2.115)
where 0 < η < 1. For η = 0, Eq. (2.115) becomes centred in space and for η = 1
it becomes full upwind. So η brings about the upwind bias in the difference
quotient. If η is small, Eq. (2.115) tend towards centred in space. This upwind
method was first introduced by Gentry, Martin and Daly (1966). Some more
stimulating discussions on the need of upwinding and its minimization has been
discussed by Roache (1972) who has also pointed out that the second upwind-
formulation possesses both the conservative and transportive property provided
the upwind factor (formally called donorcell factor) is not too large. In principle,
the weighted average differencing scheme can as well be called as hybrid scheme
(see Raithby and Torrence, 1974) and the accuracy of the scheme can always be
increased by a suitable adjustment of η value.

2.5.6 Some More Suggestions for Improvements


Several researchers have tried to resolve the difficulty associated with the dis-
cretization of the first-order terms which need some amount of artificial viscosity
for stability. Substantial progress has been made on the development of higher-
order schemes which are suitable over a large range of velocities. However, none
of these prescriptions are universal. Depending on the nature of the flow and
geometry one can always go for the best suited algorithm. Now we shall discuss
one such algorithm which has been proposed by Khosla and Rubin (1974).
Consider the Burger’s equation. (2.80) once again. The derivatives in this
equation are discretized in the following way.
Finite Difference Method 2.37

For u > 0

∂ζ ζ n+1 − ζin
= i (Forward time)
∂t ∆t
n+1 n+1
∂ζ ζ − ζi−1 ζ n − 2ζin + ζi−1
n
= i + i+1
∂x ∆x 2∆x

This is modified central difference in space, which for a converged solution


(ζin+1 = ζin ) reduces to space centred scheme. Now, consider the diffusion
term
n+1
∂2ζ ζi+1 − 2ζin+1 + ζi−1
n+1
=
∂x2 (∆x)2
This is central difference in space. Substituting the above quotients in Eq. (2.80),
one finds
n+1
−Aζi+1 + Bζin+1 − Cζi−1
n+1
= Di (2.116)

where

ν∆t u∆t ν∆t u∆t ν∆t


A= , C= + , B =1+ +2
(∆x)2 ∆x (∆x)2 ∆x (∆x)2

and
 
u∆t u∆t n
Di = 1+ ζin − (ζ n
+ ζi−1 ) (2.117)
∆x 2∆x i+1

For ui > 0, Ai , Bi and Ci > 0 and Bi > Ai + Ci . The system of equations pro-
duced from Eq. (2.116) is always diagonally dominant and capable of providing
a stable solution. As the solution progresses (i.e. uni → un+1 i ), the convective
term approaches second-order accuracy. This method of implementing higher-
order upwind is known as the “deferred correction procedure”.
Another widely suggested improvement is known as third-order upwind dif-
ferencing (see Kawamura et al. 1986). The following example illustrates the
essence of this discretization scheme.
   
∂u −ui+2,j + 8 (ui+1,j − ui−1,j ) + ui−2,j
u = ui,j
∂x i,j 12 ∆x
 
ui+2,j − 4 ui+1,j + 6 ui,j − 4 ui−1,j + ui−2,j
+ |ui,j |
4 ∆x (2.118)

Higher order upwinding is an emerging area of research in Computational Fluid


Dynamics. However, so far no unique suggestion has been evolved as an opti-
mal method for a wide variety of problems. Interested readers are referred to
Thomas Algorithm is described at the last two pages

2.38 Computational Fluid Dynamics

Vanka (1987), Fletcher (1988) and Rai and Moin (1991) for more stimulating
information on related topics.
One of the most widely used higher order schemes is known as QUICK
(Leonard, 1979). The QUICK scheme may be written in a compact manner in
the following way
 
∂u ui−2 − 8 ui−1 + 8 ui+1 − ui+2
f = fi
∂x i 12 ∆x
2
  
(∆x) −ui−2 + 2 ui−1 − 2 ui+1 + ui+2
+ fi
24 (∆x)3
3
  
(∆x) ui−2 − 4 ui−1 + 6 ui − 4 ui+1 + ui+2
+ |fi |
16 (∆x)4 (2.119)

The fifth-order upwind scheme (Rai and Moin, 1991) uses seven points stencil
along with a sixth-order dissipation. The scheme is expressed as
 
∂u ui+3 − 9 ui+2 + 45 ui+1 − 45 ui−1 + 9 ui−2 − ui−3
f = fi
∂x i 60 ∆x
 
ui+3 − 6 ui+2 + 15 ui+1 − 20 ui + 15 ui−1 − 6 ui−2 + ui−3
− α|fi |
60 ∆x
(2.120)

2.6 Some Non-Trivial Problems with Discretized


Equations
The discussion in this section is based upon some ideas indicated by Hirt (1968)
which are applied to model Burger’s equation as

ζin+1 − ζin n n  n
ζi+1 − ζi−1 ζi+1 − 2 ζin + ζi−1
n 
+u =ν (2.121)
∆t 2∆x (∆x)2

From this, the modified equation becomes[vide Art.2.5.4]

u2 ∆t
 
∂ζ
+ u ζx = ν− ζxx (2.122)
∂t 2

We define
ν(∆t) u∆t
r= ; C= = Courant number
(∆x)2 ∆x

It is interesting to note that the values r = 1/2 and C = 1 (which are extreme
conditions of Von Neumannn stability analysis) unfortunately eliminates viscous
diffusion completely in Eq. (2.122) and produce a solution from Eq. (2.121)
Finite Difference Method 2.39

directly as ζin+1 = ζi−1


n
which is unacceptable. From Eq. (2.122) it is clear that
in order to obtain a solution for convection diffusion equation, we should have

u2 ∆t
ν− >0
2
For meaningful physical result in the case of inviscid flow we require
u2 ∆t
ν− =0
2
Combining these two criteria, for a meaningful solution

u2 ∆t
ν− ≥0
2
or  
1 u ∆t u ∆x
ν 1− · ≥0 (2.123)
2 ∆x ν
Here we define the mesh Reynolds-number or cell-peclet number as
u∆x
Re∆x = = P e∆x
ν
So, we get  
1
ν 1 − C · Re∆x ≥ 0
2
or
2
Re∆x ≤ (2.124)
C
The plot of C vs Re∆x is shown in Fig. 2.10 to describe the significance of
Eq. (2.124). From the CFL condition, we know that the stability requirement is
C ≤ 1. Under such a restriction, below Re∆x = 2, the calculation is always sta-
ble. The interesting information is that it is possible to cross the cell Reynolds
number of 2 if C is made less than unity.

References
1. Anderson, D.A., Tannehill, J.C, and Pletcher, R.H., Computaional Fluid
Mechanics and Heat Transfer, Hemisphere Publishing Corporation, New
York, USA, 1984.
2. Burgers, J.M., A Mathematical Model Illustrating the Theory of Turbu-
lence, Adv. Appl. Mech., Vol. 1, pp. 171-199, 1948.
3. DuFort, E.C. and Frankel, S.P., Stability Conditions in the Numerical
Treatment of Parabolic Differential Equations, Mathematical Tables and
Others Aids to Computation, Vol. 7, pp. 135-152, 1953.
2.40 Computational Fluid Dynamics

1 CFL
restriction

0
2 4 6 8
Re∆ x

2
Figure 2.10: Limiting Line (Re∆x ≤ ).
C

4. Fletcher, C.A.J., Computational Techniques for Fluid Dynamics, Vol. 1


(Fundamentals and General Techniques), Springer Verlag, 1988.

5. Gentry, R.A., Martin, R.E. and Daly, B.J., An Eulerian Differencing


Method for Unsteady Compressible Flow Problems, J. Comput. Phys.,
Vol. 1, pp. 87-118, 1966.

6. Hirt, C.W., Heuristic Stability Theory of Finite Difference Equation, J.


Comput. Phys., Vol. 2, pp. 339-355, 1968.

7. Kawamura, T., Takami, H. and Kuwahara, K., Computation of High


Reynolds Number Flow around a Circular Cylinder with Surface Rough-
ness, Fluid Dynamics Research, Vol. 1, pp. 145-162, 1986.

8. Khosla, P.K. and Rubin, S.G., A Diagonally Dominant Second Order Ac-
curate Implicit Scheme, Computers and Fluids, Vol. 2, pp. 207-209, 1974.

9. Lax, P.D. and Wendroff, B. Systems of Conservation Laws, Pure Appl.


Math, Vol. 13, pp. 217-237, 1960.

10. Leonard, B.P., A Stable and Accurate Convective Modelling Procedure


based on Quadratic Upstream Interpolation, Comp. Methods Appl. Mech.
Engr., Vol. 19, pp. 59-98, 1979.

11. Rai, M.M. and Moin, P., Direct Simulations of Turbulent Flow Using
Finite Difference Schemes, J. Comput. Phys., Vol. 96, pp. 15-53, 1991.
Finite Difference Method 2.41

12. Raithby, G.D. and Torrance, K.E., Upstream-weighted Differencing Schemes


and Their Applications to Elliptic Problems Involving Fluid Flow, Com-
puters and Fluids, Vol. 2, pp. 191-206, 1974.

13. Roache, P.J., Computational Fluid Dynamics, Hermosa, Albuquerque,


New Mexico, 1972 (revised pritning 1985).

14. Runchal, A.K. and Wolfshtein, M., Numerical Integration Procedure for
the Steady State Navier-Stokes Equations, J. Mech. Engg. Sci., Vol. 11,
pp. 445-452, 1969.

15. Thomas, L.H., Elliptic Problems in Linear Difference Equations Over a


Network, Watson Sci. Comput. Lab. Rept., Columbia University, New
York, 1949.

16. Vanka, S.P., Second-Order Upwind Differencing in a Recirculating Flow,


AIAA J., Vol. 25, pp. 1435-1441, 1987.

Problems
1. Consider the nonlinear equation

∂u ∂ 2u
u =µ 2 (2.125)
∂x ∂y

where µ is a constant and u the x component of velocity. The normal


direction is y.
(a)Is this equation in conservative form? If not, suggest a conservative
form of the equation.
(b) Consider a domain in x (x = 0 to x = L) and y (y = 0 to y = H)
and assume that all the values of the dependent variable are known at
x = 0 (along y = 0 to y = H at every ∆y interval). Develop an implicit
expression for determining u at all the points along (y = 0 to y = H) and
the next (x + ∆x)

2. Establish the truncation error of the following finite-difference approxima-


tion to ∂T /∂y at the point (i, j) for a uniform mesh

∂T −3 Ti,j + 4 Ti,j+1 − Ti,j+2


=
∂y 2 (∆y)

What is the order of the truncation error? If you want to apply a second
-order-accurate boundary condition for ∂T /∂y = 0 at the boundary (refer
to Fig. 2.11), can you make use of the above mentioned expression? If
yes, what should be the expression for Ti,j at the boundary?
2.44 Computational Fluid Dynamics

A: explicit Euler scheme


B: implicit Euler scheme
C: three-point backward scheme (implicit)
D: Lax-Keller scheme (explicit)
E: Lax-Wendroff scheme (explicit)
F: Mac Cormack scheme (predictor-corrector, explicit)
G: Low-storage Runge-Kutta scheme (3 sub-steps, explicit)

Appendix
Thomas algorithm
We have already seen in Chapter2 that in Crank Nicolson solution procedure,
we get a system of algebric equations which assumes the form of a tridiagonal
matrix problem. Here we shall discuss a very well known solution procedure
known as Thomas algorithm(1949) which utilizes efficiently the advantage of
the tridiagonal form. A tridiagonal system is:
    
d1 a1 0 0 ... ... 0 x1 c1
 b2 d2 a2 0 0 .   x2   c2 
    
 0 b3 d3 a3 0 0 .   x3   c3 
   

0 0 b4 d4 a4 0 0   x4  =  c4 
   

. 0 0  .    . 
   

0 aN −1   .   . 
0 . . . . . . . . . 0 bN dN xN cN
The Thomas Algorithm is a modified Gaussian matrix-solver applied to a tridaig-
onal system. The idea is to transform the coefficient matrix into a upper trian-
gular form. The intermediate steps that solve for x1 , x2 ...xN :
Change di and ci arrays as
 old
bi
dnew
i = d old
i − a i−1 , i = 2, 3 . . . N
di−1
and

dnew
1 = dold
1

Similarly

 old
bi
cnew
i = cold
i − ci−1 , i = 2, 3 . . . N
di−1
and

cnew
1 = cold
1
Finite Difference Method 2.45

At this stage the matrix in upper triangular form. The solution is then obtained
by back substitution as
cN
xN =
dN
and

ck − ak xk+1
xk = , k = N − 1, N − 2, N − 3, . . . 1
dk

Please look at the new diagonal array and the RHS vector calculation:

do i = 2,n
r= bb (i)/ dd (i-1)
dd (i) = dd (i)- r *aa(i-1)
cc(i) = cc (i) - r *cc (i-1)
end do
The program will have only one array for the diagonal as dd(i) and only
one array for the RHS column vector as cc(i)

You might also like