CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM

Using gnuplot to plot probe data

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By tomf

LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2019, 02:36
Default Using gnuplot to plot probe data
New Member
Join Date: Apr 2019
Posts: 13
Rep Power: 3
Rotidpor is on a distinguished road
Hello everyone.

I started using gnuplot because it is a convenient tool to plot data. Basically, you just have to type a line or two in a terminal to have your data plotted.
Yet I don't understand the syntax, I found a way to plot my residuals using an openfoam command which extracts the data in my log file and puts it in a single column text file. This way I can tell gnuplot to plot it correctly using simple commands.
This is what I do :

foamLog -n "name of my log file"
plot './Uz_0'

It works well for single column data files created by foamLog. Now my problem is that I want to do the same with probes. Often, my probe files are two columns files, time/iteration versus quantity of interest. But for the velocity, the file is much more complicated with "(" and ")" and four columns.

Is there a simple way to tell gnuplot how to plot a two column file ? Is there an openFoam utility that can convert the velocity probe file into something more manageable like several one column files, as foamLog does for the logfile ?

Thank you all for any input.
Rotidpor is offline   Reply With Quote

Old   June 14, 2019, 03:34
Senior Member
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 571
Rep Power: 28
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf

Not an OpenFOAM utility, but sed would work for this:

sed 's/[()]/ /g' postProcessing/probes/0/U > postProcessing/probes/0/U_noBrackets
Or if you just want to keep the file, you can do replacement inside the file itself as:

sed -i 's/[()]/ /g' postProcessing/probes/0/U
And than plot on the U_noBrackets or new U file.

Rotidpor likes this.
tomf is offline   Reply With Quote

Old   June 17, 2019, 02:29
New Member
Join Date: Apr 2019
Posts: 13
Rep Power: 3
Rotidpor is on a distinguished road
Thank you for your answer tomf, it was helpful.

For those who will read this, here is the gnuplot syntax to plot a file with multiple columns :

Another thing : I realised that gnuplot can actually handle parenthesis. You don't need to remove them before trying to plot. Looks like it just ignores them, which is practical.

Last edited by Rotidpor; June 18, 2019 at 04:02.
Rotidpor is offline   Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 19 June 11, 2020 15:54
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 07:31
plot probe data ehsanshams OpenFOAM Post-Processing 15 August 10, 2017 06:00
paraview - cell data or point data on plot over line bye bye my blue OpenFOAM 0 December 13, 2016 06:07
probe and sample point in same place producing different data odellar OpenFOAM Pre-Processing 3 May 2, 2016 02:35

All times are GMT -4. The time now is 13:17.