[Paraview] Cut plane average velocity over time

David Larsson david.larsson at sth.kth.se
Mon Feb 22 15:00:01 EST 2016


Hi again Jean,


sorry for the spamming. Just an additional question to what we discussed below:


Working a bit with what you gave me have led to some more problems/questions:


If I try to adapt your script (simply changing to a Slice or Threshold I use, and setting [\'PRES\'] to, in my case, Velocity, I end up in a endless loop where the program gets stuck in the first time step. However, I can't seem to understand why that is. I can see that data is loaded correctly into a vtkArray (if I simply run print(data)) but anyhow doesn't continue beyond the first loop.


Also, I would like to visualize the resulting average value on the same geometry that I loaded. Exiting from the python shell I can't though find my output values. Does anyone know how to give back calculated values to your model such that you can visualize it further in paraview?


FYI a few time steps of my model can be downloaded from here

https://app.box.com/s/u33085me6hh5tuzzb0kbjbpp9i8u9kdx in case anyone is interested.


Again thanks for all the help,


/David


________________________________
Från: ParaView <paraview-bounces at paraview.org> för David Larsson <david.larsson at sth.kth.se>
Skickat: den 19 februari 2016 17:25
Till: Favre Jean; paraview at paraview.org
Ämne: Re: [Paraview] Cut plane average velocity over time


Dear Jean,


thanks for the helpful advice!


However one question: aren't you right now creating a time average in for each point on a plane (or given input source)? What I was looking for was finding out the average value over a plane, and seeing how this changes over time. Can this be done in a similar fashion? Being new to paraview/python I'm though not really sure how...


Another question is regarding the output: How can I access the annoted outvalue (assigned in 'output.PointData.append(self.temp_data/self.tlen,'myOutputValueName'). Again, now it is in point data, but assuming I can get a single scalar value of the average value over a plane, how could I save this (for each time step) such that I can plot or evaluate it later on?


Again, thanks for your time and help.


/David


________________________________
Från: Favre Jean <jfavre at cscs.ch>
Skickat: den 16 februari 2016 11:11
Till: David Larsson; paraview at paraview.org
Ämne: RE: Cut plane average velocity over time

>> I would like to get an average over an entire cut plane (over time).

David

This sounds like a perfect case for a Python Programmable Filter, looping over timesteps, accumulating data, doing the average, and setting it as a new field. Here is a script I have tested on a single block of data with multiple timesteps.

There is an init phase, to get the number of timesteps, their values (from upstream), and the first dataset at the 0-th timestep.
There is an accumulate phase, where the filter pulls all timesteps, adding to the already existing numpy array.
There is a finish phase, where we do the average and assign it to a new field.

I am doing it for Pressure, you'll have to adapt it to your fieldnames and block structures.

-----------------
Jean M. Favre
Swiss National Supercomputing Center
CH-6900 Lugano
Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160222/9d19c1c1/attachment.html>


More information about the ParaView mailing list