[vtkusers] reading exodusII python, converting to

nicholas.malaya nicholas.malaya at gmail.com
Sat Mar 22 16:21:40 EDT 2014


I've been trying to use the exodusII files that are generated from a FEM
codebase I am using, in part because they load into paraview so easily. What
I would like to do is access the data so I can spatially average it and
generate a profile, ideally in python. 

To do this, I would like to map the exodusII data into something like a 3d
coordinate (x,y,z) as well as the scalar value at that location, say, 'u'.
The 3d coordinate could be a nodal value from the mesh, for instance. 

I'm stuck around:

import vtk
import numpy as np

name = "vortex_table.1.exo"
d = vtk.vtkExodusIIReader()
d.SetFileName(name)
d.UpdateInformation()
d.SetPointResultArrayStatus('u',1)
d.Update()

data   = d.GetOutput()
blk = data.GetBlock(0).GetBlock(0)
pt_data = blk.GetPointData().GetArray('u')

x,y,z = blk.GetPoint(0)
u = pt_data.GetValue(0)

Now, this routine runs fine in python, but it appears that the data being
returned is incorrect. For instance, the range of values returned from
iterating over all possible data points is inconsistent with the range shown
in paraview. 

I'm wondering if GetValue(0) is the correct method to call in order to get
the value of 'u' at that point? I'm also not certain the x,y,z coordinates
are coming through correctly, because they again are not over a range
(0.4-~1.0) that I would have expected for this file.

Anyway, I've been bashing my head on this all day and I'm really quite
stuck, so any assistance, wisdom, etc.  you can provide would be most
appreciated. 



--
View this message in context: http://vtk.1045678.n5.nabble.com/reading-exodusII-python-converting-to-tp5726460.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list