CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Paraview & paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/)
-   -   simpleFunctionObjects in paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/97695-simplefunctionobjects-parafoam.html)

fjgg1549 February 22, 2012 18:00

simpleFunctionObjects in paraFoam
 
Hello Foamers,

I have made simpleFunctionObjects, namely a patchAverage. called averageVelocity in the patch atmosphere.

I have a nice file in the directory ./patchAverage_averageVelocity/0 but I don't know how to visualize it with paraFoam.

Could any one, please, offer a step-by-step explanation on how to visualize this patchAverage in paraFoam?

Thanks and best regards.

Javier Garcia


gschaider February 22, 2012 20:18

Quote:

Originally Posted by fjgg1549 (Post 345812)
Hello Foamers,

I have made simpleFunctionObjects, namely a patchAverage. called averageVelocity in the patch atmosphere.

I have a nice file in the directory ./patchAverage_averageVelocity/0 but I don't know how to visualize it with paraFoam.

Could any one, please, offer a step-by-step explanation on how to visualize this patchAverage in paraFoam?

Thanks and best regards.

Javier Garcia


I don't think that paraview is the best choice for that kind of data.

The fastest way to plot this data is Gnuplot (the chances are good that it is already installed on your workstation). Starting it with "gnuplot" will bring you to a shell and there the command

plot "patchAverage_averageVelocity/0/atmosphere"

should plot the data. Gnuplot may be a bit frightening for the beginner but it is scriptable and thus makes it easy to generate plots with minimal intervention (once you've set up a script of course)

The pyFoam-utilities have a utility that generate the gnuplot-commands for you. In your case

pyFoamTimelinePlot.py . --dir=patchAverage_averageVelocity --basic-mode=lines

Piping that output directly into gnuplot gives you a PNG

pyFoamTimelinePlot.py . --dir=patchAverage_averageVelocity --basic-mode=lines | gnuplot

When you look at the online-help of the command you will find a number of other options. One of them is --csv-file. If you say

pyFoamTimelinePlot.py . --dir=patchAverage_averageVelocity --basic-mode=lines --csv=velocity.csv

then you will get a CSV file. This format is quite popular. It can be read into Excel, OpenOffice and other plotting programs and .... paraview. But doing 2D-plots is not Paraviews strong foot. You'll have to try that yourself

fjgg1549 February 22, 2012 20:37

Thank you very much Bernhard. I shall follow your recommendations.

I have already tried gnuplot, but the file I have created is an area average of U (a vector) and gnuplot does not perform a good job.

I can run my case again with patchAverage of vector components, rather than with the full vector. In any case, it is now my turn to experiment.

Again, thanks a lot. You have been most helpful.

Javier Garcia

timo_IHS February 23, 2012 03:15

Try something like this:

plot '<sed -e "s/[()]//g" ../patchAverage_avg_InOut/0/U' using 1:2 title "U_x" w l lw 2

If you want the magnitude of U, you can use:
foamCalc mag U

Best

gschaider February 23, 2012 05:21

Quote:

Originally Posted by fjgg1549 (Post 345823)
Thank you very much Bernhard. I shall follow your recommendations.

I have already tried gnuplot, but the file I have created is an area average of U (a vector) and gnuplot does not perform a good job.

I can run my case again with patchAverage of vector components, rather than with the full vector. In any case, it is now my turn to experiment.

Again, thanks a lot. You have been most helpful.

Javier Garcia

I beg to differ: in gnuplot
Code:

plot "patchToFile" using 1:(sqrt($2*$2+$3*$3+$4*$4)) with lines
gives you a plot of the magnitude of your vector (or what did you mean with "not a good job")

BTW: pyFoamTimelinePlot.py does that automatically for you if it detects a vector-value in your file

fjgg1549 February 23, 2012 18:41

Thanks Bernhard and Timo for your advices. I shall try them and I'll post here the results.

Incidentally, is there a Manual or something for those programms?

Thanks and best regards.

Javier Garcia

gschaider February 23, 2012 20:01

Quote:

Originally Posted by fjgg1549 (Post 346008)
Thanks Bernhard and Timo for your advices. I shall try them and I'll post here the results.

Incidentally, is there a Manual or something for those programms?

Thanks and best regards.

Javier Garcia

If you mean PyFoam: no. But there is
- the Wiki-page
- 2 presentations (referenced on the Wiki-page)
- every PyFoam-command gives information about its usage if tickled with the --help-option


All times are GMT -4. The time now is 04:41.