Discussion:
[Paraview] Calculation of Lambda2 using ParaView...
Stefan Melber
2017-06-09 12:46:25 UTC
Permalink
Hi,


for vortex-detection i (tried) to calculate the lambda2-criterion (see
e.g. 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/.

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
o Numerical Optimization Fax. .: +49 531/295-2914
o Visualization Techniques
o High-Lift Aerodynamics Email : ***@DLR.de
o Glider-Aerodynamics Web ..: http://www.dlr.de/AS

================================================================
Andy Bauer
2017-06-09 14:47:33 UTC
Permalink
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.
Post by Stefan Melber
Hi,
for vortex-detection i (tried) to calculate the lambda2-criterion (see
e.g. 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/.
l2_solver.png shows what the flow solver writes out for lambda2,
l2_paraview.png shows what calculated with the algorithm below.
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
<(531)%20295-2836>
o Numerical Optimization Fax. .: +49 531/295-2914
<(531)%20295-2914>
o Visualization Techniques
o Glider-Aerodynamics Web ..: http://www.dlr.de/AS
================================================================
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/
opensource/opensource.html
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
http://public.kitware.com/mailman/listinfo/paraview
Stefan Melber
2017-06-12 04:54:30 UTC
Permalink
Hi Andy,

unfortunately my comparison values (correct lambda2) does not have an
results in between to compare with. Regarding the gradients i am sure
they are ok. For this dataset i calculated other stuff based on the
gradients and thats ok. Maybe the error is in the syntax or the usage of
the eigenvalues-function - will check there ...

Stefan
Post by Andy Bauer
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.
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.
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 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>
http://paraview.org/Wiki/ParaView <http://paraview.org/Wiki/ParaView>
http://markmail.org/search/?q=ParaView
<http://markmail.org/search/?q=ParaView>
http://public.kitware.com/mailman/listinfo/paraview
<http://public.kitware.com/mailman/listinfo/paraview>
Stefan Melber
2017-06-13 07:35:18 UTC
Permalink
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).
How can i calculate the unsymmetric ones with ParaView?

Best regards,

Stefan
Post by Andy Bauer
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.
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.
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 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>
http://paraview.org/Wiki/ParaView <http://paraview.org/Wiki/ParaView>
http://markmail.org/search/?q=ParaView
<http://markmail.org/search/?q=ParaView>
http://public.kitware.com/mailman/listinfo/paraview
<http://public.kitware.com/mailman/listinfo/paraview>
Andy Bauer
2017-06-13 15:08:49 UTC
Permalink
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.
Post by Stefan Melber
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). 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.
Post by Stefan Melber
Hi,
for vortex-detection i (tried) to calculate the lambda2-criterion (see
e.g. https://en.wikipedia.org/wiki/Lambda2_method) with ParaView. The
way of calculation is based on this link http://www.iesensor.com/blog/2
016/01/24/using-paraview-to-visualise-vorticity-lambda2-vort
icity-q-criterion/.
l2_solver.png shows what the flow solver writes out for lambda2,
l2_paraview.png shows what calculated with the algorithm below.
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
<%28531%29%20295-2836>
o Numerical Optimization Fax. .: +49 531/295-2914
<%28531%29%20295-2914>
o Visualization Techniques
o Glider-Aerodynamics Web ..: http://www.dlr.de/AS
================================================================
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
http://public.kitware.com/mailman/listinfo/paraview
Stefan Melber
2017-06-14 08:07:31 UTC
Permalink
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
Post by Andy Bauer
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.
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
Post by Andy Bauer
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
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.
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
switch on "compute gradient" and name it "Gradients"
lambda = eigenvalue(strain(Vel)**2+(Gradients - strain(Vel))**2)
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 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>
http://paraview.org/Wiki/ParaView
<http://paraview.org/Wiki/ParaView>
http://markmail.org/search/?q=ParaView
<http://markmail.org/search/?q=ParaView>
http://public.kitware.com/mailman/listinfo/paraview
<http://public.kitware.com/mailman/listinfo/paraview>
Loading...