Академический Документы
Профессиональный Документы
Культура Документы
WS 2013/14
Professor:
Prof. Dr. Ing. Ernst von Lavante
Assistant Professor:
Diplom. Ing. Harun Kaya
M. Sc. Saeid Shirazian
Page
WS 2013/14
Page
The results should be summerized in a report. This report should include: The above
discribed pictures, a complete listing of your program, a short discussion of your results
(1/2 to 1 page) and a comparison with the corresponding results obtained using the
commercial product StarCD-CCM+. Few words and some screen shots are better than
long treatese over several pages, too.
WS 2013/14
1) Mesh File
Page
WS 2013/14
3) Residuals
4) Pressure coefficient
Page
5) Stream Function
WS 2013/14
6) Velocity Magnitude
Page
7) Velocity Vector
WS 2013/14
MATLAB CODE
The basic idea of this problem is to separate the domain into many points and then find
the values of the steam function at those points.
Few formulas has to defined before starting programming:
1. Stream function is defined from the discretization equation, an explicit form of the
equation can be obtained:
l
l 1
l
l
l
i , j 0.25(i 1, j i , j 1 i 1, j 1 i , j 1 )
With l is the current number of the iteration.
2. Pressure Coeficient is defined from Bernoullis equation:
Po + (0.5*den*Vin1^2) + Po + (0.5*den*Vin2^2) = P + (0.5*den*Vot1^2) + P +
(0.5*den*Vot2^2)
From this Cp is defined as:
= {
2 2
12 + 22
}
=
{1
}
0.5 (12 + 22 )
12 + 22
clear all;
close all;
Xm=200;
Ym=50;
dH=0.1;
dx=0.1; dy=0.1;
crit=1*10^(-6);
error=1;
G = zeros(Xm+1,Ym+1);
Uin1=7;
Uin2=10;
Uot=8.5;
% Error
% Inlet velocity
uy=zeros(Xm+1,Ym); vx=zeros(Xm+1,Ym);
V=zeros(Xm+1,Ym);cp=zeros(Xm+1,Ym);
G(:,Ym+1) = 5;
% Inlet Section
for i = 1:41
G(i,Ym)= 0;
end
Page
for i = 52:Xm+1
G(i,Ym)= 0;
end
for i = 42:51
G(i,Ym+1) = (i-1)*Uin1/Xm;
end
WS 2013/14
for j = 2:Ym+1
G(1,j) = (j-1)*Uin2/Ym;
end
% Outlet Section
for i = 1:51
G(i,1)= 0;
end
for i = 52:101
G(i,31)= 0;
end
for i = 102:151
G(i,1)= 0;
end
for i = 152:161
G(i,1) = (i-1)*Uot/Xm;
end
for i = 162:Xm+1
G(i,1)= 0;
end
for j= 2:31
G(51,j)= 0;
G(101,j)= 0;
End
for j= 2:Ym+1
G(Xm+1,j) = (j-1)*Uot/Ym;
end
i = (1:Xm+1);
j = (1:Ym+1);
for j = 2:Ym
Page
WS 2013/14
for i = 2:51
uy(i,j)=(G(i,j+1)-G(i,j-1))/(2*dy);
vx(i,j)=(G(i+1,j)-G(i-1,j))/(2*dx);
V(i,j)=(uy(i,j)^2+vx(i,j)^2)^0.5;
cp(i,j)=1-V(i,j)^2/(Uin1^2+Uin2^2);
end;
end;
for j = 32:Ym
for i = 51:101
uy(i,j)=(G(i,j+1)-G(i,j-1))/(2*dy);
vx(i,j)=(G(i+1,j)-G(i-1,j))/(2*dx);
V(i,j)=(uy(i,j)^2+vx(i,j)^2)^0.5;
cp(i,j)=1-V(i,j)^2/(Uin1^2+Uin2^2);
end;
end;
for j = 2:Ym
for i = 102:Xm
uy(i,j)=(G(i,j+1)-G(i,j-1))/(2*dy);
vx(i,j)=(G(i+1,j)-G(i-1,j))/(2*dx);
V(i,j)=(uy(i,j)^2+vx(i,j)^2)^0.5;
cp(i,j)=1-V(i,j)^2/(Uin1^2+Uin2^2);
end;
end;
Page
figure(1);pic = figure(1);
set(pic,'Name','Mesh of streamlines');
mesh(G);
colorbar;pause(1)
figure(2);pic = figure(2);
set(pic,'Name','Plot of streamlines);
plot(G');
colorbar;pause(1)
figure(3);pic = figure(3);
set(pic,'Name','Contourlines of Stream Functions);
contour(G',100);
figure(4);pic = figure(4);
set(pic,'Name','velocity 3D');
mesh(V);
figure(3);pic = figure(5);
set(pic,'Name','Contourlines of Velocity');
contour(V',400);
figure(3);pic = figure(6);
set(pic,'Name','Contourlines of Coefficeint of pressure');
contour(cp',600);
colorbar;pause(1)
WS 2013/14
Page
2) Stream Lines
WS 2013/14
3) Velocity Contours
Page
10
4) Velocity 3D
WS 2013/14
Page
11
6) Contours of Velocity
WS 2013/14
CONCLUSION
The results of Matlab are different than StarCCM+ because of the following points as
Numerical code depends on Laplace equation while StarCCM+ solves problem with
Navier-Stocks and many other equations and using more different numerical methods.
Then we are using different grid size in both tools. Matlab using bigger grid size as it cant
solve smaller grids as it takes a lot of time in solving it.
Also we have to derive and derive few equations and also make some assumptions before
programming which result in not much accuracy.
However graph generated by Matlab representing flow seems similar behavior with
StarCCM+ graphs which reflects that Matlab graphs are also acceptable if not much
accuracy is needed.
Page
12
When the flow go over the step the properties of the fluid flow was changed, the velocity
of the flow is increased and became maximum in this region. The sudden sharp
contraction of duct area is the cause of increasing the velocity at the region of step, and
also vortex formation, which causes losses over duct. Velocity magnitude show the
change in flow direction and it also show the observable changes in the region. Pressure
is maximum at the edge in star CCM+ near the outlet.
WS 2013/14
Project 2
Gegeben ist das erste Stokessche Problem, in dem die instationre Strmung zwischen
zwei horizontal angeordneten Platten zu berechnen ist. Zur Zeit t=0 (Anfang) sind beide
Platten im Ruhestand. Die Platten sind 6 m lang und der Abstand (Hhe) betrgt
h=0,01m. Das Fluid zwischen den Platten ist Glyzerin, = 1400,8 kg/m, = 0,9554 Pa
s. Die obere Platte wird nachfolgend pltzlich auf Geschwindigkeit U = 0,7 m/s
beschleunigt und bleibt fr alle Zeiten t>0 auf dieser Geschwindigkeit. Es soll die
Verteilung der axialen Geschwindigkeit u (in x Richtung entlang der Platten) als Funktion
von Zeit und Raum, u(t,y) ermittelt werden. Es wurde gezeigt, dass die dimensionslose
Darstellung des Problems u(t, ) wesentlich gnstiger ist und empfohlen wird.
1. Es soll die parabolische Gleichung, die die axiale Geschwindigkeitskomponente u
beschreibt, numerisch gelst werden. Hierzu soll die explizite Methode wie auch die
implizite Methode verwendet werden. Die Ergebnisse fr jede einzelne Zeit sollen in eine
Datei geschrieben werden, um spter graphisch nachbearbeitet zu werden.
2. Die Ergebniss sollen in einem Bericht diskutiert werden. Insbesondere sollen die
explizite und die implizite Methode verglichen werden. Die jeweiligen Ergebnisse u(t, )
sollen fr verschiedene dimensionslose Zeite geplotet werden.
Page
13
3. Die eigene numerische Lsung soll mit der Lsung des Star CD CCM+ verglichen
werden. Insbesondere soll die Genauigkeit und Qualitt der Ergebnisse diskutiert werden.
WS 2013/14
%
%
%
%
%
%
%
Re=Suw*D*Ht/(DV);
cric=0.5*Re*(1/vx)^2;
% Reynolds Number
% Stability Condition
v=zeros((T+1),vx);
v(:,vx)=1;
% Matrix Size
if(dt<cric)
disp('solution is stable')
for t=1:T
for i=2:(vx-1)
v(t+1,i)=v(t,i)+((dt*(v(t,i+1)-(2*v(t,i))+v(t,i-1)))/(Re*(1/vx)^2));
end
end
figure(1);pic = figure(1);
set(pic,'Name','Stoke''s Problem: Explicit Method');mesh(v);
colorbar;pause(1)
figure(2);pic1 = figure(2);
set(pic1,'Name','Stoke''s Problem: Explicit Method');
plot(v(480,:),'r');
hold on
plot(v(1700,:),'g');
hold on
plot(v(7780,:),'b');
hold on
plot(v(15300,:),'y');
hold on
plot(v(32870,:),'m');
legend('480','1700','7780','15300','32870')
else
disp('solution is unstable')
Page
14
end
WS 2013/14
Page
15
2) Velocity 3D:
WS 2013/14
% Total Height
% Total Time
% Speed of upper plate
% Time Step
% Density of Glycerin
% Dynamic Viscosity
% Reynolds Number
% Matrix Size
x=zeros(1,99);x(1,:)=2*dT/(Re*(1/vx)^2)+1;
y=zeros(1,98);y(1,:)=-dT/(Re*(1/vx)^2);
z=zeros(1,98);z(1,:)=-dT/(Re*(1/vx)^2);
A=diag(x,0)+diag(y,1)+diag(z,-1);
K=zeros(99,1);
K(99,1)=dT/(Re*(1/vx)^2);
Y =(A^-1)*K;
for t=1:T,
for i=1:99,
G(t+1,i+1)=Y(i,1);
end
K=Y;
K(99,1)=K(99,1)+dT/(Re*(1/vx)^2);
Y=(A^-1)*K;
end
figure(1);pic = figure(1);colorbar;
set(pic,'Name','Stoke''s Problem: Implicit Method');
mesh(G);colorbar;
pause(1)
Page
16
figure(2);pic1 = figure(2);
set(pic1,'Name','Stoke''s Problem: Implicit Method');
plot(G(70,:),'r');
hold on
plot(G(244,:),'g');
hold on
plot(G(917,:),'b');
hold on
plot(G(1980,:),'y');
hold on
plot(G(3870,:),'m');
legend('70','244','917','1980','3870')
WS 2013/14
Page
17
2) Velocity 3D
WS 2013/14
2) XY Plot
Page
18
WS 2013/14
Page
19
6) Vector Velocity:
WS 2013/14
CONCLUSION
From the graphical results displayed by the simulation in star-CCM+ and Matlab, it is
observed that the matlab results are approximate and Star-CCM+ results are more
accurate. Reason behind this difference is that, Star CCM+ is comercially developed
software for flow simulation and uses complex equations of Naviers stokes, while in
Matlab we have to input various parameters by making approximations and it solves
Eulers Equation.
From Star CCM+ graph we can check how fluid will flow and how its properties changes
as its upper most layers moves with the velocity of upper plate and how velocity is
distributed along its depth.
It can be seen that explicit method programming is relatively easy to set up as compared
to implicit method . Base on the graphs we saw that the implicit method have a better
flexibility compared to explicit method. The time step of explicit method is bound in a
region where dt<(1/2*Re*dH2) to ensure the flow is stable.
Page
20
Therefore in explicit results the run time is more than the implicit solution hence the
implicit solution needs less number of iterations than explicit one, to achieve the
termination criteria.
WS 2013/14
Aufgabe C:
Die Ausbreitung einer schwachen Druckwelle wird nherungsweise durch die
Wellengleichung 1.-Ordnung beschrieben:
pt + c px = 0
(1)
wobei c>0 eine konstante Ausbreitungsgeschwindigkeit ist, die in diesem Fall die
Schallgeschwindigkeit ist, c0 = 310 m/s. Das Problem ist durch die Anfangsverteilung des
Druckes definiert,
2. Es soll die hyperbolische Gleichung (1), die den Druck als Funktion von Zeit und Raum,
p(x,t), beschreibt, numerisch gelst werden. Hierzu soll eine explizite upwind Methode
verwendet werden. Die Ergebnisse fr verschiedene Zeiten (mindestens 4) sollen in eine
Datei geschrieben werden, um spter graphisch nachbearbeitet zu werden.
3. Die eigene numerische Lsung soll mit der Lsung des Star CD CCM+ verglichen
werden. Insbesondere soll die Genauigkeit und Qualitt der Ergebnisse diskutiert werden.
Achtung: es mssen dimensionsbehaftete Daten verglichen werden, da CCM+ nur mit
Dimensionen funktioniert.
Insbesondere sollen anhand von Abbildungen folgende Fragen beantwortet werden:
a) Welche Methode ist dissipativer?
b) Wie ist die Dispersion der beiden Methoden (Art und Gre)
4. Der Teil 2. soll fr den nichtlinearen (aber realistischeren) Fall c = c(p) wiederholt
werden. Dabei
-
Page
21
5.Alle Ergebnisse sollen mit der (bekannten) analytischen Lsung verglichen werden.
WS 2013/14
MATLAB CODE
clear all;
close all;
L=10;
C = 310;
dt=0.0001;
dl = 0.1;
T = 0.1;
TL = 0:dl:L;
%
%
%
%
%
Total Length
velocity of sound
Time step
Spatial increment
Total Time
Page
22
% Number of Iterations
Iteration=T/dt;
K=zeros(Iteration+1,101);
pO = 7000;
p = pO*(1 + cos(2*(pi)*(dl/L)));
% Boundary Conditions (Velocity)
V1=p;
V101=0;
K(:,1)=V1;
K(1,101)=V101;
t=1;
while t<=Iteration, t;
for i = 2:101,
K(:,1)=V1;
K(t+1,i) = K(t,i) - ((C*dt)/dl)*(K(t,i)-K(t,i-1));
end
t=t+1;
end
figure(1);pic = figure(1);
set(pic,'Name','wave propagation');
mesh (K)
colorbar;pause(1)
figure(2);pic=figure(2);
set(pic,'Name','wave propagation');
plot(K')
colorbar;pause(1)
WS 2013/14
Page
23
2) Pressure distribution in 2D
WS 2013/14
Page
24
2) Residuals
WS 2013/14
3) Velocity
4) Velocity Vector
Page
25
5) Pressure Coefficient
WS 2013/14
6) XY Plot
Page
26
2) Residual:
WS 2013/14
3) Velocity:
4) Pressure Coefficient:
27
Vectors:
Page
5)
WS 2013/14
CONCLUSION:
As can be seen from the graphs that the method of Matlab is dissipative, because of its inability to
exhibit oscillatory behaviour.
The graph obtain from STAR-CCM+ is however dispersive because of its oscillatory behaviour of
second order.
Page
28
The results obtain exhibit truncation error of first order as compared to STAR-CCM+ of second
order. The Matlab however offer to the user a fast alternative of obtaining quick solution as can be
seen from the graph obtained. STAR-CCM+ requires more iteration before being able to reach a
certain target value.