CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [OpenFOAM] Integrate Variables using ParaView Python Shell (https://www.cfd-online.com/Forums/paraview/178613-integrate-variables-using-paraview-python-shell.html)

cfdsolver1 October 12, 2016 03:08

Integrate Variables using ParaView Python Shell
 
Hello everyone. I want to access the result of U after applying integrate variables filter. This is easy and can be done manually but I want to do this using Python Shell for my further calculations.

For this, I open Paraview and select my mesh regions and cell arrays and after that, I run Python Shell and run my script. However, I get error as

Code:

Traceback (most recent call last):
File "<string>", line 16, in <module>
AttributeError: 'NoneType' object has no attribute 'GetValue'

The following is my Python script:

Code:

import paraview.simple as pvs
data = pvs.Wavelet()
my_slice = pvs.Slice(Input=data)
my_slice.SliceType = 'Plane'
my_slice.SliceType.Origin = [0.0, 0.0, 0.0]
my_slice.SliceType.Normal = [0.0, 1.0, 0.0]
my_slice.SliceType.Offset = 0.0
my_slice.Crinkleslice = 0
my_slice.Triangulatetheslice = 0
my_slice.SliceOffsetValues = [0.0]
iv = IntegrateVariables(Input=my_slice)
iv.UpdatePipeline()
data = servermanager.Fetch(iv)
numPoints=data.GetNumberOfCells()
print numPoints
U10=data.GetCellData().GetArray("U1").GetValue(1) # This is the line no. 16
print U10


I am doing something wrong. I checked the forum and Google but I couldn't find my mistake. Can you help me to correct this?


All times are GMT -4. The time now is 23:41.