|
[Sponsors] |
[General] VTK API: Working with values inside the python shell |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 7, 2013, 07:05 |
VTK API: Working with values inside the python shell
|
#1 |
New Member
Thomas S
Join Date: Aug 2012
Posts: 11
Rep Power: 14 |
Dear all,
I have some problems with the VTK API. The problem is a value which I have calculated before in a python script. I want now to import and to work with it inside the python shell. That is what I have done so far: s_kero = 3.4 #dummy value, normally calculated in a python script Calculator2 = Calculator() Calculator2.AttributeMode = 'cell_data' Calculator2.Function = 'a*s_kero' # a: value from the CFD simulation Calculator2.ResultArrayName = 's_kerosene' Of course this is not working.... Does anyone have a suggestion? Thanks for your help. |
|
January 7, 2013, 16:43 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Thomas,
I'm not sure I understand the problem. Assuming you're using ParaView, the code seems to work, at least up to a point. On ParaView 3.14.1, these following commands worked for me: Code:
from paraview.simple import * Calculator2 = Calculator() Calculator2.AttributeMode = 'cell_data' Calculator2.Function = 'p*2' Calculator2.ResultArrayName = 's_kerosene' Show() Render() Bruno
__________________
|
|
January 7, 2013, 18:16 |
|
#3 |
New Member
Thomas S
Join Date: Aug 2012
Posts: 11
Rep Power: 14 |
Hey Bruno,
thank you very much for your response. Yes, I am working with paraview. I need to do some modifications on the results stored in a vtk-file. Because I want to display these results later in Paraview, I am working with the calculator. The problem is, that my value, s_kero (your 2), is a value, that comes from a complex python script. It is computed for every cell and the numbers are changing depending on the input values. I do not want to translate the entire phyton script with calculators in paraview. It would be too much work... I hope to find a way to create an interface between the value from pyhton and paraview. So I have the calculator function: Calculator2.Function = 'p*s_kero' where s_kero is a value, calculated for every cell and corresponds every time to a different number. Regards, Thomas |
|
January 8, 2013, 16:08 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Thomas,
Sorry about that, it was late and I was tired. Right now it also took some time to finally understand the problem. But still, there are (at least) two possibilities, because I'm not 100% certain of what you need. So:
Bruno
__________________
|
|
January 10, 2013, 15:35 |
|
#5 |
New Member
Thomas S
Join Date: Aug 2012
Posts: 11
Rep Power: 14 |
Hey Bruno.
Thank you very much!! Actually I can use both of your suggestions!! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
do permeability and inertia loss coefficients values depend on working fluid? | sh.a.ghafour | FLUENT | 4 | July 5, 2020 23:38 |
Working with Python: Query of through-plane flow of multiple clips in one plot | PedroInvierno | EnSight | 8 | April 10, 2017 10:23 |
[General] Python Shell Clipping | sisetrun | ParaView | 0 | January 30, 2017 13:57 |
Limiting values inside volScalarField | PekkaRo | OpenFOAM Programming & Development | 3 | March 18, 2011 08:50 |
meshing F1 front wing | Steve | FLUENT | 0 | April 17, 2003 13:37 |