Computational Fluid Dynamics : February 28

Download as pdf or txt
Download as pdf or txt
You are on page 1of 68

COMPUTATIONAL FLUID

DYNAMICS (MKM411)
Prof. M. Sharifpur
[email protected]

February 28th
Department of Mechanical and Aeronautical Engineering
University of Pretoria

2019
Thursday Mach 7 th

Demonstrations on our licenced


CFD software packages
(ANSYS FLUENT, STAR
CCM+ and FLoEFD)
Registration for the packages
will be after the demonstration
Finite Difference Method (FDM)
Computational Solution

Finding;
- Governing (Differential) Equations
- Initial & Boundary Conditions 
Discretization of the Domain 
Changing Differential Eqs. to Algebraic Eqs.

Solving the system of Algebraic equations


Algebraic equations instead of differential Eq.
For example, the governing equations for incompressible, steady and
constant properties (µ, Cp, k);
Conservation of Mass u v w
  0
x y z
X-direction 
 u u u  p   2u  2u  2u 
  u  v  w     f x    2  2  2 
 x y z  x  x y z 
Energy Eq.

 T T T    2T  2T  2T 
c u v w     k  2  2  2   egen
 x y z   x y z 
 u  2  v  2  w  2   v u 
2
 w v 
2
 u w 
2

  2                      
 x   y   z    x y   y z   z x 

Differential Eqs. to Algebraic equations


Which parts must be     2
 2

changed? , , , 2 , 2 and 2
2

x y z x y z
Discretization of the Domain
h, T

Tm ,n  T2,1

Number of the Nodes = 1+ Number of elements


(in each Row or Column)
x can be  y, but in general x  y
Discretization of the Domain

Boundary Nodes & Internal Nodes

Number of internal Nodes in each Row or Column =


=Number of Nodes of the same Row or Column - 2
Algebraic equations instead of differential Eq.
For first order  ,  ,  in the case of 1D d , d , d
x y z dx dy dz
df  x  f f  x  x   f  x 
 lim  lim
dx x 0 x x 0 x

df  x  f  x  x   f  x 

dx x

In the case of 3D
f ( x, y, z ) f ( x  x, y, z )  f ( x, y, z )

x x
f ( x, y, z ) f ( x, y, z ) f ( x, y, z  z )  f ( x, y, z )
? 
z z z
d 2T ( x)
2
 ? for 1D
dx
dT ( x) 1 2 d 2T ( x)
T ( x  x)  T ( x)  x  x 2
 ...
dx 2 dx
2 Add together
dT ( x) 1 2 d T ( x)
T ( x  x)  T ( x)  x  x 2
 ...
dx 2 dx
d 2T ( x) T ( x  x)  2T ( x)  T ( x  x)

dx 2
x 2
And in general

d 2Ti Ti 1  2Ti  Ti 1
or 
dx 2
(x) 2
One-Dimensional Steady Heat Conduction
Steady one-dimensional heat
conduction in a plane wall of
thickness L with heat generation.

The wall is subdivided into M


sections of equal thickness x=L/M.
M+1 points 0, 1, 2, . . . , m, m+1, . . . , M
called nodes or nodal points.

The x-coordinate of any point m is xmmx.


The temperature at that point is simply T(xm)=Tm.
•Internal and boundary nodal points.
1D Steady Heat Conduction with heat generation (FDM)
The Governing equations should apply for the Internal nodes.
 T T T T    2T  2T  2T 
c
 u v w   k  2  2  2   egen , k  constant
 t x y z   x y z 
1D, Steady ,with heat generation

e
and constant k
d 2T e
2
 0
dx k

Boundary Conditions must be


applied for the Boundary nodes
1D, Steady ,with heat generation and constant k

d 2T e
2
 0
dx k

d 2T Tm1  2Tm  Tm1



2
dx m x 2
Tm1  2Tm  Tm1 em
 =0, m  1, 2,3, M 1
x 2
k
-The equation is applicable to each of the M-1 interior nodes
 M-1 equations for the determination of temperatures.
The two additional equations needed to solve for the M+1
unknown nodal temperatures
If L=10 cm and we divide the domain to 10
Therefore, Δx=1 cm
How many internal nodes do we have? 9

In general, how many unknown


temperature do we have? 11
Or M+1
Except , when we have constant
temperature at the boundaries.

In general, how many equations


do we need in order to find the
M+1 unknown? M+1
If L=10 cm and we divide the domain to 10
Therefore, Δx=1 cm and for k=const.
How many internal nodes do we have? 9

T0=10 C T10=100 C
e1
node11
node 10 T1022TT1 TT2 1  00
10 4
4 
e
kk
0 1 2

e2
node 2  10 T1  2T2  T3    0
4

 k
node 6  10 4 T5  2T6  T7   6  0
e
k
e8
node 8  10 T7  2T8  T9    0
4

k
ee99
node 9  10 T8  2T9  100
4
T10  00
kk
Therefore, if we need
more nodal temperature
we should make ⍙x
smaller.
One-Dimensional Steady Heat Conduction
Steady one-dimensional heat
conduction in a plane wall of
thickness L with heat generation.

The wall is subdivided into M


sections of equal thickness x=L/M.
M+1 points 0, 1, 2, . . . , m, m+1, . . . , M
called nodes or nodal points.

The x-coordinate of any point m is xmmx.


The temperature at that point is simply T(xm)=Tm.
•Internal and boundary nodal points.
1D Steady Heat Conduction with heat generation (FDM)
The Governing equations should apply for the Internal nodes.
 T T T T    2T  2T  2T 
c
 u v w   k  2  2  2   egen , k  constant
 t x y z   x y z 
1D, Steady ,with heat generation

e
and constant k
d 2T e
2
 0
dx k

Boundary Conditions must be


applied for the Boundary nodes
1D, Steady ,with heat generation and constant k

d 2T e
2
 0
dx k

d 2T Tm1  2Tm  Tm1



2
dx m x 2
Tm1  2Tm  Tm1 em
 =0, m  1, 2,3, M 1
x 2
k
-The equation is applicable to each of the M-1 interior nodes
 M-1 equations for the determination of temperatures.
The two additional equations needed to solve for the M+1
unknown nodal temperatures
Boundary Nodes in FDM
• A boundary node does not have a neighboring node
on at least one side.
• We need to obtain the finite difference equations of
boundary nodes separately in most cases.
• (specified temperature boundary conditions is an
exception).

• Energy balance on the volume elements of boundary


nodes will be apply.

 Q  Egen,element  0
egen V
All sides
Boundary Conditions Steady One-Dimensional
Heat Conduction in a Plane Wall
1. Specified temperature boundary conditions
• T(0)=T0=Specified value
• T(L)=TM=Specified value
• No need to write an energy balance
If L=10 cm and we divide the domain to 5
Therefore, Δx=2 cm and if k=2 and e  500 W/m
 3

d 2T e
How many internal nodes do we have? 4 2
 0
dx k

44 e1
node11
node
10
 10
10 T022TT1 1TT2 2 25000
44 k
10 4
node 2  T1  2T2  T3   250  0
4
10 4
node 3  T2  2T3  T4   250  0
4
1044

node44
node
10
TT33 22TT44 100
T5  
 250
25000
44
10 4 10 4
node1 10  2T1  T2   250  0 node 3  T2  2T3  T4   250  0
4 4
10 4 10 4
node 2  T1  2T2  T3   250  0 node 4  T3  2T4  100  250  0
4 4

node1 1010  2T1  T2   1  0

node 2  10T1  2T2  T3   1  0


node 3  10T2  2T3  T4   1  0
node 4  10T3  2T4  100   1  0

Four equations and four unknowns

T1  28.2 C , T2  46.3 C ,
T3  64.3 C and T4  82.2
T1  28.2 C , T2  46.3 C , T3  64.3 C and T4  82.2 From
FDM
Now, analytical exact solution:
d 2T e d 2T
2
 0 2
 250
dx k dx
250 2
T ( x)   x  C1 x  C2
2
T (0)  10 , T (0.1)  100

C1  915.5, C2  10

250 2
T ( x)   x  912.5 x  10
2
T (0.02)  28.2
The width of the volume element: x/2
In General at boundary
• An energy balance on the
volume element at that boundary:


All sides
Q  Egen,element  0

• The finite difference formulation


at the node m=0 can be expressed as:
T1  T0
Qleft surface  kA  e0  Ax / 2   0 (1)
x

• The finite difference form of various boundary


conditions can be obtained from Eq. (1)by replacing
Qleft surface
left surface by a suitable expression.
Let’s get back to the previous example and changing one
of the boundary conditions
node1 1010  2T1  T2   1  0 node 3  10T2  2T3  T4   1  0

node 2  10T1  2T2  T3   1  0 node 4  10T3  2T4  100   1  0

Four equations and four unknowns

T1  28.2 C , T2  46.3 C ,
T3  64.3 C and T4  82.2
With new boundary conditions
Internal nodes= ? 4
How many unknown T= ? 5
For Internal nodes:

node 1  10T0  2T1  T2   1  0

node 2  10T1  2T2  T3   1  0

node 3  10T2  2T3  T4   1  0

node 4  10T3  2T4  100   1  0


For boundary the node:
Δx=2 cm and k=2 e  500 W/m 3


All sides
Q  Egen,element  0

T1  T0
Qleft surface  kA  e0  Ax / 2   0
x
Q  q A

500(0.02)
100  100(T1  T0 )  0
2

100(T1  T0 )  105  0
node 0  100(T1  T0 )  105  0

node1 10T0  2T1  T2   1  0

node 2  10T1  2T2  T3   1  0


node 3  10T2  2T3  T4   1  0

node 4  10T3  2T4  100  1  0

T0  106.3 T1  105.2 T2  104.1 T3  102.8 T4  101.5


Numerical Result:
T0  106.3 T1  105.2 T2  104.1
T3  102.8 T4  101.5
Analytical Result:
250 2 dT (0)
T ( x)   x  C1 x  C2 k  100 , T (0.1)  100
2 dx

BC1)  (2)( 250(0)  C1 )  100 C1  50


250 C2  106.25
BC 2)  (0.1) 2  ( 50)(0.1)  C2  100
2
T ( x)  125 x 2  50 x  106.25
T0  T (0)  106.25 T1  T (0.02)  105.2 T2  T (0.04)  104.1
T3  T (0.06)  102.8 T4  T (0.08)  101.5 T5  T (0.1)  100
Finite Difference Method (FDM)
Internal Nodes

Differential Eqs.

Diff. Eqs. to
Algebraic Eqs.

Boundary Nodes

Boundary
Conditions

All sides
Q  Egen,element  0
The width of the volume element: x/2
In General at boundary
• An energy balance on the
volume element at that boundary:


All sides
Q  Egen,element  0

• The finite difference formulation


at the node m=0 can be expressed as:
T1  T0
Qleft surface  kA  e0  Ax / 2   0 (1)
x

• The finite difference form of various boundary


conditions can be obtained from Eq. (1)by replacing
Qleft surface
left surface by a suitable expression.
d 2T e
2
 0
dx k

Boundary Conditions
• Specified Temperature Boundary Condition
• Specified Heat Flux Boundary Condition
• Convection Boundary Condition
• Radiation Boundary Condition
• Interface Boundary Conditions
• Generalized Boundary Conditions
• Insulated Boundary Condition 31
T1  T0
 Q  Egen,element  0 Qleft surface  kA  e0  Ax / 2   0
All sides x

2. Specified Heat Flux Boundary Condition


T1  T0
q0 A  kA  e0  Ax / 2   0
x
3. Convection Boundary Condition
T1  T0
hA T  T0   kA  e0  Ax / 2   0
x

4. Radiation Boundary Condition


T1  T0
 A T 4
T 4
  kA  e0  Ax / 2   0
x
surr 0

5. Combined Convection and Radiation


T1  T0
hA(T  T0 )   A T  4
surr T 0
4
  kA
x
 e0  Ax / 2   0
Example
Consider heat conduction in a plain wall in the case of steady
state and constant properties. Inside the wall there is a
uniform heat generation of 5000 W/m³. The wall thickness is
10 cm ,assume Δx =1mm for domain discretization
Specify: k  20 W/m o C.
1- The governing differential
equation for this wall
2- The general algebraic equation
for internal nodes and then equation
for the second node.
3- The algebraic equation for
boundary nodes.
 T T T T    2T  2T  2T 
c  (u v  w )     k  2  2  2   egen
 t x y z   x y z 

Heat conduction in a plain wall (1D) in the case of


steady state and constant properties, with heat
generation, L=10 cm, Δx=1mm.
1- The governing differential
equation for this wall

 2T egen d 2T egen
 0   0
x 2
k dx 2
k
2- The general algebraic equation for
internal nodes and then equation for the
second node.
.
The general algebraic equation for internal nodes

x  1 mm  10 3 , egen  5000 W/m 3 , k  20 W/m o C

106 (Tm 1  2Tm  Tm 1 )  250  0

For the second node; m 1


106 (T0  2T1  T2 )  250  0

3- The algebraic equation for


boundary nodes.


All sides
Q  Egen,element  0
3- The algebraic equation for boundary nodes.

All sides
Q  Egen,element  0

3-1- For left side of the wall


T1  T0
Qleft surface  kA  e0  Ax / 2   0
x
A  11  1m 2 , x  10 3

Q left  hA(T  T0 )

3
10
h(T  T0 )  103 k (T1  T0 )  5000( )0
2
h(T  T0 )  103 k (T1  T0 )  2.5  0
3-2- For right side of the wall


All sides
Q  Egen,element  0

Q left  qA

A  11  1m2 , x  103

3
10
q  103 k (T99  T100 )  5000( )0
2

q  103 k (T99  T100 )  2.5  0


Keep in your mind about the boundary node.

3
10
h(T  T0 )  103 k (T1  T0 )  5000( )0
2
T1  T0
 Q  Egen,element  0 Qleft surface  kA  e0  Ax / 2   0
All sides x

Convection Boundary Condition


T1  T0
hA T  T0   kA  e0  Ax / 2   0
x
Radiation Boundary Condition
T1  T0
 A T 4
T4
  kA  e0  Ax / 2   0
x
surr 0

Combined Convection and Radiation


T1  T0
hA(T  T0 )   A T  4
surr T
0
4
  kA
x
 e0  Ax / 2   0
d 2T e
2
 0
dx k

Boundary Conditions
• Specified Temperature Boundary Condition
• Specified Heat Flux Boundary Condition
• Convection Boundary Condition
• Radiation Boundary Condition
• Interface Boundary Conditions
• Generalized Boundary Conditions
• Insulated Boundary Condition 40
Insulated boundary condition

Insulated boundary can be


treated as “zero” heat flux
0 T1  T0
Qleft surface  kA  e0  Ax / 2   0
x
The Mirror Image Concept (Thermal symmetry)
Insulated boundary can be
treated as “zero” heat flux
0 T1  T0
Qleft surface  kA  e0  Ax / 2   0
x
Another and more practical way is to
assume the node on an insulated boundary
as an interior node.
By replacing the insulation on the boundary by a mirror
(Thermal symmetry)and considering the reflection of the
medium as its extension
M+1 algebraic equations and M+1 unknown
Node 0  a0T0  b0T1  S 0
Node 1  a1T0  b1T1  c1T2  S1
Node 2  a2T1  b2T2  c2T3  S 2

.
.
.
Node M  aM TM 1  bM TM  S M

[A][T]  [C]
Finite Differences Solution
• Usually a system of N algebraic equations in N unknown
nodal temperatures that need to be solved simultaneously.

• There are numerous systematic approaches available which


are broadly classified as

– direct methods
• Solve in a systematic manner following a
series of well-defined steps

– iterative methods
• Start with an initial guess for the solution,
and iterate until solution converges
direct methods
Solve in a systematic manner following a
series of well-defined steps

Node 0  a0T0  b0T1  S 0

Node 1  a1T0  b1T1  c1T2  S1


Node 2  a2T1  b2T2  c2T3  S 2

.
.
.
Node M  aM TM 1  bM TM  S M

1
[A][T]  [C] [T]  [A] [C]
[T]  [C] /[ A]
Iterative method;

S 0  b0T1
Node 0  a0T0  b0T1  S 0 T0 
a0

Node 1  a1T0  b1T1  c1T2  S1 T1  F (T2 )

Node 2  a2T1  b2T2  c2T3  S 2 T2  F (T3 )


.
.
TM 1  F (TM )
.
Node M  aM TM 1  bM TM  S M TM  ...
Finite Differences Solution
• The direct methods usually require a large amount of
computer memory and computation time.

• The computer memory requirements for iterative methods


are minimal.

• The convergence of iterative methods to the desired


solution, however, may pose a problem.

The direct methods can not solve nonlinear problems


For solving the system of equations it is important
to know if they are Linear or nonlinear equations

Linear and nonlinear equations


Obtain if the following Eqs. are linear or nonlinear?
If only u , v, w and T are the unknow variables
 T  T   50  T 
[1] ( c p vT )  ( c p v T )  k (    )  0
 x   y 
uv vw
[2]  0
x y
[3] u 2  v  w  kT  100

[4] uv  vw  w  kT  10
Nonlinear equations
1- Whenever, one of the unknown parameters(variables)
has a power more than one
2 2
T or u
2- If there is a multiplication of two unknowns (variables)

vT or uT
3- If There is a multiplication of an unknown parameters to a
differential of an unknown parameter, like u u
u or v
x y
4- A differential of an unknown parameters has a power more
2
 u   v 
2
than one
  or  
 x   y 
Now let’s back to previous question;
Nonlinear equations
1- Whenever, one of the unknown parameters has a power
more than one
2- If there is a multiplication of two unknowns
Obtain if the following Eqs. are linear or nonlinear?
If only u , v, w and T are the unknow variables
 T  T   50  T 
[1] ( c p vT )  ( c p v T )  k (    )  0 NL
 x   y 
uv vw
[2]  0 L
x y
[3] u 2  v  w  kT  100 NL

[4] uv  vw  w  kT  10 NL
Do not mix power with order, please
Whenever, one of the unknown parameters has a power more than one
Or
There is a multiplication of two unknown parameters
Or
There is a multiplication of an unknown parameters to a differential of an
unknown parameters, the equation is NON-LINEAR

Which of them can be applicable here?


v y ( x, y)
Nonlinear equations
1- Whenever, one of the unknown parameters(variables)
has a power more than one
2 2
T or u
2- If there is a multiplication of two unknowns (variables)

vT or uT
3- If There is a multiplication of an unknown parameters to a
differential of an unknown parameters, or u u
u or v
x y
4- A differential of an unknown parameters has a power more
2
 u   v 
2
than one
  or  
 x   y 
Unannounced QUIZ 5
Allowance Time, 4 minutes
Obtain if the following Eqs. is linear or nonlinear?
If it is nonlinear, explain why (which term(s) make it
nonlinear) If only 𝑢, 𝑣, 𝑤, 𝑝 and 𝑇 are the unknown variables
If the last digit of your Student number is an
odd number use A , else use B
2
𝜕𝑇 𝜕𝑣 𝜕2𝑇 𝜕2𝑣 𝜕𝑢
A 𝜌𝑐𝑣 = 2𝜇 +𝑘 2
+ 2
+ + 𝑔2
𝜕𝑦 𝜕𝑦 𝜕𝑦 𝜕𝑦 𝜕𝑥

𝜕𝑇 𝜕𝑢 𝜕2𝑇 𝜕2𝑢 𝜕𝑝
B 𝜌𝑐 = 𝜇𝑤 + 𝑘𝑢 2
+ 2
+ +𝑔2
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑥 𝜕𝑥
Unannounced QUIZ 5- Solution
Allowance Time, 4 minutes
If only u, v, w and T are the unknow variables

2
𝜕𝑇 𝜕𝑣 𝜕2𝑇 𝜕2𝑣 𝜕𝑢
A 𝜌𝑐𝑣 = 2𝜇 +𝑘 2
+ 2
+ + 𝑔2
𝜕𝑦 𝜕𝑦 𝜕𝑦 𝜕𝑦 𝜕𝑥

𝜕𝑇 𝜕𝑢 𝜕2𝑇 𝜕2𝑢 𝜕𝑝
B 𝜌𝑐 = 𝜇𝑤 + 𝑘𝑢 2
+ 2
+ +𝑔2
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑥 𝜕𝑥
Linear and nonlinear equations
For example, the governing equations for incompressible, steady and
constant properties (µ, Cp, k);

Conservation of Mass u v w
  0
x y z
Conservation of Momentum
X-direction 
 u u u  p   2u  2u  2u 
  u  v  w     f x    2  2  2 
 x y z  x  x y z 

Energy Eq.:
 T T T T    2T  2T  2T 
c  (u v  w )     k  2  2  2   egen
 t x y z   x y z 

 u  2  v  2  w  2   v u 
2
 w v 
2
 u w 
2

  2                      
 x   y   z    x y   y z   z x 
For steady two-dimensional heat conduction with heat
generation and constant thermal conductivity

For m=1, 2, 3, . . . , M-1


and n=1, 2, 3, . . . , N-1.

For x  y  l
em,nl 2
Tm1,n  Tm1,n  Tm,n 1  Tm,n 1  4Tm,n  0
k
Boundary Nodes
Is similar to the
development in the
one-dimensional case.

The basic equation to keep


in mind when writing an
energy balance on a
volume element is


All sides
Q  eVelement  0
How many axis of symmetry does it have?
T2, , h2

T2, , h2 T1, , h1 T2, , h2

T2, , h2
How many axis of symmetry does it have?
T2, , h2

T2, , h2 T2, , h2
T1, , h1

T2, , h2
What is the meaning of Insulation ?

T2, , h2

T2, , h2 T1, , h1 T2, , h2

T2, , h2
The problem reduced to:

T2, , h2

T1, , h1

Therefore, Simplified by using axis of symmetry


The problem reduced to:
T2, , h2

T1, , h1
How many axis of symmetry does this one have?

T3

T2, , h2 T1, , h1 T2, , h2

Only 2
T3
The problem reduced to:
T3

T2, , h2
T1, , h1

Therefore, Simplified by using axis of symmetry


How many axis of symmetry does this one have?

T3

T2, , h2 T1, , h1 T2, , h2

Only 1
T4
T2, , h1 T2, , h1

T3 T3
Only 1
Finite Difference Method (FDM)
Computational Solution

Finding;
 - Governing (Differential) Equations
- Initial & Boundary Conditions

 Discretization of the Domain

Internal Nodes
 Changing Differential Eqs. and
to Algebraic Eqs. Boundary Nodes

 Solving the system of Algebraic equations

You might also like