필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Ben Brooke
Ben Brooke 2012년 4월 10일
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

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 4월 10일
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
Sean de Wolski
Sean de Wolski 2012년 4월 12일
I think quiver expects column vectors:
quiver(xx(:),yy(:),uu(:),ww(:))
Ben Brooke
Ben Brooke 2012년 4월 12일
Thank you so much for all your help Sean!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by