Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

vortex core line detection

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 :: frozenset numbers in python 
Python :: affochage dun index du array list a deux dimension 
Python :: python sqlite select where 
Python :: disable chrome console errors selenium 
Python :: CHECK POLYGON IS VALID 
Python :: ouvrir fichier txt python et le lire 
Python :: godot ternary 
Python :: Upgrade requests-html in python 
Python :: Python NumPy squeeze function Example with axis 
Python :: Python NumPy transpose Function Example with use of tuples 
Python :: no definition 
Python :: how to make dinamic table in jinja python 
Python :: Python NumPy asarray Function Example list to array 
Python :: Python NumPy concatenate Function Example when axis equal to none 
Python :: get text from heatmap 
Python :: Python NumPy vsplit Function 
Python :: pandas dt.weekday to string 
Python :: palindrome rearrange 
Python :: 16. count total numbers of uppercase and lowercase characters in input string python 
Python :: NumPy packbits Code Packed array along default axis 
Python :: http://172.18.0.128:8114/ 
Python :: adjoint of 3x3 matrix in python 
Python :: call a Python range() using range(start, stop) 
Python :: lsit to dataframe 
Python :: if is 
Python :: make python present number in sciencetifc 
Python :: django assign authenticated user to foreign user 
Python :: session timeout flask 
Python :: python go back one using abspath 
Python :: ring print part of the content of a binary file 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =