[Paraview] Calculating time-averaged shear stress

Eslami, Parastou PESLAMI1 at mgh.harvard.edu
Mon Oct 23 14:36:45 EDT 2017


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20171023/25c8ac99/attachment.html>


More information about the ParaView mailing list