Example Simulation of Particels
clc
clear
tt=10;
for i=1:tt
I = rand (100, 100);
II(:,:,tt)=I(:,:);
[row, col] = find (I > 0.99);
hold on;
imshow (I);
plot (col, row, 'ro');
hold off;
pause(0.1)
end
clear
tt=10;
for i=1:tt
I = rand (100, 100);
II(:,:,tt)=I(:,:);
[row, col] = find (I > 0.99);
hold on;
imshow (I);
plot (col, row, 'ro');
hold off;
pause(0.1)
end
Example Spray Modelling
clc
clear
N=10;
deltat=0.1;
y(1)=0;
x(1)=0;
dx=12/N;
f=3.1;
for i=1:N
if (i>=50)
v(i)=30*exp(-0.1*i)+f*randn(1,1);
else
v(i)=30*exp(-0.1*i)+f*randn(1,1)-0.9*i*dx;
end
u(i)=0.1*i*dx+f*rand(1,1);
V(i,1:2)=[ v(i) u(i)];
velocity(i)=norm(V(i,1:2));
y(i+1)=y(i)+deltat*v(i);
x(i+1)=x(i)+deltat*u(i);
plot(0,0);
hold on
plot(12,12);
plot(-5,0)
plot(x,y,'*');
grid on
pause(0.01)
end
hold off
theta(1)=0;
delta=360/N;
for i=1:N-1;
theta(i+1)=theta(i)+delta;
alpha(i+1)=(pi/180)*theta(i+1);
end
r=0.4;
c=0;
for j=1:N;
c=c+1;
for i=1:N;
xc(j,i)=r*cos(alpha(i))+x(j);
yc(j,i)=r*sin(alpha(i))+y(j);
plot(xc(j,:),yc(j,:));
hold on
pause(0.1)
end
end
clear
N=10;
deltat=0.1;
y(1)=0;
x(1)=0;
dx=12/N;
f=3.1;
for i=1:N
if (i>=50)
v(i)=30*exp(-0.1*i)+f*randn(1,1);
else
v(i)=30*exp(-0.1*i)+f*randn(1,1)-0.9*i*dx;
end
u(i)=0.1*i*dx+f*rand(1,1);
V(i,1:2)=[ v(i) u(i)];
velocity(i)=norm(V(i,1:2));
y(i+1)=y(i)+deltat*v(i);
x(i+1)=x(i)+deltat*u(i);
plot(0,0);
hold on
plot(12,12);
plot(-5,0)
plot(x,y,'*');
grid on
pause(0.01)
end
hold off
theta(1)=0;
delta=360/N;
for i=1:N-1;
theta(i+1)=theta(i)+delta;
alpha(i+1)=(pi/180)*theta(i+1);
end
r=0.4;
c=0;
for j=1:N;
c=c+1;
for i=1:N;
xc(j,i)=r*cos(alpha(i))+x(j);
yc(j,i)=r*sin(alpha(i))+y(j);
plot(xc(j,:),yc(j,:));
hold on
pause(0.1)
end
end
Unless otherwise noted, all content on this site is @Copyright by Ahmed Al Makky 2012-2013 - http://cfd2012.com