Professional Documents
Culture Documents
Moving wall
Stationary
walls
WPI Computational Fluid Dynamics I
Nondimensional N-S Equation
∂u ∂u ∂u 1 ∂p ∂ 2u ∂ 2u
+u +v =− + ν 2 + 2
∂t ∂x ∂y ρ ∂x ∂x ∂y
Nondimensionalization
~ ~ ~ ~ = ρ
u = u /U , x = x / L , t = tU / L , p p / U 2
~
U ∂u ~ ∂u ~ ∂ u
2 ~ ~ ~
U ∂p νU ∂ u ∂ u
2
2~ 2~
~ + u ~ + v ~ = − ~ + 2 ~ 2 + ~ 2
L ∂t ∂x ∂y L ∂x L ∂ x ∂y
∂u~ ~ ∂u~ ~ ∂u~ ∂~
p ν1 ∂ 2u~ ∂ 2u~
~ +u ~ +v ~ = − ~ + ~ 2 + ~ 2
∂t ∂x ∂y ∂x ULRe ∂x ∂y
WPI Computational Fluid Dynamics I
The vorticity/stream function equations
∂ ∂v ∂v ∂v ∂p 1 ∂ 2 v ∂ 2 v
+u +v = − + 2 +
∂ x ∂ t ∂ x ∂ y ∂ y Re ∂ x ∂y 2
∂ω ∂ω ∂ω 1
2
∂ ω ∂ ω2
+u +v = 2 + 2
∂t ∂x ∂y Re ∂x ∂y
∂v ∂u
ω= −
∂x ∂y
WPI Computational Fluid Dynamics I
The vorticity/stream function equations
Substituting
∂ψ ∂ψ
u= ; v=−
∂y ∂x
into the definition of the vorticity
∂ v ∂u
ω= −
∂ x ∂y
yields
∂ψ ∂ψ
2 2
2 + 2 = −ω
∂x ∂y
WPI Computational Fluid Dynamics I
The vorticity/stream function equations
∂ω ∂ψ ∂ω ∂ψ ∂ω
1 ∂ 2
ω ∂ 2
ω
=− + + 2 +
∂t
∂y ∂x ∂x ∂y Re ∂x ∂y 2
Elliptic equation
∂ψ ∂ψ
2 2
2 + 2 = −ω
∂x ∂y
WPIBoundary
Computational Fluid Dynamics I
Conditions for the Stream Function
∂ψ
u = 0⇒ =0
∂y
⇒ ψ = Constant
WPIBoundary
Computational Fluid Dynamics I
Conditions for the Stream Function
∂ψ
v =0⇒ =0
∂x
⇒ ψ = Constant
WPIBoundary
Computational Fluid Dynamics I
Conditions for the Stream Function
ψ = Constant
WPI Computational Fluid Dynamics I
Boundary Conditions for the Vorticity
∂ψ ∂ψ
v =0⇒ =0 u = 0⇒ =0
∂x ∂y
At the top boundary:
∂ψ
u = U wall ⇒ = U wall
∂y
WPI Computational Fluid Dynamics I
Boundary Conditions for the Vorticity
∂ψ ∂ψ
2 2
∂ψ 2
2 + 2 = −ω ⇒ ω wall =− 2
∂x ∂y ∂x
Similarly, at the top and the bottom boundary:
2
∂ψ ∂ψ
2 2 ∂ψ
2 + 2 = −ω
⇒ ω wall =− 2
∂x ∂y ∂y
WPI Computational Fluid Dynamics I
Summary of Boundary Conditions
∂ψ ∂ 2ψ
= Uwall ; ω wall = − 2
∂y ∂y
∂ψ ∂ψ
=0 =0
∂x ∂x
2
ψ = Constant
∂ψ 2
∂ψ
ω wall =− 2 ω wall =− 2
∂x ∂x
∂ψ ∂ 2ψ
= 0; ω wall = − 2
∂y ∂y
WPI Computational Fluid Dynamics I
Finite Difference Approximations
j=NY
ψ i, j and ω i , j
Stored at
each grid
point
j=2
j=1
i=1 i=2 i=NX
WPI Computational Fluid Dynamics I
Finite Difference Approximations
h h
WPI Computational Fluid Dynamics I
Finite Difference Approximations
∂f ( x ) f ( x + h ) − f ( x − h ) ∂ f ( x ) h
3 2
= + +!
∂x 2h ∂x 3
6
∂ 2 f ( x ) f ( x + h) − 2 f ( h) + f ( x − h) ∂ 4 f ( x ) h 2
= + +!
∂x 2
h 2
∂x 12
4
j+1
(x, y)
fi , j = f (x,y)
j fi +1, j = f (x + h, y)
j-1 fi , j +1 = f (x, y + h)
i -1 i i+1
WPI Computational Fluid Dynamics I
Finite Difference Approximations
Laplacian
∂2 f ∂ 2 f
2 + 2 =
∂x ∂y
n n n n n n
fi +1, j − 2 fi, j + fi−1, j fi, j +1 − 2 f i, j + fi , j −1
2 + 2 =
h h
n n n n n
f
i +1, j + f
i −1, j +fi, j +1 +f
i , j −1 − 4f
i,j
2
h
WPI Computational Fluid Dynamics I
Finite Difference Approximations
∂ω ∂ψ ∂ω ∂ψ ∂ω 1 ∂ ω ∂ ω
2 2
=− + + 2 + 2
∂t ∂y ∂x ∂x ∂y Re ∂x ∂y
Using these approximations, the vorticity equation becomes:
ω in, +j 1 − ω in, j
=
∆t
ψ in, j +1 − ψ in, j −1 ω in+1, j − ω in−1, j ψ in+1, j −ψ in−1, j ω in, j +1 − ω in, j −1
− +
2 h 2h 2h 2 h
ω n
1 i +1, j + ω n
+ ω n
+ ω n
− 4ω n
+
i −1, j i , j +1 i , j −1 i, j
Re h2
WPI Computational Fluid Dynamics I
Finite Difference Approximations
ψ n
− ψ n
ω n
− ω n
ω in, +j 1 = ω in, j − ∆t i , j +1 i , j −1
i +1, j
i −1, j
2h 2h
ψ in+1, j −ψ in−1, j ω in, j +1 − ω in, j −1
−
2 h 2 h
ω n
1 i +1, j + ω n
+ ω n
+ ω n
− 4ω n
+
i −1, j i , j +1 i , j −1 i, j
Re h2
WPI Computational Fluid Dynamics I
Finite Difference Approximations
∂ψ ∂ψ
2 2
2 + 2 = −ω
∂x ∂y
j=3
j=2
j=1 ω wall = ω i, j =1
Uwall
i -1 i i+1
2
∂ψ i, j =1 ∂ ψ i , j =1 h 2 3
ψ i, j = 2 = ψ i, j =1 + h+ 2 + O(h )
∂y ∂y 2
WPI Computational Fluid Dynamics I
Discrete Boundary Condition
2
∂ψ i, j =1 ∂ ψ i , j =1 h 2 3
ψ i, j = 2 = ψ i, j =1 + h+ 2 + O(h )
∂y ∂y 2
Using: 2
∂ ψ i, j =1 ∂ψ i, j =1
ω wall =− 2 ; Uwall =
∂y ∂y
This becomes:
h2 3
ψ i, j = 2 = ψ i, j =1 + Uwall h − ω wall + O(h )
2
Solving for the wall vorticity:
2 2
ω wall = (ψ i , j =1 − ψ i , j =2 ) 2 + Uwall + O(h)
h h
WPI Computational Fluid Dynamics I
Discrete Boundary Condition
n n n n n
ψ i +1, j +ψ i −1, j +ψ i, j +1 +ψ i, j −1 − 4ψ i, j n
2 = −ω i, j
h
Rewrite as
n +1 n n n n 2 n
ψ i, j = 0.25 (ψ i +1, j +ψ i−1, j +ψ i, j +1 +ψ i, j −1 +h ω ) i, j
j+1
j
j-1
i-1 i i+1
WPI Computational Fluid Dynamics I
Solving the Stream Function Equation
If the grid points are done in order, half of the points have
already been updated:
j+1
j
j-1
i-1 i i+1
ν ∆t 1 (| u | + | v |) ∆t
2 ≤
≤2
h 4 ν
WPI Computational Fluid Dynamics I
Solution Algorithm
v(i,j)=v(i,j)+dt*rhs(i,j)
Update vorticity in interior
t=t+∆t
WPI Computational Fluid Dynamics I
MATLAB Code
9 × 9 Grid 17 × 17 Grid
1 1
0.5 0.5
y
0 0
0 0.25 0.5 0.75 0 0.25 0.5 0.75
x x
WPI Computational Fluid Dynamics I
Accuracy by Resolution
Vorticity at t = 1.2
9 × 9 Grid 17 × 17 Grid
1 1
0.5 0.5
y
y
0 0
0 0.25 0.5 0.75 0 0.25 0.5 0.75
x x
WPI Computational Fluid Dynamics I
Mini-Project
Mini-project:
Add the temperature equation to the vorticity-
streamfunction equation and compute the
increase in heat transfer rate:
WPI Computational Fluid Dynamics I
Convection
∂T ∂T ∂T ∂ 2 T ∂ 2 T
+u +v =α 2 +
∂t ∂x ∂y ∂x ∂y
2
where
D
α=
ρc p
WPI Computational Fluid Dynamics I
Natural convection
Natural convection in a
closed cavity. The left
vertical wall is heated.
0
WPI Computational Fluid Dynamics I
Natural convection
Natural convection in a
closed cavity. The left
vertical wall is heated.
125
WPI Computational Fluid Dynamics I
Natural convection
Natural convection in a
closed cavity. The left
vertical wall is heated.
250
WPI Computational Fluid Dynamics I
Natural convection
Natural convection in a
closed cavity. The left
vertical wall is heated.
375
WPI Computational Fluid Dynamics I
Natural convection
Natural convection in a
closed cavity. The left
vertical wall is heated.
500
WPI Computational Fluid Dynamics I
Natural convection
Natural convection in a
closed cavity. The left
vertical wall is heated.
750
WPI Computational Fluid Dynamics I
Natural convection
Natural convection in a
closed cavity. The left
vertical wall is heated.
1000
WPI Computational Fluid Dynamics I
Natural convection
0.15
0.05
Conduction only
0
200 400 600 800 1000