CFD Notes Reference
CFD Notes Reference
Basic equations of fluid flow include continuity, momentum and energy equation. Depending
on the type of flow compressible/incompressible, laminar/turbulent, steady/unsteady the
governing equations are assumed.
Continuity Equation
Principle of conservation of mass: Within the region, the difference between the rate of
increase of the fluid mass contained within the region must be equal to the difference
between the rate at which the fluid mass enters the region and the rate at which the fluid
leaves the region.
Consider an elementary rectangular parallelepiped with sides of length δx, δy and δz.
u, v, w are the velocity components in x, y and z directions.
Δz
Δy
1
Neglecting the higher order terms as Δx, Δy, Δz 0
( u )
( u) x x u x x
x
( u )
Net flux in x-direction = [ u x x u x ] yz
x
( u )
xyz .................................................... (3)
=
x
( v)
Similarly, Net flux in y-direction = xyz .......................... (4)
y
( w)
Net flux in z-direction = xyz ............................................. (5)
z
Net flux = Rate of change of mass within control volume
(3)+(4)+(5) = (1)
( u ) ( v) ( w)
[ ] xyz = xyz
x y z t
( u ) ( v) ( w)
0 3-D Compressible Continuity Equation
t x y z
Writing the above equation in vector notation
t
.V 0
t
V . .V 0
or
D
Dt
.V 0
D ( ) ( ) ( )
Where u v w
Dt t x y z
Continuity equation is .V 0
2
Case II For steady incompressible flow
Continuity equation is V
. 0 .This equation is valid for uniform cross sectional area.
1-D Continuity Equation
Considering a stream tube AV AV S
s
AV AV S
s
S
AV
AV S AS
s t
A AV 0 1-D variable area Continuity equation
t s
The continuity equation becomes AV 0
s
or AV constant
AV = constant
3
Acceleration of a Fluid Particle
a = Rate of change of velocity
du dv dw
ax ; ay ; ax
dt dt dt
u = f (x, y, z, t)
du u x u y u z
ax
dt x t y t z t
u u u u
ax u v w
x y z t
u u u u
ax u v w
t x y z
Similarly
a y v u v v v w v
t x y z
w w w w
az u v w
t x y z
a
DV V
Dt
t
V . V
Local Conventional
acceleration acceleration
DV V V V V
u v w
Dt t x y z
Du Dv Dw
ax ; ay and az
Dt Dt Dt
4
Force:
A Fluid in motion is subjected to several forces which results in the variation of the
acceleration and the energies involved in flow phenomenon in the fluid.
Force Pressure
Surface forces
Force α Surface area Others-Shear, tangential, force of
compressibility, force due to turbulence etc
Most of the fluids in motion, surface tension and compressibility forces are not significant.
Neglecting these terms
Ma Fg F p Fv Ft ........................Reynolds equation of motion.
For laminar of viscous flows, the turbulent forces become less significant. Then
Ma Fg F p Fv ..........................Navier stokes equations.
5
Euler’s Equation of motion
Pressure force and fluid weight are assumed to be acting on the mass of fluid in motion.
p
F px xyz
x
P
PΔyΔz ΔΔ Δy P x yz
x
Δz
Δx
mass x acceleration = body force + pressure force
p
xyz a x xxyz xyz
x
where x is the body force per unit mass
1 P
ax x
x
u u u u
a
But x u v w
t x y z
u u u u 1 P
u v w x
t x y z = x
v v v v 1 P
u v w y
t x y z = y Euler’s Equations
w w w w 1 P
u v w = z
t x y z z
6
Bernoulli’s Equation
Consider a stream tube of length
Gravity force = mg
dp
-mg AS ma x .........................................................(1)
ds
But m AS
z
s
v v
ax v Δs
t s
dp
Equation (1) becomes: pdA AS
ds
dz dp AS
-g - ax θ
ds ds AS
dz dp 1 v v
-g - v PdA mg sinθ
ds dS t s
v
For steady flow 0
t
dp
gdz vv 0
Integrating the above equation
v 22 v12
g Z 2 Z1
dP
0
2
7
GENERAL STRESS SYSTEM IN A DEFORMABLE BODY:
In order to determine the surface forces, let us consider a volume element dV= x.y.z ,whose
front lower left corner has the coordinates x, y, z as shown in figure.
xz
xz dx
x
xy
xy dx
x
x
x Δz x dx
x
xy xz
Δy
Δx
x xy xz
Stress Tensor Π = yx y yz .............................................................(1)
zx zy z
Du xy xz
FBX x
Dt x y z
Dv yx y yz
FBY
z
...........................(2)
Dt x y
Du zy z
FBX zx
Dt x y z
8
Symmetry Tensor:
Let τ = Tangential force which causes rotational motion of the fluid.
ς=Normal stress which causes translatory motion of the fluid.
Let us consider a 2-Dimensional element where Δz=1.
Y yx yx x
x
xy xy xy x
x
yx X
Consider a fixed point ‘C’, now momentum about point “C” is given
d z
I zz xy y.1x yx x.1y
dt
d z
Ak 2 xy yx xy ....................................................................(3)
dt
As the element is small, in the limit k 2 tends to zero;
xy yx
xz zx and .......................................................(4)
yz zy
x xy xz
Stress Tensor Π = xy y yz which is symmetric....................................(5)
xz yz z
Considering a symmetric stress tensor ,the Momentum equation can be written as
Du xy xz
FBX x
Dt x y z
Dv yx y yz
FBY ..........................(6)
Dt x y z
Du zy z
FBX zx
Dt x y z
For ideal fluids: friction= 0; Shear stress =0
9
So x y z P
x 0 0 P 0 0
Stress Tensor Π = 0 y 0 = 0 P 0
0
0 z 0 0 P
Trace of stress tensor =Arithmetic mean of normal stresses.
x y z 3P
= = P
3 3
For real fluids: x y z
u v w u
x P 2
x y z x
u v w v
y P 2 .............................(7)
x y z y
u v w w
z P 2
x y z z
2
From Stokes Theorem
3
x P 2 u v w 2 u
3 x y z x
2 u v w v
y P 2 ..........................(8)
3 x y z y
u v w w
z P 2
x y z z
STRAIN RATE:
The rate at which the fluid element is strained in a flow field is called “Strain Rate”.
Similarly, u u+du
v v v
Relative motion in Y-direction= dv = x y z ........(9) B
x y z
w w w
Relative motion in Z-direction= dw= x y z B
x y z
Let us consider a 2 dimensional element ABCD,
10
After time t , the element is A’B’C’D’.
Displacement of cover A:
u
Linear rate of strain= x=
x
v
Linear rate of rotation= 1= (Counter clockwise)
x
u 1 v u 1 w u
x 2 x y 2 x z
xz 1 u v
v 1 w v
x
xy
(11)
u u
du = x + y + u z (12)
x y z
du= ( x x + xy y + xz z) + ( y z- z y ) (13)
Similarly,
dv= ( xy x + y y + yz z) + ( z x- x z) (14)
dw= ( xz x + yz y + z z) + ( x y- y x) (15)
u
from equations (12) and (13), coefficients of x =
x
u
y =
y
=
xy z
u
z =
z
=
xz y
u 1 v u
Coefficient of y = = = - z
y xy z
2 x y
1 v u
z=
2 x y
Similarly, (16)
1 u w 1 w v
y= & x =
2 z x 2 y z
12
, Angular Velocity. x, y, z are components.
1
= curl
2
Thus the overall motion of the particle occupying a position (x, y, z) at time t is composed of,
Let us consider a fluid particle having a shape of parallelepiped with sides dx, dy and dz.
D
Acceleration of the particle is, a=
Dt
^ ^ ^
The body force is F BX = .[Link]. (x i + y j + z k )
Surface force = P
x xy xz
Px=
x y z
Equation (8) gives the value of , normal stress
v u w u
And xy = 2 xy = ; xy = 2 xz = ;
x y x z
Du
FBX +
x xy xz
Dt x y z
2 u v u w u
= FBX +
x P 3 (v) 2 x y ( x y ) z x z
Du P u 2 v u w u
FBX 2 (v) ( ) (1)
Dt x x x 3 y x y z x z
Dv P v u v 2 w v
Similarly, = FBY ( ) 2 (v) (2)
Dt y x x y y y 3 z x z
13
P w u w v w 2
= FBZ ( ) 2 (v)
Dw
(3)
Dt z x x z y y z z z 3
Where,
u v w
v =
x y z
These equations are the Navier Stokes equations for the 3 Dimensional UNSTEADY,
COMPRESSIBLE, VISCOUS flow.
u v w
Continuity equation for incompressible flow is v = 0, x y z =0;
Du P u 2 v u w u
FBX 2 (v) ( )
Dt x x x 3 y x y z x z
P 2u 2u 2u u v w
= FBX 2 2 2
x x y z x x y z
Du P 2u 2u 2u
FBX 2 2 2
Dt x x y z
Du P
FBX + 2 u
Dt x
Similarly;
Dv P
= FBY 2 v
Dt z
Dw P
= FBZ 2 w
Dt z
Similarly;
v v v P
u v w FBY 2 v
x y z y
w w w P
u v w FBz 2 w
x y z z 14
Further If The Body Forces are zero :
* + [ ]
ρ* + [ ]
ρ* + [ ]
ENERGY EQUATION:
For an incompressible flow the unknowns are the velocity components
u,v,w and the pressure p. To obtain these four quantities we have the four equations in the
form of continuity and the three Navier-Strokes [Link] a compressible flow,
temperature(T) is an additonal unknown; the density(ρ) can be calculated using the equation
of state when p and T are known. The additional equation for T is obtained from first law of
Thermodynamics to a fluid particle. This equation is called Energy Equation.
…………………..(1)
ρΔV ( )
The addition of heat is assumed to be only due to conduction. According to Fourier’s law, the
heat flux, q (J/m2s) per unit area A and time is proportional to the temperature gradient
normal to the surface.
i.e.,
………………….(2)
where k (J/m s K) is the thermal conductivity of the fluid.
15
Hence the heat transferred into the volume V * through the surface normal to the X
kT
direction is equal to - dydz .the amount leaving the x- direction is
x
T T
k x x k x dx dydz.
Thus the total amount of heat added b conduction during the time dt to the volume V * can
be written as;
T T T
dQ dtV * k
k
z k z .......................3
y x y y
To obtain the work done, let us consider the contribution from the Component , xy of the
stress.
u xx
dWxx dydz uxx u dx xx dx V * uxx
x x x
The total work performed b the normal and shear stresses can now be written as
dW V * uxx vxy wxz uxy vyy wyz utzx vtyz wzz ......4
x y z
Substituting the stresses xx,yy,zz ,xy,yz,zx can be written in terms of and velocity
components.
De T T T
p.V k k k
Dt x x y y z z
Where is called dissipation function, is
u 2 v 2 w 2 v u 2 w v 2 u w 2 2 u v w 2
2
x x x x y y z z x 3 x y z
TURBULENCE:
The Reynolds number of a flow gives a measure of the relative importance of inertia force and
viscous forces. In experiments on fluid systems it is observed that at values below the so called
Reynolds number Recrlt the flow is smooth and adjacent layers of fluid slide past each other
in an orderly fashion. if the applied boundary conditions do not change with time the flow is
steady. this regime is called “LAMINAR FLOW”.
16
At values of the Reynolds number and above Rexpt a complicated series of events takes place
which eventually leads to a radical change of the flow character. In the final state the flow
behaviour is random and chaotic. The motion becomes intrinsically unsteady even with
constant boundary condition. The velocity and all other flow properties vary in a random and
chaotic way. This regime is called “TURBULENT FLOW”.
Take, for example, the common tap by a domestic sink. Slowly turn the tap on and see that
water rips out of the tap. Open the tap further to increase the flow rate until a steady column
of water comes out of the tap. Notice how smooth the water column is, appearing crystal
clear like glass. Increase the flow rate further and the water column surface begins to move
slowly before the whole column becomes opaque. At this final stage the water flows in a
direction which is generally downwards, but if we look at one point in space in the water
column the fluid seems to move in a random fashion, a so called turbulent motion, which is
superimposed on the general flow. This simple experiment with the flow out of a tap
demonstrates that two main types of flow can be seen with viscous fluids; first a smooth
laminar flow, where the water moves layer over layer giving a clear column of liquid , and a
randomly fluctuating turbulent flow.
AVERAGING:
Mathematically, the instantaneous velocity component u can be described as
Similarly,
V =v+vˊ w=w+ wˊ p=p+ pˊ ρ = ρ+ ρˊ T= T +Tˊ
The average is formed as the time average at a fixed point in space, thus for example
u= ∫
17
Where T= time period of sampling which is sufficiently large to include adequate number of
fluctuations
T
to
2
1
T to T
Similarly dt
2
The integral is to be taken over a sufficiently large time interval T so that the average is
independent of the time. The time averages of the fluctuating quantities are then zero by
definition.
2 2 2 2
1 1 1 1
1) ' T u ' dt T u u dt T udt T udt u u 0
T T T T
t o t t o t o o
2 2 2 2
2) u 2 u u' 2
u u 2uu 'u '
2
uv u'v'
4) Averaging of uw = u w u'w'
5) Averaging of vw = v w v'w'
u u
6)
7) ud udn
18
MASS WEIGHTED AVERAGING:
~ u ~ v ~ w ~ h ~ T ~ H
u v w h p T
H
u u~ u *
v v~ v *
~ w*
ww
u* v* w* 0
For incompressible flows(p=constant); then u* v* w* 0
'
' uj u ' j 0
t xj
'
t
t xj
uj
xj
u ' j
xj
'u j
xj
' u ' j 0
Taking time average;
'
t
t xj
uj
xj
u ' j
xj
' uj
xj
'u' j 0
t xj
uj
xj
'u' j 0
t xj
uj ' u ' j 0
19
FAVRE Average form of Continuity equation:
( )
[ ̃ ]
( ̃) ̃
( ̃) ̃
( ) ( ) * + ( )
( ̃)
( ) ( )
( ) ( )
where
[( ) ]
20
l 2 lv ' lw'
2
' v' w
Reynolds stress matrix (or) Apparent stress matrix = π = lv v ' '
2
lw v' w ' w '
'
The fluxes of momentum arise as we have carries the averaging process over non- linear
equations. These are additional unknowns in the equations. To solve the equations for these
quantities, they would involve co relations among fluctuating quantities for higher order and
so on. Thus, the number of unknowns always exceeds the number of equations for reynold’s
averaged quantity. This is called “CLOSURE PROBLEM”.
To obtain a closed set of equations, the higher order correlations need to be expressed
in terms of lower order co relations and their derivatives, such expressions are called
“TURBULANCE MODELS”.
TURBULENT MODELS:
21
Which has dimensions m2/s, can be expressed as a product of a turbulent velocity V1(m/s) and
a length scale lm(m).
And | | ;
| |
| || |
ADVANTGES:
Easy to implement and cheap in terms of computing resources.
Good predictions for thin shear layers : jets, mixing layers, wakes and boundary layers.
Well established.
DISADVANTAGES:
Completely incapable of describing flows with separation and recirculation.
Only calculates mean flow properties and turbulent shear stress.
K-ε MODEL:
The instantaneous kinetic energy k(t) of a turbulent flow is the sum of mean
kinetic energy K= and the turbulent kinetic energy ( )
; k(t)=K + k .
Momentum equation,
( ) ( ) { [ ] }
22
The value of k and ε come directly from the differential transport equations for turbulent
kinetic energy and dissipation rate as:
( k ) ( u j k ) k
k PK
t x j x j x j
( ) ( u j k )
C 1 Pk C 2
t x j x j x j k
t
Where diffusion coefficients k =
k
t
U U j U i 2 U i U k
Pk t i k t
x j xi x j 3 xi xk
ADVANTAGES:
Simplest turbulence model for which only initial and/ or boundary conditions need
to be supplied.
DISADVANTAGES:
More expensive to implement than mixing length model (two extra PDE’s).
ii. Flows with large extra Strains (e.g. curved boundary layers, swirling flows).
The order of a partial differential equation is determined by the highest order partial
derivative present in that equation.
G 0 First order
x y
2
0 Second order
x 2
y
2
3 2
3 0 Third order
x xy y
Where is a dependent variable, x and y are independent variables and G is a constant.
2) According to Linearity:
Partial differential equations are broadly classified into linear equations and non-linear
equations.
If the coefficients are constants or functions of the independent variables then they are
called “Linear Equations”.
Example: G 0
x y
2 2
a 2 +b +c +d=0
x xy y
If the coefficients are constants or functions of the dependent variables and/or any of its
derivatives of either lower or same order, then they are called “Non-Linear Equations”.
2
Example: - =0
x 2
y
ELLIPTIC, PARABOLIC AND HYPERBOLIC EQUATIONS:
Linear second order partial differential equations in two independent variables are further
classified into three canonical forms.
1)Elliptic
2)Parabolic and
3)Hyperbolic Equations.
The general form of this class of equation is
2 2 2
a + b + c +d e f g = 0
x 2
xy y 2
x y
Where coefficients are either constants or functions of the independent variables.
24
The three canonical forms are determined by the following criteria:
25
C) HYPERBOLIC PDE: Typical example is
2 2
2
(Wave equation)
t 2 x 2
The solution domain of hyperbolic PDE has the same open-ended nature as in parabolic PDE.
However, two initial solutions are required to start the solution of hyperbolic equations in
contrast with parabolic equations where only one initial condition is required.
t
The initial and boundary conditions must be specified to obtain unique numerical solution to
partial differential equations.
The mathematical representation of the a physical problem is, the temperature within a large
solid slab having finite thickness changes in the x-direction(thickness direction)as a function of
time till steady state is reached.
26
Dirichlet Boundary conditions (First Kind)
Cauchy conditions:
A problem which combines both Dirichlet and Neumann conditions is called Cauchy
conditions.
Robbins conditions (Third Kind):
The derivative of the dependent variable is given as a function of the dependent variable on
the boundary.
For heat conduction problem, this may correspond to the case of cooling of a large steel slab
of finite thickness ‘L’ by water or oil, the heat transfer coefficient, ‘h’ being finite.
Fluid T>Ta
T
Fluid h, Ta -k h(T Ta )
x
T
k h(T Ta ) x
x
0 L
27
3. FINITE DIFFERENCE METHODS
According to Taylor Series Expansion
x u x 2 2 u x 3 3 u
u i 1 ui
2! x 2 i 3! x 3 i
______________ (1)
1! x i
x u x 2 2u x3 2u
ui 1 ui
1! x i 2! x 2 i 3! x3 i ______________ (2)
u ui 1 ui
O(x)
x x
From backward eq(2)
u ui ui 1
O(x)
x x
ui 1 ui 1 u x 2 3u
..............
2x x i 3! x 3 i
u ui 1 ui 1
O(x 2 )
x 2x
Truncation error for forward and backward difference is of first order where as for central
difference it is of second order.
ui 1 2ui ui 1 2 u x 2 4 u
2 4 ..........................
x 2 x i 12 x i
2 u ui 1 2ui ui 1
2 O(x 2 )
x x 2
28
Euler’s Explicit method
u 2u
2
t x
ui
n 1
ui
n
u n i 1 2ui n u n i 1
t x 2
Euler’s Implicit method
u 2u
2
t xo
n 1
ui ui
n
u n 1i 1 2ui n 1 u n 1i 1
t x 2
Crank Nicolson Method
u 2u
2
t xo
ui
n 1
ui
n
u n 1i 1 2ui n 1 u n 1i 1 u n i 1 2ui n u n i 1
t 2 x 2 x 2
COMPARISION OF IMPLICIT/EXPLICIT METHODS
Explicit method involves pointwise updating & requires no matrix inversion. Implicit
scheme needs matrix inversion.
Computational time for time set is more for more for implicit method than the explicit.
For stability considerations explicit scheme may require very small time steps and hence
several thousand steps to obtain steady solution. Large time steps can be used in implicit
scheme.
29
General Methods to get Higher order Accuracy
Q1: Derive backward difference equation for second derivative with second order accuracy.
Answer:
Second derivative r=2
Second order m=2
m+r=4 .Therefore four terms ui, ui-1, ui-2, ui-3 are considered for the equation.
x u x 2 2u x 3 3u
u i 1 ui .................
1! x i 2! x 2 i 3! x 3 i
(2x) u (2x) 2 2u (2x)3 3u
u i 2 ui .................
1! x i 2! x 2 i 3! x 3 i
(3x) u (3x) 2 2u (3x)3 3u
u i 3 ui .................
1! x i 2! x 2 i 3! x 3 i
ui 1 ui 2 ui 3
x u x 2 2u x 3 3u
( )ui ( 2 3 ) ( 4 9 ) 2 ( 8 27 ) .............
1! x i 2! x i 3! x 3 i
u 2u 3u
setting the coefficients of , 2 and 3 to 0,1,0 respectively
x i x i x i
( 2 3 )x =0
x 2
( 4 9 ) =1
2
x 3
( 8 27 ) =0
6
Solving the above equations
α=-5/Δx2 β=4/Δx2 γ=-1/Δx2
Substituting the above values in the equation ui 1 ui 2 ui 3
We get
Assignment:
Q2: Derive central difference equation for third derivative with second order accuracy.
Q3: Derive forward difference equation for third derivative with first order accuracy.
30
Solution of 2nd Order Differential Equation On One Dimensional Domain
y 4 y 2 y x
2 y y
4 +2y=x
x 2
x
y i 1 2 y i y i 1 y y i 1
4 i 1 2 yi x
x 2 2x
y 2 2 y1 y 0 y y0
4 2 2 y1 x
0.252 20.25
At i=1;
16 y2 -32 y1 +8 y2 +2 y1 =0.25
-30 y1 +24 y2 =0.25 ………………(1)
y 3 2 y 2 y1 y y1
4 3 2 y 2 0.5
At i=2;
0.252 20.25
y 4 2 y3 y 2 y y2
4 4 2 y 3 0.75
20.25
At i=3;
0.252
16 y4 -32 y 3 +16 y2 +8 y4 -8 y2 +2 y 3 =0.75
8 y2 -30 y 3 +24 y4 =0.75
8 y2 -30 y 3 =-23.25 ………………(3)
y1 = 0.83042
y 2 = 1.04844
y 3 = 1.0545 31
[Link]-NEUMANN STABILITY ANALYSIS
N r 1 x
1k
Let U(0,x)= Ak e L
k 0
r = Complex constant
t 1 k i 1 k i
= Ui
n rt rt n
U i = e e = e e e
n t 1 k i
U i = e e
=
n n
U i U i
n 1
= Ui
n
U i
n
n 1 U i
U i =
U
n
i 1 =e
1 k i
U n
i
U
n
i 1 =e
1 k i
U n
i
U
n 1
i 1 = e
1 k i
U n
i
U
n 1
i 1 = e
1 k i
U n
i
U
n 1
Ui
n
Un 2UnUn
i
i 1 i i 1
t x 2
t
Let r=
x t
U
n 1
i
Ui r Ui 1 2Ui Ui 1
n
n n n
32
Ui Ui r U
1 k i 1 k x
2Ui e
n n n n n
e U
i i
1 r e 1 k x
2e
1 k x
= r 2Cos k x 2
= 2r Cos k x 1
k x
=2r 2rSin 2
2
2 k x
=4r Sin
2
2 k x
=1-4r Sin
2
t 2 k x
For a solution to be stable: 1 4 2 Sin 1
x 2
For this condition there are low possible situation which must hold simultaneously are;
t 2 k x
1) 1-4 2 Sin ≤1
x 2
t 2 k x
Thus 4 2 Sin ≥0
x 2
t
Since 2 is always poisitive; this condition always holds good.
x
t 2 x
2) 1-4 2 Sin k ≥-1
x 2
t 2 k x
Thus 4 2
Sin -1≤1
x 2
t 1
This condition holds good when
x 2 2
33
STABILITY ANALYSIS OF IMPLICIT METHOD:
U 2U
t x 2
n 1
Ui
n
Un 1 2Un 1 Un 1
=U i
i 1 i i 1
t x 2
t
Let r=
x 2
n 1 n 1 n 1 n 1
U i
Ui =r[
n
Ui1 2Ui Ui1 ]
n
i
n
i
=r[ e
1 k x
i
n
2 i e 1 xi ]
n
k
n
1 =[ e 1 k x
2 + e
1 k x
]
=2r [-2Sin 2 (
k
x
)]
2
x
= 4r Sin ( )
2 k
x
= 1 4r Sin ( 2 k
2
)
[1 4r Sin 2 (
k
x
)]=1
2
1
2 k x
1 4 rSin ( )
2
Unconditionally stable for all values of r
34
STABILITY ANALYSIS OF CRANK – NICOLSON METHOD
U 2U
t x 2
t
Let r=
x 2
U
n 1
i
Ui
n r
2
U n 1
i 1
n 1 n 1
2Ui Ui 1 Ui 1 2Ui Ui 1
n n n
U n 1
i
Ui
n
r
2 e
1 k x
U 2U e
n
i
n
i
1 k x
U e
n
i
1 k x
U 2U e
n
i
n
i
1 k n
U
i
1 =
r
2 e
1 k x
2 e
1 k x
e
1 k x
2e
1 k x
1 = r 2Cos k x 2 2Cos( k x 2
2
r 2 k x 2 k x
1= 2 4rSin 4 Sin
2 2
k x 2rSin 2 k x
2rSin =1- 2
2 2
x
1 2rSin 2 k
2
x
1 2rSin 2 k
2
35
[Link] METHODS
GAUSSIAN ELIMINATION METHOD:
The algebraic equations are to be written in the form of AX=B. Row equations are performed
to obtain lower triangular elements as zero to obtain the solution.
Example :
Let us consider a linear system of n equations with n unknowns x1,x2,x3…..xn
8x2+2x3=-7
3x1+5x2+2x3=8
3x1+x2+4x3=13
[ ] [ ]=[ ]
R2-R3
[ ] [ ]=[ ]
R3-2R2
[ ] [ ]=[ ]
6x3=3 ; x3=0.5
4x2-2x3=-5 ; x2=-1
3x1+x2+4x3=13 ; x1=4
x1=4; x2=-1 ; x3=0.5
At(0.8,0.75,1.75);
At(2.95,0.175,4.39375)
At(2.0075,0.959375,4.071875)
At(1.979375,1.0340625,4.013359)
Iteration No X1 X2 X3
1 5 5 5
2 0.8 0.75 1.75
3 2.95 0.175 4.39375
4 2.0075 0.959375 4.071875
5 1.979375 1.0340625 4.013359
6 1.9878439 1.0118357 3.99238
37
GAUSS-SEIDAL ITERATION METHOD :
An initial guess for the unknown elements are assumed for starting the iteration.
Unlike Jacobi method, the latest value obtained is taken for the iteration calculations.
Iterations are to be performed till the solution converges.
Example:
5x1+x2+2x3=19
x1+4x2-2x3=-2
2x1+3x2+8x3=39
Initial values or guess values; x1=5 ; x2 = 5 ; x3=5
At (5,5,5);
x1= - (5) - (5)+ = 0.8
x2=- (0.8)+ (5)- = 1.8
x3= - (0.8)- + =4
At (0.8,1.8,4);
x1= - (1.8) - (4)+ = 1.84
x2=- (1.84)+ (4)- = 1.04
x3= - (1.84)- + = 4.025
38
Iteration No X1 X2 X3
1 5 5 5
2 0.8 1.8 1.8
3 1.84 1.04 1.04
4 1.982 1.017 1.017
5 1.99735 0.999725 0.999725
39
[Link] OF FINITE DIFFERENCE METHOD :
Finite Difference Method of 1-D Heat Conduction
At x=L, TL=100
1 2 3 4 5 6
T1 30 0 T6 100 0
At i=1; T1=30
At i=2;
At i=3;
At i=4;
At i=5;
At i=6; T6=100
[ ]x[ ]=
[ ]
The above matrix is a tri-diagonal matrix and can be solved using Thomas Algorithm.
1 2 3 4 5 6
T
Finite Difference equation T1 30 0 0
x
40
Q (x)
2
T i 1
2T i T i 1
k
At i=1; T 1 30
Q (x) Q (x)
2 2
At i=2; T 3 2T 2 T 1 T 2T
3 2
30
k k
Q (x)
2
At i=3; T 4 2T 3 T 2 5 6 7
k
Q (x)
2
At i=4; T 5 2T 4 T 3
k
Q (x)
2
At i=5; T 6 2T 5 T 4
k
Q (x)
2
At i=6; T 7 2T 6 T 5
k
T T T
2(x) 7 5
0 that implies T T5
x
7
Q (x)
2
30
2 1 0 0 0 T
2
k
2 Q (x)
2
1 1 0 0 T 3
0
1 2 1 0 T k
4
Q (x)
2
0 2 1 T
5
0 1
0
0 0 2 2 T 6
k
Q (x)
2
k
Q (x)
2
k
3
x y
2 2
(1,2) (2,2) (3,2)
U 2U U
i 1, j i, j i 1, j
U i , j 1
2U i , j U 1, j 1
0 2 (1,1) (2,1) (3,1)
x 2
x 2
1
41 U=0
For uniform grid; x y U=0
U i 1, j
4U i , j U i 1, j U i , j 1 U i , j 1 0
At (1,1) U 4U U U U
2 ,1 1,1 0 ,1 1, 2 1, 0
0
At (2,1) U 4U U U U
3,1 2 ,1 1,1 2, 2 2, 0
0
At (3,1) U 4 ,1
4U 3,1 U 2,1 U 3, 2 U 3, 0 0
At (1,2) U 2, 2
4U 1, 2 U 0, 2 U 1,3 U 1,1 0
At (2,2) U 3, 2
4U 2, 2 U 1, 2 U 2,3 U 2,1 0
At (3,2) U 4, 2
4U 3, 2 U 2, 2 U 3,3 U 3,1 0
At (1,3) U 2,3
4U 1,3 U 0,3 U 1, 4 U 1, 2 0
At (2,3) U 3, 3
4U 2,3 U 1,3 U 2, 4 U 2, 2 0
At (3,3) U 4,3
4U 3,3 U 2,3 U 3, 4 U 3, 2 0
4 1 0 1 0 0 0 0 0 U 11 0
1 4 1
0 1 0 0 0 0 U 21 0
0 1 4 0 0 1 0 0 0 U 31 1
1 0 0 4 1 0 1 0 0 U 12 0
0
1 0 1 4 1 0 1 0 U 22 0
1
0 0 1 0 1 4 0 0 1 U 32
0 0 0 1 0 0 4 1 0 U 13 1
0 0 0 0 1 0 1 4 1 U 23 1
0 1 4 9 X 9 U 33 2
0 0 0 0 1 0
42
Then
U i 1, j 2U i , j U i 1, j 2 U i , j 1 2U i , j U i , j 1 0
U i 1, j U i 1, j 2U i , j 1 2U i , j 1 2(1 2 )U i , j 0
U i 1, j U i 1, j 2U i , j 1 2U i , j 1 U i , j 0
Where 2(1 2 )
At (1,1); U 2,1 U 0,1 2U 1, 2 2U 1,0 U 1,1 0
At(2,1); U 3,1 U 1,1 2U 2, 2 2U 2,0 U 2,1 0 (1,3) (2,3) (3,3)
At(3,1); U 4,1 U 2,1 2U 3, 2 2U 3,0 U 3,1 0
(1,2) (2,2) (3,2)
At(1,2); U 2, 2 U 0, 2 2U 1,3 2U 1,1 U 1, 2 0 U U1
At(2,2); U 3, 2 U 1, 2 2U 2,3 2U 2,1 U 2, 2 0 (1,1) (2,1) (3,1)
At(3,2); U 4, 2 U 2, 2 2U 3,3 2U 3,1 U 3, 2 0
At(1,3); U 2,3 U 0,3 2U 1, 4 2U 1, 2 U 1,3 0
At(2,3); U 3,3 U 1,3 2U 2, 4 2U 2, 2 U 2,3 0
At(3,3); U 4,3 U 2,3 2U 3, 4 2U 3, 2 U 3,3 0 U U1
1 0 2 0 0 0 0 0 U 11 U 01 2U10
1 1 0 2 0 0 0 0 U 21 2
U 20
0 1 0 0 2 0 0 0 U 31 U10 U 41
2
2
0 0 1 0 2 0 0 U 12 U
02
0 2 0 1 1 0 2 0
U 22
0
0 0 2 0 1 0 0 2 U 32 U 42
0 0 0 2 0 0 1 0 U 13 U 03 U14
2
0 0 0 0 2 0 1 1 U 23 U 24 2
0 0 0 0 0 2 0 1 9 X 9 U 33 U 43 2U 34
43
CONVECTIVE DIFFUSION EQUATION
dT d 2T
The governing equation u 2
dx dx
CENTRAL DIFFERENCING
2Ti–(1-Pee/2)Ti+1 - (1+Pee/2)Ti-1 = 0
UPWIND DIFFERENCING
u{(Ti - Ti-1)/Δx} = α{(Ti+1+ Ti-1– 2Ti)/Δx2}
FOR U>0
44
ARTIFICIAL DIFFUSION
Artificial diffusion can be used in flow direction for high speed flows to avoid numerical
oscillations ; need not be used in cross flow direction it can be used to smoothen the solution
at shocks & high gradient regions
By setting (α0/α) = Pee/2, one can get the upwind form from central difference from for
artificial diffusion , 2nd order , 4th order or 6th order expressions etc. Can be used
u (dT/dx) = α (d2T /dx2) + α0u (d2T /dx2) + α0iv (d4T/dx4) + α0vi (d6T/dx6)
Cross differentiating the x - and y – momentum equations, and subtracting one from the
other, we get
Vorticity Transport Equation u (∂σ/ ∂x) + v (∂σ / ∂y) = µ/ρ {(∂2σ/ ∂x2 )+( ∂2σ / ∂y2)}
45
v u
Where vorticity is defined as V ( )
x y
For 2 – d incompressible flow , we can define stream function y as
u = ∂ψ/∂y ; v = - ∂ψ/∂x
In terms of y the equations for vorticity definition and vorticity transport become
2 2
= - 2 2
x y
2 2
x y y x x 2 y 2
u=0,v=0
46
FOR INTERIOR POINTS THE DIFFERENCE EQUATION IS
i 1, j i 1, j 2 i , j i , j 1 i , j 1 2 i , j
i , j
x 2 y 2
i 1, j i 1, j 2 i , j 1 i , j 1 21 2 i , j x 2 i , j
i , j 1 i , j 1 i , j i 1, j i 1, j i 1, j i , j i , j 1 i 1, j i 1, j 2 i , j i , j 1 i , j 1 2 i , j
2y x 2x y x 2 y 2
Where β = Δx/Δy
Any surface having normal velocity = 0must be a y = constant. Surface. Hence, all the
boundaries of the cavity have same y value, which can be conveniently set as zero
47
7.3 STAGGERD MESH PROCEDURE
X-velocity (u) nodes are shifted by x/2 with reference to pressure nodes and y-velocity
(v) nodes
V-VELOCITY
U-VELOCITY
PRESSURE
Continuity equation
x-momentum , -
y-momentum , -
energy equation ( ) ( )
For compressible flow the mass, momentum & energy balance equations are integrated
with respect to time to obtain and e values at new time level.
50
[Link]:
[Link]:
[Link]:
If a given numerical error is amplified from one time step to the next, then the calculation will
become unstable.
If the error does not grow; if it decreases from one step to another, then the calculation has a
stable behavior.
[Link]:
I. Discretization Error.
II. Truncation Error and
III. Round-Off Error.
I. DISCRETIZATION ERROR:
This is the difference between the exact analytical solution of the partial differential equation
and the exact solution of the corresponding finite difference equation.
The discretization error is simply the truncation error for the finite difference equation plus
any errors introduced by the numerical treatment of the boundary conditions.
This is the difference between an exact expression and the corresponding truncation form
used in numerical solution.
51
III. ROUND-OFF ERROR:
This is the numerical error introduced for a repetitive number of calculations in which the
computer is constantly rounding the numbers to some decimal points.
If
* + . . . . . . . . . (4)
From the definition; D is the exact solution of the finite difference equation; hence it exactly
satisfies the differential equation.
D * + . . . . . . . . (5)
From eq(6); we see that the error also satisfies the difference equation.
If the error , grow larger during the progression of the solution from step n to (N+1) then the
solution is unstable.
52