[vtkusers] Importing lagrangian data from openfoam into numpy arrays

Paul Melis paul.melis at surfsara.nl
Thu Mar 30 04:13:39 EDT 2017


Hi Victor,

Perhaps this series of blog posts on VTK+numpy integration can help you 
further? I haven't used that stuff too much myself, but I believe you 
should be able to use VTK's numpy adapters to get all your data as numpy 
arrays:

https://blog.kitware.com/improved-vtk-numpy-integration/

Regards,
Paul

On 29-03-17 13:55, Victor Koppejan - TNW wrote:
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>


-- 

Paul Melis
| Visualization group leader & developer | SURFsara |
| Science Park 140 | 1098 XG Amsterdam |
| T 020 800 1312 | paul.melis at surfsara.nl | www.surfsara.nl |


More information about the vtkusers mailing list