Hi i need a little help about streamlines for circular cylinder.
We calculate the vorticity for circular cylinder like
for(j=1;j<M;j++) for(i=1;i<N;i++) if(flag[j][i]==1) vor[j][i]=((u[j+1][i]-u[j-1][i])-(v[j][i+1]-v[j][i-1]))/(2*dx);

i need some help if we calculate the stream line then what will be the expression like above one for vorticity.

for(j=1;j<M;j++) for(i=1;i<N;i++) if(flag[j][i]==1) streamline[j][i]=?

I hope some one will write down the expression for streamline to help me.
Thanks in advance

computing streamlines could be more complicated than this. it’s about integrating the velocity field and may require interpolations between lattice nodes. you can use matlab to plot streamlines easily, or use a library like vtk to compute them inside your program.


if you want to calculate stream function from velocity field

this is the equation but you need to know the stream function at one positon ( like wall Strf=0 )

Strf = Strf ( x0,y0 ) + intg from y0 to y { u(x,y) dy } + intg from x0 to x { v(x,y0) dx }

where x0 and y0 are the index of known stream function

//I assume (0,0) is the location of known stream function
for (int i=0; i<nX ; i++) // for each point in the domine
for (int j=0; j<nY ; j++)
str[i][j]=str[0][0] + IntgU( 0 , 0 , i , j) - IntgV(0 , 0 , i , j);

double IntgV(int X0 , int Y0 , int Xn , int Y)
double I=0;
for (int i=X0 ; i<Xn ; i++)
I+= (V[i][Y0]+V[i+1][Y0])/2.0;
return I;

double IntgU(int X0, int Y0 , int X , int Yn)
double I=0;
for (int j=Y0 ; j<Yn ; j++)
I+= (U[X][j]+U[X][j+1])/2.0;
return I;

I hope this will help you.

Thanks a lot SaS, Dear if you like i facing some problems after developing code for flows over circular cylinders, but the graphical representation of vorticty contours shows some instabilities , this means i make some mistake in my code. If you like to check my code and where i do the mistake i will send it to you.
Thanks again and bye for now.