Shrediquette / PIVlab

Particle Image Velocimetry for Matlab, official repository
https://shrediquette.github.io/PIVlab/
MIT License
126 stars 30 forks source link

Implement Q-criterion #29

Open Shrediquette opened 3 years ago

Shrediquette commented 3 years ago

As nicely shown in invariant2_factor.m in https://github.com/Tianshu-Liu/OpenOpticalFlow

Shrediquette commented 4 months ago

https://de.mathworks.com/matlabcentral/answers/1566758-find-q-criterion-and-lambda2-from-velocity-values?s_tid=srchtitle

Shrediquette commented 4 months ago

x(nx,ny,nz): x coordinates of your grid

y(nx,ny,nz): y coordinates of your grid

z(nx,ny,nz): z coordinates of your grid

dudx(nx,ny,nz): x-wise derivative of x-wise velocity component

dudy(nx,ny,nz): y-wise derivative of x-wise velocity component . . . dwdz(nx,ny,nz): z-wise derivative of z-wise velocity component

This is, more or less, how i would put it down in Matlab the task of plotting Q isosurfaces (tipically used for flow visualization in DNS/LES):

%MATLAB CODE

iso_q=100; %Pick your number here

%Definition of Q q=-0.5(dudx.^2+dvdy.^2+dwdz.^2)-dudy.dvdx-dudz.dwdx-dvdz.dwdy;

%Plotting a Q isosurface, Q=iso_q figure() p=patch(isosurface(x,y,z,q,iso_q)); set(p,'FaceColor','red','EdgeColor','none'); daspect([1,1,1]) axis tight ax = -1; ay = 1; az = 1; view([ax,ay,az]); camroll(240) camlight lighting gouraud

%END OF MATLAB CODE

Shrediquette commented 4 months ago

!MC 1400

Created by Tecplot 360 build 14.0.2.35002

$!ALTERDATA EQUATION = '{Q} = 0'

$!VarSet |NUMVARSINIT| = |NUMVARS| $!VarSet |NUMVARSINIT| += 1

$!PROMPTFORTEXTSTRING |U| INSTRUCTIONS = "Enter the variable number for U" $!PROMPTFORTEXTSTRING |V| INSTRUCTIONS = "Enter the variable number for V" $!PROMPTFORTEXTSTRING |W| INSTRUCTIONS = "Enter the variable number for W"

$!GLOBALTHREEDVECTOR UVAR = |U| $!GLOBALTHREEDVECTOR VVAR = |V| $!GLOBALTHREEDVECTOR WVAR = |W|

$!ALTERDATA EQUATION = '{dudx} = ddx(u)' $!ALTERDATA EQUATION = '{dvdx} = ddx(v)' $!ALTERDATA EQUATION = '{dwdx} = ddx(w)' $!ALTERDATA EQUATION = '{dudy} = ddy(u)' $!ALTERDATA EQUATION = '{dvdy} = ddy(v)' $!ALTERDATA EQUATION = '{dwdy} = ddy(w)' $!ALTERDATA EQUATION = '{dudz} = ddz(u)' $!ALTERDATA EQUATION = '{dvdz} = ddz(v)' $!ALTERDATA EQUATION = '{dwdz} = ddz(w)' $!ALTERDATA EQUATION = '{s11} = {dudx}' $!ALTERDATA EQUATION = '{s12} = 0.5({dudy}+{dvdx})' $!ALTERDATA EQUATION = '{s13} = 0.5({dudz}+{dwdx})' $!ALTERDATA EQUATION = '{s22} = {dvdy}' $!ALTERDATA EQUATION = '{s23} = 0.5({dvdz}+{dwdy})' $!ALTERDATA EQUATION = '{s33} = {dwdz}' $!ALTERDATA EQUATION = '{Omga12} = 0.5({dudy}-{dvdx})' $!ALTERDATA EQUATION = '{Omga13} = 0.5({dudz}-{dwdx})' $!ALTERDATA EQUATION = '{Omga23} = 0.5({dvdz}-{dwdy})' $!ALTERDATA EQUATION = '{s2o2_11} = {s11}2 + {s12}2 + {s13}2 - {Omga12}2 - {Omga13}2' $!ALTERDATA EQUATION = '{s2o2_12} = {s11}{s12} + {s12}{s22} + {s13}{s23} - {Omga13}{Omga23}' $!ALTERDATA EQUATION = '{s2o2_13} = {s11}{s13} + {s12}{s23} + {s13}{s33} - {Omga12}{Omga23}' $!ALTERDATA EQUATION = '{s2o2_22} = {s12}2 + {s22}2 + {s23}2 - {Omga12}2 - {Omga23}2' $!ALTERDATA EQUATION = '{s2o2_23} = {s12}{s13} + {s22}{s23} + {s23}{s33} - {Omga12}{Omga13}' $!ALTERDATA EQUATION = '{s2o2_33} = {s13}2 + {s23}2 + {s33}2 - {Omga13}2 - {Omga23}2' $!ALTERDATA EQUATION = '{Q} = 2*{Omga12}*2 + 2{Omga13}2 + 2{Omga23}2 - {S11}2 - {S22}2 - {S33}2 - 2{S12}2 - 2*{S13}*2 - 2{S23}2'

$!VarSet |NUMVARSFIN| = |NUMVARS| $!DELETEVARS [|NUMVARSINIT|-|NUMVARS|]