Você está na página 1de 15

Final Project of Introduction to CFD

Instructor:
Prof. A. Noghreh-Abadi

Due Date:
January 15, 2019

Student:
S.M.A. Taleghani
- Problem Specification[1]:

1
-Requirements:
The streamlines within the chamber are to be determined using:
I. Finite difference method
II. Finite volume method
III. Ansys Fluent with structured mesh
IV. Ansys Fluent with unstructured mesh
For Parts I & II, the following methods are to be used:
(a) Jacobi
(b) Point Gauss-Seidel
And the corresponding codes shall be provided in the appendix.

It is also required to compare the convergence time and accuracy of different methods.
- Pre-analysis:
I. For the FDE method, there is no significant pre-analysis required. All boundary
conditions are Dirichlet –type and the governing FDE equation for equal sizes of
𝚫𝐱 𝐚𝐧𝐝 𝚫𝐲 is:
𝛹𝑖+1,𝑗+𝛹𝑖−1,𝑗+𝛹𝑖,𝑗+1 +𝛹𝑖,𝑗−1
𝛹𝑖,𝑗 = (P5-1.6)
4
II. In the FVM method, the governing equation for the domain is the same as (P5-1.6)

III. & IV. For solving the problem in Fluent, the stream function Ψ will be treated as
temperature T. Therefore, all Ψ= constant boundary conditions will turn into isothermal
boundary conditions.
The only matter of concern is the modeling of inlet and outlet velocities:
𝒅𝚿 𝒅𝐓
𝒂𝒕 𝒊𝒏𝒍𝒆𝒕: 𝒗𝒐𝒖𝒕 = − ≡− (P5-1.7)
𝒅𝒙 𝒅𝒙

2
Since the inlet is surrounded by 𝛹= 100 on the right and 𝛹= 0 on the left:
𝒅𝚿 𝚫𝚿 𝟏𝟎𝟎−𝟎
− ≅− =− = −𝟓𝟎𝟎 (P5-1.8)
𝒅𝒙 𝚫𝒙 𝟎.𝟐
Using Fourier's law:
𝒅𝐓
𝒒𝒙 = −𝒌𝑨 (P5-1.9)
𝒅𝒙
Comparing (P5-1.8) & (P5-1.9):
𝒒𝒙 = −𝟓𝟎𝟎𝒌𝑨 (P5-1.9)
(P5-1.9) in the thermal analysis is equivalent of having an inlet velocity causing the difference of
100 in 𝛹 between the left and right side of the inlet. This equation indicated that the heat flux is
only in the x-direction, i.e. parallel to the inlet. As far as we are concerned, the heat flux normal
to the inlet will be set to zero in Fluent and the flux in x-direction will be automatically satisfied
by the Ψ= constant boundary conditions
Also, by comparing (P5-1.7) & (P5-1.8):
𝒇𝒕
𝒗𝒐𝒖𝒕 = −𝟓𝟎𝟎
𝒔
Which indicates that the inlet is actually an outlet!
A similar analysis for the outlet yields:
𝒅𝚿 𝒅𝐓
𝒂𝒕 𝒐𝒖𝒕𝒍𝒆𝒕: 𝒖𝒊𝒏 = ≡ (P5-1.10)
𝒅𝒚 𝒅𝒚

𝒅𝚿 𝚫𝚿 𝟎−𝟏𝟎𝟎
≅ = = −𝟓𝟎𝟎 (P5-1.11)
𝒅𝒚 𝚫𝒚 𝟎.𝟐
𝒅𝐓
𝒒𝒚 = −𝒌𝑨 𝒅𝒚 (P5-1.12)

𝒒𝒚 = 𝟓𝟎𝟎𝒌𝑨 (P5-1.13)

(P5-1.13) will be satisfied by insulating the outlet (allowing flux only in the y-direction).
Also by comparing (P5-1.10) & (P5-1.11):
𝒇𝒕
𝒖𝒊𝒏 = −𝟓𝟎𝟎
𝒔
Therefore, the outlet is actually an inlet! The same pitfall was present for the inlet.

3
- Results:
I & II.
(a) Jacobi method
Matlab command window output:
Numeric solution is done.
Number of iterations using Jacobi:
348

4
(b) Gauss-Seidel method
Matlab command window output:
Numeric solution is done.
Number of iterations using Gauss-Seidel:
215
III.
The geometry which is a 5-by-5 surface with split edges as shown in the figure below was created
in Ansys SpaceClaim Direct Modeler 19.1.

A uniform Quadrilateral 4-node mesh, 0.2 m in size was created in Ansys Meshing using the face
meshing method.
Before initiating the solver, all cells were set with an initial value of the temperature of 50 K
and the absolute convergence criteria was set to 0.01 per the problem specifications.
After solving, the solution converged with two iterations and a final residual of 4.2773e-03:

Results from post-processing in CFD-Post:

9
IV.
The unstructured mesh with element size of 0.2 m is as below:

Same setting as in part III. was used and the solution converged with a residual of 6.4942e-03.

10
Post-processing results:

11
-Discussion:
Comparing the accuracy of each method:

FDM Jacobi FDM Gauss-Seidel Fluent Structured Mesh Fluent Unstructured Mesh

0.0100 0.0099 0.0042773 0.0064942

This indicated that in general, the structured mesh is more accurate than an unstructured mesh in the
same circumstances.

Comparing the convergence time (judging by the number of iterations):

FDM Jacobi FDM Gauss-Seidel Fluent Structured Mesh Fluent Unstructured Mesh

348 215 2 2

All methods had the same initial guess of 50 K.

-References:
[1] K. A. Hoffmann and S. T. Chiang, Computational Fluid Dynamics for Engineers, 4th ed., no. v. 1.
Engineering Education System, 2000.

12
-Appendix:
Matlab Code:

clear all
close all
clc
m=25; %number of devisions in x dir
n=25; %number of devisions in y dir
L=5; %length of the chamber
W=5; %width of the chamber
x = linspace(0,L,m+1); dx = x(2)-x(1);
y = linspace(0,W,n+1); dy = y(2)-y(1);
T_jac=50*ones(n+1,m+1);%Allocating memmory for Jacobi with initial
value of 50
T_jac(1,1:6) = 0; %Left of Inlet B.C
T_jac(1,7:end) = 100; %Right of Inlet B.C
T_jac(1:16,end) = 100; %Below outlet B.C
T_jac(17:end,end) = 0; %Above outlet B.C
T_jac(end,1:end) = 0; %TOP B.C
T_jac(1:end,1) = 0; %Left B.C
T_gauss=T_jac;%Allocating memmory for gauss-seidel

eps=1e-2; %error for the iterations


b = dx/dy;

%%% Jacobi
iter_jac=0;
while 1
Told = T_jac;
for j = 2:m
for i = 2:n
T_jac(j,i) = (b^2*(Told(j,i+1)+Told(j,i-
1))+Told(j+1,i)+Told(j-1,i))/(2*(b^2+1));
end
end
iter_jac=iter_jac+1;
error = max(max(abs(Told-T_jac)));
if error <eps
break
end
end
disp('Numeric solution is done.')
disp('Number of iterations using Jacobi:')
disp(iter_jac)
contour(x,y,T_jac,25),colormap(jet)
title('Psi'),xlabel('x(m)'),ylabel('y(m)'),colorbar,axis square
figure(2)
pcolor(x,y,T_jac),colormap(jet)
title('Psi'),xlabel('x(m)'),ylabel('y(m)'),colorbar,axis square

13
figure(3)
for i=0:5
plot(0:0.2:5,T_jac(:,1+i*5))
hold on
end
title('Psi along vertical
sections'),xlabel('y(m)'),ylabel('Psi'),axis square
grid
on,legend('x=0(m)','x=1(m)','x=2(m)','x=3(m)','x=4(m)','x=5(m)')

%%% Gauss-Seidel
iter_gauss=0;
while 1
Told = T_gauss;
for j = 2:m
for i = 2:n
T_gauss(j,i) = (b^2*(T_gauss(j,i+1)+T_gauss(j,i-
1))+T_gauss(j+1,i)+T_gauss(j-1,i))/(2*(b^2+1));
end
end
iter_gauss=iter_gauss+1;
error = max(max(abs(Told-T_gauss)));
if error <eps
break
end
end
disp('Numeric solution is done.')
disp('Number of iterations using Gauss-Seidel:')
disp(iter_gauss)
figure(4)
contour(x,y,T_gauss,25),colormap(jet)
title('Psi'),xlabel('x(m)'),ylabel('y(m)'),colorbar,axis square
figure(5)
pcolor(x,y,T_gauss),colormap(jet)
title('Psi'),xlabel('x(m)'),ylabel('y(m)'),colorbar,axis square

figure(6)
for i=0:5
plot(0:0.2:5,T_gauss(:,1+i*5))
hold on
end
title('Psi along vertical
sections'),xlabel('y(m)'),ylabel('Psi'),axis square
grid
on,legend('x=0(m)','x=1(m)','x=2(m)','x=3(m)','x=4(m)','x=5(m)')

14

Você também pode gostar