CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Extracting a probe value after a simulation run (

challenger December 22, 2010 05:36

Extracting a probe value after a simulation run
This should be really easy to answer, but I couldn't find any information myself. :o
I want to print out probes values for multiple locations on a finished simulation.
What I normally do is to create a probe file, include it in the controldict and then rerun the simulation for at least an iteration to print out the results. Is there a static function that can do this so that I don't have to got through this or is the way I'm doing the only way possible?


Cyp December 22, 2010 05:58

Hi Frank!

I think you can use the sample utility. (see page U-169 of the user guide)

To use it, you have to setup a sampleDict file which will be put inside your system folder.

You can use the general template located at:

You modify it in order to have what you need, rename it as "sampleDict" and then you execute the sample utility after your run with the command:

New files will be created in a "sets" directory.

I hope this can help you.
Best regards,

challenger December 22, 2010 06:22

Thanks a lot Cyp,

I completely overlooked sample.

Merry X-Mas and a Happy New Year.

nandiganavishal January 27, 2011 19:09

Dear Foamers,

I have been using the probes function to extract the data at particular location, but I find that the probes function uses some sort of interpolation scheme and the results are not same as the results I observe in paraview at the same location. Is there a way to get more accurate results especially at the boundaries and other locations.

Thanks for the help.

mvoss January 28, 2011 04:38

check for the type of data your going to probe and ... check whether you use the point or the cell data values in paraview. try to convert from cell to point and compare again. asfaik there is not interpolation, the probing is searching for the closest CellCenter and takes the value.
You might want to check probes.H (not 100% sure about the name).
Any experts around?


nandiganavishal January 28, 2011 11:55

Hi newbee,

I am using the point data in paraview and comparing it with probes function still there is slight deviation... For example, a case like plotting the parabolic profile of velocity across a cylindrical channel, I see symmetric profile while plotting the OF data in paraview while using the data from probes function does not give a parabolic profile but is more discrete and slightly asymmetric, though the number of points is same for plotting using both the methods.

May I know how to rectify this problem...

mvoss January 28, 2011 11:59

did u use mag(U) while probing or did you reconstruct the velocity-vector from itīs probed components (U=(u^2+v^2+w^2)^(1/2))?

nandiganavishal January 31, 2011 18:15

Dear newbee,

This is how my controlDict file looks like..

application eofFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 8e6;

deltaT 100;

writeControl runTime;

writeInterval 2e6;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

// Type of functionObject
type probes;

// Where to load it from (if not already in solver)
functionObjectLibs ("");

// Locations to be probed. runTime modifiable!

(1010 485 0)
(1010 485.6900991 0)
(1010 486.4354473 0)
(1010 487.2404679 0)
(1010 488.1099383 0)
(1010 489.0490182 0)
(1010 490.0632807 0)
(1010 491.1587447 0)
(1010 492.3419113 0)
(1010 493.6198018 0)
(1010 495 0)
(1010 496 0)
(1010 497 0)
(1010 498 0)
(1010 499 0)
(1010 500 0)
(1010 501 0)
(1010 502 0)
(1010 503 0)
(1010 504 0)
(1010 505 0)
(1010 506.3801982 0)
(1010 507.6580887 0)
(1010 508.8412553 0)
(1010 509.9367193 0)
(1010 510.9509818 0)
(1010 511.8900617 0)
(1010 512.7595321 0)
(1010 513.5645527 0)
(1010 514.3099009 0)
(1010 515 0)




Hope this is fine..

mvoss February 1, 2011 03:59

if you probe like this, i am wondering how you plot in paraview.
probing the fields U and p gives you 4 values. so if you plot in U paraview you actually plot mag(U) which hasnīt been probed.
Thatīs why i was asking about the reconstr. from u,v,w to U.
reconstruct the mag(U) from your probed values and then compare that to plot_over_line with pointData and mag(U) in paraview. I am pretty shure this is a paraView issue.

Could you attach some pictures?

nandiganavishal February 1, 2011 11:50

2 Attachment(s)
Dear newbee,

I couldn't exactly get your point.

In the paraview, I do plot the U_x component that would be dumped at different time steps and comparing them with the U_x component obtained from the probed function across the channel height (from 485 to 515).

I am attaching the two plots where U_x is plotted in paraview (in m/s) and in other obtaining the value from probes function and plotting the same using MATLAB (NOTE: units for U is mm/s in this case).

Hope this helps.

mvoss February 1, 2011 12:15

it seems to me like your point data for the probing is not resolving the mesh density. there are similar entries for u_x for different coord.values. try to increase the sampling.
isnīt it possible to sample smth. like a line with the sample-tool?
how about

      type    uniform;
axis    y;
start  ( 0 0.5 0.25 );
end    ( 0 2 0.25 );
nPoints 100;

nandiganavishal February 1, 2011 12:18

Is it possible for you to elaborate on how to smooth the data.. I exactly wanted to know this,,,

nandiganavishal February 1, 2011 12:20

The code you mentioned where should we include them, further should I have to run the case again.

mvoss February 1, 2011 12:20

try ploting the data with gnuplot...
you can set it as export format in the sampleDict and you can set the stepsize when you plot the data.

mvoss February 1, 2011 12:21

see here

nandiganavishal February 1, 2011 12:28

Thanks for the link. I will go through that.

I was wondering this sampleDict would be useful when we want to plot the steady state results. I have a case where I am running an AC signal and would like to plot the velocity averaged over one time period. For that we need to know the velocity values at each time. I usually use the probes function to do that. Is there an alternative to do that using sampleDict, since we can't dump all the time step folders as they take huge memory.

nandiganavishal February 1, 2011 13:23

Dear newbee,

I looked at the SampleDict from the examples and found out how to implement them but as I had mentioned it would be useful for getting the final steady state values, is it possible to extract data for a periodic case.

Kindly let me know.

nandiganavishal February 1, 2011 17:44

Dear Foamers,

Is it possible to integrate a variable across the cross section using the probes function at every time. Kindly let me know.


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