# Is there code to plot stream function from u & v velocities

 Register Blogs Members List Search Today's Posts Mark Forums Read

 August 1, 2017, 07:11 Is there code to plot stream function from u & v velocities #1 Senior Member     Khalid Baker Join Date: Mar 2009 Location: IRAQ Posts: 154 Rep Power: 10 Hello I am searching for a code can plot stream function in terms of u & v velocity components? May somebody guide me to a similar code? Thanks Khalid

 August 5, 2017, 11:17 #2 Senior Member   Join Date: Aug 2011 Posts: 271 Rep Power: 9 Hi Kbaker, Here is a piece of code in fortran to compute the stream function from the longitudinal U componnent of the velocity field. Let me know if you need further details. Leflix C************************************************* ********* SUBROUTINE STREAM (U, DY, NI, NJ, PSI) C************************************************* ********* IMPLICIT NONE INTEGER NI,NJ, KX,KY, I, J PARAMETER(KX=512,KY=512) REAL*8 U, DY,PSI DIMENSION U(0:KX,0:KY), PSI(0:KX,0:KY) DO I=0,NI PSI(I,0)=0.d0 DO J=1,NJ PSI(I,J)= PSI(I,J-1) + U(I,J)*DY END DO END DO RETURN END

August 5, 2017, 12:16
#3
Senior Member

Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 154
Rep Power: 10
Thanks Leflix for the reply. Actually I not looking for a fortran program I want to draw the stream function in Tecplot code? Do you have experience with it?

Khalid

Quote:
 Originally Posted by leflix Hi Kbaker, Here is a piece of code in fortran to compute the stream function from the longitudinal U componnent of the velocity field. Let me know if you need further details. Leflix C************************************************* ********* SUBROUTINE STREAM (U, DY, NI, NJ, PSI) C************************************************* ********* IMPLICIT NONE INTEGER NI,NJ, KX,KY, I, J PARAMETER(KX=512,KY=512) REAL*8 U, DY,PSI DIMENSION U(0:KX,0:KY), PSI(0:KX,0:KY) DO I=0,NI PSI(I,0)=0.d0 DO J=1,NJ PSI(I,J)= PSI(I,J-1) + U(I,J)*DY END DO END DO RETURN END

 August 5, 2017, 12:21 #4 Senior Member     Paolo Lampitella Join Date: Mar 2009 Location: Italy Posts: 766 Blog Entries: 17 Rep Power: 21 That shoud be part of tecplot already... at least I recall it was. You should read the manual if that feature is not particularly immediate to reach.

 August 5, 2017, 12:26 #5 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,491 Rep Power: 40 It is very easy, you have just to activate it in the menu and then click on a point in the field to have one streamline. http://www.tecplot.com/blog/2014/10/...article-paths/ mariam.sara likes this.

 August 5, 2017, 15:16 #6 Senior Member   Join Date: Aug 2011 Posts: 271 Rep Power: 9 Ok ! Yes you have to upload your velocity field in 4 columns x y Ux Uy ................ ................ Then you activate streamtrace and as Filipo mentioned it click on a point you will have a streamline there. Yiu can also trace a line along the two opoosite corner of your domain and it will display sveral streamlines. Check out the documentation of tecplot. Leflix

August 5, 2017, 16:44
#7
Senior Member

Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 154
Rep Power: 10
Attachment 57592Thanks leflix and Filippo for the information. Leflix I already did a file with four coloums i.e. x y u v I saved it as general text file when I open it in Tecplot as a text and in order to activate streamtraces I need to do triangulation. The problem when I attempt to do 2D triangulation it give me error as the attached pict? so what the problem ?

Khalid
Attached Images
 1.jpg (129.5 KB, 7 views)

 August 5, 2017, 16:56 #8 Senior Member   Join Date: Aug 2011 Posts: 271 Rep Power: 9 Is your grid structured or unstructured ?

August 5, 2017, 17:04
#9
Senior Member

Join Date: Jan 2011
Posts: 275
Rep Power: 9
I have same problem

Quote:
 Originally Posted by leflix Is your grid structured or unstructured ?

August 5, 2017, 17:08
#10
Senior Member

Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 154
Rep Power: 10
Its structured grid I use meshing code to make the mesh and solve the problem using CFX code. My geometry is a sqaure cavity.

Quote:
 Originally Posted by leflix Is your grid structured or unstructured ?

 August 5, 2017, 17:12 #11 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,491 Rep Power: 40 Check first if the data are loaded correctly and show the grid to see if it appears structured

 August 5, 2017, 17:13 #12 Senior Member   Join Date: Aug 2011 Posts: 271 Rep Power: 9 so you don't need to make a triangulation. Check how to format the data for structured grid. You have to loop on j and i , the number of nodes in j direction is NJ, and NI the number of nodes in the i direction. write(1,*)'zone i=',NI,', j=', NJ,', F=POINT' do j=1,NJ do i=1,NI write(1,*) Xc(i,j), Yc(i,j), U(I,J), V(I,J) end do end do FMDenaro and mariam.sara like this.

 August 5, 2017, 17:15 #13 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,491 Rep Power: 40 leflix is correct, the first line is the header, the you can activate directly the streamtracer without triangulation

August 5, 2017, 17:23
#14
Senior Member

Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 154
Rep Power: 10
I am really not sure about the type of mesh structured or not? I uploaded some picts for it?

Quote:
 Originally Posted by leflix so you don't need to make a triangulation. Check how to format the data for structured grid. You have to loop on j and i , the number of nodes in j direction is NJ, and NI the number of nodes in the i direction. write(1,*)'zone i=',NI,', j=', NJ,', F=POINT' do j=1,NJ do i=1,NI write(1,*) Xc(i,j), Yc(i,j), U(I,J), V(I,J) end do end do
Attached Images
 1.jpg (181.5 KB, 7 views) 2.jpg (141.9 KB, 6 views)

 August 5, 2017, 18:22 #15 Senior Member   Join Date: Aug 2011 Posts: 271 Rep Power: 9 It is definetely a structured grid. You can access to every nodes with 2 indices i and j. Leflix

August 6, 2017, 02:13
#16
Senior Member

Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 154
Rep Power: 10
Dear Leflix As I think the part of program you sent it is in Fortran? right? I need to ask in order to apply it to the data I need to save the data in a file then call it by open? my question is do I need separate file for x,y,u and v or I store all of it in one file (as I stored it now see attached dat file which I arrange starting from left x,y,u,v)?
What part of program should be written before this statement:

write(1,*)'zone i=',NI,', j=', NJ,', F=POINT'

Quote:
 Originally Posted by leflix It is definetely a structured grid. You can access to every nodes with 2 indices i and j. Leflix
Attached Files
 stream.txt (171.3 KB, 5 views)

Last edited by kbaker; August 6, 2017 at 04:53.

 August 6, 2017, 07:20 #17 Senior Member   Join Date: Aug 2011 Posts: 271 Rep Power: 9 Hi Kbaker, You should write all the data in the same file x, y, U, V just at the begining of the file write this: VARIABLES= "X","Y", "U","V" zone i= 100, j= 100 , F=POINT assuming you have 100 grid nodes in i direction and 100 grid nodes in j direction. (this should be automatized when generatin the file in your code) and then write x,y, U,V as you did in your file. name the file with .plt as extension rather than .txt so that Tecplot can recognise it and open it directly. Name it velocity.plt seems not bad.

 August 6, 2017, 07:51 #18 Senior Member   Join Date: Jan 2011 Posts: 275 Rep Power: 9 Is this code need to be programed in Fortran language?

August 6, 2017, 07:57
#19
Senior Member

Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 154
Rep Power: 10
I am really confused about the program. Now I am started with writing a program to just reading the variable in a one matrix and print it as below:

IMPLICIT none
real X
integer i,j
DIMENSION X(5000,4)
open (unit = 1, file = "f:\velo.txt")
open(unit = 2 , file = "d:\fortran programing\res1.txt")
do i=1,4624
do j=1,4
enddo
enddo
do i=1,4624
write(2,*) (X(I,j),j=1,4)
enddo
stop
end

I just want to test the program validity in printing the variables but it tell me error: run time error F6501: Read(F:\velo.txt)
-end of file encountered

What the problem with my data? I attached the dat file?

Quote:
 Originally Posted by leflix Hi Kbaker, You should write all the data in the same file x, y, U, V just at the begining of the file write this: VARIABLES= "X","Y", "U","V" zone i= 100, j= 100 , F=POINT assuming you have 100 grid nodes in i direction and 100 grid nodes in j direction. (this should be automatized when generatin the file in your code) and then write x,y, U,V as you did in your file. name the file with .plt as extension rather than .txt so that Tecplot can recognise it and open it directly. Name it velocity.plt seems not bad.
Attached Files
 velo.txt (171.3 KB, 1 views)

 August 6, 2017, 08:06 #20 Senior Member   Join Date: Aug 2011 Posts: 271 Rep Power: 9 First how many points do you have in x direction (i) and in y direction (j) ?

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Madeleine P. Vincent OpenFOAM Native Meshers: blockMesh 51 May 30, 2016 10:51 a99 Main CFD Forum 2 March 5, 2016 05:04 asaijo OpenFOAM Installation 9 April 6, 2011 12:21 matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51 Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00

All times are GMT -4. The time now is 12:26.