CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [OpenFOAM] Cylindrical slices not accepting float (https://www.cfd-online.com/Forums/paraview/214009-cylindrical-slices-not-accepting-float.html)

yambanshee January 16, 2019 07:06

Cylindrical slices not accepting float
 
Good day!


I am busy preforming data analysis on an axial flow fan and need to take many cylindrical slices. These slices will vary from roughly 0.31 m to 0.71 m. I've just picked up the basics of programming within paraview, and generated the following script:


Code:

source = GetActiveSource()
for i in range (31, 71, 5):
    r = i/100;
    Slice1 = Slice( source )
    Slice1.SliceType = "Cylinder"
    Slice1.SliceOffsetValues = [0.0]
    Slice1.SliceType.Center = [0.0, 0.0, 0.0]
    Slice1.SliceType.Axis = [0.0, 1.0, 0.0]
    Slice1.SliceType.Radius = r

As described in the code, it slices whatever object is selected at the time of executing the code with cylinders who's origin is (0 0 0) along the axis (0 1 0) and with radius varying from 0.31 to 0.71 in increments of 0.05



My problem is that these slices all have radius 0. As soon as I take away the division of 100, they slice at the radius given.
How would I accomplish what is set out here?


EDIT:
It seems the reason was that paraview wasn't working with floats, and instead treated everything like integers. To remedy this, I included the line: from __future__ import division at the top, which solved the problem


All times are GMT -4. The time now is 09:21.