Velocityfield and stream function

1 reply · 5K views · last reply
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 [tex]\nabla[/tex]psi


The Attempt at a Solution


I am starting with the assumption, the velocity is [tex]\nabla[/tex]psi, 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
  • Quiver plot on axes from -2 to 2 showing arrows over x from about -1.6 to 1.6 and y from about -1.6 to 1.6; arrows point inward toward the origin along the axes and outward in the four quadrants, with the field vanishing near the origin.
    numfield.jpg
    37.8 KB · Views: 528
  • Quiver plot of a vector field on x and y axes from -2 to 2, with arrows forming a rotating pattern of square-like cells centred near the origin.
    velocityfield.jpg
    37.6 KB · Views: 501
Last edited:
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?