[Paraview] Calculation of Lambda2 using ParaView...
Stefan Melber
Stefan.Melber at DLR.de
Wed Jun 14 04:07:31 EDT 2017
Hi Andy,
ok - try to do the job with a programmable filter:
importnumpyasnp
fromnumpyimportlinalg asLA
fromparaview.numpy_supportimportvtk_to_numpy
input0 =inputs[0]
# Test NumPy
w, v =LA.eig(np.diag((1, 2, 3)))
printw
printv
npArr =vtk_to_numpy(input0.PointData["val"])
The test with the eig-function works fine. However - i have to convert
the val-Tensor from VTK to NumPy to work with NumPy. I use therefore the
vtk_to_numpy function - but it gives
Traceback (most recent call last):
File "<string>", line 22, in <module>
File "<string>", line 19, in RequestData
File
"/opt/PARAVIEW_5_4_0_OpenGL2/ParaView-v5.4.0.bin/lib/site-packages/paraview/numpy_support.py",
line 213, in vtk_to_numpy
typ = vtk_array.GetDataType()
AttributeError: 'VTKCompositeDataArray' object has no attribute
'GetDataType'
[ 1. 2. 3.]
[[ 1. 0. 0.]
[ 0. 1. 0.]
[ 0. 0. 1.]]
What did i wrong?
Stefan
> Hi,
>
> The best way to do this would be in a programmable filter. I'm
> guessing numpy has some method to compute eigenvalues for
> non-symmetric matrices. Beyond that adding the capability to the
> Python calculator or some other filter would be needed.
>
>
>
> On Tue, Jun 13, 2017 at 3:35 AM, Stefan Melber <Stefan.Melber at dlr.de
> <mailto:Stefan.Melber at dlr.de>> wrote:
>
> Hi Andy,
>
> i think i found the reason: i need the computation of
> (unsymmetrical) eigenvalues for lambda2 - however it seems that
> the function "eingenvalue" calculates only symmetric ones (see
> https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.vtk.numpy_interface.algorithms.html
> <https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.vtk.numpy_interface.algorithms.html>).
> How can i calculate the unsymmetric ones with ParaView?
>
> Best regards,
>
> Stefan
>
>
>> Hi,
>>
>> Maybe compute each portion manually and check that against the
>> correct values. Also, verifying the gradient calculation is
>> correct is another thing to look at. If the grid isn't specified
>> properly then the gradient operation will likely be wrong.
>>
>> On Fri, Jun 9, 2017 at 8:46 AM, Stefan Melber
>> <Stefan.Melber at dlr.de <mailto:Stefan.Melber at dlr.de>> wrote:
>>
>> Hi,
>>
>>
>> for vortex-detection i (tried) to calculate the
>> lambda2-criterion (see e.g.
>> https://en.wikipedia.org/wiki/Lambda2_method
>> <https://en.wikipedia.org/wiki/Lambda2_method>) with
>> ParaView. The way of calculation is based on this link
>> http://www.iesensor.com/blog/2016/01/24/using-paraview-to-visualise-vorticity-lambda2-vorticity-q-criterion/
>> <http://www.iesensor.com/blog/2016/01/24/using-paraview-to-visualise-vorticity-lambda2-vorticity-q-criterion/>.
>>
>> However - the results are a kind of "wrong" - see attached
>> pictures: l2_solver.png shows what the flow solver writes out
>> for lambda2, l2_paraview.png shows what calculated with the
>> algorithm below.
>>
>> Calculation of lambda2:
>>
>> D = Gradients = [d_ij]
>> S = strain(Vel)
>>
>> S = (D + D^T)/2
>> Omega = (D - D^T)/2
>>
>> lambda = EigenValue_of(S^2 + Omega^2)
>> = EigenValue_of(S^2 + (D - S)^2)
>> = EigenValue_of(S^2 + (Gradients - strain(vel))^2)
>>
>> lambda2 = lambda_Y
>>
>> and in ParaView this mean
>>
>> o Vector of velocity with "Calculator".................: Vel
>> = iHat*x_velocity+jHat*y_velocity+kHat*z_velocity
>> o Gradients of Vel with "GradientOfUnstructuredDataSet":
>> switch on "compute gradient" and name it "Gradients"
>> o Calculate lambda with "PythonCalculator".............:
>> lambda = eigenvalue(strain(Vel)**2+(Gradients - strain(Vel))**2)
>> o Caluclate lambda2 with Calculator....................:
>> lambda2 = lambda_Y
>>
>>
>>
>> Does anyone see the error why the calculation of lambda2 with
>> ParaView does not work?
>>
>> Remark: i contacted the author of the blog above already -
>> seems he never tested his calculation and has no idea what is
>> "wrong".
>>
>> Stefan
>>
>>
>>
>> ================================================================
>>
>> _/ *Dr. Stefan Melber-Wilkending*
>> _/_/
>> _/ _/ Deutsches Zentrum für Luft-
>> _/_/_/_/_/_/_/_/_/_/ und Raumfahrt e.V. (DLR)
>> _/ _/ _/ _/
>> _/ _/ _/ _/ German Aerospace Center
>> _/_/_/_/_/_/_/_/_/_/ Institute of Aerodynamics
>> _/ _/ _ _ and Flow Technology
>> _/_/ | \ | |_| Transport Aircraft Branch
>> _/ |_/ |_ | \
>> Lilienthalplatz 7
>> Fields of activities: 38108 Braunschweig
>> Germany
>> o Numerical Windtunnel Simulation
>> o Aero-Acoustic Windtunnel Design Phone : +49 531/295-2836
>> <tel:%28531%29%20295-2836>
>> o Numerical Optimization Fax. .: +49 531/295-2914
>> <tel:%28531%29%20295-2914>
>> o Visualization Techniques
>> o High-Lift Aerodynamics Email : Stefan.Melber at DLR.de
>> <mailto:Stefan.Melber at DLR.de>
>> o Glider-Aerodynamics Web ..: http://www.dlr.de/AS
>>
>> ================================================================
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com <http://www.kitware.com>
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> <http://www.kitware.com/opensource/opensource.html>
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>> <http://paraview.org/Wiki/ParaView>
>>
>> Search the list archives at:
>> http://markmail.org/search/?q=ParaView
>> <http://markmail.org/search/?q=ParaView>
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/paraview
>> <http://public.kitware.com/mailman/listinfo/paraview>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170614/12230353/attachment.html>
More information about the ParaView
mailing list