Escolar Documentos
Profissional Documentos
Cultura Documentos
Y V S S Sanyasiraju
Associate Professor
Department of Mathematics
IIT Madras, Chennai 600036
Early Methods
Cramers rule
Direct methods
Iterative methods
Triangular
Diagonal
Elimination Methods
Decomposition Methods
Next
for i = n, n-1, . . . , 1 do
n
bi a
j =i +1
i, j xj
xi =
end ai ,i
back
Complete pivoting
PAx = Pb
{
si = max ai , j = max ai ,1 , ai ,2 ,K , ai ,n
1 j n
} (1 i n)
ai , j
Pivotal Row = pi = max for 1 i n
i jn si
P = { p1 , p2 ,K , pn }
Forward Elimination
ac ad
bi = bi i i 1 , di = di i i 1
bi 1 bi 1
Back Substitution
( di ci xi +1 )
xi =
bi
LU Decomposition
Cholesky Decomposition
j 1
i1
uij = aij - lik ukj (for i > 1)
k=1
uii = 1
U = LT
(A + A) x = b + b
) || A 1 ||
|| x - x || ( || A-1A|| + || b || )
(1|| A1A||)
)
|| x x || || b || || A || k (A )
+
|| x || || b || || A || 1 || A 1 A ||
max ev
k(A) = = 2472.73
min ev
= Q + C as
Incomplete factorization M = LU
2U = 0, 0 x 1, 0 y 1
Boundary conditions
U(x,1) = U(y,1) = U(0,y) = 0 and
U(x,0) = x(x-1)
February 19, 2010 sryedida@iitm.ac.in 30
Preconditioning
2U = 0, 0 x 1, 0 y 1
Boundary conditions:
Ux(x,1) = sin3 y and
U(1,y) = U(0,y) = U(x,0) = 0
Continuity equation .u = 0
1
Momentum equation (u.)u = p + u
Re
1
Energy equation (u.)T = T
Pr
where u (velocity vector), (gradient), T (Temperature),
(Laplace operator), Re (Reynolds number), Pr(Prandtle number)
Non-Dimensional Integral form
(Two-Dimensional)
u dv + v dv = 0
p 1
(u.)u dv = x dv + Re u dv
p 1
(u.)v dv = y dv + Re v dv
1
(u.)T dv = Pr T dv
where is the control volume
CheckerboardPressurefield
GridGeneration:Staggeredgrid
Staggered Grid
Typical u, v and p-cells
At center node of u control
volume
p p P pW
= 0
x x
At center node of v control
volume
p p P p S
= 0
y y
GaussDivergencetheorem
p u u j nds
( ) 1
=
(uu )i + (vu ) j nds dV + i+
u u
x Re u x y
p v v j nds
( ) 1
(uv)i + (vv) j n ds =
^
dV + i+
v v
y Re v x y
u +u
i, J i 1, J where Fs are mass fluxes of the
Fw = Aw corresponding cell face
2
u +u
i +1, J i, J
Fe = Ae
2
v +v
I, j I 1, j
Fs = As
2
v +v
I , j +1 I 1, j + 1
Fn = An
2
Diffusiveandpressurepartsofx
momentumequation.
u (u E u P )
=
x e x
u (u P uW )
=
x w x
u (u u )
= N P
y n
y
u (u u ) p ( pe pw) V u = x y
y
= P
y
S
=
s
x x
Interpolation at Cell Interfaces
if
k = 1 Fk > 0
k = 0 if
Fk < 0
for k=e, w, n, s.
SourceTerms
S = ( u i 2 , J 2 u i 1, J + 3u i , J )
+ 1
S = ( ui,J 2 2ui,J 1 + 3ui,J )
+ 1 w
8
s
S w = ( u i +1, J 2 u i , J + 3u i 1, J )
8 1
8
Ss = ( ui,J +1 2ui,J + 3ui,J 1 )
1
8
S = ( ui 1, J 2ui , J + 3ui +1, J ) S = ( ui , J 1 2ui , J + 3ui , J +1 )
+ 1 +1
e n
8 8
Sn = ( ui , J +2 2ui , J +1 + 3ui , J )
1
Se = ( ui + 2, J 2ui +1, J + 3ui , J )
1
8 8
Discretised xandymomentum
equations
ai , J ui , J = anb u nb ( p I 1, J p I , J ) Ai , J + bi , J
a I , j v I , j = anb vnb ( p I , J 1 p I , J ) AI , j + bI , j
where
a i +1, J y
(1 )F +
R e x
e e
x
ai , J 1 F +
R e y
s s
x
ai , J +1 (1 )Fn +
Re y
n
bi , J = Fnb ( nb S nb
+
+ (1 nb ) S nb
)
ai , J = anb + Fe Fw + Fn Fs
SIMPLE
Semi-Implicit Method for
Pressure Linked Equations
FirststepinSIMPLEalgorithm
Guess pressure field p * and initial velocities and use
them to solve momentum equations to get guessed
velocity components.
a u = a u + ( p
i ,J i ,J
nb nb
I 1, J
p ) Ai ,J + bi ,J
I ,J
a v
I ,J I ,J = a v + ( p
nb nb
I , J 1
p ) AI , j + bI , j
I ,J
*
where u * and v are guessed velocities.
Define pressure correction p ' and velocity u ' , v '
corrections
p = p + p , u = u + u , v = v + v
where p , u , v are correct pressure and correct
velocities respectively.
CorrectionFormulae
Substituting correct pressure field yields correct velocities
a i,J u i,J = a nb
u n b + ( p I 1, J p I , J ) A i , J + b i , J
a I ,J v I ,J = a nb
v n b + ( p I , J 1 p I , J ) A I , j + b I , j
a i , J u i , J = a n b u ' n b + ( p I 1 , J p I , J ) A i , J
'
a I , j v ' I , j = a n b v n b + ( p I , J 1 p I , J ) A I , j
SIMPLEApproximation
Omission of following terms is the main approximation
of the SIMPLE
a nbu 'nb a v
nb nb
Ai,J AI , j
where d i,J = d I ,J =
ai,J a I , j
VelocityCorrection
ui , J = ui*, J + d i , J ( p 'I 1, J pI , J )
vI , j = vI*, j + d I , j ( p 'I , J 1 pI , J )
Similarly
a I , J = a I 1, J + a I + 1, J + a I , J + 1 + a I , J 1
v new = v v + (1 v ) v n 1
Similarly for velocity component
v I , j =
a nb v nb + b I , j
aI,j
u , v
STEP 2:Solve pressure equation
a I , J p I , J = aI 1, J pI 1, J + aI +1, J p I +1, J + a I , J 1 p I , J 1 + a I , J +1 p I , J +1 + bI , J
p
A
SET p*=p
ai , J v I , J = nb nb I J 1 I , J ) AI , J + bI , J
a v
+ ( p
, p
u ,v
p
A
A
STEP 3: correct and velocities
u i , J = u i , J + d i , J ( p I 1 , J p I , J )
v I , j = v I , j + d I , j ( p I , J 1 p I , J )
p = p, u = u
v = v
p, u, v
NO
Convergence?
YE S
stop
SIMPLER (Algorithm)
TestProblem LidDrivenCavityFlow
u=1,v=0
u=0, v=0
Streamlines and Vorticity contours at Re = 100.
Velocity components at the
center of the cavity
Vorticity and streamlines at Re = 1000.
References
Han et al, A comparison of hybrid and quadratic upstream differencing in high
Reynolds number elliptic flows, Compu. methods Appl.Mech. Eng., 29, 81-95, (1981).
Hayase T et al, A consistently formulated QUICK scheme for fast and stable
convergence using finite volume iteration, Journal of computational physics, 98, 108-
118, (1992).
Pollard A and Siu A L W, The calculation of some laminar flows using various
discretisation schemes, Compu. methods Appl.Mech. Eng., 35, 293-313, (1982).
sryedida@iitm.ac.in
Consistency, Stability & Convergence
of the Numerical Schemes
2u 2u
Consider the two dimensional Laplace equation, + =0
x 2
y 2
AU = B
U = (u1,1 u2,1 u3,1 u1,2 u2,2 u3,2 u1,3 u2,3 u3,3 )
B = (u0,1 2u1,0 , 2u2,0 , u4,1 2u3,1 , u0,2 , 0 , u4,2 ,
u0,3 2u1,4 , 2u2,4 , u4,3 2u3,4 )
1 0 2
0 0 0 0 0
1 1 0 2
0 0 0 0
0 1 1 0 2
0 0 0
2
0 1 1 0 2
0 0
A=
0 2
0 1 1 0 2 0
0 0 2
0 1 1 0 2
0 0 0 2
0 1 1 0
0 0 0 0 2
0 1 1
0 0 0 0 0 2
0 1
February 19, 2010 sryedida@iitm.ac.in 3
Necessary & sufficient condition for
the Iterative schemes to be convergent
lim ( n )
for e =0 we need k < 1
n
G 1
Diagonal Dominance of A
where A is the coefficient matrix
u u 2
2 = 0
t x
2) Richardson Method:
1
( u in + 1 u in 1 )
2t
= ( u in+ 1 2 u in + u in 1 )
x2
n +1
n +1
+ n +1
1 i +1
( u 2 u u )
(uin +1 u n ) = i i 1
t x 2 + (1 )(uin+1 2uin + uin1 )
=0 Explicit scheme
=1/2 Crank Nicholson scheme
=1 Fully implicit scheme
u u u
2 2
2 + 2 = 0
t x y
1 n+1
t ( ) 1
( )
ui, j ui, j = 2 uin+1, j 2uin, j + uin1, j +
n
x
1
y 2
n
( n n
)
ui, j +1 2ui, j + ui, j 1
1
(ui, j ui, j ) = 2 (uin++1,1/j 2 2uin, +j 1/ 2 + uin+1,1/j 2 ) +
1 n +1/ 2 n
t / 2 x
1
(ui, j +1 2ui, j + ui, j 1 )
n n n
y 2
1 1
(ui, j ui, j ) = 2 (uin++1,1/j 2 2uin, +j 1/ 2 + uin+1,1/j 2 ) +
n+1 n+1/ 2
t / 2 x
1 n +1 n +1 n +1
(ui, j +1 2ui, j + ui, j 1 )
y 2
February 19, 2010 sryedida@iitm.ac.in 13
Convergence
U Exact solution
u Numerical solution
n +1 t n
u = u + 2 (ui 1 2ui + ui +1 )
n n n
x
i i
n
1 u 1
2
u 4
Ti n = t 2 x 2 4
2 t 12 x i
O(t , x ) 2
(t )
u n+1
i =u n1
i +
x 2 ( uin1 2 ( uin+1 + (1 )uin1 ) + uin+1 )
n
t u x u
2 3
t u t u
2 4
t 4
2 2 3
Ti =
n
+ (2 1) 2 + 2 2 + O( 2 , x , t )
4
6 t 12 x
3 4
x t x t x i
Discretisation error
Matrix method
1 2r r
r 1 2 r r
r 1 2r r
A=
L L L L L L L
r 1 2r r
r 1 2 r
e =Ae n n 0
n
e = ci vi
0
i =1
n n
e n = An ci vi = ci n vi
i =1 i =1
2 i 1
1 + r 4sin 1 r
2N 2
February 19, 2010 sryedida@iitm.ac.in 27
Numerical Example
Solve the 1D unsteady diffusion with initial conditions
u = 2x when 0 x ,
u = 2(1-x) when x 1 boundary conditions
u = 0 at x=0 and x=1 for all t>1
Exact solution:
8 1 1
u = 2 2 sin i ( sin i x ) e i 2 2t
i =1 i 2
I
en
j
N
j = N
t
n +1 Ii
e = e n Ii
+ 2 ( n e I ( i +1) 2 n e I ( i ) + n e I ( i 1) )
x
n +1
g = 1 for all
n
1 2r (1 cos ) 1
February 19, 2010 sryedida@iitm.ac.in 33
Couette flow
u u 2
= 2 , = 0.000217m / s
2
t y
IC : u = 40m / s at y=0
u=0, 0<y h
BC: u = 0 at y = h and u = 40m / s at y = 0
u u
+ a = 0, a > 0
t x
1 n+1
(ui ui ) = c(ui +1 ui )
n n n
t
a t
where c =
x
1 n+1
(ui uin ) = c(uin+1 uin1 )
t
a t
where c =
x
1 n+1
(ui uin ) = c(uin uin1 )
t
a t
where c =
x
1 n c n
uin+1 = (ui 1 + ui +1 ) (ui +1 uin1 )
n
2 2
(Taken average of uin1 and uin+1 in place of uin to
maintain stability.)
1 n +1 n 1 c n
(ui ui ) = (ui +1 ui 1 )
n
2 t 2
n+1 c c2
ui = ui
n
(ui+1 ui1) +
n n
(ui+1 2ui + ui1)
n n n
2 2
c n+1 n+1
uin+1 uin = (ui +1 ui 1 )
2
a t
c=
x
Boundary conditions
0 x=0
t=0 u(x)=
0 x = 300
D A i C
n +1
u i = au + bu + cu
n
i 1
n
i
n
i +1
1 t
a h
a t
1 c 1
h
u u
+u = 0
t x
u( x,0) = 1, 0 x 2
u( x,0) = 0, 2 x 4
February 19, 2010 sryedida@iitm.ac.in 53
February 19, 2010 sryedida@iitm.ac.in 54
2D Wave Equation
2u 2 u
2
=a
t 2 x 2
subject to the initial conditions
0
0 x 100
( x 100)
at t = 0, u ( x) = 100sin 100 x 220
120
220 x 300
0
u
at t=0, =0
t
Boundaryconditions
0 x=0
t=0 u(x)=
0 x = 300