Вы находитесь на странице: 1из 89

DEPARTMENT OF MECHANICAL

ENGINEERING,
SHARDA UNIVERSITY
Computational Fluid Dynamics
(MEC019)
By
Mr. Manish Sharma

Lecture no. 6 (Discretization)


Overview of numerical methods
Many CFD techniques exist.
The most common in commercially available CFD programs are:
The Finite Volume Method - broadest applicability (~80%).
The Finite element (~15%) limited due to greater computational
resources and computer processing power.
Here we will focus on the finite volume method.
There are certainly many other approaches (5%), including:
Finite difference (Unknowns of the governing equations are replaced with truncated
Taylor series)
Spectral methods (Unknowns of the governing equations are replaced with truncated
Fourier series)
And more! (Boundary element, Vorticity based methods & Lattice gas/lattice Boltzmann)
3
Overall Computational Solution Procedure
Discretisation approaches
Finite difference Finite volume
Basic derivations of finite volume
equations
Basic derivations of finite difference
equations
System of algebraic equations
Governing partial differential equations and
boundary conditions
Numerical methods
Approximate solutions: u, v, w, p, etc.
4
Overall Computational Solution Procedure
Many types of grid generation: type is usually related to capability
of flow solver.
Structured grid A structured grid consists of planar cells with
four edges (4 nodal corner points) in 2-D or volumetric cells with
six faces (hexahedral shape, 8 nodal corner point) in 3-D.
Unstructured grid - various shapes, but typically triangles or
quadrilaterals (2-D) and tetrahedrons or hexahedrons (3-D)
Hybrid grids - some portions of flow field are structured (viscous
regions) and others are unstructured
32 38 76
5
Overall Computational Solution Procedure
For complex geometries, an unstructured grid is usually much
easier for the user of the grid generation code to create.
However structured grids have certain advantages: convergence
more rapidly, and often more accurately, by utilizing the index
feature of structured grids. Fewer cells are usually generated with
a structured grid than with an unstructured grid.
Hybrid grid (2D) near a curved surface; two
structured regions and one unstructured
region are labeled
6
Discretising equations - What are we solving?
Need to know
values of each variable (e.g. u) at each point
values of the first derivative
values of cross-derivatives
values of second derivatives
..and more
Practical consequences of discretisation
Errors arise from spacing of grid needs to be small
enough to represent the key aspects of the flow
Errors arise from the order of the equations
1
st
order should generally not be used
Only 2
nd
order solutions are acceptable for journal
publication

7
Finite difference method (FDM)
Historically, the oldest of the three.
The numerical methods for solving
differential equations are based on
replacing the differential equations
by algebraic equations.
In the Finite Difference Method, this
is done by replacing the derivatives
by differences.
In order to use finite differences, one
should define a structured grid.
Advantage: easy to implement.
Disadvantages: restricted to simple
grids and does not conserve
momentum, energy, and mass on
coarse grids.
8
Finite difference method (FDM)
The domain is discretized into a series of grid points.
The governing equations (in differential form) are discretized on
grid points.
First and second derivatives are approximated by truncated
Taylor series expansions.
The resulting set of linear algebraic equations is solved either
iteratively or simultaneously.
This approach uses numerical approximations to the spatial
derivatives. Example is a finite difference approximation to a
1st order derivative at a mesh point
i i
i i
i
x x x

~
c
c

1
1
| | |
9
Mesh Notations in Cartesian Grid
1D and 2D uniformly distributed Cartesian grid
for the finite difference method
I = 1 I = N
I = 1 I = NI
J = 1
J = NJ
i i + 1 i 1
j
j + 1
j 1
i i + 1 i 1
(i, j)
Ax
Ay
x
y
10
First order derivative for c|/cx
Finite difference representation
i i + 1 i 1
|
i 1

|
i + 1

|
i

|(x)
x
Exact
Central
Forward
Backward
A
B
C
11
Discretising equations - 1
st
Order

Finite
Difference
12
Discretising equations - 1
st
Order

Finite
Difference
13
Discretising equations - 1
st
Order

Finite
Difference
14
Discretising equations - 1
st
Order

Finite
Difference
End of Lecture
15
Discretising equations - 1
st
Order

Finite
Difference
Next Lecture
16
Discretising equations - 1
st
Order

Finite
Difference
17
Discretising equations - 1
st
Order

Finite
Difference
18
Discretising equations - 1
st
Order

Finite
Difference
19
Discretising equations - 1
st
Order

Finite
Difference
20
Discretising equations 1
st
Order

Finite
Difference
21
Discretising equations - 2nd Order

Finite
Difference
22
Discretising equations Mixed Finite
Difference
Take backward pt Taylor expansion series and differentiate w.r.t y
23
Discretising equations Mixed Finite
Difference
later former
Integral Method
29
Finite Volume Method (FVM)
First well-documented use was by Evans and Harlow (1957) at Los
Alamos and Gentry, Martin and Daley (1966).
Was attractive because while variables may not be continuously
differentiable across shocks and other discontinuities mass,
momentum and energy are always conserved.
Solve PDEs by replacing continuous functions by piecewise
polynomial approximations. Similar to FDM.
FVM enjoys an advantage over FEM in memory use and speed for
very large problems, higher speed flows, turbulent flows, and source
term dominated flows (like combustion).
Late 70s, early 80s saw development of body-fitted grids. By early
90s, unstructured grid methods had appeared.
Advantages: basic FV control volume balance does not limit cell
shape; mass, momentum, energy conserved even on coarse grids;
efficient, iterative solvers well developed.
Disadvantages: false diffusion when simple numerics are used.
30
Finite Volume Method (FVM)
Most popular approach, especially for commercial codes
Named after Italian mathematician Joseph Louis Lagrange (1736-
1813).
Lagrangian description of fluid flow tracks the position and velocity
of individual particles.
Based upon Newton's laws of motion.
Use CV form of Navier-Stokes equations (NSE) on each grid cell.


Difficult to use for practical flow analysis.
However, useful for specialized applications Sprays, particles,
bubble dynamics, rarefied gases.
Coupled Eulerian-Lagrangian methods.
31
Finite volume: basic methodology
Divide the domain into control volumes.
Integrate the differential equation over the control volume
and apply the divergence theorem.
To evaluate derivative terms, values at the control volume
faces are needed: have to make an assumption about
how the value varies.
Result is a set of linear algebraic equations: one for each
control volume.
Solve iteratively or simultaneously.
32
Finite Volume Method (FVM)
33
Cells and nodes
Using finite volume method, the solution domain is
subdivided into a finite number of small control volumes
(cells) by a grid.
The grid defines the boundaries of the control volumes while
the computational node lies at the center of the control
volume.
The advantage of FVM is that the integral conservation is
satisfied exactly over the control volume.
x
y
Control Volume
Structured
Grid
Unstructured
Grid
x
y
Control Volume
34
Finite volume: basic methodology
35
Finite Volume Method
36
Finite volume: basic methodology
37
Finite Volume Method
38
Finite Volume Method
1D steady State diffusion equation
39
Finite Volume Method
By applying Gauss divergence theorem to the volume
integral, the first order derivative of | in two dimensions, can
be approximated by

} }
=
A
~
A
=
c
c
A
=
|
.
|

\
|
c
c
N
i
x
i i
A
x
V
A
V
dA
V
dV
x V x
1
1 1 1
| |
| |

} }
=
A
A
~
A
=
c
c
A
=
|
|
.
|

\
|
c
c
N
i
y
i i
A
y
V
A
V
dA
V
dV
y V y
1
1 1 1
| |
| |
In x direction
In y direction
variable value at elemental surfaces and N denotes the
number of bounding surfaces on the elemental volume
Control Volume
P
E W
N
S
n
e
s
w
x
y
Ay
Ax
40
Discretization Example I
Determine the discretised form of the two-dimensional
continuity equation by the finite volume method in a structured
uniform grid arrangement
Continuity
Equation
0 =
c
c
+
c
c
y x
u v

} }
=
=
A
~
A
=
c
c
A
4
1
1 1 1
i
x
i i
A
x
V
A u
V
udA
V
dV
x
u
V
( )
x
s s
x
n n
x
w w
x
e e
A u A u A u A u
V
+
A
1
In x direction
In y direction

( )
4
1
1 1 1 1
y y y y y y
i i e e w w n n s s
i
V A
dV dA A A A A A
V y V V V
=
c
= ~ = +
A c A A A

} }
v
v v v v v v
( )
4
1
1 1 1 1
y y y y y y
i i e e w w n n s s
i
V A
dV dA A A A A A
V y V V V
=
c
= ~ = +
A c A A A

} }
v
v v v v v v
41
Discretization Example I
Determine the face velocities from the values located at the
centroids of the control volumes
2
E P
e
u u
u
+
=
2
W P
w
u u
u
+
=
2
N P
n
v v
v
+
=
2
S P
s
v v
v
+
=
Final form of the discretised continuity equation becomes
0
2 2 2 2
=
|
.
|

\
|
+

|
.
|

\
|
+
+
|
.
|

\
|
+

|
.
|

\
|
+
y
s
S P y
n
N P x
w
W P x
e
E P
A A A
u u
A
u u v v v v
y A A
x
w
x
e
= =
x A A
y
s
y
n
= =
with
0
2

2
= |
.
|

\
|
+
|
.
|

\
|
+
+ |
.
|

\
|
+

|
.
|

\
|
+
x x y
u u
y
u u
S P N P W P E P
v v v v
0
2

2
= |
.
|

\
|

+ |
.
|

\
|

x y
u u
S N W E
v v
42
Pure Diffusion Process
Steady heat conduction problem
in a large brick plate with a
uniform heat generation
x
y
z
A
B
T
A
=100
o
C

T
B
=400
o
C
L
q =500 W/m
3
Finite Volume discretization of the large
brick domain
In the absence of fluid motion the convective term is zero
and the process is pure diffusion. An example of a pure
diffusion process is heat conduction through a solid object.

0 =
|
.
|

\
|
c
c
c
c

diffusion
x x
|
43
Converting Governing Equations to
Algebraic Equations I
Steady heat conduction problem in a large brick plate with a
uniform heat generation
x
y
z
A
B
T
A
=100
o
C

T
B
=400
o
C
L
q =500 W/m
3
Control Volume
ox ox
ox
P E W
e w
1
2 3
4
T
A
T
B

ox/2 ox/2
Finite Volume discretization of the large
brick domain
44
Converting Governing Equations to
Algebraic Equations II
For a constant thermal conductivity and uniform heat
generation, the equation becomes
0 = +
|
.
|

\
|
c
c

|
.
|

\
|
c
c
x q
x
T
k
x
T
k
w e
o
0
2
= +
|
|
.
|

\
|
|
.
|

\
|

x q
x
T T
kA
x
T T
kA
A P P E
o
o o
Linear approximation gives:
b T a T a T a
W W E E P P
+ + =
Rearrange the above equation into algebraic equation
45
Converting Governing Equations to
Algebraic Equations III
For Node 2 and 3, the coefficients are
x
kA
a
E
o
=
x
kA
a
W
o
=
W E P
a a a + =
x q b o =
For Node 1, the coefficients are
x
kA
a
E
o
=
0 =
W
a
x
kA
a a
E P
o
2
+ =
A
T
x
kA
x q b
o
o
2
+ =
For Node 4, the coefficients are
0 =
E
a
x
kA
a
W
o
=
x
kA
a a
W P
o
2
+ =
B
T
x
kA
x q b
o
o
2
+ =
Control Volume
ox ox
ox
P
E W
e w
1
2 3
4
T
A
T
B

ox/2 ox/2
46
Converting Governing Equations to
Algebraic Equations III
Coefficients at each node of the control volumes
Node a
E
a
W
a
P
b
1 1000 0 3000 2500 + 2000 T
A

2 1000 1000 2000 2500
3 1000 1000 2000 2500
4 0 1000 3000 2500 + 2000 T
B


Control Volume
ox ox
ox
P
E W
e w
1
2 3
4
T
A
T
B

ox/2 ox/2
47
Converting Governing Equations to
Algebraic Equations IV
Coefficients at each node of the control volumes
Node a
E
a
W
a
P
b
1 1000 0 3000 2500 + 2000 T
A

2 1000 1000 2000 2500
3 1000 1000 2000 2500
4 0 1000 3000 2500 + 2000 T
B


The resultant matrix form of the algebraic equations
3000 -1000 0 0 T
1
2000 T
A
+ 2500
-1000 2000 -1000 0 T
2
2500
0 -1000 2000 -1000 T
3
2500
0 0 -1000 3000 T
4
2000 T
B
+ 2500

=
Substitute
2
W/m 5 = k
3
kW/m 500 = q
m 005 . 0 = x o
2
m 1 = A
48
Finite Volume Method
1D steady State
convective-diffusion
equation
49
Convective-diffusion Process
Steady heat conduction problem in
a large brick plate with a uniform
heat generation exposed to water
on one side
z
x
y
A
B
T
A
=100
o
C

Water
L
Finite Volume discretization of the large brick
domain along with specified boundary condition
A steady convective-diffusion process consists of the fluid
in motion and this is reflected through the convective (also
called advective) term. Diffusion always occurs alongside
convection.
( ) 0 =
|
.
|

\
|
c
c
c
c

c
c


diffusion
convective
x x
u
x
|
|
50
Central Difference Scheme
51
Finite Volume Method - CDS
52
53
Finite Volume Method - CDS
54
Finite Volume Method - CDS
55
Finite Volume Method - CDS
Note that as F/D ratio reduces,
solution converges
Case 1: 0.2 & Ax = 0.2m
Case 2: 5 & Ax = 0.2m
Case 3: 1.25 & Ax = 0.05m
56
Finite Volume Method - CDS
57
Finite Volume Method - CDS
See Example of case 2
58
Finite Volume Method - CDS
59
Finite Volume Method
60
First order upwind Scheme
61
Upwind scheme
62
Upwind scheme
63
Upwind scheme
64
Upwind scheme
65
Upwind scheme
66
Upwind scheme
67
Upwind scheme
Note for same grid size,
CDS Failed to produce
reasonable results
68
Hybrid Scheme
Note accuracy
of Hybrid and
upwind is of
first order only
69
Hybrid Scheme
70
Hybrid Scheme
71
Hybrid Scheme
72
Second Order Upwind Scheme
73
Power Law Scheme
Note more accurate than
Hybrid and upwind.
74
Power law scheme
75
Quadratic Upwind Interpolation
76
Quadratic Upwind Interpolation
77
Quadratic Upwind Interpolation
78
Quadratic Upwind Interpolation
79
Quadratic Upwind Interpolation
80
Quadratic Upwind Interpolation
81
Quadratic Upwind Interpolation
82
Quadratic Upwind Interpolation
Note since quadratic
function hence third order
accurate.
Also for Pe > 2.5, stability
problems and may diverge
in some flows.
83
Summary
Note higher schemes can minimize the false diffusion error due to higher
order accuracy but generally less computationally stable.
84
Summary
Quadratic Upwind Interpolation
85
Finite Volume Method
86
87
Finite Volume Method
88
Finite Volume Method
89
Finite Volume Method
1st order upwind works best in problems which are
dominated by real diffusion and will be accurate where
the real diffusion exceeds the numerical diffusion. Also
useful as a starting point in solution
Most CFD problems are dominated by advection (flow)
and hence higher order schemes are probably going to
be the most accurate. So you will probably use at least
2nd order upwind.
Many problems will converge well with the higher order
schemes anyway
However this is also very dependent on grid quality. The
higher order schemes will give the most improvement in
accuracy on poorer quality grids.

Вам также может понравиться