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

Case Studies in Computational Fluid Dynamics, MECE E6104

Spring 2016
Assignment 4
Due: February 16th, 2016

SOLUTIONS

1. Solve, in Excel, the following set of equations.


8 + 3 + 4 = 94
3 + 8 + 2 = 78
2 + 5 + 7 = 67

First use the Jacobi method and then the Gauss-Seidel method. Use as the initial guess,  =  =
 = 1. Iterate until    < 10 for all , where = 1,2,3. Compare the number of

iterations for convergence between the Gauss-Seidel method and the Jacobi method.
Jacobi

1
"# = $94 3" 4" %
8
1
"# = $78 3" 2" %
8
1
"# = $67 2" 5" %
7


1


1



1
2

10.8750
4.0424

9.1250
3.5290

78
79

9.0000
9.0000

5.0000
5.0000

iteration

"# "

"# "

"# "

8.5714
-0.0536

6.83E+00

5.60E+00

8.63E+00

4.0000
4.0000

1.03E-06
-8.35E-07

8.03E-07
-6.53E-07

1.07E-06
-8.68E-07

Gauss-Seidel

iteration



1
"# = $94 3" 4" %
8
1
"#
 = $78 3"# 2" %
8
1
"# = $67 2"# 5"# %
7





1
2

1
10.8750
8.4210

1
5.4219
5.9442

1
2.5915
2.9195

9
10

8.0000
8.0000

6.0000
6.0000

3.0000
3.0000

"# "

"# "

"# "

2.45E+00

-5.22E-01

-3.28E-01

2.69E-06
3.35E-07

2.74E-06
5.55E-07

-2.72E-06
-4.92E-07

2. The linear Burgers equation can be written as


&'()
&
&
=
+ &*
&* &*
Discretize this equation using the Finite Volume Method. Use simple upwind differences for the
convective term. Assume the grid has four equi-sized active cells (Fig. 1). Solve by hand using the
Thomas Algorithm. Plot the prediction and the analytical solution. Take x = 0.25, L = 1, = 1, ( = 4,
 = 1 and ./ = 0, and assume an initial condition of  = 0 for interior cells. Show all steps.
Analytical solution:
1 exp456 '* 8 1):
 =  0
;
1 exp'56)
56 = (8
 = 1

Solution domain

./ = 0

x
dummy cell

L=1

dummy cell

Figure 1. Solution domain and grid


Using the Finite Volume Method, the above becomes
'() '() = +

&
&
- + &* 
&* 

Assume u>0 and use upwind differencing


 = < ,

&
> <
+ - =
,
&* 
*

 = =

&
< =
+ - =
&* 
*

= @ABCDEBD, and ( = @ABCDEBD

Hence, Eq. 1 becomes


(< (= =

> <
< =

*
*

Which can be rearranged to


+( + 2

Or

- < =
> + + + (- =
*
*
*
F< < = F> > + F= =

Apply boundary conditions


Inlet

 = 2 

'F< )  = 'F> )  + 'F= ) 

Hence

or

'F< )  = 'F> )  + 'F= ) '2  )

or

4'F< ) + 'F= ) : = 'F> )  + 2'F= ) 

Outlet

 = 2./ G

Hence

'F< )G G = 'F> )G  + 'F= )G H

or

'F< )G G = 'F> )G '2./ G ) + 'F= )G H

or

4'F< )G + 'F> )G :G = 2'F> )G ./ + 'F= )G H

In matrix form

where,

'F ) + 'F= )
K < 
)
J 'F= 
0
J
0
I
F= = ( +

'F> )
'F< )
'F= )H
0

= 8,
*

0
'F> )
'F< )H
'F= )G

F> =

= 4,
*

0

2'F= ) 
N 
0

0
M O P = O
P
0
'F> )H M H
2'F> )G ./
'F< )G + 'F> )G L G
F< = F= + F> = ( + 2

= 12
*

Thomas algorithm

20 4 0
0 
16
8 12 4 0 
0
O
PO P = O P

0 8 12 4
0
H
0
0 8 16 G
0

0
20
4
16
4
8
12
0
Q = O P , R = O P, S = O P and T = O P
8
12
4
0
0
8
16
0
For 2
=2
=3
=4

Back substitute
=

<




Hence

W
E
V 
W
@ = @
@
V 

V = V

'8)
W
'4) = 10.400
E = 12
V
20
'8)
W
@ = @ @ = 0
16 = 6.400
V
20

V = V

'8)
W
'8) = 8.923
E = 12
V
10.4
'8)
W
@ = @ @ = 0
6.4 = 4.923
V
10.4

V = V

'8)
WH
'4) = 12.414
E = 16
V
8.923
'8)
WH
@H = @H @ = 0
4.923 = 4.414
V
8.923

VH = VH

*Z[\ =

* =

@Z[\
VZ[\

@ E *#
V

*H = G =

* = H =

@H
4.414
=
= 0.356
VH 12.414

@ E *H 4.923 '4)0.356
=
= 0.711
V
8.923

* =  =

* =  =

@ E * 6.4 '4)0.711
=
= 0.889
V
10.4
@ E * 16 '4)0.889
=
= 0.978
V
20

3. The linear Burgers equation can be written as


&'()
&
&
=
+ &*
&* &*
Discretize this equation using the Finite Volume Method. Use central differences for the convective
term. Assume the grid has four equi-sized active cells. Solve by hand using the Thomas Algorithm. Plot
the prediction and the analytical solution. Take x = 0.25, L = 1, = 1, ( = 4,  = 1 and ./ = 0,
and assume an initial condition of  = 0 for interior cells. Show all steps.
Analytical solution:
1 exp456 '* 8 1):
 =  0
;
1 exp'56)
56 = (8
Using the Finite Volume Method, the above becomes

'() '() = +
Use central differencing

1
 = '> + < ),
2

&
> <
,
+ - =
&* 
*

&
&
- + &* 
&* 

1
 = '= + < )
2

&
< =
+ - =
&* 
*

= @ABCDEBD, and ( = @ABCDEBD

Hence, Eq. 1 becomes


(
(
> <
< =
'> + < ) '= + < ) =

2
*
*
2
Which can be rearranged to

Or

Apply boundary conditions


Inlet

(
(
< = + + - = + + - >
*
* 2
* 2
F< < = F> > + F= =

 = 2 

'F< )  = 'F> )  + 'F= ) 

Hence

or

'F< )  = 'F> )  + 'F= ) '2  )

4'F< ) + 'F= ) : = 'F> )  + 2'F= ) 

or

Outlet

 = 2./ G

Hence

'F< )G G = 'F> )G  + 'F= )G H

or

'F< )G G = 'F> )G '2./ G ) + 'F= )G H

or

4'F< )G + 'F> )G :G = 2'F> )G ./ + 'F= )G H

In matrix form,
'F ) + 'F= )
K < 
)
J 'F= 
0
J
0
I
where,

F= =

Thomas algorithm

'F> )
'F< )
'F= )H
0

(
+ = 6,
* 2

0
'F> )
'F< )H
'F= )G

F> =

0

2'F= ) 
N 
0

0
M O P = O
P
0
'F> )H M H
2'F> )G ./
'F< )G + 'F> )G L G

(
= 2,
* 2

F< = F= + F> = 2

14 2 0
0 
12

0
6 8 2 0
O
P O P = O P
0
0 6 8 2 H
0
0 6 10 G
0

0
14
2
12
6
8
2
0
Q = O P , R = O P, S = O P and T = O P
6
8
2
0
6
10
0
0

=8
*

For 2

=2
=3
=4

Back substitute
=

<

W
E
V 
W
@ = @
@
V 

V = V

'6)
W
'2) = 7.143
E = 8
V
14
'6)
W
@ = @ @ = 0
12 = 5.143
V
14

V = V

'6)
W
'2) = 6.320
E = 8
V
7.143
'6)
W
@ = @ @ = 0
5.143 = 4.320
V
7.143

V = V

'6)
WH
'2) = 8.101
E = 10
6.320
V
'6)
WH
@H = @H @ = 0
4.320 = 4.101
V
6.320

VH = VH



*Z[\ =



* =
*H = G =

* = H =

* =  =

@Z[\
VZ[\

@ E *#
V

@H 4.101
=
= 0.506
VH 8.101

@ E *H 4.320 '2)0.506
=
= 0.844
V
6.320

@ E * 4.320 '2)0.844
=
= 0.956
V
7.143

* =  =

@ E * 12 '2)0.956
=
= 0.994
V
14

1.2

central

upwind

anal

0.8
0.6
0.4
0.2
0
0

0.2

0.4

0.6

0.8

x
Figure. Numerical solution of the linear steady state Burgers equation using upwind differencing (UD) for
the convection term. Prediction with central differencing (CD) included for

You might also like