CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Programmable filter - eigenvalue/lambda2

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 30, 2023, 13:29
Default Programmable filter - eigenvalue/lambda2
  #1
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,400
Rep Power: 47
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
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.
flotus1 is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Listing the inputs of a grouped dataset with a programmable python filter in Paraview NadineHS ParaView 3 December 12, 2021 14:54
[General] Programmable filter halal ParaView 0 March 19, 2018 09:49
[General] Pass variable from programmable filter to Plot Over Line Filter Jack001 ParaView 0 March 29, 2016 13:18
Programmable Filter Problem quantenmaschine OpenFOAM Post-Processing 0 August 22, 2015 09:44
[General] Programmable Filter: when multiple inputs, how to verify which input is which? macfly ParaView 0 July 12, 2014 11:14


All times are GMT -4. The time now is 10:19.