Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
22 views21 pages

Lecture 2 M

The document discusses finite difference methods for solving differential equations related to incompressible and compressible fluid flows, including the continuity and Navier-Stokes equations. It outlines the process of discretization, which involves replacing differential equations with finite difference quotients to create a system of algebraic equations. Additionally, it covers various boundary conditions, error and stability analysis, and the formulation of equations of interest such as the Poisson and Laplace equations.

Uploaded by

h20240049
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views21 pages

Lecture 2 M

The document discusses finite difference methods for solving differential equations related to incompressible and compressible fluid flows, including the continuity and Navier-Stokes equations. It outlines the process of discretization, which involves replacing differential equations with finite difference quotients to create a system of algebraic equations. Additionally, it covers various boundary conditions, error and stability analysis, and the formulation of equations of interest such as the Poisson and Laplace equations.

Uploaded by

h20240049
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Finite Difference Methods

Basic ideas of Discretization

Professor Gautam Biswas


Department of Mechanical Engineering
For Incompressible Flows

The continuity Equation


u v w
+ + =0
x y z

The Navier-Stokes Equations for Incompressible Flows:

 u u u u  p   2u  2u  2u 
  +u +v + w  = − +   2 + 2 + 2
 t x y z  x  x y z 

 v v v v  p   2v  2v  2v 
  +u +v + w  = − +   2 + 2 + 2
 t x y z  y  x y z 

 w w w w  p   2w  2w  2w 
  +u +v + w  = − + 2 + 2 + 2
 t x y z  z  x y z 
For Compressible Flows

  (  u ) (  v ) (  w )
The continuity Equation + + + =0
t x y z

The Navier-Stokes Equations for Compressible Flows:

 u  ( u 2 )  ( uv )  ( uw )  p   u 2  u v w  
  + + + = − +  2 −  + + 
 t  x  y  z   x  x  x 3  x y  z 
 
   v u      u w  
+    +  +    + 
y   x y   z   z x  

 v  ( uv )  ( v 2 )  ( vw )  p   v 2  u v w  
 + + + = − +  2 −   + + 
 t  x  y  z  y y   y 3  x y  z 
 
   v u      v w  
+    +  +    + 
x   x y   z   z y  

 w  ( u w )  ( v w )  ( w2 )  p   w 2  u v w  
 + + + =− +  2 −  + + 
 t
 x y z  z z  z 3  x y z  

   w u      v w  
+   +  +  + 
x   x z   y   z y  
Energy Equation for Incompressible flows:

 T T T T    2T  2T  2T 
 cp  + u +v +w  = k  x 2 + y 2 + z 2 
  t x y  z   

 
  u 2  v 2  w  2   u v 2  v w 2 u w 2 
+   2   +   +    +  +  +  +  + + 
x 
        
y z  y x   z y  z x 

Energy Equation for Compressible flows:

 T T T T    2T  2T  2T  Dp
 cp  + u +v +w  = k  2 + 2 + 2 +
 t x y z   x y z  Dt

 
  u 2  v 2  w  2   u v 2  v w 2 u w 2 2  u v w 2 
+   2   +   +    +  +  +  +  + + −  + +  
  x   y   z    y x   z y  z x 3  x y z  

Contents

Discretization
Differential equations
Finite Difference Quotients
Consistency
General schemes
Explicit method
Implicit method
ADI method
Error and Stability Analysis
Conservative and Transportive Properties
Upwind Differencing
Higher Order Upwinding
Discretization

Procedure by which a continuous domain is


divided into a discrete number of points.
Basic idea is to replace differential equations
by finite difference quotients.
This results in a system of algebraic equations
for replacing the differential equations.
Differential equations
General second order equation

 2  2  2  
A 2 +B +C 2 + D +E + F = G( x, y)
x xy y x y
If the coefficient A, B, C, D, E, and F are either constants or functions of only
(x, y) (do not contain  or its derivatives), it is said to be a linear equation;
otherwise it is a non-linear equation. An important subclass of non-linear
equations is quasilinear equations. In this case, the coefficients may contain 
or its first derivative but not the second (highest) derivatives. If G=0 the
aforesaid equation is homogeneous, otherwise it is non-homogeneous.

B 2 − 4 AC  0 Equation is elliptic

B 2 − 4 AC = 0 Equation is parabolic

B 2 − 4 AC  0 Equation is hyperbolic
Platon the Athenian (c.428 - 347 BCE) – the great Plato –
discovered the ‘regular’ solids and stressed the importance of
symmetry, which is a cornerstone of modern physics.

Diophantus of Alexandria (c. 201 - 285 CE) wrote the


Arithmetica, the first treatise on algebra. Diophantine
equations, i.e. algebraic equations involving integers only,
are still being researched by modern number theorists.

Pappus of Alexandria (c. 290 - 350 CE) was the father of


solid geometry. His theorems on centroids of revolution
are still very useful in mechanics.

Hypatia of Alexandria (c. 360 - 415 CE) pioneered


math education in schools. Her assassination
brought an abrupt end to ancient Hellenistic
mathematics.
Equations of Interest
The unsteady Navier-Stokes equations are elliptic in space and parabolic in
time. At steady-state, the Navier-Stokes equations are elliptic.
The Laplace equation and the Poisson equation are generally associated
with the steady-state problems. These are elliptic equations
The wave equation is hyperbolic equation

 2  2
Poisson Equation + 2 +S =0
x y
2

Laplace Equation  2  2
+ =0
x 2 y 2

Wave Equation

Heat Conduction Equation


Boundary and Initial conditions
For unsteady 2-dimensional problems the appropriate flow
     2  2 
equation can be written as +u +v = D 2 + 2 +S
t x y  x y 
Where,  is the transported property, D is the diffusivity
and S is a source term
The formulation of a problem requires complete
specification of the boundary and initial conditions in
addition to the governing equation above
Boundary conditions can be Dirichlet, Neumann and
mixed.
Three types
• Dirichlet (Fixed)

• Neumann(Derivative)

• Mixed
Finite Differences

• Grid - A network of
horizontal and vertical lines
that provide coordinates for
locating points in a domain. y
y
• x,  y - grid spacing, can be
uniform or non-uniform.
• Finite difference
representations of
derivatives are obtained
from Taylor series
expansions Figure-1
Derivatives approximated by finite differences

 u    2u  ( x) 2
ui +1, j = ui , j +  x + 
 x 2 
 + .... (1)
 x i , j   2
 u  ui +1, j − ui , j
  = + O ( x)…first order forward difference
 x  i , j x
Similarly we can have other elementary finite differences from

(2)

…first order backward difference

…second order central difference of first der

Higher order terms

…central difference of second derivative


Derivatives approximated by finite differences

Combinations of such finite difference quotients for partial derivatives form finite
difference expressions for the partial differential equations. For example, the Laplace
equation 2u = 0 in two dimensions, becomes
ui +1, j − 2ui , j + ui −1, j ui , j _1 − 2ui , j + ui , j −1
+ =0
( x ) ( y )
2 2

ui +1, j + ui −1, j +  2 ( ui , j +1 + ui , j −1 ) − 2 (1 +  2 ) ui , j = 0

Where  is the mesh aspect ratio ( x ) ( y ) . If we solve the Laplace equation on a


domain given by Fig. 1 the value of ui , j will be
ui +1, j + ui −1, j +  2 ( ui. j +1 + ui , j −1 )
ui , j =
2 (1 +  2 )

It can be said that many other forms of difference approximations can be obtained for the
derivatives which constitute the governing equations for fluid flow and heat transfer. The
basic procedure, however, remains the same.
Derivatives approximated by finite differences

The same approach can be made to generate a finite difference quotient for the mixed
( )
derivative  2u x y at grid point ( i , j ) . For example,
 2u   u 
=  
xy x  y 
In the above equation, if we write the x − derivative as a central difference of y −
derivatives, and further make use of central differences to find out the y − derivatives, we
obtain
 u   u 
 y  −  y 
u2
 u   i +1, j  i −1, j
=  =
x y x  y  2 ( x )
  2u   ui +1, j +1 − ui +1, j −1   ui −1, j +1 − ui −1, j −1   1
  =   −   
  x y   2 ( )  
 y 2 ( )   2 ( x )
 y
  2u 
  =
1
( ui +1, j +1 + ui −1, j −1 − ui +1, j −1 − u i −1, j +1 ) + o 
 ( x )
2
, ( y )
2


 xy  4 x y
TRUNCATION ERRORS
• First order forward difference:
O(∆x) = -((∆x)/2)(∂2u/∂x2)i,j – ((∆x)2/6) (∂3u/∂x3)i,j +
• First order backward difference:
O(∆x) = ((∆x)/2)(∂2u/∂x2)i,j + ((∆x)2/6) (∂3u/∂x3)i,j +
• Second order central difference:
O(∆x)2 = -((∆x)2/6)(∂3u/∂x3)i,j + ….
Consistency and Convergence

• The Finite Difference representation of a PDE is consistent if

lim ( PDE − FDE ) = lim (TE ) = 0


mesh→0 mesh→0

• The solution of the FDE is convergent if the approximate


solution obtained approaches the exact solution of the PDE at
each point as the grid spacing tends to zero

uin = u ( xi , t n ) as  x,  t → 0
FORWARD TIME CENTRAL SPACE
(FTCS) DISCRETIZATION
• One dimensional unsteady state heat conduction
equation:
∂u/∂t = α(∂2u/∂x2)
• Using the FTCS method of discretization
(uin+1 - uin)/∆t = α(ui+1n – 2uin + ui-1n)/∆x2 +
O[(∆t),(∆x)2]
• When (∆t) and (∆x) approach zero, the truncation
error also approaches zero. Such a partial differential
representation is said to be consistent.
Truncation Error and Consistency
Let us consider heat conduction equation again. The dependent variable u (temperature) is a function of
x and t (time) and  is a constant known as thermal conductivity.
u  2u
= 2
t x
Use the Dufort-Frankel (1953) differencing scheme which has higher order accuracy than FTCS.
The FDE is

uin+1 − uin−1  u n − u n+1 − u n−1 + u n 


=   i +1 i i i −1
 Let us find out truncation errors:
2t  ( x )
2


  2u  ( t )  3u  ( t )
n 2 n 3
 u 
n
n +1
ui = ui +   t +  2 
n
+ 3  + (A)

 i
t   t i 2  t i 6

  2u  ( −t )   3u  ( −t )
n 2 n 3
 u 
n

ui = ui +   ( −t ) +  2 
n −1 n
+ 3  + ... (B)

 i
t   t i 2   t i 6
23
 u ( )
n
t 3
Highest term of the truncation error can be obtained from (A)-(B) as −  3 
 t i 6
Truncation Error and Consistency

Now let us consider errors associated with the spatial terms

  u  ( x )   u  ( x )   u  ( x )
n 2 n 3 n 4
 u 
n 2 3 4
uin+1 = uin +   x +  2  + 3  + 4  (C)
 x i  x i 2  x i 6  x i 24

( ) ( ) u  ( −x )
n n n
− −
2 3 4
        
n
 
2 3 4
u u x u x
ui −1 = ui +   ( −x ) +  2 
n n
+ 3  + 4  (D)
 x i  x i 2  x i 6  x i 24
Overall truncation error for the spatial discretization can be obtained from (C) – (D) as
n
  u
4
n+1 n−1
 4  (x) . Next, we may consider that on the RHS, 2 ui has been replaced by ui + ui
2 n

12  x i
n
 u  t 
2 2

The truncation error due to this approximation is −  2   


 t i  x 
Inconsistent scheme example

• Dufort-Frankel scheme for 1D unsteady heat conduction


equation

• Truncation error

• If ∆t, ∆x approaches 0 in such a way that ∆t/ ∆x approaches


‘β’ then TE

• Reconstructing PDE from FDE and TE


….hyperbolic! We started with a
parabolic equation
Therefore, It is understood that higher order schemes
enhance formal Order of accuracy. However, one has
to be careful about consistency and convergence.
Otherwise, one may end up with spurious solutions

We will meet again in the next class

You might also like