[Paraview] How to compute functions for all particles and plot as function of time

Berk Geveci berk.geveci at kitware.com
Mon Feb 3 10:06:47 EST 2014


Here is a way of doing this. Apply a Programmable Filter with a script
like this:

displ = inputs[0].PointData['DISPL']
val = numpy.sum(displ[:,0], 0)
a = vtk.vtkFloatArray()
a.SetName("Sumdispl")
a.InsertNextValue(val)
output.SetNumberOfRows(1)
output.AddColumn(a)

Make sure that the output type is set to vtkTable. Also, you need a
ParaView compiled with Python and numpy support.

Once you have the table, select the first row in the spreadsheet view.
Then apply Plot Selection Over Time.

This is a bit more complicated if the data is multi-block or AMR. Let
me know if that is the case.

Best,
-berk



On Wed, Jan 29, 2014 at 6:50 PM, William Oquendo <woquendo at gmail.com> wrote:
> Hi, thanks for your response.
> Yes, I have tried it, and although useful for the statistics, like average
> velocity magnitud, still does not allow
> me to extract what I really need, like the sum of every mass*|V|^2 for all
> particles as a function of time, and,
> in general,  a global function (a function which depends on all the
> particles) as function of time (array which
> seems to be hidden).
> Do you or anybody know if it is possible to configure the "Plot Selection
> Over Time" filter to add it some
> other function? or, is it possible to use the Python Calculator filter for
> this? can someone share and example?
> Thanks again for your kind response.
>
>
> On Tue, Jan 28, 2014 at 9:32 PM, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com> wrote:
>>
>> Have you tried selecting all the particles, then applying "Plot Selection
>> Over Time", however this time checking the "Only report selection
>> statistics" property?
>>
>>
>> On Tue, Jan 28, 2014 at 2:01 PM, William Oquendo <woquendo at gmail.com>
>> wrote:
>>>
>>> Dear all,
>>> I have a system of particles printed on vtp files. I am visualising them
>>> on Paraview, and want to analyse some dynamic info. Each particle has its
>>> own position and velocity vectors, and mass (scalar) as well, plus some
>>> other scalars and vectors not relevant now. Let/s say that I want to plot
>>> the total kinetic energy as a function of time. I was able to plot the
>>> individual kinetic energies per particle for each time (using the calculator
>>> and plot data filters), and also to plot the kinetic energy for a single
>>> selected  particle as function of time (after selecting the particle and
>>> using the plot selection over time filter). But I haven't found how to use
>>> the Python calculator or similar to compute that aggregate quantity (total
>>> kinetic energy in this example), and to plot it as a function of time.
>>> Any help is greatly appreciated.
>>>
>>> --
>>>
>>> Best regards / Cordialmente,
>>>
>>> William-Fernando Oquendo
>>> --------------------------
>>> Este correo puede carecer de tildes o eñes debido al teclado.
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>
>
>
> --
>
> Best regards / Cordialmente,
>
> William-Fernando Oquendo
> --------------------------
> Este correo puede carecer de tildes o eñes debido al teclado.
>
>
> _______________________________________________
> 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
>


More information about the ParaView mailing list