[vtkusers] Importing lagrangian data from openfoam into numpy arrays

Victor Koppejan - TNW V.W.Koppejan at tudelft.nl
Wed Mar 29 07:55:57 EDT 2017


Hi Everyone,

I'd like to import data from openfoam lagrangian particle (saved as binary or ascii vtk files) in simulations into numpy-arrays. The data is either in scalar or vector format. I can't find what I want in the examples or other online tutorials. Does anyone have a suggestion can you refer me to online material?

The data is stored as polydata, see a short version of the file (in this case ascii) contents below:

# vtk DataFile Version 2.0
linkCG2-500cmh-run1
ASCII
DATASET POLYDATA
POINTS 187550 float
<lots of points>
POINT_DATA 187550
FIELD attributes 8
origId 1 187550 float
<lots of points>
lmpCpuId 1 187550 float
<lots of points>

etc., here origId and lmpCpuId are scalar variables, after this there's 8 more variables. I can read it all in in matlab but I've been trying to move all my computations to python.

Thanks in advance for your help.

Kind regards,

Victor


More information about the vtkusers mailing list