[Paraview] File Format for Particles

Bryn Lloyd blloyd at vision.ee.ethz.ch
Fri Nov 28 02:17:39 EST 2008


Hi Shi,

Yes, for large amounts of data you should use the binary (not ascii) 
formats. It is very simple to switch between ascii/binary. In the writer 
classes (e.g. vtkPolyDataWriter) you can usually call the function 
SetFileTypeToBinary() or SetFileTypeToASCII().


An unstructured grid can of course be used to visualize your data in 
paraview. Since you not have cells (tetrahedra, hexahedra, etc.) a 
vtkPolyData data structure and associated file type might be better, 
since it uses slightly less storage and if you add the points as "Verts" 
Paraview will automatically display them using glyphs (sphere,arrow,..)

File formats are described here:
http://www.vtk.org/pdf/file-formats.pdf


--Bryn





Ivo Roghair wrote:
> Hi Shi,
> 
> Saving such amounts of data in ascii format is not going to be 
> efficient. We just accepted this fact, otherwise we should go to binary 
> formats.
> 
> In our group we have discrete particle simulations, and we export vtk 
> files (xml format -- an unstructured grid to be precise) that contains 
> all the particle data. I have included an example of such a file below. 
> You write the point positions of the particles first, followed by data 
> concerning the movement of the particle, the diameter and other stuff 
> like rotation, temperature, etc... I don't see what you mean by 
> redundant data. When you load this file into Paraview choose the glyph 
> option, choose 'sphere', set 'radius' to 1 (it is initially set to 0.5), 
> scale mode to 'scalar' and scale factor to 1. You can then draw the 
> particles. You can color them by velocity, temperature, rotation or 
> whatever you included in the file, or you can choose to show arrows 
> (another glyph) to display the particle movement.
> For the flow field, which is calculated on a structured grid, you can 
> use another file format, e.g. rectilinear grid. In all cases the 
> kitware/vtk file formats documentation is going to be useful.
> 
> Regards,
> Ivo Roghair
> 
> PhD student at Fundamentals of Chemical Reaction Engineering
> University of Twente, The Netherlands
> 
> ------------------ BEGIN EXAMPLE FILE ---------------------
> <VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
>  <UnstructuredGrid>
>    <Piece NumberOfPoints="3" NumberOfCells="0">
>      <Points>
>        <DataArray name="Position" type="Float32" NumberOfComponents="3" 
> format="ascii">
>        0 0 0 1 1 1 0 0 1
>        </DataArray>
>      </Points>
>      <PointData  Vectors="vector">
>        <DataArray type="Float32" Name="Velocity" NumberOfComponents="3" 
> format="ascii">
>        4 4 4 4 0 0 2 2 -2
>        </DataArray>
>    <DataArray type="Float32" Name="Diameter" format="ascii">
>        0.1 0.5 1
>        </DataArray>
>    <DataArray type="Float32" Name="Temperature" format="ascii">
>        273 300 350
>        </DataArray>
>      </PointData>
>      <Cells>
>        <DataArray type="Int32" Name="connectivity" format="ascii">
>        </DataArray>
>        <DataArray type="Int32" Name="offsets" format="ascii">
>        </DataArray>
>        <DataArray type="UInt8" Name="types" format="ascii">
>        </DataArray>
>      </Cells>
>    </Piece>
>  </UnstructuredGrid>
> </VTKFile>
> ---------- END EXAMPLE FILE --------------
> 
> Shi Jin wrote:
>> Hi there,
>>
>> I am doing a simulation of fluid-particle interactions, in which I 
>> generate a lot of data for particles. I am looking for the efficient 
>> file format to store my particle information for visualization with 
>> paraview. For example, is there a file format that allows me to store 
>> all the particle information at a given time in a single ascii file, 
>> which looks like
>> #1-id 2-radius 3-rho_p 4-fixed 5-x 6-y 7-z 8-u 9-v 10-z 11-w1 12-w2 
>> 13-w3 14-alpha 15-theta 17-phi
>> 0 0.500000 1.200000 0 2.077176 2.678227 8.649375 0.000000 0.000000 
>> 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
>> 1 0.500000 0.800 0 2.728281 0.873571 6.806029 0.000000 0.000000 
>> 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
>> ...
>>
>> I guess for the purpuse of visualization, we need radius, rho_p(for 
>> color), x,y and z at least. The rotation information would be nice to 
>> have but is considered optional at this stage.
>> I am thinking to save different time results in different files to 
>> make the loading efficient in terms of memory since I have a lot of 
>> particles here. Then we can produce animation using time control. I 
>> guess we could use VTK formats but that has lots of redundant 
>> information.
>>
>> I saw some very early discussion on a similar topic in the forum but 
>> didn't get the conclusive answer. I would appreciate some advice for 
>> the current version of paraview.
>>
>> Thank you very much.
>>
>>  --
>> Shi Jin, PhD
>>
>>
>>
>>       _______________________________________________
>> ParaView mailing list
>> ParaView at paraview.org
>> http://www.paraview.org/mailman/listinfo/paraview
>>   
> 
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
> 


-- 
-------------------------------------------------
Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 27690
Fax: +41 44 63 21199
-------------------------------------------------


More information about the ParaView mailing list