Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 6

Exp 3

Uniform Flow :
Code:
x=-2:0.02:2;
y=-2:0.02:2;
V=2;
for i=1:length(x)
for j=1:length(y)
xn(i,j)=x(i);
yn(i,j)=y(j);
phi(i,j)=V*x(i);
psi(i,j)=V*y(j);
end
end
contour(xn,yn,phi,'k')
hold on
contour(xn,yn,psi,'k','LineWidth',3)
legend('potential lines','streamlines')

output:

2
potential lines
streamlines
1.5

0.5

-0.5

-1

-1.5

-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

Source flow:
k=-2;
x=-2:0.02:2;
y=-2:0.02:2;
for i=1:length(x)
for j=1:length(y)
xn(i,j)=x(i);
yn(i,j)=y(j);
phi(i,j)=k*log(sqrt(x(i)^2+(y(j)+0.01)^2));
psi(i,j)=k*atan(y(j)/x(i));
end
end
contour(xn,yn,phi,'k')
hold on
contour(xn,yn,psi,'k','LineWidth',3)
legend('potential lines','streamlines')

output:

2
potential lines
streamlines
1.5

0.5

-0.5

-1

-1.5

-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Exp 4:
Doublet flow:
k=1;
x=-2:0.02:2;
y=-2:0.02:2;
for i=1:length(x)
for j=1:length(y)
xn(i,j)=x(i);
yn(i,j)=y(j);
phi(i,j)=k*x(i)/(x(i)^2+(y(j)+0.01)^2);
psi(i,j)=-k*y(j)/(x(i)^2+(y(j)+0.01)^2);
end
end
contour(xn,yn,phi,[-10:1:10],'k')
hold on
contour(xn,yn,psi,[-2:0.5:2],'k','LineWidth',3)
legend('potential lines','streamlines')

output:

2
potential lines
streamlines
1.5

0.5

-0.5

-1

-1.5

-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Vortex flow
k=2;
x=-2:0.02:2;
y=-2:0.02:2;
for i=1:length(x)
for j=1:length(y)
xn(i,j)=x(i);
yn(i,j)=y(j);
phi(i,j)=-k*atan(y(j)/x(i));
psi(i,j)=k*log(sqrt(x(i)^2+(y(j)+0.01)^2));
end
end
contour(xn,yn,phi,[-10:1:10],'k')
hold on
contour(xn,yn,psi,[-2:0.5:2],'k','LineWidth',3)
legend('potential lines','streamlines')

Output

2
potential lines
streamlines
1.5

0.5

-0.5

-1

-1.5

-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Exp 6
Uniform source
x=-10:0.1:10;
y=-10:0.1:10;
for i=1:length(x)
for j=1:length(y)
xn(I,j)=x(i);
yn(I,j)=y(j);
psi(I,j)=0.8*(y(j)+atan2(y(j),(x(i)+1)));
%phi(I,j)=0.8*(x(i)+log(sqrt(x(i)^2+(y(j)+0.01)^2)));
end
end
contour(xn,yn,psi,[-10:2:10],’k’)
%hold on
%contour(xn,yn,phi,[-10:2:10],’k’,’LineWidth’,2)
legend(‘streamlines’,’potential lines’)

output:

10
streamlines
8 potential lines

-2

-4

-6

-8

-10
-10 -8 -6 -4 -2 0 2 4 6 8 10
Uniform doublet
x=-2:0.02:2;
y=-2:0.02:2;
V=2;
for i=1:length(x)
for j=1:length(y)
xn(i,j)=x(i);
yn(i,j)=y(j);
psi(i,j)=V*(y(j)-y(j)/(x(i)^2+(y(j)+0.01)^2));
%phi(i,j)=V*(x(i)+x(i)/(x(i)^2+(y(j)+0.01)^2));
end
end
contour(xn,yn,psi,[-10:1:10],'k','LineWidth',2)
%hold on
%contour(xn,yn,phi,[-10:1:10],'k','LineWidth',0.1)
legend('streamlines')

Output

2
streamlines
1.5

0.5

-0.5

-1

-1.5

-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

You might also like