Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

S

hool of Me hani al, Aerospa e & Civil Engineering


Me h/Aero Year 3/4 CFD-1

Exam 2007 Solutions

Question 1.

(a). Using entral di eren es we approximate


 
  +1  1
U U i i

x 2x
 
 
x x
 ( +1  )=xx( i i i  i 1 )=x
=
 +1 +  1 2
i

(x)2
i i

Substituting these into the governing equation leads to


   
 +1   +1 +  1 2
U i i 1
= i i i

2x (x)2
and rearranging gives
     
2 U U
 =  +1 + +
i
(x)2 (x)2 i
2x i 1
(x)2 2x

(b). Multiplying through by (x)2 =(2 ), the above dis retized equation be omes
 =  +1 [1=2 U x=(4 )℄ + 
i i i 1 [1=2 + U x=(4 )℄ =  +1 (1=2)(1 P e=2) +  i i 1 (1=2)(1 + P e=2)

Hen e we have
   +1 (1=2)(1 P e=2) +  1 (1=2)(1 + P e=2)  1
i i 1
= i i i

 +1 
i i 1  +1  1 i i

(1=2) +1 (1 P e=2) (1=2) 1 (1 P e=2)


= i
= (1=2)(1 P e=2) i

 +1  1 i i

If P e < 2 then we have (  1 )=( +1  1 ) lying between 0 and 1.  thus lies between the
i i i i i

neighbouring values of , and the s heme is bounded. If P e > 2, the above ratio be omes negative
and the s heme is unbounded.
( ). If the rst order upwind s heme is used to approximate the onve tion terms, then we take (sin e
U > 0):  
   1
U U i i

x x
The dis retized equation thus be omes
   
   +1 +  1 2
U i i 1
= i i i

x (x)2
or, on rearranging,
     
U 2 U
 + =  +1 + +
i
x (x)2 (x)2 i i 1
x (x)2

Multiplying through by (x)2 = leads to


 (P e + 2) =  +1 + 
i i i 1 (P e + 1)

1
or
 +1 +  1 (P e + 1)
 = i i
i
Pe + 2
Thus we obtain
  ( +1 + 
(P e + 1))=(P e + 2)  1
i i 1
= i i 1 i

 +1 
i i 1  +1  1 i i

 +1 +  1 (P e + 1 P e 2) 1
= i i
=
(P e + 2)( +1  1 ) Pe + 2
i i

(d). Hen e, with the upwind s heme for onve tion we always have the ratio ( i  i 1 )=( +1
i  i 1 )
lying between 0 and 1 and the s heme will not produ e unbounded results.

Question 2.

(a). Integrating the governing equation over the ontrol volume surrounding node P , we obtain
Z Z Z Z  
P  U
dxdy =  dxdy
x y y
Approximating the integrals leads to

P U U
xy =  x  x =  x(U U )=y  x(U U )=y
x y n
y s
N P n P S s

Can elling the fa tor x results in


U U U U y P
N P P S
=
y n y s  x
(b). On the grid shown, we have y = h=2. For ell 2 we have y = y and y = y=2. For ell 3 n s

we have y = y=2 and y = y.


n s

(i) The dis retized equations over ells 2 and 3 thus be ome
(y)2 P h2 P
(U3 U2 ) 2(U2 U1) = =
 x 4 x
(y)2 P h2 P
2(U4 U3 ) (U3 U2 ) = =
 x 4 x
(ii) With the boundary onditions U1 = U2 and U4 = 0, the dis retized equations be ome
h2 P
U3 U 2 =
4 x
h2 P
3U3 + U2 =
4 x
Adding these gives
h2 P h2 P
2U3 = so U3 =
2 x 4 x
Then
h2 P h2 P
U2 = U3 =
4 x 2 x

2
(iii) If we approximate the boundary ondition at y = 0 by tting a quadrati urve through the
values at y2 and y3 , with zero gradient at y = 0, the urve will have the form
U = ay2 + b
To determine a and b, we need
U2 = ay22 + b and U3 = ay32 + b
subtra ting y22 times the se ond equation from y32 times the rst gives
b(y32 y22 ) = U2 y32 U3y22 or b = (U2 y32 U3 y22 )=(y32 y22 )
But y2 = h=4 and y3 = 3h=4, so we obtain the approximation
U1 = b = (U2 y32 U3 y22 )=(y32 y22 ) = (9U2 U3 )=8
(iv) With the above boundary ondition at y = 0, the dis retized equations over ells 2 and 3 be ome
h2 P h2 P
U3 3U2 + (9=4)U2 (1=4)U3 = or 3U3 3U2 =
4 x  x
h2 P
3U3 + U2 =
4 x
Hen e we obtain
5h2 P 5h2 P
2U2 = so U2 =
4 x 8 x
and
h2 P 7h2 P
U3 = U 2 + =
3 x 24 x

Question 3.

(a). For the rst order expli it s heme we approximate the time derivative as
T T ( n+1)
T( n)

t
 i

t
i

and evaluate all other terms at time level n.


The dis retized equation thus be omes
" #
T( n+1)
T( n)
(T (+1)n
T ( ))=x (T (
n n)
T ( 1) )=x
n
i i
= i i i i

t x
or, on rearranging,
t  ( ) 
T( n+1)
= T( ) +
n
T + T( n n)
2T ( n)
i i
(x)2 +1 i i 1 i

(b). With the spike shown, we have T (0) = 1 and T (0)1 = T (0)
k +1 = 0. k k

Hen e the above dis retized equation gives


t t
T (1)1 = 0 + (1 + 0 0) =
k
(x)2 (x)2
t t
T (1)
+1 = 0 + (0 + 1 0) =
k
(x) 2 (x)2
t 2 t
T (1) = 1 + (0 + 0 2) = 1
k
(x) 2 (x)2

3
( ). For t=(x)2 = 1=4 we get T (1)1 = T (1)
k +1 = 1=4 and T
k
(1)
= 1=2. The solution at time t + t thus
k
looks something like:
T
1

x
0
k-1 k k+1
T
1

For t=(x)2 = 1 we get T (1)1 = T (1)


k +1 = 1 and k

T (1) = 1. The solution at time t + t thus looks


k
0
x
something like: k-1 k k+1

Clearly the se ond ase is physi ally not possible.


(d). If the Lax method is used to approximate the time derivative, the dis retized equation be omes
 
t  ( ) 
T ( +1) = (1=2) T (+1) + T ( 1) +
n n
T +
n
T ( )
2T ( ) n n n
i i
(x)2 +1i 1 i i i

(e). Hen e for the 3 points we obtain


t t
T (1)1 = 1=2 + (1 + 0 0) = 1=2 +
k
(x) 2 (x)2
t t
T (1)
+1 = 1=2 + (0 + 1 0) = 1=2 +
k
(x)2 (x)2
t 2 t
T (1) = 0 + (0 + 0 2) =
k
(x)2 (x)2
T
1

The omputed temperature pro le at t + t thus looks


something like the sket h, whi h is learly unphysi al. 0
x
k-1 k k+1

Question 4.

(a). In mesh 2, h << l allows to better apture the gradient a ross the jet, while along the jet axis
dire tion variation are very mild. With mesh 1, the grid needs to be re ned in both dire tions to
a hieve reasonable a ura y.
p
x1 (1 ; 2 ) = (l1 h2 ) 2=2 (1)
p
x2 (1 ; 2 ) = (l1 + h2 ) 2=2 (2)
Ploting those gridlines is trivial and shown in part e).

4
(b). 2
f 3 2
x1 x2 32
f 3

6 1 7
=6 1 1 76 x1 7
(3)
4
f 5 4
x1 x2 54
f 5

2 2 2 x2


p   p  
2 l l ; J = lh , T = A 1 2 h l
A= h h
1
= h l (4)
2 J 2
J is the surfa e of the ell.
  p
11 12 = rh rl 2
21 22 rh rl with r = (5)
2
( ). By de nition of the hain rule, and inverting sumations:
   
f 1 f 1 f f
u =u = u = ue (6)
i
x J  i
i
k
ik
J i ik

k  k
k

p
1 1 rh 2
ue1 = u 1 = (u + u ) (u + u ) = (u1 + u2)
J i i
J 1 11 2 21 J p1 2 2l
1 1 2
ue2 = u 2 = (u1 12 + u2 22 ) = ( u1 + u2 )
J i i
J 2h
(d).
f f (i + 1; j ) f (i 1; j ) f f (i; j + 1) f (i; j 1)
( ) = , ( ) =
1 i;j
2 2 2 i;j

f f (i + 1; j ) f (i 1; j ) f (i; j + 1) f (i; j 1)
u = r(u1 + u2 ) + r ( u 1 + u2 )
i
x i 2l 2h
p
For the ase: u1 = u2 = V = 2 j

f f (i + 1; j ) f (i 1; j )
u =V
i
x i
j
2l
This orresponds to the lassi al nite di eren e dis retisation along the jet axis.
(e).
 
1 f (i + 1; j ) + f (i; j 1) f (i 1; j ) + f (i; j + 1)
= u1 ( p ) + u2 :::
2 h 2 2
 
f f
= u1 p A
) B

2h
This an be interpreted as interpolating rst the values of f on the horizontal line passing through
the entral node, then introdu ing the lassi al nite di eren e method along that horizontal line.
If there are gradients of f in the verti al dire tion these repeated interpolations will introdu e mu h
smoothing, so this shows that it an be re ommended to generate gridlines that are aligned with the
ow dire tion.

5
Question 5.

(a). A segregated solution s heme treats one variable (eg. U , V , or W , et ) at a time, updating the
urrent estimate whilst keeping values of all other variables xed. It therefore requires less storage
(sin e the matrix system is smaller), and is relatively simple to implement. However, it may require
more iterations, and need more under-relaxation or similar treatment to onverge, sin e the oupling
between variables is handled expli itly.
A oupled solution s heme solves the dis retized equations for di erent variables together, retaining
the oupling between variables in an impli it fashion. It therefore may onverge faster, and more
stably, but requires more storage and resour es to solve the matrix system.
(b). The dis retized problem results in equations of the form
a i
w i 1 + a i p i a i  +1 = s
e i ui

(i) If the boundary values an be eliminated, then the rst and last equations to be solved be ome
a 1 1 a 1 2 = s
p e u1 and a iw n 1 + a n = s
p n un

Hen e the set of dis retized equations an be written in the form


0 10 1 0 1
a1
p a1 e 0 ::: 1 s1 u
B
B
a 2 w a2
p a2 e ::: C B C
C B 2C
Bs C
B 2C u
B
B
0 a 3 w a3
p a 3 :::C
e
B C Bs C
C B 3C = B 3 C u
B .. ... ... ... C B . C
A  .. A
B . C
 .. A
 .
0 ::: ::: a n an
w  snp n u

(ii) Performing Gauss elimination, the rst row of the matrix gives
s 1 + a 1 2
1 = u e
= 1 2 + Æ 1 with 1 = a 1 =a 1 and Æ1 = s 1 =a
a1p
e p u p1

The se ond row an then be written as


a 2 ( 1 2 + Æ1 ) + a 2 2
w p a 2 3 = s
e u2

or
2 ( a 2 1 + a 2 ) a 2 3 = s 2 + a 2 Æ1
w p e u w

Thus
a2 s 2 + a 2 Æ1
2 = 2 3 + Æ 2 where 2 = e
Æ2 = u w

a 2 1 + a
w p2 a 2 1 + a 2
w p

Similarly, row 3 then gives


a 3 ( 2 3 + Æ2 ) + a 3 3
w p a 3 4 = s
e u3

or
3 ( a 3 2 + a 3 ) a 3 4 = s 3 + a 3 Æ2
w p e u w

Thus
a3 s + a 3 Æ2
3 = 3 4 + Æ 3 where Æ3 = 3
3 = e u w

a 3 2 + a 3 a 3 2 + a 3 w p w p

Hen e, ontinuing this elimination we obtain a series of the form


 =  +1 + Æ
i i i i

where
ai s i + a iÆ 1
= e
Æ = u w i
i
a i 1 + a
w i pi
i
a i 1 + a i
w i p

6
( ). A pentadiagonal system an be solved using a tri-diagonal solver, by rst treating only the depen-
den ies in one dire tion in an impli it fashion, and then those in the other dire tion (ie. an ADI
method).
For example, one an start by writing the system as
a 
w i 1;j +a 
p i;j a  +1 = s + a 
e i :j u n i;j +1 +a 
s i;j 1

and solve this, using the tri-diagonal method, treating all the terms on the right hand side as sour e
terms.
Having updated the values of  in this manner, the system an then be written as
a
s i;j 1 +a 
p i;j a 
n i:j +1 =s +a 
u w i 1;j + a  +1
e i ;j

and solved again, treating terms on the right hand side as sour es. One an then repeat the pro edure
in an iterative fashion until onvergen e is a hieved.

You might also like