colored isosurface could not be maintained
Afficher commentaires plus anciens
Hello Matlab community,
I am visualizing a turbulent flow field with sphereical particles and encountered a strange problem.
I use "isosurface" to visualize the vortex structures, and color them with the local flow velocity. The plot looked fine, but when I add some particles into the plot with "surf", the colored isosurface of vortex structure became single colored.
Here is my script for the plot (the data files are pretty large so I don't upload them)
clear all;
Re = 11279.5;
visc = 0.004;
ny = 512;
vscale = Re*0.004/ny;
lscale = 20;
scale = vscale/lscale;
rad = 10;
A1 = load('qvalue3D0000500.dat');
A3 = load('ux0000500.dat');
x = [0.5:2:512-0.5];
y = [0.5:2:512-0.5];
z= [0.5:2:512-0.5];
[X,Y,Z] = meshgrid(y,x,z);
Qvalue = A1(:)/vscale/vscale*lscale*lscale;
streamvel = A3(:)/vscale;
Qvalue = reshape(Qvalue,256,256,256);
streamvel = reshape(streamvel,256,256,256);
Qvalue = smooth3(Qvalue,'gaussian',[3,3,3]);
streamvel = smooth3(streamvel,'gaussian',[3,3,3]);
maximumQ = max(max(max(Qvalue)));
minimumQ = min(min(min(Qvalue)));
maxstreamvel = max(max(max(streamvel)));
minstreamvel = min(min(min(streamvel)));
streamvel = (streamvel - minstreamvel)/(maxstreamvel - minstreamvel);
A2 = load('partS10000500.dat');
partx = A2(:,2); party = A2(:,3); partz = A2(:,4);
figure(1)
aaa = 0.2;
isosurface(X,Y,Z,Qvalue,aaa,streamvel);
hold on;
for id = 1:length(partx)
partx9 = partx(id); party9 = party(id); partz9 = partz(id);
[X1,Y1,Z1] = sphere(30);
r = rad;
X2 = X1 * r;
Y2 = Y1 * r;
Z2 = Z1 * r;
s1 = surf(X2+partx9,Y2+party9,Z2+partz9);
hold on;
set(s1,'FaceColor',[1 1 1], ...
'FaceAlpha',0.8,'FaceLighting','gouraud','EdgeColor','none');
end
%camlight
axis([0 512 0 512 0 512]);
brighten(0.0);
daspect([1 1 1]);
set(gca,'box','on')
ax = gca;
ax.BoxStyle = 'full';
xticks([]);
yticks([]);
zticks([]);
Before I insert particle, the plot looks like

But once I insert particles, it looks like

As you can see, the colored vortex structures turns uniformly purple.
I wonder if someone can explain the reason and offer me suggests to maintain color isosurface with particles.
Thanks a lot for your help,
Cheng
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Volume Visualization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


