|
[Sponsors] |
January 9, 2012, 21:01 |
Plot Data from Probes
|
#1 |
Senior Member
|
Hallo,
My question might sound a little bit simple and old. But I am gonna ask it any for. I have a transient simulation, with many probes in my flow domain. I want to plot the probes data. The format of the file for the probed fields doesn't seem plotable to me (atleast with the software I know). I want to plot some points over time. Is there any simple, elegant, easy and time saving way to do it? Or do I have to right my own utility to get individual points data out of that file. Regards, Awais |
|
January 10, 2012, 14:53 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Another option would be to write a small script in the scripting language of your choice that transforms the file into a CSV-file (basically replace groups of spaces with a comma) which you can open with a lot of programs (including Excel and OpenOffice) I (but I'm biased) prefer pyFoamTimelinePlot from the PyFoam-utilities. For instance pyFoamTimelinePlot.py . --value=T --dir=probes --basic-mode=line prints the Gnuplot-commands to plot the temperature on all probe locations to the terminal, so pyFoamTimelinePlot.py . --value=T --dir=probes --basic-mode=line | gnuplot generates a PNG with that plot pyFoamTimelinePlot.py . --value=T --dir=probes --basic-mode=line --csv=temperature.csv writes a CSV-file with all the temperatures. |
||
January 10, 2012, 20:47 |
|
#3 |
Senior Member
|
Thanks for your help and I can understand why you are biased.
Indeed pyFoam sounds a combination of handy utilities. But I have an error while using the utility you have just mentioned. When I use it, it says: "Traceback (most recent call last): File "/usr/local/bin/pyFoamTimelinePlot.py", line 3, in <module> from PyFoam.Applications.TimelinePlot import TimelinePlot File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/TimelinePlot.py", line 11, in <module> from PyFoam.RunDictionary.TimelineDirectory import TimelineDirectory File "/usr/local/lib/python2.6/dist-packages/PyFoam/RunDictionary/TimelineDirectory.py", line 11, in <module> from PyFoam.Basics.SpreadsheetData import SpreadsheetData File "/usr/local/lib/python2.6/dist-packages/PyFoam/Basics/SpreadsheetData.py", line 6, in <module> import numpy,copy ImportError: No module named numpy " I hope that you will help me again and I really appreciate it. Thanks and Regards, Awais |
|
January 11, 2012, 02:00 |
|
#4 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21 |
The last line provides a good clue. You are missing the NumPy package for python: http://numpy.scipy.org/
|
|
January 11, 2012, 05:07 |
|
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
January 11, 2012, 18:26 |
|
#6 |
Senior Member
|
Well I have seen the pre-requisites on the wiki page. And only Python is mentioned as a pre-requisite.
I have also installed numpy and now I have this error. "Traceback (most recent call last): File "/usr/local/bin/pyFoamTimelinePlot.py", line 5, in <module> TimelinePlot() File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/TimelinePlot.py", line 32, in __init__ interspersed=True) File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PyFoamApplication.py", line 155, in __init__ result=self.run() File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/TimelinePlot.py", line 403, in run spread=plots[0][-1]() File "/usr/local/lib/python2.6/dist-packages/PyFoam/RunDictionary/TimelineDirectory.py", line 317, in __call__ title="%s_t=%s" % (self.val,self.time)) File "/usr/local/lib/python2.6/dist-packages/PyFoam/Basics/SpreadsheetData.py", line 66, in __init__ self.data=numpy.array(map(tuple,data),dtype=zip(na mes,['f8']*len(names))) TypeError: expected a readable buffer object " Thanks for your quick response again, Awais |
|
January 12, 2012, 04:49 |
|
#7 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
If I can't figure it out from that information I'll have to ask you to report it on the Mantis of openfoam-extend and provide me some sample data (only the timeline-directory the rest of the case is unneeded) there |
|||
January 13, 2012, 05:54 |
|
#8 |
Senior Member
|
Output from pyFoamVersion.py
" PYTHONPATH: not set OpenFOAM (1, 7, 1) of the installed versions ['171'] pyFoam-Version: 0.5.6 Configuration search path: [('file', '/etc/pyFoam/pyfoamrc'), ('directory', '/etc/pyFoam/pyfoamrc.d'), ('file', '/home/awais/.pyFoam/pyfoamrc'), ('directory', '/home/awais/.pyFoam/pyfoamrc.d')] Configuration files (used): [] Installed libraries: Gnuplot : No Not a problem. Version from ThirdParty is used ply : No Not a problem. Version from ThirdParty is used Numeric : No Not a problem if numpy is present numpy : Yes matplotlib : No Only Gnuplot-plotting possible psyco : No Not a problem. Acceleration not possible hotshot : Yes profile : No Not a problem. Can't profile using this library cProfile : Yes PyQt4 : Yes PyQt4.Qwt5 : No Only an alternate plotting back-end vtk : No Not a problem. Only used for some utilities Tkinter : No Not a problem. Used for the old version of DisplayBlockmesh and some matplotlib-implementations mercurial : No Not a problem. Used for experimental case handling " Plus I still can't see any change in prerequisites on Wiki page. May be I am looking at the wrong page. Could you provide me the link ? Regards, Awais |
|
January 14, 2012, 06:15 |
|
#9 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
python -c "import numpy; print numpy.__version__" Quote:
http://openfoamwiki.net/index.php/Co...#Prerequisites |
|||
January 15, 2012, 16:23 |
|
#10 |
Senior Member
|
1.3.0
Thats the output of the command you sent me. Regards, Awais |
|
January 15, 2012, 18:45 |
Thanks It worked.
|
#11 |
Senior Member
|
Dear Gschaider,
I tried it again and this time I was able to extract the data csv format. May be I was doing something wrong earlier. Thanks alot for your help. I really appreciate that. Regards, Awais |
|
January 16, 2012, 05:31 |
|
#12 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Should you be able to reproduce the behaviour it'd be nice if you let me know (Mantis-Bugreport preferred) so that I can at least catch the user-error in a way that gives a less obscure error message
|
|
January 16, 2012, 14:45 |
|
#13 |
Senior Member
|
Sure I will do that.
But I would take this opportunity to tell you again, that its a perfect tool for me. I hope it will be useful for others as well. Keep up the good work and thanks. Awais |
|
January 17, 2012, 11:52 |
|
#14 |
Member
Join Date: Apr 2010
Posts: 61
Rep Power: 16 |
How can I display the probes updated every time the file (of the probes) change?
Thanks. |
|
January 17, 2012, 12:48 |
|
#15 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
I THINK (not sure): there is a way that involves gnuplot, the tail-command and a pipe. But I'm not totally sure |
||
January 17, 2012, 13:06 |
|
#16 |
Member
Join Date: Apr 2010
Posts: 61
Rep Power: 16 |
Thanks gschaider for the tip. I'll post the reply when I reach it.
|
|
March 17, 2014, 12:32 |
|
#17 |
Senior Member
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14 |
Hm, I keep getting some bug as well. My probes are in the postProcessing/probes1 directory
so I write pyFoamTimelinePlot.py . --dir=postProcessing/probes1/ --info and get Traceback (most recent call last): File "/usr/local/bin/pyFoamTimelinePlot.py", line 5, in <module> TimelinePlot() File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/TimelinePlot.py", line 31, in __init__ interspersed=True) File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/PyFoamApplication.py", line 309, in __init__ result=self.run() File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/TimelinePlot.py", line 236, in run writeTime=self.opts.writeTime) File "/usr/local/lib/python2.7/dist-packages/PyFoam/RunDictionary/TimelineDirectory.py", line 66, in __init__ if TimelineValue(self.dir,v,self.usedTime).isVector: File "/usr/local/lib/python2.7/dist-packages/PyFoam/RunDictionary/TimelineDirectory.py", line 245, in __init__ self.positions.append(poses[i]) Any ideas anyone? |
|
March 19, 2014, 18:28 |
|
#18 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The problem with that class is that it tries to find out what kind of data is inside by looking at the filename and the number of columns in the file. Sometimes it gets thrown of the train. Especially with field names that have a _ Could you give me the filenames in the probes-directory and the first few lines of a file?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
March 20, 2014, 07:11 |
|
#19 |
Senior Member
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14 |
Hi and thank you for the reply!
Here are the files postProcessing │** ├── probes1 │** │** └── 0 │** │** ├── k │** │** ├── nuSgs │** │** ├── p │** │** ├── pMean │** │** ├── pPrime2Mean │** │** ├── U │** │** ├── UMean │** │** └── UPrime2Mean I do have a whole bunch of probes, about 200. Here are the first lines in k, with most of the columns cut of # x 1.5 1.5 1.5 1.5 # y 0 0.1 0.2 0.3 # z 1.5 1.5 1.5 1.5 # Time 0.2 0.000119397 5.58722e-05 4.39089e-05 1.68841e-05 0.4 1.48173e-05 5.61585e-05 4.32905e-05 1.68423e-05 0.6 2.72097e-05 5.63581e-05 4.28651e-05 1.67996e-05 0.8 1.71347e-05 5.65558e-05 4.25659e-05 1.67494e-05 1 8.93701e-06 5.68052e-05 4.23349e-05 1.66891e-05 1.2 5.12171e-06 5.71486e-05 4.21242e-05 1.66199e-05 1.4 3.79153e-06 5.7625e-05 4.18843e-05 1.65415e-05 1.6 3.45644e-06 5.82698e-05 4.15752e-05 1.64632e-05 |
|
March 20, 2014, 14:43 |
|
#20 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
BTW: is it sure that this is the file it chokes on? Could you check by (for instance) creating "probes2/0" copying one file over using pyFoamTimelinePlot.py on probes2 until it fails? Thanks
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to plot the data made by java? | jelon | STAR-CCM+ | 2 | April 11, 2010 06:00 |
How to save 2-D data in contour plot | mssound | FLUENT | 0 | February 15, 2010 14:01 |
[OpenFOAM] How to create an contour plot for arbitrary plane with interpolated data | navaladi | ParaView | 0 | June 4, 2008 07:57 |
xy data from graph plot to excel | Radhika | Siemens | 5 | February 23, 2007 07:23 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 17:27 |