There's the `SaveData` function you can use. Just save via a .vtu extension. I personally also use CompressorType="LZ4"

Try doing this in the paraview gui first and then record it into Python. Then you can see how everything is done.

Shuhao

On 2017-10-23 05:00 PM, Eslami, Parastou wrote:
Hi Shuhao,


Thank you for your response. Yes, I found the TemporalStatistics filter as 
well. Could you please let me know how I can save it back as a .vtu file?


Best Regards,

Parastou



________________________________
From: ParaView <paraview-boun...@paraview.org> on behalf of Shuhao Wu 
<shu...@shuhaowu.com>
Sent: Monday, October 23, 2017 4:46:24 PM
To: paraview@paraview.org
Subject: Re: [Paraview] Calculating time-averaged shear stress

I believe you're looking for the TemporalStatistics filter. Specifically
what you want maybe something along the lines of:

    temporal_statistics = TemporalStatistics(Input=vtk_data)
    temporal_statistics.ComputeAverage = 1
    temporal_statistics.ComputeMinimum = 0
    temporal_statistics.ComputeMaximum = 0
    temporal_statistics.ComputeStandardDeviation = 0

This should make the computation slightly faster as you don't need to
compute and store the stddev, min, and max.

Shuhao

On 2017-10-23 02:36 PM, Eslami, Parastou wrote:
Hi  Everyone,


I'm very new to Paraview and python scripting. I have a series of time 
dependent .vtu files and would like to

    1.  Read the vtu files for each time step
    2.  calculate the magnitude of shear stress
    3.  calculate time-averaged shear stress for all the elements in my geometry
    4.  output/write a vtu file and load it back to paraview.

I think I have been able to successfully implement steps 1 and 2 (please see 
bellow)  but am completely clueless on how to do 3 and 4. Could anyone help me 
with this? I also should mention that I have tried the Temporal Statistics 
Filter and it seems to be working fine, but would like to have a way to do it 
with pythons scripting as well.


Thanks,
Parastou


#### import the simple module from the paraview
from paraview.simple import *
import numpy as np
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

dumm_vWSS = []

for i in range(4500, 4550, 50):
      f = "\...\.../all_results_0" + str(i) + ".vtu"
      print i
      # create a new 'XML Unstructured Grid Reader'
      all_results = XMLUnstructuredGridReader(FileName=f)
      all_results.CellArrayStatus = ['GlobalElementID']
      all_results.PointArrayStatus = ['GlobalNodeID', 'vinplane_traction', 
'vWSS', 'average_speed', 'average_pressure', 'pressure', 'velocity', 
'timeDeriv']
      # create a new 'Calculator'
      calculator1 = Calculator(Input=all_results)
      calculator1.Function = ''
      # Properties modified on calculator1
      calculator1.ResultArrayName = 'WSS mag'
      calculator1.Function = 'mag(vWSS)'
      # get the data points
      SetActiveSource(calculator1)
      calculator1.UpdatePipeline()
      vWSSdata=servermanager.Fetch(calculator1)
      vWSSPoints     =vWSSdata.GetPoints()
      vWSSPointData  =vWSSdata.GetPointData()
      vWSSArrayData=vWSSPointData.GetArray('WSS mag')
      dumm_vWSS.append(vWSSArrayData)
      print dumm_vWSS



Parastou Eslami, PhD
Post-doctoral Fellow, Harvard University
Department of Radiology, Massachusetts General Hospital








The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.



_______________________________________________
Powered by www.kitware.com<http://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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

_______________________________________________
Powered by www.kitware.com<http://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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to