CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   Sample Utility not working in OpenFoam 1.6 (

titio February 5, 2010 13:13

Sample Utility not working in OpenFoam 1.6
Hi Foamers,

I am having problems working with the sample utility in OpenFoam 1.6. I have downloaded the current version from the site, and installed following the instructions. I tested the installation doing a simulation, and everything went fine. However, when I tested the sample utility, using the example given in the UserGuide manual, it seems it did not worked.
I ran the case, and after that I typed sample in the main case directory. It ran without problems, at least no error message. However, it created no sets directory. I tried with sample -time xx, and no result again.
After this, I tried after recompiling the sample utility, that compiled with no problems, and the same problem occorred.
I am runing OpenFoam 1.6 in Ubuntu 8.1, and I have already done some development work, with a solver to model the flow of fluids with electroforetic effects. The results were good, but the sampling of results is hard, and with this difficulties with the sampling utility, even worse.

Can anyone help me out?


Antonio Martins

wyldckat February 7, 2010 19:28

Greetings Antonio,

Why don't you try using Mads cookbook (this thread)? I suggest trying the script version for Ubuntu 9.04, although I'm not 100% sure it will work with Ubuntu 8.10, although it should.
With that script, you can get the latest OpenFOAM 1.6.x that has multiple bug fixes since last July's 1.6 release and then you can make sure if the problems are related to an old bug or a pending bug in OpenFOAM!

As for your other thread about Paraview, it seems a bit strange... have you checked the md5 checksum of the downloaded packages? There have been issues with either downloading as well as unpacking files! And even disappearing files!
Try also getting the official Paraview binaries from, and using foamToVTK to export the OpenFOAM case files to VTK format, and then opening with the official Paraview. It's not the perfect solution, but at least will get you going for a while!

edit: Try looking for solutions in this thread for your Paraview issues!

Best regards,
Bruno Santos

titio February 8, 2010 13:46

Still does not work
Hi wyldckat,

Concerning the sample problem in OpenFoam 1.6, the same thing goes to OpenFoam 1.5. I followed the script you recomended, with no sucess. The same problem occurrs in version 1.5 of OpenFoam, the official one. The sample utility runs, the problem is that it does not generate a sets directory. I even tried with a sampleDict file with incorrect values, and it works without even giving a error of scales... without creating ounce again a sets directory. I am lost with this things, OpenFoam works, pos-processing is hell...


António Martins

examosty March 2, 2010 12:28

Hi António Martins,
I think it's very important to set the position of the line or point correct. It happened to me because of that.

heavy_user March 5, 2010 11:55

HI There,

the sampling utility also does NOT create an "sets" directory, when you request a parameter to be evaluated which is not present or which sample just cant process...or a location outside the domain....

If you try sampling components of U (like U.component(0) ) sample does not like it.
In this case you have to sample the U-vector and extract the desired component yourself.
( like this
sed 's/\t/ /g' z\=0_U.xy >new | cut new -d ' ' -f1,4 >U_z


catapult June 6, 2011 05:40

use awk

I experience similar problems with U.components(n) or R.components(n) ....

a perhaps more elegant way to extract columns of a field (velocity component or Reynols stress component) :

awk '{print $1, $3}' input.agr > output.agr

extract the first column (coordinate for exemple) and third column (Uy for exemple) of the file. then :

xmgrace output.agr

Though you may need to edit the headers of the file.

Hope it helps

martad November 15, 2014 19:04

You can also run

foamCalc <calcType> <fieldName1 ... fieldNameN>
so eg. for the velocity components

foamCalc components U
first, and then sample picks those up using sampleDict if written correctly.

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