Effacer les filtres
Effacer les filtres

Curl Function to Plot CFD output: Data - [x y x Ux Uy Uz]

3 vues (au cours des 30 derniers jours)
Ben Brooke
Ben Brooke le 10 Avr 2012
Hi,
I have a data set consisting of coordinates, x y z, and magnitudes of velocity Ux Uy Uz in a (26683 x 6) data set. This data has been produced by taking a cut through a 3D CFD simulation I have produced, so that the y coordinate is constant throughout the slice.
I have no experience with the curl function and would appreciate it if anyone could give me a hand with the code I'd have to write to plot angular velocity in a 2D plot, with shading and quiver on.
Thanks

Réponse acceptée

Sean de Wolski
Sean de Wolski le 10 Avr 2012
So each columne of the 26683x6 matrix represents one of the coordinates or components?
Are x/y/z monotonic? If so, you should be able to reshape() each of the channels ino a three-d matrix and call curl directly. If they are not, you will need to generate monotonic coordinates (with meshgrid() or ndgrid() and interpolate to these values with TriScatteredInterp(). From here call curl directly.
More per comments:
Matrix was your 26683x6 matrix. I was assuming it was of the form [x y z u v w] or similar. Thus you extract the columns of it to figure out how to mesh the data.
So in the above you would have something like:
[xx yy zz] = meshgrid(0:238,120,0:148) %uses increments of 1, this could be refined.
Now create the interpolant object for each vector component:
Fu = TriScatteredInterp(Matrix(:,1),Matrix(:,2),Matrix(:,3), Matrix(:,4)); %u component
Then to get the results for curl, calculate the vector components with the corresponding interpolant on the above meshgrid output:
uu = Fu(xx,yy,zz); %interpolate to our grid
Then call curl after doing this:
curl(xx,yy,zz,uu,vv,ww)
  14 commentaires
Sean de Wolski
Sean de Wolski le 12 Avr 2012
I think quiver expects column vectors:
quiver(xx(:),yy(:),uu(:),ww(:))
Ben Brooke
Ben Brooke le 12 Avr 2012
Thank you so much for all your help Sean!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by