Velocityfield and stream function

  • Thread starter Thread starter MaxManus
  • Start date Start date
  • Tags Tags
    Function Stream
Click For Summary
SUMMARY

The discussion revolves around the calculation of a velocity field defined by the equations u = cos(x)sin(y) and v = -sin(x)cos(y) within the domain x = y = [-π/2, π/2]. The stream function is given by psi = cos(x)cos(y). A MATLAB function, streamfun, is provided to compute the stream function, but the user encounters discrepancies between the generated velocity field and the expected results. The user seeks clarification on the relationship between the velocity field and the gradient of the stream function, specifically using the nabla operator.

PREREQUISITES
  • Understanding of vector fields and stream functions
  • Familiarity with MATLAB programming and syntax
  • Knowledge of gradient calculations in multivariable calculus
  • Basic concepts of quiver plots for visualizing vector fields
NEXT STEPS
  • Review MATLAB's gradient function for calculating vector fields
  • Study the relationship between stream functions and velocity fields in fluid dynamics
  • Learn how to visualize vector fields using quiver plots in MATLAB
  • Explore the application of the nabla operator in vector calculus
USEFUL FOR

Students and professionals in fluid dynamics, MATLAB users, and anyone interested in understanding the relationship between velocity fields and stream functions.

MaxManus
Messages
268
Reaction score
1

Homework Statement


A velocity field is given by v = ui + vj
where:
u = cos(x)sin(y)
v = -sin(x)cos(y)
x = y = [-pi/2,pi/2]


the stream function psi is:

psi = cos(x)cos(y)

Matlab function:
--------------------------------------
function[X,Y,psi] = streamfun(n)

if nargin < 1;
n=20;
end

x=linspace(-0.5*pi,0.5*pi,n);
[X,Y] = meshgrid(x,x);
psi=cos(X).*cos(Y);

------------------------------------------

Homework Equations




calculate the velocity numerically with \nablapsi


The Attempt at a Solution


I am starting with the assumption, the velocity is \nablapsi, is this correct?

--------------------------------------

[x,y,psi] = streamfun(20)
[u,v] = gratient(20)

quiver(x,y,u,v)

and I get numfield.jpg, see attachment, but this is not the same as my velocityfield.jpg

which I got from:

-----------------------------------------------
x = linspace(-0.5*pi,0.5*pi,n);
[x,y] = meshgrid(x,x);

u = cos(x).*sin(y);
v = -sin(x).*cos(y);

quiver(x,y,u,v)
----------------------------------------------------------
Can someone please help me and tell me what I am doing wronge.

Edit:
nabla*psi = -sin(x)cos(y)i - cos(x)*sin(y)j
 

Attachments

  • numfield.jpg
    numfield.jpg
    37.8 KB · Views: 501
  • velocityfield.jpg
    velocityfield.jpg
    37.6 KB · Views: 473
Last edited:
Physics news on Phys.org
One more question:

A velocity field is given by v = ui + vj
where:
u = cos(x)sin(y)
v = -sin(x)cos(y)

Draw stream vectors along the x and y axes.

What is a stream vector?
Is it just like arrows with magnitude and direction v?
 

Similar threads

Replies
28
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
Replies
18
Views
2K
Replies
8
Views
2K
Replies
8
Views
1K
  • · Replies 13 ·
Replies
13
Views
1K
Replies
12
Views
2K
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K