Plotting Contours of velocity potential and stream function of top of velocity vectors.

41 views (last 30 days)
This is my question I have
Use MATLAB to plot contours of velocity potential and stream function on top of velocity vectors for each a combined with a uniform flow of V = 10 m/s
a. A source strength 20 m2/s
b. A doublet strength 20 m2/s
c. A vortex strength 20 m3/s
d. A source and a sink each of strength 15 m2 separated by 1 m
Here is my code so far. I am terrible with MATLAB and do not know where to go from here
clc, clear
[x,y] = meshgrid(0:0.1:4,0:0.1:4);
u = 10*y;
v = (-6*x)-10;
z=5*(y.^2)-(3*x.^2)-(10*x)-5;
figure
quiver(x,y,v,u)
hold on
contour(x,y,z,20)

Answers (2)

Ali Alaraini
Ali Alaraini on 22 Jan 2020
How do you plot the veolcity isolines of a veolcity potential flow of a source or a sink ??

Isaiah Garcia-Romaine
Isaiah Garcia-Romaine on 27 Oct 2023
Edited: Isaiah Garcia-Romaine on 27 Oct 2023
clc, clear
[x,y] = meshgrid(-2:0.1:2,-2:0.1:2);
V = 10; % uniform flow speed
% a. A source strength 20 m2/s
strength_source = 20;
u_source = strength_source/(2*pi)*x./(x.^2+y.^2);
v_source = strength_source/(2*pi)*y./(x.^2+y.^2);
figure
quiver(x,y,u_source+V,v_source)
hold on
contour(x,y,u_source+V,20)
title('A source strength 20 m^2/s')
% b. A doublet strength 20 m2/s
strength_doublet = 20;
u_doublet = -strength_doublet/(2*pi)*x./(x.^2+y.^2).^2;
v_doublet = -strength_doublet/(2*pi)*y./(x.^2+y.^2).^2;
figure
quiver(x,y,u_doublet+V,v_doublet)
hold on
contour(x,y,u_doublet+V,20)
title('A doublet strength 20 m^2/s')
% c. A vortex strength 20 m3/s
strength_vortex = 20;
u_vortex = strength_vortex/(2*pi)*y./(x.^2+y.^2);
v_vortex = -strength_vortex/(2*pi)*x./(x.^2+y.^2);
figure
quiver(x,y,u_vortex+V,v_vortex)
hold on
contour(x,y,u_vortex+V,20)
title('A vortex strength 20 m^3/s')
% d. A source and a sink each of strength 15 m^2 separated by 1 m
strength_source_sink = 15;
separation_distance = 1;
u_source_sink = strength_source_sink/(2*pi)*(x+separation_distance/2)./( (x+separation_distance/2).^2 + y.^2 ) - strength_source_sink/(2*pi)*(x-separation_distance/2)./( (x-separation_distance/2).^2 + y.^2 );
v_source_sink = strength_source_sink/(2*pi)*y./( (x+separation_distance/2).^2 + y.^2 ) - strength_source_sink/(2*pi)*y./( (x-separation_distance/2).^2 + y.^2 );
figure
quiver(x,y,u_source_sink+V,v_source_sink)
hold on
contour(x,y,u_source_sink+V,20)
title('A source and a sink each of strength 15 m^2 separated by 1 m')

Categories

Find more on Object Containers in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!