CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Plot Data from Probes (https://www.cfd-online.com/Forums/openfoam-post-processing/95994-plot-data-probes.html)

tiam March 20, 2014 15:59

Hi!

Have no idea why I didn't get that debugging idea, I guess the script fails on me totally or it works for everything. So it works on all fields but UPrime2Mean!

It looks like this:
# x 1.5 1.5 1.5 1.5 1.5 1.5
# y 0 0.1 0.2 0.3 0.4 0.5
# z 1.5 1.5 1.5 1.5 1.5 1.5
# Time
0.2 (0 0 0 0 0 0) (0 0 0 0 0 0) (0 0 0 0 0 0)
0.4 (2.7993e-08 -7.77667e-10 1.05859e-08 2.16042e-11 -2.94084e-10 4.00318e-09)
0.6 (3.17292e-08 -1.45928e-09 1.17226e-08 8.21429e-11 -5.31962e-10 4.33446e-09)
0.8 (2.85533e-08 -1.82099e-09 1.0425e-08 1.72582e-10 -6.48406e-10 3.81149e-09)
1 (2.40662e-08 -1.85896e-09 8.91598e-09 2.70264e-10 -7.08062e-10 3.32037e-09)
1.2 (2.01257e-08 -1.64986e-09 7.54823e-09 3.69006e-10 -7.58858e-10 2.96515e-09)

gschaider March 20, 2014 17:33

Quote:

Originally Posted by tiam (Post 481176)
Hi!

Have no idea why I didn't get that debugging idea, I guess the script fails on me totally or it works for everything. So it works on all fields but UPrime2Mean!

It looks like this:
# x 1.5 1.5 1.5 1.5 1.5 1.5
# y 0 0.1 0.2 0.3 0.4 0.5
# z 1.5 1.5 1.5 1.5 1.5 1.5
# Time
0.2 (0 0 0 0 0 0) (0 0 0 0 0 0) (0 0 0 0 0 0)
0.4 (2.7993e-08 -7.77667e-10 1.05859e-08 2.16042e-11 -2.94084e-10 4.00318e-09)
0.6 (3.17292e-08 -1.45928e-09 1.17226e-08 8.21429e-11 -5.31962e-10 4.33446e-09)
0.8 (2.85533e-08 -1.82099e-09 1.0425e-08 1.72582e-10 -6.48406e-10 3.81149e-09)
1 (2.40662e-08 -1.85896e-09 8.91598e-09 2.70264e-10 -7.08062e-10 3.32037e-09)
1.2 (2.01257e-08 -1.64986e-09 7.54823e-09 3.69006e-10 -7.58858e-10 2.96515e-09)

OK. That explains it. That is a tensor field and that class only supports scalars and vectors

gschaider March 22, 2014 05:12

1 Attachment(s)
Quote:

Originally Posted by gschaider (Post 481188)
OK. That explains it. That is a tensor field and that class only supports scalars and vectors

The attached patch tries to make PyFoam more tolerant about this (it ignores, warns, but doesn't fail)

Attachment 29552

arieljeds February 4, 2016 07:18

Hi, I couldn't find a more relevant thread so I am reviving this one.

I am trying to use pyFoamTimelinePlot.py to plot values from probes but I can find NOTHING except for this thread to help me understand how to use it.

First of all, here is my probeDict file:

Code:

      fields
        (
            p_rgh
            p
            U
            Ux
            Uy
            Uz
            magU
            vorticity
            Co
        );

// Locations to be probed. runTime modifiable!
        probeLocations
        (
            ( -4    0    0 )        // 1 - inlet, in relaxation zone
            ( -2    0    0 )        // 2 - upstream
            ( -0.52  0    0 )        // 3 - upstream
            (  0.52  0    0 )        // 4 - at the larger radius
            (  2    0    0 )        // 5 -
            ( -4    0    0 )        // 6
            (  0    0.52  0 )        // 7
            (  0    -0.52  0 )        // 8
            (  0    3.9  0 )        // 9
            (  0    3.9  0 )        // 10
            (  0.37  0.37  0 )        // 11
            ( -0.37  0.37  0 )        // 12
            ( -0.37 -0.37  0 )  // 13
            (  0.37 -0.37  0 )  // 14
         
        );

I am then trying the following things:

1) This command DOES work:
Code:

pyFoamTimelinePlot.py --fields=p_rgh --basic-mode=lines postProcessing/ | gnuplot
This produces a plot of, for example, the p_rgh field. However, this is not that useful because it is plotting ALL of the probes.

2) This command DID work but is now giving the error listed below:

Code:

pyFoamTimelinePlot.py --fields=p_rgh --basic-mode=lines --csv-file=p_rgh.csv postProcessing/
This has worked for me previously but is now giving:

Code:

Traceback (most recent call last):
  File "/usr/local/bin/pyFoamTimelinePlot.py", line 5, in <module>
    pkg_resources.run_script('PyFoam==0.6.5', 'pyFoamTimelinePlot.py')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/PyFoam-0.6.5-py2.7.egg/EGG-INFO/scripts/pyFoamTimelinePlot.py", line 5, in <module>
    TimelinePlot()
  File "/usr/local/lib/python2.7/dist-packages/PyFoam-0.6.5-py2.7.egg/PyFoam/Applications/TimelinePlot.py", line 34, in __init__
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/PyFoam-0.6.5-py2.7.egg/PyFoam/Applications/PyFoamApplication.py", line 424, in __init__
    result=self.run()
  File "/usr/local/lib/python2.7/dist-packages/PyFoam-0.6.5-py2.7.egg/PyFoam/Applications/TimelinePlot.py", line 463, in run
    spread=plots[0][-1]()
  File "/usr/local/lib/python2.7/dist-packages/PyFoam-0.6.5-py2.7.egg/PyFoam/RunDictionary/TimelineDirectory.py", line 353, in __call__
    title="%s_t=%s" % (self.val,self.time))
  File "/usr/local/lib/python2.7/dist-packages/PyFoam-0.6.5-py2.7.egg/PyFoam/Basics/SpreadsheetData.py", line 138, in __init__
    dtype=list(zip(names,['f8']*len(names))))
ValueError: two fields with the same name

This error and producing no output.

Therefore, I have two specific questions for plotting values at probes:

1) Is it possible to use pyFoamTimelinePlot to specify which probe to plot at? And how would I do this?

2) Has anyone had experience with the error above? I don't understand it at all because this was working for a different case and I can't see where I've gone differently.

Any help or advice is much appreciated... I've been spending a loooooong time on this now and getting frustrated with the lack of documentation (aside from the code itself)


All times are GMT -4. The time now is 21:37.