CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   Gnuplot usage (

mike_jaworski December 15, 2007 04:42

Hi all. I'm either an idiot
Hi all.

I'm either an idiot or something isn't working, or both. I'm trying to set up plotting with gnuplot of the various fields created with OpenFOAM, however, I don't seem to see a straightforward way of doing this. When I try to alter the output format to something other than raw, (like gnuplot, but I just tried xmgr), nothing gets output except the raw format. So, nothing changes.

So, is there some easy way of outputting things to a gnuplot-friendly output, or will I be left with hand altering the input files. What files will I need to accomplish this and does anyone have any suggestions?

While I love paraview and all, I've come to appreciate the very small file size associated with gnuplot created graphics and the ease with which I can put them in my latex docs. Any advice is greatly appreciated.


gschaider December 16, 2007 06:52

Hi Mike! The output format
Hi Mike!

The output format you are referring to is not for the fields, but for the sample-utility which lets you extract the data of the fields on lines. Have a look in the user-guide in section 7.5. A similar utility is sampleSurface, but I know of no docu for it except for the sources and a sample dictionary (no pun intended) that is located with the sources


ville December 16, 2007 11:29

Hi Everybody, why not use the
Hi Everybody,
why not use the cutting plane??! I found about this option which really makes many things about postprocessing just flexible and I think it should be put into the manual as well. So what you can do
is to add top-level code to your solver for printing out data just from a single cutplane that you choose. This can be done as follows:

1) define a plane
point xyz(0,0,0) // choose the point through which //the plane goes

vector dir(0,0,1) // normal direction
plane plane1(xyz,dir)

cuttingPlane plane1(mesh, plane1);

Now it is very easy to refer to the cell indeces
by e.g.

planeCell = plane1.cells()[cutplaneIterator];
xpoint = mesh.C()[planeCell].x();

and so on..

This enables the user to print out the coordinate
points to a file and to refer to the field values in the cells that are on the plane. It is then possible to print out stuff from the defined cutplanes as often as you wish. This really
makes post processing with matlab, gnuplot etc
handy since you can just load the data to
those programs, interpolate to a cutplane using
e.g. griddata in matlab etc. I found this
necessary since my cases are so big that
running paraview or other postprocessors is
really unpractical for making animations etc.


mike_jaworski December 17, 2007 13:43

Hi all! Thank you both for
Hi all!

Thank you both for the advice. I apparently skipped that section of the solidDisplacementFoam tutorial so I was unaware of the sample utility.

Thank you also for the suggestion of a cutting plane. I haven't gotten into the coding parts yet, but this will soon be becoming more important in my research... which now that I think of it, is something I said this summer but something kept pushing it back... such is life.


All times are GMT -4. The time now is 23:56.