CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [OpenFOAM] Problem with the cylindrical coordinates on Paraview (https://www.cfd-online.com/Forums/paraview/228866-problem-cylindrical-coordinates-paraview.html)

maxlec94 July 17, 2020 09:40

Problem with the cylindrical coordinates on Paraview
 
Hello everyone,

I am a trainee in hydraulics and new to OpenFOAM and Paraview.

In my projects I have to visualize my results in Paraview using cylindrical components of the velocity.

I found on the internet this macro that permits to convert into cylindrical coordinates :

import vtk

input = self.GetInput()
output = self.GetOutput()

transform = vtk.vtkCylindricalTransform()

transformFilter = vtk.vtkTransformFilter()
transformFilter.SetInputData(input)
transformFilter.SetTransform(transform.GetInverse( ))
transformFilter.Update()

output.ShallowCopy(transformFilter.GetOutput())

When I run the macro I have this error :
File '<string>', line 3, in <module>
NameError: name 'self' is not defined

I am not an expert in Python and I don't understand the error and how to resolve it.

Anyone have a solution ?

Thank you very much and have a good day.

Flowkersma July 17, 2020 17:31

Hi Maxime,

The script should be used in Programmable Filter.

Best, Mikko

maxlec94 July 21, 2020 10:37

Hello Mikko and thank you for your reply

Is the code the same as a programmable filter ? It seems that paraview don't like the shallow copy function

Thanks

Maxime


All times are GMT -4. The time now is 13:04.