Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

lambda2 criterion python

def Lambda2(macroscopic_velocities, negative_cutoff = 0):
  """Use vortex detection algorithm "Lambda2" to get which nodes in your velocity field are inside a vortex.
  """
  # First define the gradients of the velocity field: Δu
  _gradients = np.gradient(macroscopic_velocities, 
                           axis = (0, 1, 2))
  gradients = np.einsum('dD...-> ...dD', 
                        np.array(_gradients))

  # Get the strain rate tensor: S = (Δu + Δuᵀ)/2
  transposed_gradients = np.einsum('...dD -> ...Dd', 
                                   gradients)
  strain_rate = (gradients + transposed_gradients)/2

  # Get the vorticity tensor: Ω = (Δu - Δuᵀ)/2
  vorticity = (gradients - transposed_gradients)/2 

  # Get the eigenvalues (λ) of S² + Ω². Use np.eigh to get ordered eigenvalues. 
  S2_O2 = strain_rate**2 + vorticity**2
  eigen_values, errors = np.linalg.eigh(S2_O2)

  # Select the locations where λ₂ < the negative cutoff. 
  # Negative cutoff must be 0 or less.
  in_vortex = (eigen_values < negative_cutoff)[..., 1]
  return in_vortex
Comment

PREVIOUS NEXT
Code Example
Python :: vortex identification 
Python :: pandas sample weights example 
Python :: how to add item to a list in pithon 
Python :: python sumproduct excel 
Python :: OSError Traceback (most recent call last) <ipython-input-74-8920269c5588 in <module() 9 10 run_with_ngrok(app) --- 11 app.run() 
Python :: odoo 13 vs code 
Python :: Elasticsearch scroll with Parallelism r 
Python :: ax text not placed correclty 
Python :: how to print hello world in python stack overflow 
Python :: Python NumPy atleast_1d Function Example 02 
Python :: seasonal plot python 
Python :: with statement in python 
Python :: k means em algorithm program in python 
Python :: Python NumPy require Function Example without requirements attribute 
Python :: how to kill python program 
Python :: Python NumPy vsplit Function Syntax 
Python :: python pandas read parquet with progressbar 
Python :: object at being output python 
Python :: del mutiple indexes at once 
Python :: NumPy left_shift Code When inputs and bit shift are an arrays 
Python :: wget http://xael.org/norman/python/python-nmap/pythonnmap- 0.2.4.tar.gz-On map.tar.gz 
Python :: python restrict function parameter type 
Python :: Creating a Nested Dictionary 
Python :: list of class instances in python 
Python :: opencv2.3 
Python :: python re return index of match 
Python :: ignore exception decorator 
Python :: python logical operators code in grepper 
Python :: np sign no 0 
Python :: ring Conversion Number 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =