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

2 views (last 30 days)
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

Accepted Answer

Sean de Wolski
Sean de Wolski on 10 Apr 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 Comments
Sean de Wolski
Sean de Wolski on 12 Apr 2012
I think quiver expects column vectors:
quiver(xx(:),yy(:),uu(:),ww(:))

Sign in to comment.

More Answers (0)

Categories

Find more on Computational Fluid Dynamics (CFD) in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!