MATLAB Solve MATLAB Source Potential Flow Issues

AI Thread Summary
The discussion centers on issues encountered while plotting streamlines of a source flow in MATLAB. The user reports that changing the strength parameter does not affect the streamlines as expected. Additionally, there are problems with three lines of code that were previously functional but now fail to work. The provided code snippet includes the setup for a mesh grid and the calculation of the stream function PsiM for a source flow. The user seeks assistance in troubleshooting the code to resolve these issues and achieve the desired streamline visualization.
physicsCU
Messages
198
Reaction score
1
Hey all:

I am trying to plot the streamlines of a source flow in MATLAB. I just have a couple issues. First, when I change the strength, it doesn't appear that the streamlines change at all. Second, the three lines commented out below, I used them from an example, but now they don't work.

If someone could give me a hand checking this code, that would be great.

Code:

clear all
close all
clc

nx = 100; xmin = -2; xmax = 2;
ny = 100; ymin = -2; ymax = 2;
[x y] = meshgrid(linspace(xmin,xmax,nx),linspace(ymin,ymax,ny));
M = 8; xM = 0; yM = 0;
PsiM = (M/(2*pi))*atan2(y - yM,x - xM);
% levmin = PsiM(1,nx);
% levmax = PsiM(ny,nx/2);
% levels = linspace(levmin,levmax,50);
contour(x,y,PsiM,100)
axis([xmin xmax ymin ymax])
xlabel('x'), ylabel('y')
title('Source of Strength M = 4')
 
Physics news on Phys.org
Can anyone help me?
 

Similar threads

Back
Top