CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Visualization of Data in polar coordinates

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   December 3, 2002, 12:41
Default Re: Visualization of Data in polar coordinates
  #5
Sujit Kirpekar
Guest
 
Posts: n/a
Hi, thanks for your help. Indeed MATLAB can take in 2D matrices for X and Y that don't need to be evenly spaced.

I have another question: Would you know how to visualize 3D contour data? Plot surfaces of constant function value? I wrote something like this: but it dies (returns NaN) at the origin. Could someone show me a better way to do it?

Many Thanks,

--Sujit

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear

start = cputime;

nz = 128;

nt = 128;

nx = 128;

zlen = 4.33121852439964;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%load r and theta collocation points.

load rData.dat;

load thetaData.dat;

ti = -4:.1:4;

[XI,YI] = meshgrid(ti,ti);

%clear ti;

for i=1:nz

for j=1:nt*2

x(i,j) = rData(i)*cos(thetaData(j));

y(i,j) = rData(i)*sin(thetaData(j));

end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%load up the 3D matrix for vorticity

%It is actually a 2D ascii file

load omegaZ_3D_001;

rawData = omegaZ_3D_001;

clear omegaZ_3D_001;

%rearrange the 2D ascii data into the 3D matrix it

%represents.

for i=0:nx-1

temp = rawData((nz+1)*i+1nz+1)*(i+1),1:2*(nt+1));

data(:,:,i+1) = temp(:,;

end

clear temp, rawData; <font color = red> %convert vorticity from r- theta- to x- y-

%This is where griddata() returns NaN at the origin.

for k=1:nx

temp = data(1:nz,1:2*nt,k);

output(:,:,k) = griddata(x,y,temp,XI,YI, 'cubic');

now = cputime-start

end </font> clear temp

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Various ways to visualize.

%surf(XI,YI,output(:,:,64)), hold; grid on; view([30 65])

%shading flat; shading interp;

z = 0:zlen/nx:zlen;

z = (z(1:nx))';

x = (XI(1,)';

y = YI(:,1);

%output = smooth3(output);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%this produces contour lines in various slices

%this is probably the best!

%h = contourslice(x,y,z,output,[0],[0],[1:0.1:12]);

%axis([-3,3,-3,3,0,13]); daspect([1,1,1])

%camva(24); camproj perspective;

%campos([-20,-6,25])

%set(gcf,'Color',[.5,.5,.5],'Renderer','zbuffer')

%set(gca,'Color','black','XColor','white','YColor' ,'whi te','ZColor','white')

%box on

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%use this for solid and multicolored tubes

%note: for a good view 'output' must have positive vorticity

%if everything is red, make output = -output

p1 = patch(isosurface(x,y,z,output),'FaceColor','blue', 'Edge Color','none');

p2 = patch(isocaps(x,y,z,output),'FaceColor','interp',' EdgeC olor','none');

isonormals(x,y,z,output,p1);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%if you want a hollow tube use this one:

%p = patch(isosurface(x,y,z,output));

%isonormals(x,y,z,output,p)

%set(p,'FaceColor','red','EdgeColor','none');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

view(3); axis vis3d;

axis([-4 4 -4 4 0 zlen])

camlight left; camlight; lighting phong;

timeItTook = cputime - start
  Reply With Quote

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Neumann Boundary Condition for Poisson Equation solution in Polar Coordinates prapanj Main CFD Forum 2 July 30, 2011 19:07
polar coordinates Joscha OpenFOAM 0 May 25, 2010 05:39
Polar coordinates in Fluent Ergys Rexhepi FLUENT 0 January 9, 2009 07:04
OpenFOAM native format data visualization and workflow zeliboba OpenFOAM Post-Processing 0 September 12, 2008 08:44
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 17:27


All times are GMT -4. The time now is 20:18.