CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] Cylindrical slices not accepting float

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2019, 08:06
Default Cylindrical slices not accepting float
  #1
Senior Member
 
Zander Meiring
Join Date: Jul 2018
Posts: 125
Rep Power: 8
yambanshee is on a distinguished road
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

Last edited by yambanshee; February 6, 2019 at 07:07.
yambanshee is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 08:31
Implementation of Simple Algorithm JunaidAhmad Main CFD Forum 40 November 4, 2017 14:16
slices animation in cylindrical coordinate cecilia_xiao559 Tecplot 2 January 9, 2015 13:46
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
to correct me an udf program farida hamadi FLUENT 0 December 18, 2004 06:54


All times are GMT -4. The time now is 01:07.