CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] Contour plot: celldata2pointdata (https://www.cfd-online.com/Forums/paraview/134360-contour-plot-celldata2pointdata.html)

dmaz April 28, 2014 15:03

Contour plot: celldata2pointdata
 
Hi to everyone, I have to do some contours plot from a file with Paraview using the python scripting.
The following script shows you the contents of my file:

from paraview.simple import *
reader = ExodusIIReader(FileName = "/home/.. file.case")
SliceFile = Slice(reader)
DataSliceFile = paraview.servermanager.Fetch(SliceFile)
print(DataSliceFile)

vtkMultiBlockDataSet (0x4e91180)
Debug: Off
Modified Time: 127260
Reference Count: 1
Registered Events: (none)
Information: 0x3e4a8d0
Data Released: False
Global Release Data: Off
UpdateTime: 0
Field Data:
Debug: Off
Modified Time: 127252
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Children: 1
Child 0: vtkPolyData
Debug: Off
Modified Time: 126789
Reference Count: 1
Registered Events: (none)
Information: 0x3e4cdd0
Data Released: False
Global Release Data: Off
UpdateTime: 0
Field Data:
Debug: Off
Modified Time: 126759
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 0
Number Of Cells: 0
Cell Data:
Debug: Off
Modified Time: 126787
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 17
Array 0 name = Pressure
Array 1 name = Velocity
Array 2 name = Scalar00
Array 3 name = Density
Array 4 name = TimeStep
Array 5 name = Courant
Array 6 name = GradP
Array 7 name = GradU
Array 8 name = GradV
Array 9 name = GradW
Array 10 name = GrdScl00
Array 11 name = Pprime
Array 12 name = Uprime
Array 13 name = Divergence
Array 14 name = Div-SIMPLE
Array 15 name = DD-SIMPLE
Array 16 name = Vorticity
Number Of Components: 33
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars:
Debug: Off
Modified Time: 126392
Reference Count: 4
Registered Events: (none)
Name: Pressure
Data type: float
Size: 0
MaxId: -1
NumberOfComponents: 1
Information: 0
Name: Pressure
Number Of Components: 1
Number Of Tuples: 0
Size: 0
MaxId: -1
LookupTable: (none)
Array: (null)
Vectors:
Debug: Off
Modified Time: 126398
Reference Count: 4
Registered Events: (none)
Name: Velocity
Data type: float
Size: 0
MaxId: -1
NumberOfComponents: 3
Information: 0
Name: Velocity
Number Of Components: 3
Number Of Tuples: 0
Size: 0
MaxId: -1
LookupTable: (none)
Array: (null)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Point Data:
Debug: Off
Modified Time: 126789
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Bounds:
Xmin,Xmax: (1, -1)
Ymin,Ymax: (1, -1)
Zmin,Zmax: (1, -1)
Compute Time: 127407
Number Of Points: 0
Point Coordinates: 0x3caab40
Locator: 0
Number Of Vertices: 0
Number Of Lines: 0
Number Of Polygons: 0
Number Of Triangle Strips: 0
Number Of Pieces: 1
Piece: -1
Ghost Level: 0


If I try to do the contour plot using:
contourFilter = Contour(reader)
contourFilter.PointData[:]

Nothings happens because I haven't point data..
How could I transform the Arrays inside my cell data in point data?
I read about the celldata2pointdata filter but I don't know how to use it..
Can you help me?

wyldckat April 28, 2014 16:05

Greetings dmaz,

ParaView has a feature for recording most of the operations made, such as opening files, applying filters and changing the camera view. The feature is the Python Trace, accessible from the menu Tools:
  • Start Trace
  • Stop Trace
With these you can easily create scripts that perform most of the operations you want. An article briefly explaining this feature can be found here: http://www.kitware.com/media/html/PythonTrace.html

The tracing feature should help you figure out how to do many of the configurations your looking for, as it will show you how the options used in the GUI translate to Python code.

After you've played around with this feature, along with trying to modify the resulting scripts, have a look into the threads already existing on this forum: http://www.cfd-online.com/Forums/paraview/

Best regards,
Bruno


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