CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   How to plot the sampled line over time under sets/ (http://www.cfd-online.com/Forums/openfoam-post-processing/112828-how-plot-sampled-line-over-time-under-sets.html)

tfuwa February 6, 2013 05:20

How to plot the sampled line over time under sets/
 
Hi OFers,

The pressure over a line has been sampled in the sets directory distributed in many time directories. I would like to plot the changes of the pressure over time on the fixed line. Is there any tool to do this?

Thanks a lot.

gschaider February 6, 2013 19:49

Quote:

Originally Posted by tfuwa (Post 406273)
Hi OFers,

The pressure over a line has been sampled in the sets directory distributed in many time directories. I would like to plot the changes of the pressure over time on the fixed line. Is there any tool to do this?

Thanks a lot.

pyFoamSamplePlot.py from http://openfoamwiki.net/index.php/Contrib_PyFoam

Actually. It doesn't plot. It only generates the commands for gnuplot. But that is not a problem as you've only got to pipe the output into gnuplot ("pyFoamSamplePlot.py .... | gnuplot") to get a bunch of pictures. These you can animate with "animate" or encode them into a video

tfuwa February 6, 2013 21:46

Thanks Bernhard, for your quick reply and tips on how to use gnuplot. As I want to plot a 2D picture with x being time, y being the line and pressure in the 2D area, so I am trying to combine all the files in sets/ together.

gschaider February 7, 2013 05:51

Quote:

Originally Posted by tfuwa (Post 406446)
Thanks Bernhard, for your quick reply and tips on how to use gnuplot. As I want to plot a 2D picture with x being time, y being the line and pressure in the 2D area, so I am trying to combine all the files in sets/ together.

Ah. I thought you were going for an animation of the line. So you want a surface plot with the pressure going in z-direction, right? That is something the utility can't do yet

tfuwa February 7, 2013 06:33

Quote:

Originally Posted by gschaider (Post 406492)
Ah. I thought you were going for an animation of the line. So you want a surface plot with the pressure going in z-direction, right? That is something the utility can't do yet


Yes, Bernhard, I want to plot the temporal evolution of the pressure over a line. I have just solved the problem by combining all the files together, then use tecplot. Thanks for your attention.

aujamal20 February 27, 2013 10:15

pyFoamSamplePlot.py
 
Dear
The temperatur over a line has been sampled in the sets directory distributed in many time directories. I would like to plot the changes of the temperature over time on the fixed line.
Quote:

Actually. It doesn't plot. It only generates the commands for gnuplot. But that is not a problem as you've only got to pipe the output into gnuplot ("pyFoamSamplePlot.py .... | gnuplot") to get a bunch of pictures.
Pleae elaborate this a bit more. I mean what commands would be generated and how to use those for gnuplots...
I am using this command pyFoamSamplePlot.py sets/timeDirectory/lineX1_.gplt and in result it gives following lines

Traceback (most recent call last):
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/bin/pyFoamSamplePlot.py", line 5, in <module>
SamplePlot()
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/Applications/SamplePlot.py", line 31, in __init__
interspersed=True)
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 213, in __init__
result=self.run()
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/Applications/SamplePlot.py", line 288, in run
prefixes=self.opts.fieldPrefix)
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/RunDictionary/SampleDirectory.py", line 32, in __init__
for d in listdir(self.dir):
OSError: [Errno 20] Not a directory: 'sets/4320/lineX1_T.gplt/samples'


Thanks

gschaider February 27, 2013 10:51

Quote:

Originally Posted by aujamal20 (Post 410437)
Dear
The temperatur over a line has been sampled in the sets directory distributed in many time directories. I would like to plot the changes of the temperature over time on the fixed line.
Pleae elaborate this a bit more. I mean what commands would be generated and how to use those for gnuplots...
I am using this command pyFoamSamplePlot.py sets/timeDirectory/lineX1_.gplt and in result it gives following lines

Traceback (most recent call last):
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/bin/pyFoamSamplePlot.py", line 5, in <module>
SamplePlot()
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/Applications/SamplePlot.py", line 31, in __init__
interspersed=True)
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 213, in __init__
result=self.run()
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/Applications/SamplePlot.py", line 288, in run
prefixes=self.opts.fieldPrefix)
File "/opt/OpenFOAM/adin-2.1.0/lib/PyFoam-0.5.7/lib/python2.6/site-packages/PyFoam/RunDictionary/SampleDirectory.py", line 32, in __init__
for d in listdir(self.dir):
OSError: [Errno 20] Not a directory: 'sets/4320/lineX1_T.gplt/samples'


Thanks

You only have to specify the sets-directory. The utility will figure out what data is there (especially in cases where not every timestep has all the data).

Anyway. Like all other pyFoam-utilities the option --help gives you the basic usage and the options.

In your case something like

pyFoamSamplePlot.py . --dir=sets --field=T

should work


All times are GMT -4. The time now is 03:46.