CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ParaView

Paraview-Python Scripting, Accessing Data Through Objects

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By wilandlane

Reply
 
LinkBack Thread Tools Display Modes
Old   February 7, 2014, 17:52
Default Paraview-Python Scripting, Accessing Data Through Objects
  #1
New Member
 
William Lane
Join Date: Apr 2013
Posts: 3
Rep Power: 3
wilandlane is on a distinguished road
I am trying to do some post processing of simulations using Paraview through Python scripting. So far I have used Paraview's Trace function to generate the basic script but I can not seem to view/export the data:

Quote:
from paraview.simple import *

tStop = 100
dt = 0.01
files = ['%s/FT_%04d.vtu' %t for t in range(int(tStop/dt))]

FT_ = XMLUnstructuredGridReader(FileName=files)

FT_.PointArrayStatus = []
FT_.CellArrayStatus = ['EP_G', 'P_G', 'P_S', 'Gas_Velocity', 'Solids_Velocity_1', 'Gas_temperature', 'Solids_temperature_1']

Calculator2 = Calculator()
Calculator2.Function = '(Gas_temperature+Solids_temperature_1)/(2)'
Calculator2.ResultArrayName = 'Tbar'
Calculator2.AttributeMode = 'Cell Data'

IntegrateVariables2 = IntegrateVariables()

PlotSelectionOverTime1 = PlotSelectionOverTime()

selection_source_3717 = IDSelectionSource( ContainingCells=0, InsideOut=0, FieldType='CELL', IDs=[-1L, 0L] )

PlotSelectionOverTime1.Selection = selection_source_3717
The new data seems to be stored in PlotSelectionOverTime1. According to Paraview, the attribute is "Row Data"; however, the class does not contain such an attribute. Is anyone familiar with Paraview's objects/attributes in Python?

Thanks!
wilandlane is offline   Reply With Quote

Old   February 16, 2014, 13:27
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,453
Blog Entries: 33
Rep Power: 73
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
Greetings William,

I believe what you're looking for is somewhat already explained here: Get data from Calculator filter in python script post #6

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   February 19, 2014, 12:38
Default
  #3
New Member
 
William Lane
Join Date: Apr 2013
Posts: 3
Rep Power: 3
wilandlane is on a distinguished road
wyldckat,

You're right, that is exactly what I needed, thanks! I was actually able to get it working last week, but forgot to update my post. Here's the code I used to extract information from a "Plot Selection Over Time" filter which stores data not as Points or Cells, but as a Block.

Code:
Fetch = servermanager.Fetch(PlotSelectionOverTime1)
Block = PlotFetch.GetBlock(0)
RowData = PlotBlock.GetRowData()
Array = PlotRowData.GetArray(0)
Value = Array.GetValue(i)
wyldckat and kiddmax like this.
wilandlane is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Animating unsteady data from Fluent in Paraview.. frodooon ParaView 10 May 9, 2014 11:39
2 datas on one plot Akuji ParaView 46 December 1, 2013 15:06
paraview ignores SPACING in STRUCTURED_POINTS vtk data? jaffar ParaView 0 November 27, 2012 10:36
ParaView automizing with python Nigirim ParaView 3 November 27, 2012 03:40
Accessing solution data in UDF Ale FLUENT 1 June 12, 2002 01:25


All times are GMT -4. The time now is 20:18.