Professional Documents
Culture Documents
WPI
WPI
WPI
Stationary
walls
WPI
2u 2u
1 p
u
u
u
+u +v
=
+ 2 + 2
t
x
y
x
y
x
Nondimensionalization
~
2
~
~
~
/
=
p
p
U
/
,
=
t
tU
L
/
,
=
x
x
L
u = u /U ,
2
2
2~
2~
~
~
~
~
U p U u u
U u ~ u ~ u
~ + u ~ + v ~ =
+ 2 ~ 2 + ~ 2
~
x
y
y
L x L x
L t
u~ ~ u~ ~ u~
~
p 1 2u~ 2u~
~ 2 + ~ 2
~ +u ~ +v ~ = ~ +
t
x
y
x UL
y
Re x
WPI
u
u
u
p 1 2 u 2u
+u
+v = +
2 +
2
x
y
x Re x
y
y t
v
v
p 1 2 v 2 v
v
+u +v = +
2 +
2
Re
t
x
y
y
x
y
2
2
+u
+v
=
2 +
2
t
x
y Re x
y
v u
=
x y
WPI
,
u=
y
v=
x
by substituting
u v
+
=0
x y
=0
x y y x
WPI
Substituting
; v=
u=
y
x
into the definition of the vorticity
v u
=
x y
yields
2 +
2 =
x
y
2
WPI
1
=
+
+
2 +
2
t
y x x y Re x
y
Elliptic equation
2 +
2 =
x
y
2
u = 0
=0
y
= Constant
v =0
=0
x
= Constant
= Constant
WPI
=0
v =0
x
At the top boundary:
u = U wall
u = 0
=0
y
= U wall
y
WPI
2 +
2 =
x
y
2
wall
= 2
x
2
2 +
2 =
x
y
2
wall
= 2
y
WPI
2
= Uwall ; wall = 2
y
y
=0
x
2
wall
= 2
x
= Constant
2
= 0; wall = 2
y
y
=0
x
wall
= 2
x
WPI
WPI
j=NY
i, j and i , j
Stored at
each grid
point
j=2
j=1
i=1 i=2
i=NX
WPI
WPI
f ( x ) f ( x + h ) f ( x h ) f ( x ) h
=
+
+!
3
2h
6
x
x
3
2 f ( x ) f ( x + h) 2 f ( h) + f ( x h) 4 f ( x ) h 2
=
+
+!
2
2
4
h
x
x 12
f (t) f (t + t) f (t) 2 f (t) t
=
+
+!
2
2
t
t
"" t
2nd order in space, 1st order in time
WPI
(x, y)
j+1
j
j-1
i -1
i+1
fi , j = f (x,y)
fi +1, j = f (x + h, y)
fi , j +1 = f (x, y + h)
WPI
Laplacian
2 f 2 f
2 +
2 =
x
y
n
n
n
n
n
n
fi +1, j 2 fi, j + fi1, j fi, j +1 2 f i, j + fi , j 1
+
=
2
2
h
h
n
i +1, j
n
i 1, j
+ f
n
i, j +1
2
+f
h
n
i , j 1
+f
n
i,j
4f
WPI
2
2
1
2 + 2
=
+
+
t
y x x y Re x
y
in, +j 1 in, j
t
in, j +1 in, j 1 in+1, j in1, j
2
2h
h
in+1, j in1, j
+
2h
n
n
n
n
n
4
+
+
+
1 i +1, j
i 1, j
i , j +1
i , j 1
i, j
+
Re
h2
in, j +1 in, j 1
2
h
WPI
i , j 1
i 1, j
i +1, j
in, +j 1 = in, j t i , j +1
2h
2h
2
2
h
h
n
n
n
n
n
4
+
+
+
1 i +1, j
i 1, j
i , j +1
i , j 1
i, j
+
Re
h2
WPI
2 +
2 =
x
y
2
n
i, j
WPI
i, j = 0
j=ny
for
i =1
i = nx
j =1
j = ny
j=2
j=1
i=1 i=2
i=nx
WPI
j=3
j=2
j=1
Uwall
i -1
wall = i, j =1
i+1
2
i, j = 2
i, j =1
i , j =1 h 2
3
h+
= i, j =1 +
+ O(h )
2
2
y
y
WPI
i, j = 2
Using:
i, j =1
i , j =1 h 2
3
h+
= i, j =1 +
+ O(h )
2
2
y
y
2
wall
i, j =1
i, j =1
; Uwall =
=
2
y
y
This becomes:
i, j = 2 = i, j =1 + Uwall h wall
h2
3
+ O(h )
2
wall
2
2
= ( i , j =1 i , j =2 ) 2 + Uwall + O(h)
h
h
WPI
wall
2
2
= ( i , j =1 i , j =2 ) 2 + Uwall + O(h)
h
h
wall
2
2
= ( i , j = ny i , j = ny 1 ) 2 U wall + O(h)
h
h
WPI
n
i +1, j
n
i 1, j
Rewrite as
n +1
i, j
= 0.25 (
n
i, j +1
2
+
h
n
i +1, j
n
i1, j
i-1
n
i, j 1
j+1
j
j-1
i+1
n
i, j +1
n
i, j
n
i, j 1
n
i, j
n
i, j
+h )
WPI
If the grid points are done in order, half of the points have
already been updated:
j+1
j
j-1
i-1
i+1
WPI
t 1
2
4
h
(| u | + | v |) t
2
WPI
for i=1:MaxIterations
for i=2:nx-1; for j=2:ny-1
s(i,j)=SOR for the stream function
end; end
end
v(i,j)=
for i=2:nx-1; for j=2:ny-1
rhs(i,j)=Advection+diffusion
end; end
v(i,j)=v(i,j)+dt*rhs(i,j)
WPI
WPI
WPI
WPI
0.5
0.25
0.5
17 17 Grid
0.75
0.5
0.25
0.5
0.75
WPI
0.5
0.25
0.5
17 17 Grid
0.75
0.5
0.25
0.5
0.75
WPI
Mini-project:
Add the temperature equation to the vorticitystreamfunction equation and compute the
increase in heat transfer rate:
WPI
2 T 2 T
T
T
T
+u
+v
=
2 +
2
t
x
y
x
y
where
D
=
c p
WPI
Natural convection in a
closed cavity. The left
vertical wall is heated.
WPI
Natural convection in a
closed cavity. The left
vertical wall is heated.
125
WPI
Natural convection in a
closed cavity. The left
vertical wall is heated.
250
WPI
Natural convection in a
closed cavity. The left
vertical wall is heated.
375
WPI
Natural convection in a
closed cavity. The left
vertical wall is heated.
500
WPI
Natural convection in a
closed cavity. The left
vertical wall is heated.
750
WPI
Natural convection in a
closed cavity. The left
vertical wall is heated.
1000
WPI
0.2
0.15
0.1
Natural convection
0.05
Conduction only
200
400
600
800
1000