Solve MATLAB Source Potential Flow Issues

  • Context: MATLAB 
  • Thread starter Thread starter physicsCU
  • Start date Start date
  • Tags Tags
    Flow Potential Source
Click For Summary
SUMMARY

The discussion focuses on issues encountered while plotting streamlines of a source flow in MATLAB. The user reports that changing the strength of the source flow does not affect the streamlines as expected. Additionally, commented-out lines of code intended for contour levels are not functioning correctly. The provided MATLAB code utilizes the 'meshgrid' and 'contour' functions to visualize the potential flow, specifically using a source strength of M = 8.

PREREQUISITES
  • Familiarity with MATLAB programming and syntax
  • Understanding of fluid dynamics concepts, specifically potential flow theory
  • Knowledge of the 'meshgrid' and 'contour' functions in MATLAB
  • Basic grasp of stream function and its application in flow visualization
NEXT STEPS
  • Investigate the impact of varying source strength on streamlines in MATLAB
  • Learn about the 'contour' function and its parameters for effective flow visualization
  • Explore debugging techniques in MATLAB to resolve code issues
  • Study potential flow theory to understand the mathematical basis for the source flow
USEFUL FOR

Engineers, researchers, and students in fluid dynamics or computational fluid dynamics who are using MATLAB for flow visualization and analysis.

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

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K