[Paraview] Integrate Value for all time steps

Rodrigo Piccinini rbpiccinini at gmail.com
Wed Aug 11 13:45:32 EDT 2010


Hello,

I wrote a python script to integrate a quantity defined in a calculator. I'd
like to perform the computation for all time steps,
but I  just have zero values for all time steps after the first one.
Someone would know it?
This is my try:

#!/cluster/apps/paraview/bin/pvpython
try: paraview.simple
except: from paraview.simple import *

casefile = '/home/piccinini/work/sygma_head/v02/movel/paraview/SYG2.CASE'

CASE = EnSightReader( CaseFileName=casefile )   #Read ENSI case
CASE.CellArrays = ['SVEL', 'P', 'PTER', 'TE', 'ED', 'T']
tsteps = CASE.TimestepValues                    #Get timesteps
print len(tsteps)
Show()

PointData = CellDatatoPointData(PassCellData=1)                #Convert to
cell data

valveCurtain = Slice( SliceType="Plane" )
valveCurtain.SliceType.Origin = [0, 0, 0.015]
valveCurtain.SliceType.Normal = [0.0, 0.0, 1.0]

LzF = Calculator()
LzF.AttributeMode = 'point_data'
LzF.Function = '(coordsX*SVEL_Y-coordsY*SVEL_X)*SVEL_Z'
LzF.ResultArrayName = 'LzF'

for t in tsteps:
    print 'Time (s) = ',t
    RV1 = GetRenderView()
    RV1.ViewTime = t

    RV1.CameraViewUp = [0.0, 0.0, 1.0]
    RV1.CameraPosition = [-0.080070000141859055, -1.1188103732684673,
0.027209000661969185]
    RV1.CameraFocalPoint = [-0.080070000141859055, -0.078404996544122696,
0.027209000661969185]
    RV1.CameraClippingRange = [0.74661537378502163, 1.4127359813330285]


    Render()
    Show()

    valveCurtainIntegral = IntegrateVariables()
    data = servermanager.Fetch(valveCurtainIntegral,0)
    scalarData = data.GetPointData()
    avgVar = scalarData.GetArray(0).GetTuple1(0)

    print 'Integral value = ', avgVar


--
Rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100811/53456f80/attachment.htm>


More information about the ParaView mailing list