October 12, 2015, 04:34
|
How to use python script in paraFoam?
|
#1
|
Member
pan
Join Date: May 2015
Posts: 30
Rep Power: 11
|
Hi,
I am using the Postprocessing for Turbomachinery,I download the code from: http://sourceforge.net/projects/turbopost/,but i don't know how to use them in paraFoam.
I try the turbofilter.py in the turbevtk.And I use the ProgrammableFilter,the script is:
Quote:
import sys
sys.path.insert(0 ,"/home/username/python/vtk/")
import turbofilter as filter
## Input format default value is openfoam
## Set input format to numeca
filter.setInputFormat("numeca")
## omega default value is 0.0
filter.omega = 2*filter.math.pi*28160.0/60.0
## Calculate only Cm, Cr and Cu
filter.setTrue(["Cm", "Cr", "Cu","Ma", "MaRel"])
## All variables were calculated
# filter.setAllTrue()
## run calculation
filter.run(self)
|
But I get the error:
Quote:
File "<string>", line 2
if not file:///home/pjc/OpenFOAM/pjc-1.6-ext/turbopost-turbovtk/src/turbofilter.py
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "<string>", line 26, in <module>
File "<string>", line 16, in RequestData
File "/home/pjc/OpenFOAM/pjc-1.6-ext/turbopost-turbovtk/src/turbofilter.py", line 744, in run
turbofilter(curInput, curOutput)
File "/home/pjc/OpenFOAM/pjc-1.6-ext/turbopost-turbovtk/src/turbofilter.py", line 521, in turbofilter
Cr.InsertNextValue((input_loc.GetPoint(i)[:3][0]*input_loc.GetPointData().GetVectors(absolutVeloci tyXYZ).GetTuple3(i)[0]+input_loc.GetPoint(i)[:3][1]*input_loc.GetPointData().GetVectors(absolutVeloci tyXYZ).GetTuple3(i)[1])/radius)
AttributeError: 'NoneType' object has no attribute 'GetTuple3'
|
I have also try the python shell in paraview,it doesn't work.
Who can tell me the step of using python script in paraview?thanks.
Last edited by Thomas pan; October 12, 2015 at 08:05.
|
|
|