How to calculate vorticity and rotation of the vector field

Hello,
I need to calculate the vorticity and rotation of the vector field with the curl function, but I get only Infs and NaNs results. I have 4000 snapshots of a 2D flow field, each snapshot is 159x99 vectors, containts x and y coordinates in mm and U and V components in m/s. The x and y variables are 159x99 double, the Udatar and Vdatar variables are 4000x159x99 double. The included MAT file contains the first snapshot of the flow field.
For the beginning I want to calculate the curl for the first snapshot. Thanks for your help.
My code:
close all; clear;
input_folder=uigetdir;
cd(input_folder);
load('PIVkolmo_example.mat');
I=159; J=99; IJ=[159 99];
% Ures1=reshape(Udatar(1,:,:),I,J);
% Vres1=reshape(Vdatar(1,:,:),I,J);
[curlz1,cav1] = curl(x,y,Ures1,Vres1);

8 Comments

If you calculate the vorticity vector, just divide them by 2. Or multiply by 0.5. Since you obtain vorticity as = 2xrotation
Obtain x and y matrices using meshgrid and then apply curl
Check also size of Ures1 and Vres1
Ures1 and Vres1 are both 159x99 double
Maybe I got it right now, as the x and y coordinates are already a grid of uniformly spaced and monotonic points, it is ok to change the code to [curlz1,cav1] = curl(Ures1,Vres1); and I get results for the 1st snapshot.
Then you just have to remember to scale the curl-components with the spacing of x and y.
How exactly do I scale the curl and cav with the spacing of x and y?
From the help of curl:
[CURLZ, CAV] = curl(U,V) assumes
[X Y] = meshgrid(1:N, 1:M) where [M,N]=SIZE(U).
Since curl is a differential operator you simply have to divide by dx and dy, in the correct places...

Sign in to comment.

Answers (0)

Categories

Find more on Chemistry in Help Center and File Exchange

Products

Release

R2020b

Tags

Asked:

on 2 Sep 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!