CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   2D streamline (

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


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


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 10:37.