CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] Programmable filter - eigenvalue/lambda2 (https://www.cfd-online.com/Forums/paraview/250139-programmable-filter-eigenvalue-lambda2.html)

flotus1 May 30, 2023 13:29

Programmable filter - eigenvalue/lambda2
 
Crosspost from https://discourse.paraview.org/t/pro...-lambda2/12188

I followed this guide in an attempt to get Eigenvalues / Lambda2 calculated by ParaView:
https://discourse.paraview.org/t/eig...mputation/9307


My script looks like this:
Code:

import numpy as np
from vtk.numpy_interface import algorithms as algs

input=inputs[0]
Velocity_Vector = input.PointData[‘velocity’]
STRAIN = strain(Velocity_Vector)
V_gradient = gradient(Velocity_Vector)
AAA=STRAIN**2+(V_gradient - STRAIN)**2
print(shape(AAA))
Lambda_2 = np.linalg.eigvals(AAA[:])
Lambda_2 = np.real(Lambda_2)
output.PointData.append(Lambda_2, ‘Lambda_2’)

Which seems to work up to the line “Lambda_2 = np.linalg.eigvals(AAA[:])”
Here I get the error “numpy.linalg.LinAlgError: 0-dimensional array given. Array must be at least two-dimensional”
The shape of AAA is printed as (12058557,3,3)
The input for this filter is point data with a velocity field in vector form.
PV version 5.11.0

I am new to programmable filters and Python in general. A nudge into the right direction would be greatly appreciated.


All times are GMT -4. The time now is 00:04.