wow, thanks a lot for this! I am on a report deadline at the moment but will 
try it afterwards. I guess the easiest way is just to write integers (1, 2, 3 
...) as the timesteps to the cgns file which should make the mapping work 
without problems. In any case, I will fiddle around a bit with what you give 
me, should be able to make it work, if I have serous problems I might contact 
you again but think this is already all I need :)

cheers, tom
Berk Geveci <[email protected]> schrieb am 20:35 Dienstag, 20.Mai 2014:
 


OK try this. Apply a Programmable Filter to the csv file. Turn on advanced 
properties on that panel and use the following scripts:

Script:

oi = self.GetOutputInformation(0)
ut = oi.Get(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP())
t = inputs[0].RowData['t']
output.RowData.append(numpy.transpose(inputs[0].RowData['x'][t==ut]), 'x')
output.RowData.append(numpy.transpose(inputs[0].RowData['y'][t==ut]), 'y')
output.RowData.append(numpy.transpose(inputs[0].RowData['z'][t==ut]), 'z')

RequestInformation script:

oi = self.GetOutputInformation(0)
oi.Remove(vtk.vtkStreamingDemandDrivenPipeline().TIME_STEPS())
oi.Append(vtk.vtkStreamingDemandDrivenPipeline().TIME_STEPS(), 0)
oi.Append(vtk.vtkStreamingDemandDrivenPipeline().TIME_STEPS(), 1)
oi.Remove(vtk.vtkStreamingDemandDrivenPipeline().TIME_RANGE())
oi.Append(vtk.vtkStreamingDemandDrivenPipeline().TIME_RANGE(), 0)
oi.Append(vtk.vtkStreamingDemandDrivenPipeline().TIME_RANGE(), 1)

The csv file looks like:

x,y,z,t
0, 0, 0, 0
1, 0, 0, 0
2, 0, 0, 0
1, 0, 0, 1
2, 0, 0, 1
3, 0, 0, 1

If the column names are different, you can adjust the Script code.

After this filter, you can apply Table to Points and Glyph usual way. The heart 
of this is the inputs[0].RowData['x'][t==ut] bit. This selects elements from an 
array that fit a certain criteria. In this case t == ut where t is the time 
column value and ut is the time value requested from the filter by ParaView's 
animation engine. If you are running into an issue, make sure that the values 
in the csv file match exactly the values in the simulation file. If there are 
round off errors, you may have to implement a more complicated logic in the 
file to round the ut value to one that is closest in the table.

Best,
-berk



On Mon, May 19, 2014 at 5:41 AM, Tom-Robin Teschner 
<[email protected]> wrote:

Hi Berk, 
>
>
>I think option two would be best as I don't use vtu (at least for my 
>animations) + for the sake of animation I can reduce the csv file to contain 
>only 1 particle per location so the csv file would be indeed small. If you 
>could send me the python file I would be very thankful, could you also let me 
>know how to put it into paraview as i have never used the python shell before 
>(in paraview). 
>
>
>Thanks, 
>Tom
>
>
>Berk Geveci <[email protected]> schrieb am 19:21 Freitag, 16.Mai 2014:
> 
>
>
>
>Since you want to sync the two, you can't live without the time information, 
>unless the simulation time values are simply an integer sequence of 0, 1, 2, 3 
>etc. The time value is what ParaView uses to sync sources. So unless you have 
>this particular case, we need to do something to fix the issue. There are two 
>ways I thought of:
>
>
>1. Using a pvd file pointing to vtu files
>2. Doing Python magic to extract particles from a single csv file
>
>
>2 is very doable and fun under two conditions:
>a. the number of particles and the number of time steps are relatively small 
>(otherwise the csv file will be too big)
>b. you add the time value as another column.
>
>
>If these hold, I can send you a script that does this. Otherwise, I can send 
>you an example file collection of pvd/vtu files.
>
>
>-berk
>
>
>
>On Thu, May 15, 2014 at 5:48 PM, Tom-Robin Teschner 
><[email protected]> wrote:
>
>thanks berk, 
>>
>>
>>thanks for the reply. i can live without the time information, but would 
>>paraview automatically map the csv file to the flow solution that i would 
>>load before?
>>the problem is that i have one cgns file containing all flow solutions so i 
>>wonder if paraview would know which csv file to use. 
>>i'll probably give it a try in the next days when i have some time, but 
>>thanks again for your reply.
>>
>>
>>cheers,
>>tom
>>Berk Geveci <[email protected]> schrieb am 15:59 Dienstag, 13.Mai 2014:
>> 
>>Hi Tom-Robin,
>>
>>
>>ParaView does not support having a time series of particles within a single 
>>csv file. You can have a file series of csv files as described here:
>>
>>
>>http://www.paraview.org/Wiki/ParaView/Users_Guide/Loading_Data
>>
>>
>>
>>Unfortunately, you will not be able to specify a time value in this case. 
>>ParaView will pick 0, 1, 2 etc.
>>
>>
>>To be able to specify time values, you will have to use a  format such as pvd 
>>or Xdmf. Of course, I just noticed that we have absolutely no documentation 
>>on the PVD format :-) We'll fix that. Here is some info:
>>
>>
>>http://www.cacr.caltech.edu/~slombey/asci/vtk/
>>
>>
>>
>>Xdmf is better documentation.
>>
>>
>>Both of these formats support ASCII content. Xdmf supports having all of the 
>>data in one file although if you have thousands of time steps, the file may 
>>get somewhat bulky.
>>
>>
>>-berk
>>
>>
>>
>>On Thu, May 8, 2014 at 10:59 AM, Tom-Robin Teschner 
>><[email protected]> wrote:
>>
>>Hi, 
>>>
>>>
>>>I am doing particle tracking at the moment and I am visualise my results 
>>>with paraview. I have a 3D Navier Stokes solver from which I get a CGNS file 
>>>with the flow solution (for example velocity and vorticity in x, y and z) 
>>>and I also get csv file where I store position of particles, which i track 
>>>inside my code. 
>>>Now I want to bring them both together, i.e. have an animation of the 
>>>flowfield (let's say of the x velocity) and on top I want to display the 
>>>particles at each timestep (so how they move along the flow). the csv file 
>>>looks something like this (shorten for visualisation): 
>>>
>>>
>>>"X" , "Y" , "Z"
>>>0.0068 , 0.52500 , 0.005
>>>0.0593 , 0.52510 , 0.005
>>>0.1171 , 0.52542 , 0.005  
>>>
>>>
>>>I have loaded the particles into paraview and then used tabletopoints from 
>>>the filters but then I get all the particles displayed, instead of getting 
>>>one particle per timestep. I have tried to use a fourth column for time but 
>>>I was unable to map that to my animation.
>>>
>>>
>>>Does anyone have an idea how to solve this?
>>>
>>>
>>>Kind regards, 
>>>Tom-Robin Teschner
>>>_______________________________________________
>>>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 ParaView Wiki at: 
>>>http://paraview.org/Wiki/ParaView
>>>
>>>Follow this link to subscribe/unsubscribe:
>>>http://www.paraview.org/mailman/listinfo/paraview
>>>
>>>
>>
>>
>>
>
>
>
_______________________________________________
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to