< Back

Calculate Swirl Strength


Problem:

How do I calculate the Swirling Strength criterion (Lambda-Ci)?

Solution:

Use a Tecplot Macro to automate the calculation.

Make sure Tecplot is aware of the variables representing your velocity field (Analyze->Field Variables menu).

 

The commands are as follow:

  • Calculate the tensor of velocity gradients. This command can be obtained by recording the Analyze->Calculate Variables…->Velocity Gradient (tensor) action in Tecplot’s user interface (UI).
$!EXTENDEDCOMMAND
  COMMANDPROCESSORID = 'CFDAnalyzer4'
  COMMAND = 'Calculate Function=\'VELOCITYGRADIENT\' 
             Normalization=\'None\' 
             ValueLocation=\'Nodal\' 
             CalculateOnDemand=\'F\' 
             UseMorePointsForFEGradientCalculations=\'F\''

  • The Swirling Strength correspond to the imaginary part of the complex eigenvalues of ∇u. The characteristic equation for ∇u is: λ3+Pλ2+Qλ+R=0. We use the equations tool (Data->Alter->Specify Equations… menu) to compute P, Q and R:
$!ALTERDATA EQUATION = '{P} = -({dUdX}+{dVdY}+{dWdZ})'
$!ALTERDATA 
  EQUATION = '{Q} = (-{dUdY}*{dVdX}-{dUdZ}*{dWdX}-{dVdZ}*{dWdY}+{dUdX}*{dVdY}+{dWdZ}*{dUdX}+{dWdZ}*{dVdY})'
$!ALTERDATA 
  EQUATION = '{R} = ({dUdX}*({dVdZ}*{dWdY}-{dVdY}*{dWdZ})

                    +{dUdY}*({dVdX}*{dWdZ}-{dWdX}*{dVdZ})

                    +{dUdZ}*({dWdX}*{dVdY}-{dVdx}*{dWdY}))'
  • We then solve the characteristic equation (for incompressible flows, P=0):
$!ALTERDATA EQUATION = '{R2} = ({R}+(2/27)*{P}**3-{Q}*{P}/3)'
$!ALTERDATA EQUATION = '{Q2} = ({Q}-{P}**2/3)'
$!ALTERDATA EQUATION = '{Delta} = ({Q2}/3)**3+({R2}/2)**2'
  • The tensor has one real eigenvalue and a conjugate pair of imaginary eigenvalues when the discriminant is positive:
$!ALTERDATA EQUATION = '{Beta2} = IF ({Delta}>=0 ,(ABS(SQRT(ABS({Delta}))-{R2}/2))**(1/3),0)'
$!ALTERDATA EQUATION = '{Beta3} = IF ({Delta}>=0 ,(ABS(SQRT(ABS({Delta}))+{R2}/2))**(1/3),0)'
  • The imaginary part λCi of the complex pair of eigenvalues is:
$!ALTERDATA EQUATION = '{LambdaCi}=(SQRT(3)/2)*({Beta2}+{Beta3})'

 

Download Lambda_CiCalculation.mcr from our handyscripts GitHub page.

Tip: For faster access, consider placing the macro in your Quick Macro Panel.