CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   2D streamline (http://www.cfd-online.com/Forums/main/11989-2d-streamline.html)

Junseok Kim August 10, 2006 21:52

2D streamline
 
I am trying to draw 2D streamline from a vector field with matlab software, but I got spiral shape, which is not right. Is there any way to avoid that.

a=3; n=30;

xt = linspace(-a, a, n); yt = linspace(-a, a, n);

[x,y] = meshgrid(xt, yt);

quiver(x,y,y,-x,5) axis image

hold

h=streamline(stream2(x,y,y,-x,2,0)); set(h, 'Color', 'red');

hold

Arambatzis George August 11, 2006 05:32

Re: 2D streamline
 
I run your code and I think every think is OK.

The stream lines seems to be tangent to the vector field. Why do you say that the spiral shape is wrong?

Junseok Kim August 11, 2006 05:35

Re: 2D streamline
 
What I expect was a closed circle.


Jonas Holdeman August 11, 2006 16:12

Re: 2D streamline
 
Right. Stream lines cannot spiral in 2D unless there is a source or sink. They must close on themselves, or begin and end on a boundary. In this case they must be circles.

Junseok Kim August 13, 2006 03:37

I got it
 
I got it by using stream function


All times are GMT -4. The time now is 13:14.