Linear Algebraic Equations: - Direct Methods
Linear Algebraic Equations: - Direct Methods
Linear Algebraic Equations: - Direct Methods
EQUATIONS
• DIRECT METHODS
- MATRIX INVERSION
- GAUSSIAN ELIMINATION
- LU DECOMPOSITION
• ITERATIVE METHODS
- SUCCESSIVE UNDER- /OVER
RELAXATION
MATRIX INVERSION
5 x1 + 2 x 2 + x 3 = 8 (1)
x1 + 2 x 2 + x 3 = 4 (2)
x1 + x2 + 3x3 = 5 (3)
5 2 1 x1 8
1 2 1 x 4
2 A x r x A 1 r
1 1 3 x3 5
COFACTOR METHOD
COFACTORS
A11 = 2x3 – 1x1 = 5; A12 = - (1x3 – 1x1) = -2; A13 = 1x1 – 1x2 = -1;
A21 = - (2x3 – 1x1) = -5; A22 = 5x3 – 1x1 = 14; A23 = - (5x1 – 1x2) = -3;
A31 = 2x1 – 2x1 = 0; A32 = - (5x1 – 1x1) = - 4; A33 = 5x2 – 1x2 = 8.
DETERMINANT
D = a11.A11 + a12.A12 + a13.A13 = 5x5 – 2x2 –1x1 = 20.
MATRIX INVERSE
5 5 0
1
A 1 2 14 4
20
1 3 8
x1 1
x A r x2 1
1
x 1
3
GAUSSIAN ELIMINATION
Then B y r
LU DECOMPOSITION
Applying forward substitution procedure, we can solve for the vector (y).
For example, 5 y1 = 8.0; y1 + 2 y2 = 4.0; y1 + 0.75 y2 + 3 y3 = 5.0.
By forward substitution, y1 = 1.6; y2 = 1.2 ; y3 = 0.8333.
Now consider C x y
This system can be solved by backward substitution. For example,
0.8333 x3 = 0.8333; 0.8 x2 + 0.4 x3 = 1.2; x1 + 0.4 x2 + 0.2 x3 = 1.6.
By backward substitution procedure, we get: x1 = 1.0; x2 = 1.0; x3 = 1.0.
TRIDIAGONAL SOLVER
Consider the tridiagonal system
b1 T1 + c1 T2 = d1
a2 T1 + b2 T2 + c2 T3 = d2
…………………………
ai Ti-1 + bi Ti + ci Ti+1 = di
…………………………
an Tn-1 + bn Tn = dn
TRIDIAGONAL SOLVER
2 T1 – T2 = 40 (1)
-T1 + 2 T2 – T3 = 0 (2) 3 T2 – 2 T3 = 40
-T2 + 2 T3 – T4 = 0 (3) 4 T3 – 3 T4 = 40
-T3 + 2 T4 – T5 = 0 (4) 5 T4 – 4 T5 = 40
-T4 + 2 T5 – T6 = 0 (5) 6 T5 – 5 T6 = 40
-T5 + 2 T6 = 110 (6) 7 T6 = 700
By backward substitution, we get T6 = 100, T5 = 90, T4 = 80, T3 = 70, T2
= 60 & T = 50.
ITERATIVE SOLUTION
Consider 5 x = 5. If this equation is rewritten as 2 x(k+1) = 5 – 3 x(k),
we can investigate the iterative solution.
Iter x(k)
0 0
1 2.5
2 –1.25
3 4.38
4 –4.07
5 8.61
6 –10.42
7 18.12
8 –24.68
9 39.52
10 –56.78
ITERATIVE SOLUTION
Now consider the system 3 x(k+1) = 5 – 2 x(k); using the same initial
guess, we get
Iter (k) x(k)
0 0
1 1.67
2 0.56
3 1.29
4 0.81
5 1.13
6 0.91
7 1.06
8 0.96
9 1.027
10 0.982
UNDER RELAXATION
Consider 2 x (k+1) = 5 - 3 x(k). We can iterate as follows.
x cal = 2.5 – 1.5 xk.
xk+1 = w. xcal + (1-w).xk = w.{ 2.5 – 1.5 xk} + (1-w).xk
3 x = 3.5 – 2 y
3 y = 4.0 – 2 x
iter x1 x2 x3
1 0.0 0.0 0.0
2 1.833 1.238 1.062
3 2.069 1.002 1.015
4 1.998 0.995 0.998
5 1.999 1.000 1.000
6 2.000 1.000 1.000
ERROR PROPAGATION
System 2:
1.01 0.99 x 2.02
0.99 1.01 y 1.98
The solution is x = 2.00, y=0.00
ILL-CONDITIONED SYSTEMS
System 3:
1.01 0.99 x 1.98
0.99 1.01 y 2.02
The solution is x =0.00, y=2.00
• Bi-section method
• Regula- falsi & Secant methods
• Newton- Raphson method
BI-SECTION METHOD
Let f(x) = 0 be a non- linear equation. If
two guesses are taken such that f() > 0 and
f() <0, the next guess can be taken as
(+)/2. Depending on the sign of
f(0.5+0.5), the new guess can be set as
or .
BI-SECTION METHOD
Consider f(x) = x2 + 3x – 10. For this, x = 2.0 is a solution.
f ( xi )
xi 1 xi ' xi+1 xi x
f ( xi )
EXAMPLE OF NON-LINEAR
EQUATION SOLUTION
f ( x) 3x sin x e x 0
f ( x) 3x sin x e x
f ' ( x) 3 cos x e x
iter x f(x)
0 0.0 -1.0
1 0.33333 -0.068418
2 0.36017 -6.279x10-4
3 0.3604217 ~10-8
NEWTON-RAPHSON METHOD FOR
NON-LINEAR SYSTEM
Consider the non-linear algebraic system
f 1 ( x, y ) x 2 3 xy 10 0
f 2 ( x, y ) xy y 2 3 0
f 1 f 1
x y 2 x 3 y 3x
J f
f 2 y
2 x 2 y
x y
k 1 k k
x x 1 f 1
J
y y f2
NEWTON-RAPHSON METHOD
FOR NON-LINEAR SYSTEM
iter x y f1 f2
0 1.0 0.0 - 9.0 - 3.0
1 1.0 3.0 0.0 9.0
2 1.3971 1.5442 - 1.576 1.542
3 1.9013 1.0269 - 0.5277 6.97x10-3
4 1.9971 0.9993 - 0.02449 - 5.697x10-3
5 2.003091 0.999974 0.02149 2.987x10-3
n 1 dy
y y
n
x y n f ( x, y ).x
dx y
y
dx
Implicit scheme: (uses final slope)
n 1
n 1 dy
y y
n
x y n f ( x n 1 , y n 1 ).x
dx
EXPLICIT/ IMPLICIT MARCHING
dy
Consider the differential equation 2 x y with the
dx
initial condition of y(0) = -1. The solution for this is given as y(x)
= -3e-x – 2x + 2. Using h = x = 0.1, we get by explicit scheme:
xn yn (y’)n h(y’)n yanalytical
0.0 -1.00000 1.00000 0.10000 -1.00000
0.1 -0.90000 0.70000 0.07000 -0.91451
0.2 -0.83000 0.43000 0.04300 -0.85619
0.3 -0.78700 0.18700 0.01870 -0.82245
0.4 -0.76830 -0.03170 -0.00317 -0.81096
2 2
' n 1, p
' n
( y ) ( y )
y n 1 y h
n
y n h f ( x n , y n ) f ( x n 1 , y n 1, p ) / 2
2
yn+1,p
This uses the average yn+1,c
yn
between the initial slope and
the predicted final slope
xn xn+1
MODIFIED EULER METHOD
xn yn h(y’)n yn+1,p h(y’)n+1 h(y’)av yn+1,c
0.0 -1.0000 0.1000 -0.9000 0.0700 0.0850 -0.9150
k1 f ( x , y )
n n
k 2 f ( x h, y hk1 )
n n
Thus the second slope k2 is evaluated using the first slope k1.
ACCURACY OF R-K II METHOD
n n n
dy h d y h d y
2 2 3 3
y n 1
y h.
n
2 3 O(h 4 )
dx 2! dx 3! dx
n 1
With a = b = ½ and , we have y y h(k1 k 2 ) / 2
n
k1 f ( x n , y n ) k 2 f ( x n h, y n hk1 )
Applying Taylor expansion to k2, we get
n 1 n n
dy dy d y
2
k 2 h 2 O(h 2 )
dx dx dx
Substituting for k2, the final expression becomes
n n
dy h d y 2 2
y n 1
y h.
n
2 O(h 3 )
dx 2! dx
Thus the R-K II method has local error of O(h3) and cumulative
error of O(h2).
R-K IV ORDER METHOD
n 1 h
y y ( k1 2 k 2 2 k 3 k 4 ) O ( h )
n 5
6
k1 f ( x n , y n ) k 2 f ( x n 0.5h, y n 0.5hk1 )
k 3 f ( x n 0.5h, y n 0.5hk 2 ) k 4 f ( x n h, y n hk 3 )
k2 k4
y k1 k3
xn xn+h
x
R-K IV METHOD
dy
For the equation 2 x y with the b.c. of y(0) = -1.0,
dx
the application of R-K IV method gives
dy 2
y1 y 2
dx
n
k 2i f i ( x 0.5h, y i 0.5hk1i )
n
n
k 3i f i ( x 0.5h, y i 0.5hk 2i )
n
n
k 4i f i ( x n h, y i hk 3i )
Here, we need to evaluate all the k1i first, then all the k2i
etc. for the whole range of i = 1,2,… m; where m is the
number of differential equations (number of dependent
variables)
INITIAL/ BOUNDARY VALUE PROBLEMS
Initial value problem:
d2y dy
2
5 3y 0 y(0) = 0.0, y’(0.0) = 0.2.
dx dx
Boundary value problem:
d2y dy
2
5 3y 0 y(0) = 0.0, y(1.0) = 0.5.
dx dx
dy1
dy y2
Let y y1 ; y 2 dx
dx
dy 2
5 y 2 3 y1
dx
y1(0) = 0.0; y2(0) = (guess). is to updated until the
boundary condition y1(1.0) = 0.5 is satisfied.
MARCHING METHOD FOR
BOUNDARY VALUE PROBLEM
yexact(L)
y } g() = yexact-ynum
ynum(L)
y(0)
x
We need to find such that g() = 0. By applying the Newton-
Raphson method, we get:
g ( k
)
' k
k 1 k
g ( )
MARCHING METHOD FOR
BOUNDARY VALUE PROBLEM
Initially a guess value of the slope is assumed. By integrating
the ODE system with this guess value of , the predicted end
boundary condition value is obtained. The difference between
the correct end b.c. and the predicted end b.c. value is taken as a
function g(), whose root we seek. In other words, we look for
the correct value of slope which will result in the predicted
end b.c.matching with exact end b.c.
In order to evaluate the derivative g’(), we slightly perturb the
current value of ; find the change g in g() due to this small
perturbation and numerically compute g’() as g/.
EXAMPLE OF INITIAL
VALUE PROBLEM
Consider the set of reactions
C + ½ O2 k1 CO ; CO + ½ O2 k2 CO2
Also let the initial concentrations of these species be 0.5,0.5,0.0 and 0.0
respectively. The ODE system can be written as follows:
dY1 dY2 k1 1.0 0.5 k 2 1.0 0.5
k1Y1 Y2
1.0 0.5
Y1 Y2 Y3 Y2
dt dt 2 2
dY3 dY4
k1Y11.0Y20.5 k 2Y31.0Y20.5 k 2Y31.0Y20.5
dt dt
with initial conditions Y1(0) = 0.5,Y2(0) = 0.5,Y3(0) = 0.0 and Y4(0)= 0.0.
Boundary value problem
(boundary layer flow)
Using the similarity transform method, we get : f ''' 0.5 ff '' 0
f’ = 1 y
U 1 y= 0
f = f’ = 0.0
( f n 2 f n 1 f n2
) (3 f n
4 f n 1
f n2
)
f ( x, y ) x
2
x f n
2h 2 2h
y n 1
y
n h
12
23 f n 16 f n 1
5f n2
O(h 4
)
Quadratic fits are used for the slope in both the predictor &
corrector steps. Predictor involves extrapolation, while corrector
involves interpolation (implicit evaluation).
Milne’s Method
Predictor Step:
x N 1
4h 28 5 v
f ( x, y)dx y ) h y ( 1 )
n 1 n 3 n 3 n 1 n2
y y (2 f n f 2f
x n 3
3 90
Corrector Step:
x N 1
h 1 5 v
f ( x, y)dx y ) h y ( 2 )
n 1 n 1 n 1 n 1 n 1
y y (f 4f f
n
x n 1
3 90
The predictor step uses quadratic fit between three points for the
slope and extrapolates the solution; the corrector step also involves
a quadratic fit for the slope which is implicit. But this gives a more
accurate final expression. However, Milne’s method suffers from an
instability which renders the method inaccurate for a certain class of
problems.
Adams- Moulton Method
Predictor Step:
x N 1
h 251 5 v
y n 1 y n h y (1 )
n 1 n2 n 3
f ( x, y )dx y n (55 f n 59 f 37 f 9f )
xn
24 720
Corrector Step:
x N 1
h 19 5 v
y n 1 y n h y ( 2 )
n 1 n 1 n2
f ( x, y )dx y n (9 f 19 f n 5 f f )
xn
24 720
Since the error in these methods is O(h5), until the above error estimate is
less than the prescribed tolerance value, the step size h has to be reduced.
For example, if the estimated error for Milne’s method at a point is 2 x
10-6 and we need to reduce this to 10-8, the step size can be decreased to
h/3. (Note: (h/3)5 = h5/243).
For RK-4 method, by finding the difference in solution for a step size of
2h and for h at the same location, we can get an estimate of the error.
The step size can then be reduced suitably to meet the tolerance
criterion.
Stability of the solution technique
dy
10 y
Consider dx with the b.c. y(0) = 1.0. The solution for this
case is y(x) =e-10x. The discretised form is obtained as:
yn+1 = yn + (dy/dx).h = yn – 10yn.h = yn(1-10h).
The above expression is of the form yn+1 = yn, which will diverge if ||
> 1. Here is called the amplification factor.
The discretised equation will diverge if 10h > 2. Or, if h > 0.2. In order
to avoid this one can go for an implicit solution procedure.
yn+1 = yn + (dy/dx)n+1.h = yn – 10yn+1.h yn+1(1+10h) = yn.
The above system is stable for any step size h. In general for a system of
the form dy/dx = - cy, the explicit procedure will diverge if h> 2/c.
Stiff ODE systems
d 2u du
Consider the ODE 2
100 0.01u 0
dt dt
dy1 dy 2
y2 and 100 y 2 0.01y1
dt dt
du
where u = y1 and y2
dt
2 2 2
A B C 2 0
Consider the linear PDE system x 2 xy y
It is parabolic if B 2
4 AC 0.
It is hyperbolic when B 2
4 AC 0.
Elliptic PDE
Consider steady two dimensional heat conduction governed by the
equation 2T 2T
k 2 2 Q 0
x y
Here, A = C = k and B = 0. Hence B 2
4 AC 4 k 2
0. Therefore, the
system is elliptic. For an elliptic PDE, the boundary conditions need to
be given on a closed boundary. In other words, the boundary conditions
all around influence the solution at a point
b.c. b.c.
b.c. P b.c. P
b.c.
Boundary conditions for elliptic systems
Parabolic PDE
Transient heat conduction problem which follows the governing
T k 2T 2T
equation 2
t c x 2
x
• AEROSPACE VEHICLES
• AUTOMOBILES
• POWER GENERATION
• MANUFACTURING TECHNOLOGY
• STRUCTURAL DESIGNS
• ENVIRONMENTAL POLLUTION
STEPS INVOLVED IN MODELING
u u u u p
x-mom.: ( t
u
x
v
y
w ) 2 u g x
z x
v v v v p
(
y-mom.: t u v w ) 2
v g y
x y z y
z-mom.: ( w u w v w w w ) p 2 w g z
t x y z z
T T T T
Heat balance: C p ( u v w ) k 2T Q
t x y z
Governing equations (compressible flow)
Mass balance: ( u ) ( v) ( w)
0
t x y z
( u ) ( u 2 ) ( uv) ( uw) xx xy xz
g x
Momentum t x y z x y z
u 2 v 2 w v
xx p 2 (.V ) yy p 2 (.V ) yz zy ( )
x 3 y 3 y z
w 2 u v u w
zz p 2 (.V ) xy yx ( ) xz zx ( )
z 3 y x z x
Energy ( e) ( uH ) ( vH ) ( wH )
.(kT ) Q
eq.: t x y z
Typical flow boundary
conditions
U
No-slip b.c.
Exit b.c.
extrapolation
Symmetry
v=0, y-der. = 0
Inlet
b.c.
Typical thermal b.c.
flow
Temp. specified
T = Tw Convective b.c
-k(dT/dn) = h(T-Tf)
Adiabatic.
Heat flux = 0 ambient at T
Radiative b.c.
q -k(dT/dn) = (T4-T4)
Prescribed heat flux
-k(dT/dn) = q
MODELING METHODS
• FINITE DIFFERENCE METHOD
• FINITE VOLUME METHOD
• FINITE ELEMENT METHOD
• BOUNDARY ELEMENT METHOD
• SPECTRAL METHOD
FINITE DIFFERENCE METHOD
dT Ti Ti 1 Ti 1 Ti
or
dx x x
i-1 i i+1
FINITE VOLUME METHOD
• FLUX BALANCE IS APPLIED FOR EACH CELL
• HEAT FLUX IN – HEAT FLUX OUT = RATE OF
THERMAL STORAGE
• FLUXES ARE APPROXIMATED USING
NEIGHBOURING NODES
FINITE ELEMENT METHOD
• WHILE FDM & FVM WERE APPLIED FOR
FLOW/THERMAL PROBLEMS, FEM WAS
INITIALLY DEVELOPED FOR STRUCTURAL
PROBLEMS
• IN THIS METHOD, A LARGE STRUCTURE IS
DIVIDED INTO SMALL ELEMENTS AND
CHARACTERISTIC OF EACH ELEMENT IS
WRITTEN AS A MATRIX CONTRIBUTION
• BY ADDING CONRIBUTIONS OF ALL
ELEMENTS, WE GET THE MATRIX
EQUATION FOR THE WHOLE GEOMETRY
STRUCTURAL ANALYSIS
F = K x for a
spring
ik T ( x i , t k ) T * ( x i , t k )
ik x i2 and ik t k
= O (x2, t)
TAYLOR SERIES EXPANSIONS
dT d 2T x 2 d 3T x 3 d nT (x) n
Ti 1 Ti x 2 3 .... n 0(x n 1 )
dx i dx i 2! dx 3! dx n!
dT d 2T x 2 d 3T x 3 d nT x n
Ti 1 Ti x 2 3 .... n O(x n 1 )
dx dx i 2! dx i 3! dx n!
dT d 2 T (2x ) 2 d 3 T (2x ) 3
Ti 2 Ti (2x ) 2 3
dx i dx i 2! dx 3!
d n T ( 2 x ) n
....... n 0 (x n 1 )
dx n!
dT d 2 T (2x ) 2 d 3 T (2x ) 3
Ti 2 Ti (2x ) 2 3
dx i dx i 2! dx i 3!
d n T (2x ) n
n 0(x n 1 )
dx i n!
DERIVATIVE APPROXIMATIONS
dT Ti 1 Ti d 2 T x d 3 T x 2
2 3
dx i x dx i 2! dx i 3!
T Ti
i 1 0(x )
x
dT Ti Ti 1 d 2T x d 3T x 2
2 3
dx i x dx i 2! dx i 3!
Ti Ti 1
0(x)
x
dT Ti 1 Ti 1
O (x 2 )
dx i 2x
DERIVATIVE APPROXIMATIONS
dT
4Ti 1 Ti 2 3Ti 2 x 0( x 3 )
dx i
dT 4Ti 1 Ti 2 3Ti
0( x 2 )
dx i 2 x
d 2 T x 2 d 4 T x 4
Ti 1 Ti 1 2Ti 2 2 2 4 .......
dx i 2! dx i 4!
d 2 T Ti 1 Ti 1 2Ti
2 2
0( x )
dx i x 2
FDM FOR HEAT CONDUCTION
d 2T
k 2 Q 0
dx
d 2T (T T 2Ti )
k 2 Q k i 1 i 12 Q 0( x 2 )
dx i x
dT
0 at x = L
dx
dT T TN
N 2 0
dx
i N 1 2 x
k (TN 2 TN 2TN 1 )
Q0
x 2
2 k (TN TN 1 ) dT
Q 0 TO 0
x 2 dx
dT d 2T x 2 d 3T x 3 d n T x n
Ti 1 Ti x 2 3 .... n O(x n 1 )
dx dx i 2! dx i 3! dx n!
(Ti 1 Ti 1 2Ti )
k aTi b 0
2
x 2
T1 = Tb at x = 0
dT
0
dx at x = L
QUASI-LINEARISATION OF
SOURCE TERM
T k 1
Ti k11 2Ti k 1
aTi k Ti k 1 b 0
i 1
k
x 2
k 1 k 1
aTi
k
x 2
k 1 b x 2
Ti 1 Ti 1 2 Ti
k k
QUASI-LINEARISATION OF
SOURCE TERM
• DUE TO SOURCE TERM, DIAGONAL
DOMINANCE ( |aii| > |aij| ) MAY BE
AFFECTED
• FOR THIS PURPOSE, QUASI- LINEARISATION
IS DONE IN THE FORM Q(Ti) = - A ( Ti k+1) + B
• IF IT IS NOT NOT POSSIBLE TO EXPRESS Q
IN THE ABOVE FORM WITH NEGATIVE
COEFFICIENT, THEN TAKE A = 0 AND SET Q
= a (Ti)2 + b = B
TWO-DIM. HEAT CONDUCTION
i,j+1
2T 2T
k 2 2 Q 0 i-1,j i+1,j
x y
i,j
2T Ti 1, j Ti 1, j 2Ti , j i,j-1
2 2
0( x )
x i , j x 2
2T Ti , j 1 Ti , j 1 2Ti , j
2 0 ( y 2
)
y i , j y 2
POINT-BY-POINT METHOD
2(12 Ti,j = T*i+1,j + T*i-1,j + 2(T*i,j+1 + T*i,j-1) + Qx2/k
LINE-BY-LINE METHOD
Q x 2
Ti 1, j Ti 1, j 2(1 2 )Ti , j 2 (Ti*, j1 Ti*, j1 )
k
Q x 2
2 (Ti , j1 Ti , j1 ) 2(1 2 )Ti , j Ti*1, j Ti*1, j
k
UNDER-RELAXATION/ OVER-RELAXATION
Ti ,kj1 W Ti , j (1 W )Ti ,kj
HEAT CONDUCTION IN
CYLINDRICAL GEOMETRY
2 T 1 T 1 2 T
2 2 0
2
r r r r
T r ro a b sin
r r 2 2
Ti , j 1 1 Ti , j 1 1 2 (Ti 1, j Ti 1, j ) 21 2 Ti , j 0
2r j 2r j r j rj
r
HERE
MESH FOF CYLINDRICAL GEOMETRY
BOUNDARY CONDITIONS IN
ANGULAR DIRECTION
AT i = imax,
r r 2 2
Ti max, j 1 1 Ti max, j 1 1 (T T1, j ) 21 2 Ti max, j 0
2r 2r r 2 i max 1, j r j
j j j
AT i = 1,
r 2 2
T1, j 1 1 T1, j 1 1 r (T T2, j ) 21 2 T1, j 0
2r 2r r 2 i max, j r j
j j j
BOUNDARY CONDITIONS
AT i=1 AND i = imax, THE REENTRANT BOUNDARY
CONDITION IS USED. THAT IS i = 1 AND i = imax ARE
TREATED AS NEIGHBOURS
TE + TW + TN + TS - 4TP = 0
TRANSIENT HEAT
CONDUCTION
T 2T
c p k 2 Q Ti
t x
Tb Tb
BOUNDARY CONDITIONS:
T = Tb at x = 0 and x = L
INITIAL CONDITION:
• EXPLICIT METHOD
• IMPLICIT METHOD
• SEMI-IMPLICIT METHOD (CRANK-
NICOLSON TECHNIQUE)
EXPLICIT METHOD
n n
T T 2
2
t i x i
n
n 1 n T
Ti Ti t
t i
Ti n 1
Ti (t / x )(T
n 2 n
i 1 T n
i 1 2Ti )
n
IMPLICIT METHOD
n 1
n 1 n T
Ti Ti t
t i
n 1 n 1
T 2T
2
t i x i
Ti n 1
(t / x )(T 2 n 1
i 1 T n 1
i 1 2Ti n 1
) Ti n
SEMI-IMPLICIT METHOD
n n 1
n 1 n T T
Ti Ti (t / 2){ }
t i t i
Ti n 1 (t / 2x 2 )(Ti n11 Ti n11 2Ti n 1 ) Ti n (t / 2x 2 )(Ti n1 Ti n1 2Ti n )
COMPARISON OF IMPLICIT/
EXPLICIT METHODS
• EXPLICIT METHOD INVOLVES POINTWISE UPDATING &
REQUIRES NO MATRIX INVERSION. IMPLICIT SCHEME
NEEDS MATRIX INVERSION
• COMPUTATIONAL TIME PER TIME STEP IS MORE FOR
IMPLICIT METHOD THAN THE EXPLICIT.
• FROM STABILITY CONSIDERATIONS, EXPLICIT SCHEME
MAY REQUIRE VERY SMALL TIME STEPS AND HENCE
SEVERAL THOUSAND STEPS TO OBTAIN STEADY STATE
SOLUTION. LARGE TIME STEPS CAN BE USED IN IMPLICIT
SCHEME
• BOTH EXPLICIT & IMPLICIT METHODS ARE O(t) WHILE
SEMI-IMPLICIT SCHEME IS SECOND ORDER ACCURATE
ALTERNATING DIRECTION
IMPLICIT METHOD
T 2T 2T
C p k( 2 2 ) Q
t x y
X-DIR. IMPLICIT T 2T n 1 2T n
C p k 2 2 Q
t x y
Y-DIR. IMPLICIT
T 2T n 1 2T n 2
C p k 2 2 Q
t x y
CONVECTIVE DIFFUSION
dT d 2T
u 2
dx dx
u
i-1 i i+1
Ti 1 Ti 1 Ti 1 Ti 1 2Ti
u
2 x x 2
Pec = ux/
Cell Pe < 2 for spatial stability, when central difference is used
UPWIND DIFFERENCING
DIFFUSION
Ti Ti 1 T Ti 1 2Ti
u i 1 i-1 i i+1
x x 2
CONVECTION
i-1 i i+1
FOR U>0
2(1 Pec )Ti Ti 1 (1 Pec )Ti 1 0
FOR U<0
2(1 | Pec |)Ti (1 | Pec |)Ti 1 Ti 1 0
ARTIFICIAL DIFFUSION
CENTRAL DIFFERENCE:
2Ti (1 Pec / 2)Ti 1 (1 Pec / 2)Ti 1 0
UPWIND DIFFERENCE:
2(1 Pec )Ti Ti 1 (1 Pec )Ti 1 0
a
(ux / 2 )(Ti 1 Ti 1 ) (1 )(Ti 1 Ti 1 2Ti )
By setting (a/) = Pec/2, one can get the upwind
form from central difference form
UPWINDING &ARTIFICIAL
DIFFUSION
• UPWINDING CAN BE DONE WITH HIGHER ORDER
ACCURACY
• FOR NODE i, WE CAN CONSIDER THE NODES (i-2),
(i-1) AND (i) TO GET SECOND ORDER ACCURATE
EXPRESSION FOR CONVECTIVE TERM. EVEN
NODES (i-2), (i-1), (i) AND (i+1) CAN BE TAKEN FOR
THIRD ORDER ACCURACY
• FOR ARTIFICIAL DIFFUSION II ORDER, IV ORDER
OR VI ORDER EXPRESSIONS ETC. CAN BE USED
HIGHER ORDER ARTIFICIAL
DIFFUSION
dT d 2T 2
II d T d 4
T d 6
T
u 2 a 2
a
IV
4
a
VI
dx dx dx dx dx 6
d 2T Ti 1 Ti 1 2Ti
dx 2
x 2
u u 1 p 2 u 2 u
u v { 2 2}
x y x x y
v v 1 p 2 v 2 v
u v { 2 2}
x y y x y
VORTICITY STREAM
FUNCTION FORMULATION
CROSS-DIFFERENTIATING THE X- AND Y-
MOMENTUM EQUATIONS, AND SUBTRACTING
ONE FROM THE OTHER, WE GET:
2 2
VORTICITY TRANSPORT u v 2 2
EQUATION x y x y
v u
WHERE VORTICITY V k ( )
IS DEFINED AS x y
VORTICITY STREAM
FUNCTION FORMULATION
FOR 2-D INCOMPRESSIBLE FLOW, WE CAN DEFINE
STREAM FUNCTION AS
u ;v
y x
IN TERMS OF THE EQUATIONS FOR VORTICITY
DEFINITION AND VORTICITY TRANSPORT BECOME
2 2
2 2
x y
2 2
2 2
y x x y x y
LID DRIVEN CAVITY FLOW
u=uo,v=0
FOR INTERIOR POINTS:
i 1, j i 1. j 2 i , j i , j 1 i , j 1 2 i , j
i , j u=0, u=0,
x 2
y 2
v=0 v=0
1, j 0 i max, j 0
i ,1 0 1, j max 0
BOUNDARY CONDITIONS
FOR VORTICITY: CONSIDER
2 3
2, j 1, j x 2 x / 2! 3 x 3 / 3!...
2
2, j 1, j .x 2 / 2!O(x 3 )
SIMILARLY
2 3
i,2 i ,1 y 2 y 2 / 2! 3 y 3 / 3!...
y i ,1 y i ,1 y i ,1
i , 2 i ,1 .y 2 / 2!O(y 3 )
u u u 1 p 2 u 2 u
u v { 2 2}
t x y x x y
n n 1 n
n 1 u u 1 p u u 2 2
u u t.(u
n
v ) t. t. { 2 2 }
x y x x y
n n 1 n
v v v 1 p v v
2 2
Y-mom.: (u v ) { 2 2}
t x y y x y
n n 1 n
v v 1 p v v 2 2
v n 1 v n t.(u v ) t. t. { 2 2 }
x y y x y
VELOCITY CORRECTION
EQUATION
n n 1 n
u u 1 p 2u 2u
u n 1 u t.(u
n
v ) t. t. { 2 2 }
x y x x y
n * n
u u 1 p u u 2 2
u * u n t.(u v ) t. t. { 2 2 }
x y x x y
n 1 *
1 p 1 p
u n 1 u * t. t.
x x
VELOCITY CORRECTION
EQUATION
n n 1 n
n 1 v v 1 p v v
2 2
v v t.(u v ) t.
n
t. { 2 2 }
x y y x y
n * n
v v 1 p v v 2 2
v v t.(u v ) t.
* n
t. { 2 2 }
x y y x y
n 1 *
n 1 1 p 1 p
v v t.
*
t.
y y
PRESSURE CORRECTIONS
DEFINE
u ' u n 1 u * v v
' n 1
v * p ' p n 1 p *
V-VELOCITY
U-VELOCITY
PRESSURE
COMPRESSIBLE FLOW
SIMULATION
• FOR COMPRESSIBLE FLOW THE MASS,
MOMENTUM & ENERGY BALANCE
EQUATIONS ARE INTEGRATED WITH
RESPECT TO TIME TO OBTAIN u,v AND
e VALUES AT NEW TIME LEVEL
• FROM THESE VARIABLES, THE VELOCITY,
TEMPERATURE ARE DERIVED
• NEW PRESSURE IS OBTAINED USING THE
STATE EQUATION
EQUATIONS OF
COMPRESSIBLE FLOW
u v
Mass bal.: 0
t x y
u ( u 2 p ) uv
0
t x y
v uv ( v 2 p )
0
t x y
e u (e p / ) v(e p / )
0
t x y
u v
u u 2 p uv
Q E F
v uv v p
2
e u ( e p / ) v ( e p / )
Q E F
0
t x y
SOLUTION OF EULER
EQUATIONS
Q E F
0
t x y
n n 1
E F E F
Q n 1 Q n t Or Q n 1 Q n t
x y x y
( u ) n 1 n 1 ( v) n 1 ( e) n 1
u v n 1
e n 1
n 1 n 1 n 1
e n 1 c v T n 1 {(u n 1 ) 2 (v n 1 ) 2 } / 2
p n 1 n 1 RT n 1
SOLUTION OF EULER
EQUATIONS
• WHILE EVALUATING THE FLUX TERMS, ONE
CAN INTRODUCE ARTIFICIAL DIFFUSION
TERMS IN THE FLOW DIRECTION ONLY (SAY,
X) TO SMOOTHEN THE OSCILLATIONS
• TIME MARCHING CAN BE DONE WITH
HIGHER ORDER SCHEMES SUCH AS RUNGE-
KUTTA
• STABILITY OF SOLUTIONS MAY DEMAND
RESTRICTIONS ON STEP SIZE OR TIME STEP
(ut/x<1,t/x2<0.5 etc.)
MODELING OF
COMPRESSIBLE FLOWS
SOLUTION METHODS
u n
t n
FTFS (predictor): u i ui
n
(ui 1 uin )
x
u n t
FTBS(Corrector): ui ui (ui u i 1 )
x
n 1 1
u i u i u i
2
MacCormack Method (Scheme II)
u n
t n
FTBS (predictor): u i ui
n
(u i u in1 )
x
u n t
FTFS(Corrector): ui ui (u i 1 u i )
x
n 1 1
u i u i u i
2
MacCormack Method
• Scheme I can capture the left running
characteristics better
• Scheme II can capture the right- running
characteristics better
• To avoid favouring the left- running or
right- running characteristics, both schemes
are applied one after another, in subsequent
time steps.
MacCormack Method
• The predictor/ corrector scheme is stable only
for Courant number less than 1 ( ut/x <1)
• For avoiding spatial oscillations (particularly
in the regions of high gradients), suitable
artificial diffusion terms may be added
Jameson’s Method
u u u u II u
2
IV u
4
u 0 u
t x t x x 2
x 4
The time marching can be done using fourth order Runge- Kutta
marching scheme. The second order and fourth order artificial
Viscosities are calculated using switches in the shock region
Jameson’s scheme
• This has a good temporal accuracy for
prediction
• The time step can be suitably adjusted
depending on the first slope (k1)
• The shock switches are obtained the
variation of any variable (say, velocity,
pressure etc.)
u i 1 u i 1 2u i u i 1 u i 1 2u i
O(1) O(x 2 )
| u i 1 | | 2u i | | u i 1 | | u i 1 | | 2u i | | u i 1 |
dT (TP TW )
kA kA
dx xw x w
hp
TE 2TP TW (TP T ) x 2 0
kA
HEAT TRANSFER FROM FIN
dT
0 AT X = L
dx
FLUX BALANCE FOR LAST CELL BECOMES
dT dT kA(Tp Tw )
kA kA hp(TP T ) hp(TP T )x 0
dx w dx e x
TRANSIENT 1-D CONDUCTION
W P E
dT
q w q e c p ( Ax)
dt P
dT dT
q w (kA) w q e (kA) e
dx w dx e
TWO-D STEADY HEAT CONDUCTION
qn q s qe q w 0
N
dT
(kA) n
dT
(kA) s
dT
(kA) e
dT
(kA) w 0
YN
dy n dy s dx e dx w
Y
W P E
XW XE
X
YS
(TN TP ) (T TS ) (T TP ) (T p TW )
k n An k s As P k e Ae E k w Aw 0 S
y n y s x e x w
VARIABLE PROPERTIES
For smooth variation
k (Tp ) k (TW ) k p kW
kw
2 2
k (TE ) k (TP ) k E k P
ke
2 2
2 1 1
ke kE kp
Modeling of Convective
Diffusion by FVM
Heat balance for a cell
convection
conduction
w e
T T T
uC T
p y k y uC pT e y k y C p xy
w
x w x e t
Discretisation of Cell Balance
T T T
uT w uT e x
x w x e t
TW TP TP T E
u TP TW TE TP x T
2 2 x x t
ut n t
2x
TW TE 2 2TPn TWn T En T Pn TPn 1
n
x
Stability Considerations
t 1
For temporal stability,
x 2
2
For spatial stability, ux
2
UPWINDING SCHEMES
In upwind scheme, Tw =TW and Te = TP for u>0.
For u<0, Tw = TP and Te = TE.
BY
PROF. T.SUNDARARAJAN
DEPT. OF MECHANICAL ENGINEERING
IIT MADRAS
FINITE ELEMENT METHOD
• WHILE FDM & FVM WERE APPLIED FOR
FLOW/THERMAL PROBLEMS, FEM WAS
INITIALLY DEVELOPED FOR STRUCTURAL
PROBLEMS
• IN THIS METHOD, A LARGE STRUCTURE IS
DIVIDED INTO SMALL ELEMENTS. RESPONSE
OF EACH ELEMENT FOR A GIVEN LOADING, IS
WRITTEN AS A MATRIX CONTRIBUTION
• BY ADDING MATRIX CONRIBUTIONS OF ALL
ELEMENTS, THE MATRIX EQUATION FOR THE
WHOLE GEOMETRY IS OBTAINED
STRUCTURAL ANALYSIS
F = K x for a
spring
• DIRECT METHOD
• VARIATIONAL METHOD
• WEIGHTED RESIDUAL (GALERKIN)
METHOD
ONE DIMENSIONAL HEAT
CONDUCTION (DIRECT METHOD)
FROM FOURIER’S LAW OF
CONDUCTION, WE GET:
T1 T2
q1 2 kA T1 T2
x
T1 T2 x
q1 2 whereR1 2
R1 2 kA
T1 T2
T2 T1
q 2 1
R1 2
ONE DIMENSIONAL HEAT
CONDUCTION (DIRECT METHOD)
Considering heat flow from node 1 to node 2, or from
node 2 to node 1, we get:
kA kA
q1 2 x T
x 1
q kA kA T2
21
x x
kA 1 1
K
(e)
x 1 1
ELEMENT ASSEMBLY
1 1 1
(T1 T2 ) (T1 T3 ) (T1 T4 )
R12 R13 R14
1 1 1
(T1 T5 ) (T1 T6 ) (T1 T7 ) Q1
R15 R16 R17
APPLICATION OF GALERKIN
WEIGHTED RESIDUAL METHOD
d 2T
k 2 Q 0
dx
AT X = 0, T = TO
AT X = L, T = TN
TO TN
d 2T *
k 2
Q R( x)
dx
T (e) N ( x)T
i 1, 2
i i
K T Q
ij j i
ELEMENTAL MATRICES
kA kA
x
x ELEMENTAL CONDUCTION
[K](e) = kA kA
MATRIX
x x
''' .
q Ax
2 ELEMENTAL GENERATION
[G](e) = ''' .
q Ax VECTOR
2
TWO-DIM. HEAT CONDUCTION
2T 2T
k 2 2 Q 0
x y Sh
T
k q on Sq
n
Sq ST
T
k h(T T f ) on Sh
n
T=Tb on ST
2-D HEAT CONDUCTION
2T 2T
i x 2 y 2 dxdy 0; i 1,2,...
N k k Q
T T N i T N i T 2 T 2T
kN i kN i k k N i k 2 2
x x y y x x y y x y
N i T N i T
k dxdy N i Qdxdy N i k T dl
x x y y n
N i T N i T
k x x
y y
dxdy N i hTdl N i Qdxdy N i hT f dl N i qdl
Sh Sh Sq
2-D HEAT CONDUCTION
K T G
ij j i
N i N j N i N j
where K
ij k(
x x
y y
)dxdy hN i N j dl
Sh
Gi N i Qdxdy N i hT f dl N i qdl
Sh Sq
SHAPE FUNCTIONS
T N1 ( x, y )T1 N 2 ( x, y )T2 N 3 ( x, y )T3
x( y 2 y 3 ) x 2 ( y 3 y ) x3 ( y y 2 )
N 1 ( x, y ) T3
x1 ( y 2 y 3 ) x 2 ( y 3 y1 ) x3 ( y1 y 2 )
x1 ( y y3 ) x( y3 y1 ) x3 ( y1 y )
N 2 ( x, y )
x1 ( y2 y3 ) x2 ( y3 y1 ) x3 ( y1 y2 ) T1
T2
x1 ( y 2 y ) x 2 ( y y1 ) x( y1 y 2 )
N 3 ( x, y )
x1 ( y 2 y 3 ) x 2 ( y 3 y1 ) x3 ( y1 y 2 )
ELEMENTAL CONTRIBUTIONS
e 1 / 3 1 / 6 e 0.5
e i j
hN N dl h l 1 / 6 1 / 3
e f
NhT dl hT f l
0.5
1 / 3
e 0.5
e i e N i qdl ql 0.5
e
N Qdxdy QA 1 / 3
1 / 3