[Paraview] Unstructured Grids

Adrian Croucher a.croucher at auckland.ac.nz
Wed Sep 24 19:43:47 EDT 2008


hi Christopher
> I am new to using Paraview and would like some assistance if possible.  I am researching particle dynamics and need to create files for unstructured grids. For the moment as I have just started all I have are particle locations, but I will later require several physcial variables for view.
>
> So I have a problem in which X number of particles are initially static and after an initial shock the particles dissipate. I would like to view the simulation of this by a Paraview animation of the particle locations recorded at fixed time intervals.
>   
I have just been doing exactly the same thing myself.  I used the 
xml-based file format and the unstructured grid data type (*.vtu file).

Basically what I did was define four arrays in my code: points, 
connectivity, offsets and types.  Together these define the grid.  They 
each have length equal to the number of particles, np.

You can then fill these arrays like this (pseudocode):

for i=1 to np
  connect(i)=i-1
  offset(i)=i
  type(i)=1
  points(i)=particle(i).position
end

Then you can simply write the contents of these arrays in the 
appropriate places in the xml file.  You can also add other arrays 
containing the data for the physical variables you want to view.  I used 
the 'appended data' option and wrote the data out using raw binary 
encoding to make the files smaller and faster to read.

You write one of these *.vtu files for each time step, and then a *.pvd 
file containing the time data and links to each *.vtu file.

Email me if you need more detail.

Regards, Adrian

-- 
Dr Adrian Croucher
Department of Engineering Science
University of Auckland
New Zealand
tel 64-9-373-7599 ext 84611



More information about the ParaView mailing list