CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   Postprocess lagrangian fields (

dhebert December 21, 2006 11:50

Hello Everyone, I have run
Hello Everyone,

I have run a simulation with dieselFoam. I would now like to read the position and diameter of a parcel and make a pdf at a partucular time. I am attempting to read the lagrangian/positions field and am having trouble setting the file pointer to where the data starts. For example, if I use:

IFstream p(positionsFile);


string dummy;
for(label i=0; i<40; i++)
p >> dummy;

I get an error when the IFstream reaches a non-string, which happens to be the text "FoamFile":

--> FOAM FATAL IO ERROR : wrong token type - expected string found on line 9 the word 'FoamFile'

Can someone give pointers on how to read this data? Right now I have the data in ascii format, but would like to eventually read binary data.

Thanks in advance for your help,


dhebert December 21, 2006 11:58

Hi again, Regarding the abo
Hi again,

Regarding the above question of reading lagrangian fields, perhaps it would be easier to read the vtk file? Is there an OpenFOAM class that would read a particular variable from a vtk file?

Thanks again,


mattijs December 21, 2006 18:46

2] there is no OpenFOAM classe
2] there is no OpenFOAM classes to read vtk files.
1] the lagrangian fields are IOFields(i.e. registered fields residing in the case directory). Easiest is to study one of the data converters (e.g. foamToVTK) in the postProcessing utilities source directory.

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