Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
7.4 kB
2
Indexable
Never
%Fluid matlab report / doctor yasser abouf/ doctor essam wahba/ T.A mohab 
%uniform flow + source  
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%uniform flow + source  
[x,y] = meshgrid(-25:0.1:25);z
strh=input('please insert the required strength \n= '); 
vely=input('please insert the required velocity \n= '); 
figure (219) 
flowdiagram = vely*y+strh*atan2(y,x); 
%we use uniform flow equation in addition to source equation
contourf(x,y,flowdiagram,75);
colorbar;
grid on;
xlabel('Alexandria University');
ylabel('Faculty of Engineering');
title('Fluid Mechanics 2');
%7620
%7478
%7413
%7548
%7620
%7478
%7413
%7548
 
%Doublet (source+sink)
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%Doublet (source+sink)
x1=linspace(-0.5,0.5,100);
y1=linspace(-0.5,0.5,100);
[x,y]=meshgrid(x1,y1);
radius=sqrt((y.^2)+(x.^2));
Angle=atan2(y./radius,x./radius);
 Dis=input('insert the distance between the source and the sink \n= ');
 strh=input('insert the strength of fluid \n= ');
 o=strh.*Dis./pi;
 flowdiagram=-(o./radius).*cos(Angle);
[dx,dy]=gradient(flowdiagram);
contourf(x,y,flowdiagram,30), hold on
colorbar;
xlabel('Alexandria University');
ylabel('Faculty of Engineering');
title('Fluid Mechanics');
quiver(x,y,dx,dy)
%7620
%7478
%7413
%7548
%7620
%7478
%7413
%7548
 
%uniform flow in addition to free vortex
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%uniform flow in addition to free vortex
V  = input('please insert the required velocity \n= ');                                   
a= 0;                                                                 
g = input('please insert the required vortex strength \n= ');                               
X1    = 0;                                                               
Y1    = 0; 
numx = 50;
numy = 50;
X2       = linspace(-10,10,numx)';                                        
Y2       = linspace(-10,10,numy)';                                           
[XX,YY] = meshgrid(X2,Y2);                                                    
Vx = zeros(numx,numy);                                                      
Vy = zeros(numx,numy);                                                      
c  = zeros(numx,numy);                                                      
for i = 1:1:numx                                                           
    for j = 1:1:numy                                                        
        x2       = XX(i,j);                                                  
        y2       = YY(i,j);                                                  
        dx      = x2 - Xx;                                                   
        dy      = y2 - Yy;                                                   
        c      = sqrt(dx^2 + dy^2);                                       
        Vx(i,j) = V*cosd(a) + (g*dy)/(2*pi*c^2);               
        Vy(i,j) = V*sind(a) + (-g*dx)/(2*pi*c^2);                
    end
end        
nums=30;
x(Star) = -10.*ones(nums,1);                                                
y(Star) = linspace(-10,10,nums);                                            
figure(33);                                                                  
cla; hold on; grid off;                                                     
set(gcf,'Color','white');                                                 
set(gca,'FontSize',16); 
quiver(X2,Y2,Vx,Vy,'r');                                                      
Seif = streamline(XX,YY,Vx,Vy,xStart,yStart);                                  
set(Seif,'Color','k');
xlim([-6 6]);                                                               
ylim([-6 6]);                                                               
xlabel('Alexandria University');
ylabel('Faculty of Engineering');
title('Fluid Mechanics'); 
%7620
%7478
%7413
%7548
%7620
%7478
%7413
%7548

 








%source/sink flow in addition to a free vortex

%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%source/sink flow in addition to a free vortex
gg=linspace(-0.5,0.5,100);
bb=linspace(-0.5,0.5,100);
[xma,yma]=meshgrid(gg,bb);
t=sqrt((xma.^2)+(yma.^2));
angel=atan2(yma./t,xma./t);
S=input('insert the source strength of fluid \n= ');
F=input('insert the vorticity strength of fluid \n= '); 
magdy=(((S*angel)./(2.*pi))-F.*log(t));
[dx,dy]=gradient(magdy);
contourf(xma,yma,magdy,40), hold on
colorbar;
xlabel('Alexandria University');
ylabel('Faculty of Engineering');
title('Fluid Mechanics');
quiver(xma,yma,dx,dy);
%7620
%7478
%7413
%7548
%7620
%7478
%7413
%7548








%Source         @100,100
 
%Sink         @-100,100
 

%flow over a cylinder that is rotating
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber

%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
% flow over a cylinder that is rotating
seif= input('please insert the required velocity \n= ');
adham= input('please insert the cylinder velocity [Anti-clockwise] \n= ');
a = 2 ;
g =a*4;
r =-a*4;
m =a*60;
[x,y]=meshgrid([g:(r-g)/m:r],[g:(r-g)/m:r]');
warning off;
[I J]=find( (x.^2+y.^2) < a);
if ~isempty(I)
x(I,J) = 0;
y(I,J) = 0;
end
kk=sqrt(x.^2+y.^2);
angle=atan2(y,x);
z=seif.*sin(angle).*kk.*(1-(a^2./(kk.^2)))-adham*log(kk)/(2*pi);
m=100;
r=ones(1,m+1)*a;
l=[0:2*pi/m:2*pi];
Xcircle = r.*cos(l);
Ycircle = r.*sin(l);
figure(984);
contour(x,y,z,25);
colorbar;
hold on;
fill(Xcircle,Ycircle,'k');
x=[-a*2:a/3:a*2];
[x]=meshgrid(x);
y=x';
[I J]=find( (x.^2+y.^2) < a);
if ~isempty(I)
x(I,J) = 0;
y(I,J) = 0;
end
r=sqrt(x.^2+y.^2);
angel=atan2(y,x);
ur=seif*cos(angel).*(1-a^2./(r.^2));
ul=-seif*sin(angel).*(1+a^2./(r.^2))+adham./(2*pi*r);
u=ur.*cos(angel)-ul.*sin(angel);
v=ur.*sin(angel)+ul.*cos(angel);
hold on;
quiver(x,y,u,v);
title('Fluid Mechanics')
xlabel('Alexandria University \rightarrow');
ylabel('Faculty of Engineering \rightarrow');
axis square;
grid off;
scale =4;
%7620
%7478
%7413
%7548
%7620
%7478
%7413
%7548

 
%flow over a cylinder that is stationary
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
%Adham Ahmed Samir
%Magdy Mohamed A.Aziz
%Seif El-Din Hesham Mohamed
%Malak Haytham Gaber
% flow over a cylinder that is stationary
malak=input('please insert the required strength \n= ');
magdy=input('please insert the required velocity \n= ');
[X1,Y1] = meshgrid(-20:0.1:20);
psil= magdy*Y1-malak*Y1./(X1.^2+Y1.^2);
figure (1)
A='on';
B = 3;
C = 8;
contour(X1,Y1,psil,'textstep',B,'levelstep',C);
title('Fluid Mechanics')
xlabel('Alexandria University');
ylabel('Faculty of Engineering');
%7620
%7478
%7413
%7548