|
[Sponsors] |
Is there code to plot stream function from u & v velocities |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
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: 168
Rep Power: 17 |
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: 272
Rep Power: 15 |
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: 168
Rep Power: 17 |
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:
|
||
August 5, 2017, 12:26 |
|
#5 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71 |
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/ |
|
August 5, 2017, 15:16 |
|
#6 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
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: 168
Rep Power: 17 |
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 |
|
August 5, 2017, 16:56 |
|
#8 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
Is your grid structured or unstructured ?
|
|
August 5, 2017, 17:04 |
|
#9 |
Senior Member
Join Date: Jan 2011
Posts: 339
Rep Power: 16 |
||
August 5, 2017, 17:08 |
|
#10 |
Senior Member
Khalid Baker
Join Date: Mar 2009
Location: IRAQ
Posts: 168
Rep Power: 17 |
||
August 5, 2017, 17:12 |
|
#11 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71 |
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: 272
Rep Power: 15 |
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 |
|
August 5, 2017, 17:15 |
|
#13 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71 |
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: 168
Rep Power: 17 |
I am really not sure about the type of mesh structured or not? I uploaded some picts for it?
Quote:
|
||
August 5, 2017, 18:22 |
|
#15 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
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: 168
Rep Power: 17 |
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' Last edited by kbaker; August 6, 2017 at 04:53. |
|
August 6, 2017, 07:20 |
|
#17 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
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: 339
Rep Power: 16 |
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: 168
Rep Power: 17 |
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 Read(1,*) X(I,J) 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:
|
||
August 6, 2017, 08:06 |
|
#20 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
First how many points do you have in x direction (i) and in y direction (j) ?
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] Errors during blockMesh meshing | Madeleine P. Vincent | OpenFOAM Meshing & Mesh Conversion | 51 | May 30, 2016 10:51 |
Simple stream function vorticity formulation for flow past a rectangle [Matlab] | a99 | Main CFD Forum | 2 | March 5, 2016 04:04 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 12:21 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 06:51 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 14:00 |