What is CFD and Why?
SOE3213/4: CFD Lecture 1
1.1 Overview
Computational Fluid Dynamics { use of computers to study
uid dynamics.
Solve the Navier-Stokes Equations (NSE) :
r:u = 0
Du
Dt
= rp + r2 u + F
4 equations for 4 unknowns,
coupled,
non-linear,
and often involve complex geometries.
4 stage process
1. Modelling
N-S equations,
Turbulence
Combustion, multiphase, shocks : : :
2. Discretisation
3. Solving.
M u =q ) u = M 1q
p p
4. Interpretation
1
1.2 User's perspective
From the user's point of view, CFD modelling is a 3 stage process :
1. Problem denition.
geometry, mesh, boundary conditions
physical models, constants
2. Numerical solution.
dierencing schemes, soln techniques.
tolerances
actually running the solver
3. Postprocessing.
1.3 FD vs. FV (vs. FE)
Finite Dierence methods { variables represented at discrete points in space.
Derivatives evaluated
= j +1 j 1
@p p p
@x 2x
{ very complex if the grid distorted or complicated.
Finite Element (FE) methods have been used, but are not common.
Finite Volume (FV) method most common.
{ used in most commercial codes { Fluent, STAR-CD, CFX etc.
1.4 FV Method
ow region is divided into small boxes { cells or control volumes, forming
mesh.
equations reexpressed in terms of
ow into and out of each cell.
This is done by integrating the equations over the volume of each cell.
The result is a set of dierence equations which can be solved numerically
as before.
The advantage of doing things this way is that the cells can be any shape
required - cubes, tetrahedra, distorted cubes, or more complicated structures.
2
1.5 FV for transport equation
Water
owing in a river is contaminated by a chemical leak. Determine where
the chemical has reached after a given time t.
u
δx Α
w e
W P E
Flow uniform throughout the channel : const. speed u at all points.
Concentration q of contaminant
@q @uq @
@q
+ =
@t @x @x @x
{ the 1-d transport equation.
To apply the FV method, we :
1. Split the channel into cells V = Ax
2. integrate transport eqn over the cell.
First term :
ZZZ @q d
ZZZ d
dV = qdV = (qV )
V @t dt V dt
Second term : dV = Adx
ZZZ @uq
ZZZ @uq
dV = Adx = (uqA)e (uqA)w
V @x V @x
These two terms are now being evaluated on the boundary face between the
cells. However we do not know the value of the variables on w and e. Need to
interpolate to get these values.
Upwind dierencing
(uq)w = (uq)W ; (uq)e = (uq)P
3
Central dierencing
(uq)W + (uq)P
(uq)w =
2
Diusion can be treated similarly
Discretised equations :
d
@q
@q
(qV ) + (uqA)e (uqA)w = A A
dt @x e @x w
Rearanging a bit and using central dierencing to interpolate, we get
dq u
+ (qE qW ) = (qE 2qP + qW )
dt 2x x2
Number the cells i = 0 : : : N !:
dqi u
= (qi+1 qi 1 ) + x2 (qi+1 2qi + qi 1 )
dt 2x
1.6 Temporal discretisation
This problem is parabolic one { solve by timestepping { discretisation of time
into M timesteps qj .
Time derivative
dq q j +1 q j
=
dt t
At what timestep are the values on the r.h.s. evaluated?
Take values at timestep j , ! explicit scheme.
Take values at timestep j + 1, ! implicit scheme.
Explicit scheme :
+1 =
ut
(qi+1 j
1)
j j
qi qi qi
2x
t
+ (qi+1 2qi + qi 1 )j
x2
Write
ut t
C = ; D =
x x2
C = Courant number { signicant parameter in determining the stability
of the scheme.
4
D relates to the diusion.
Writing this out as an algorithm :
C C
+1 = +D 1 + (1 2D) +
j j j j
qi qi qi D qi+1
2 2
A rule for advancing the values of q through one timestep, which could be
written into a spreadsheet.
Implicit scheme : write as a matrix equation :
0. 10 . 1 0 . 1
.. .. ..
B
B C
C B
B +1 C B C
qi 1 C B qi 1 C
j j
B D U 0 C B C B C
B
B C
C B
B qi C
j +1
=B qi C
j
+1 C Bqj C
C B
L D U
B
@ 0 L D AB
C @qij+1 A @ i+1 C A
... .. ..
. .
Inverting this matrix provides the solution without the stability problems. (al-
though the Courant number is still worth calculating if there are problems).
1.7 3d transport equation
This scheme could be derived by standard FD techniques. This is because the
mesh we are dealing with was regular and uniform. However this is not always
the case.
FV approach makes it much easier to evaluate the various terms for irregular
shaped cells.
The 3d transport equation :
@q
+ r:uq = r: rq + Sq
@t
When we integrate the second term here, we nd
ZZZ X
r:uq dV = uq
V A
{ Gauss' theorem in vector calculus.