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

Dr Edmondo Minisci EngAn3-CFD

Engineering Analysis 3
2013-2014 / 2nd semester

Introduction to Computational Fluid


Dynamics ( CFD )
Dr Edmondo MINISCI
edmondo.minisci@strath.ac.uk
Twitter: https://twitter.com/edmondo_minisci https://twitter.com/MAE_Strath
1
Dr Edmondo Minisci EngAn3-CFD

Lecture 4

2
Dr Edmondo Minisci EngAn3-CFD

Mixed derivatives [1]

The mixed derivatives can be approximated by applying the 1D formulas,


first in one direction and then in the other.
We can work on i, j  1
  2 
  y
 x y i , j x

Which can be rewritten as i  1, j i, j i  1, j


   
 
x  y i , j i, j  1
         
       

  y     y  
  2         j  i 1  j i
 Ox 
Forward
     
 x y i , j x   y  j i x difference in x

3
Dr Edmondo Minisci EngAn3-CFD

Mixed derivatives [2]

i, j  1 i  1, j  1
    j 1   j
    Oy 
 y  j y y
x i  1, j
i  1, j i, j
Then
i, j  1
  j 1   j    j 1   j 
    
  2         y i 1  y i
 Ox, y  difference in y
Forward
     
 x y i , j x   y  j i x

  2         i 1, j 1   i 1, j   i , j 1   i , j
       Ox, y 

 x y i , j x   y  j i x y
4
Dr Edmondo Minisci EngAn3-CFD

Mixed derivatives [2]

i, j  1 i  1, j  1
    j 1   j
    Oy 
 y  j y y
x i  1, j
i  1, j i, j
Then
i, j  1
  j 1   j    j 1   j 
    
  2         y i 1  y i
       Ox, y 
 x y i , j x   y  j i x

  2         i 1, j 1   i 1, j   i , j 1   i , j Approximation of


       Ox, y  first order in both

 x y i , j x   y  j i x y directions
5
Dr Edmondo Minisci EngAn3-CFD

Mixed derivatives [3]

The approximation of the second order in i, j  1 i  1, j  1


both directions is generated if we use central
differences in both x and y:
y
x i  1, j
    j 1   j 1
    
 O y 2
i  1, j i, j
 y  j 2y
Then
i, j  1
  j 1   j 1    j 1   j 1 
    
  2        2y 2y
     
 i 1  i 1

 O x 2 , y 2 
 x y i , j x   y  j i 2x Approximation of
second order in
both directions
  2         i 1, j 1   i 1, j 1   i 1, j 1   i 1, j
      
 O x 2 , y 2 
 x y i , j x   y  j i 4x y
6
Dr Edmondo Minisci EngAn3-CFD

Mixed derivatives [3b]

i, j  1 i  1, j  1

y
x i  1, j
The accuracy of the approximation
is determined by the terms of the i  1, j i, j
lowest order with respect to both x
and y.
i, j  1

Approximation of
second order in
both directions
  2         i 1, j 1   i 1, j 1   i 1, j 1   i 1, j
      
 O x 2 , y 2 
 x y i , j x   y  j i 4x y
7
Dr Edmondo Minisci EngAn3-CFD

Linear interpolation [1]


Development of many finite difference and finite volume methods requires
approximate evaluation of variables at points that do not belong to the
computational grid.
This is usually done using linear interpolation from neighbouring grid points.
The operation introduces truncation error of the second order.
  i
 i 1/ 2  i 1
2
We use the Taylor series expansions around the point (xi+1/2):
x  x 2  2 
 ( xi )   ( xi 1/ 2 )  ( xi 1/ 2 )  ( xi 1/ 2 ) 
2 x 8 x 2

x 3  3
 ( xi 1/ 2 )  ...
48 x 3

x  x 2  2 
 ( xi 1 )   ( xi 1/ 2 )  ( xi 1/ 2 )  ( xi 1/ 2 ) 
2 x 8 x 2
x 3  3
 ( xi 1/ 2 )  ...
48 x 3

8
Dr Edmondo Minisci EngAn3-CFD

Linear interpolation [2]


Development of many finite difference and finite volume methods requires
approximate evaluation of variables at points that do not belong to the
computational grid.
This is usually done using linear interpolation from neighbouring grid points.
The operation introduces truncation error of the second order.
  i
 i 1/ 2  i 1
2
Adding the two formulas together, dividing by 2, and rearranging, we obtain:

 ( xi 1 )   ( xi ) x 2  2
  ( xi 1/ 2 )  ( xi 1/ 2 )  ...
2 8 x 2
 ( xi 1 )   ( xi ) x 2  2
 ( xi 1/ 2 )   ( xi 1/ 2 )  ...
2 8 x 2

 ( xi 1 )   ( xi )
 ( xi 1/ 2 ) 
2

 O x 2 
9
Dr Edmondo Minisci EngAn3-CFD

Numerical solution to 2-dimensional steady


state heat conduction equation [1]

 PDE describing the temperature within the


domain is the 2-Dimensional Laplace’s equation

  2T    2T 
k 
  k 
 0
(3,2) (3,3)

 x 2  y 2
 x  y
 Discretise using the central finite difference (2,2) (2,3)

following each independent variable

Ti 1, j  2Ti , j  Ti 1, j Ti , j 1  2Ti , j  Ti , j 1


 0
x 2
y 2

10
Dr Edmondo Minisci EngAn3-CFD

Numerical solution to 2-dimensional steady


state heat conduction equation [2]
x 2
Using 4 X4 nodes with fixed  2
temperatures boundary conditions y
Ti 1, j  2Ti , j  Ti 1, j  Ti , j 1  2Ti , j  Ti , j 1  0 For

T3, 2  2(1   )T2, 2  T1, 2  T2,3  T2,1  0 i, j  2,2

T3,3  2(1   )T2,3  T1,3  T2, 4  T2, 2  0 i, j  2,3

T4, 2  2(1   )T3, 2  T2, 2  T3,3  T3,1  0 i, j  3,2

T4,3  2(1   )T3,3  T2,3  T3, 4  T3, 2  0 i, j  3,3


11
Dr Edmondo Minisci EngAn3-CFD

Numerical solution to 2-dimensional steady


state heat conduction equation [3]

Ti 1, j  2Ti , j  Ti 1, j  Ti , j 1  2Ti , j  Ti , j 1  0

a computational stencil can be very handy in writing the matrix

12
Dr Edmondo Minisci EngAn3-CFD

Numerical solution to 2-dimensional steady


state heat conduction equation [4]

Using 4 X4 nodes with fixed


temperatures as boundary conditions

  2  2  1 0  T2, 2  T1,2  T2,1 


   T  T  T 
 2  2 0 1
  2,3 
   1,3 2, 4 

 1 0  2  2   T3, 2  T3,1  T4,2 
 0   2  2    
 1  T3,3  T3,4  T4,3 
The known
temperatures T1, j  TB Ti ,1  TL T4, j  Ttop Ti ,4  TR
13
Dr Edmondo Minisci EngAn3-CFD

Numerical solution to 2-dimensional steady


state heat conduction equation [5]
 for the two and three dimensional analysis, the Matrix indexing are better
converted into vector indexing
n  4  (i  1)  j

  2  2  1 0  T6  TB  TL 
   2  2 0  T  T  T 

1
  7   B R 
0  2  2   T10  TL  Ttop 
 1  
 0   
 1   2  2  T11  TR  Ttop 

14
Dr Edmondo Minisci EngAn3-CFD

Class exercise

x0  0m x9  1m
T ( x0 )  0 C
0
T ( x9 )  1000 C
The figure represents a grid to solve the following conduction equation
in one dimensional configuration :

 2T ( x)
k 0
x 2

1-) Use a second order central difference approximation to the second


derivative to suggest a numerical scheme to solve this conduction equation

2-) Deduce the set of linear algebraic equations giving internal node
temperatures writing in matrix representation.

3-) Plot the temperature distribution obtained and compare it with the exact
solution of this conduction equation.
15
Dr Edmondo Minisci EngAn3-CFD

Solving the algebraic equations

 as seen in previous sections, a discretised partial differential equation


becomes a set of linear algebraic equations

MX B

 the algebraic equations are those actually solved on computer


( i.e., by the solver)

 the methods for solving algebraic equation are


1. Direct methods : Gauss elimination, LU decomposition, Cyclic reduction
2. Iterative methods: Jacobi method, Gauss-Sieidel, Stone’s method
3. Other methods: under relaxation method, etc.

 note that most of these methods already exist in algorithms and we only need
to choose a convenient one for a particular problem

16
Dr Edmondo Minisci EngAn3-CFD

Visualising the solutions

 once the algebraic equations are solved the solutions are sent to a graphical
package (software) for visualisation

17

You might also like