[Paraview] programmable access to vector components (via Python)
Fabian Wein
fabian.wein at am.uni-erlangen.de
Thu May 24 04:36:46 EDT 2012
Hi Sam,
thanks for your reply.
The ensight file canot be read:
vtkPGenericEnSightReader (0x1e74fc0): Assuming binary file
But as far as I understand, the XX, ... comes from Paraview ?!
Can you apply Stress_XX in the calculator?
I converted my file to VTK and it appears that Paraview adds the XX, ...
BTW, this Voigt interpretation is in my case the wrong interpretation.
My 6-element vector is neither stress nor strain but the upper part of a
3x3 Voigt elasticity tensor.
Also with the VTK file I cannot use the components in the calculator.
This seems to be a Bug ?!
Fabian
On 05/23/2012 04:11 PM, Samuel Key wrote:
> Greetings Fabian,
> ParaView using its EnSight binary-formatted results reader accepts
> symmetric second-order tensor node/cell variables with a user-assigned
> name. I have attached an EnSight "case" file so you can see how it is
> done. The EnSight "case" file is an ASCII-text file that contains a
> file table of contents, user-assigned variable names, time-step
> values, and "directions" on the relationship between the files in
> order to know what to read when.
>
> I checked one of my EnSight data sets and Stress appears in the
> calculator with the "scaler" components Stress_XX, Stress_XY,
> Stress_XZ, Stress_YY, ...
>
> I hope this helps; I know you are not looking to change your results
> file format, but I can supply you with Fortran-90/95 routines that
> output simulation results in an EnSight "Gold" binary format.
>
> By the way, the EnSight reader in ParaView supports polyhedral finite
> elements -- and it works; I also use the EnSight "part"-construct to
> output the results by-material.
>
> Sam Key
>
> On 5/23/2012 5:28 AM, Fabian Wein wrote:
>> I have vector data with 6 elements.
>>
>> The vector is called 'mechTensor' and I can visualize all components
>> and the
>> magnitude where the components are called XX, YY, ZZ, XY, YZ, XZ.
>> Btw, this
>> is the Voigt notation for stresses and strains.
>>
>> I do not know, where the component names are assigned, they are not
>> defined in
>> the hdf5 file. Maybe this is done in our proprietary reader but I
>> could not
>> find it there up to now.
>>
>> I cannot access the components in the calculator. Having the "equation"
>> "mechTensor_XX" where the string is selected from the Scalars menue,
>> I get the error:
>>
>> "vtkFunctionParser (0x17f8b50): Syntax error: operator expected; see
>> position 12"
>>
>> I guess that the parser has a problem with the double character
>> after the underline ?!
>>
>> Then I tried the Python Calculator. Here I do not know how to access
>> the components.
>>
>> inputs[0].CellData['mechTensor'][0]
>>
>> Results in
>>
>> "Cell array result with 6 components, has only 1 tuples but there
>> are 2 cells"
>>
>> I have indeed only two elements, i.e. two times the 6 components
>> vector.
>>
>> I have a bunch of questions:
>>
>> * am I right with the assumption, that the calculator does not like
>> double characters
>> after the underline?
>> * Is this XX, YY, ... coming from Paraview?
>> * How do I access the vector components via python?
>> * Where can I find more information about the python interface?
>>
>> Thanks a lot for your help!
>>
>> Fabian
>>
>> P.S.: Same behavior with ParaView 3.10, 3.12 and 3.14
-------------- next part --------------
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
<UnstructuredGrid>
<Piece NumberOfPoints="6" NumberOfCells="2">
<PointData>
<DataArray type="UInt32" Name="origNodeNums" format="ascii" RangeMin="1" RangeMax="6">
1 2 3 4 5 6
</DataArray>
<DataArray type="Float64" Name="mechDisplacement" NumberOfComponents="3" format="ascii" RangeMin="0" RangeMax="6.5143401362">
0 0 0 1.0621182716 -1.540229249 0
0 0 0 -1.0621182716 -1.540229249 0
2.6584411185 -5.9472109623 0 -2.6584411185 -5.9472109623 0
</DataArray>
</PointData>
<CellData>
<DataArray type="UInt32" Name="origElemNums" format="ascii" RangeMin="1" RangeMax="2">
1 2
</DataArray>
<DataArray type="UInt32" Name="elemTypes" format="ascii" RangeMin="6" RangeMax="6">
6 6
</DataArray>
<DataArray type="Float64" Name="mechTensor" NumberOfComponents="6" format="ascii" RangeMin="0.12158454416" RangeMax="0.43860303129">
0.4199107952 0.076653611027 0.10085517859 1.9035494669e-17 1.7654630288e-15 1.8058899887e-18
0.079614651163 0.079321092678 0.046394751379 4.0167328192e-17 -1.6973418431e-18 9.7245440946e-21
</DataArray>
<DataArray type="Float64" Name="mechTensorTrace" format="ascii" RangeMin="0.20533049522" RangeMax="0.59741958481">
0.59741958481 0.20533049522
</DataArray>
</CellData>
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii" RangeMin="0" RangeMax="3.6055512755">
0 2 0 1.5 2 0
0 0 0 1.5 0 0
3 2 0 3 0 0
</DataArray>
</Points>
<Cells>
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="5">
3 1 0 2 5 4
1 3
</DataArray>
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="4" RangeMax="8">
4 8
</DataArray>
<DataArray type="UInt8" Name="types" format="ascii" RangeMin="9" RangeMax="9">
9 9
</DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>
-------------- next part --------------
<VTKFile type="vtkMultiBlockDataSet" version="1.0" byte_order="LittleEndian">
<vtkMultiBlockDataSet>
<DataSet index="0" file="vtk_1/vtk_1_0_0.vtu">
</DataSet>
</vtkMultiBlockDataSet>
</VTKFile>
More information about the ParaView
mailing list