Applying a Non-Slip Boundary Condition
clc
clear
M=50;
N=50;
u(1,:)=0;
u(M,:)=0;
u(:,1)=0;
u(:,N)=0;
for i=2:M-1;
for j=2:N-1;
u(i,j)=rand;
end
end
for i=1:M;
for j=1:N;
muo(i,j)=5.1*10^-6;
end
end
u
dy=0.1;
tou(1,:)=0;
tou(M,:)=0;
tou(:,1)=0;
tou(:,N)=0;
for i=2:M-1;
for j=2:N-1;
tou(i,j)=muo(i,j).*(u(i+1,j+1)-u(i,j))/dy;
end
end
tou(:,:)
contour(u)
title('Velocity Field')
xlabel('x axis')
ylabel('y axis')
figure(2)
contour(tou)
title('Shear Stress')
xlabel('x axis')
ylabel('y axis')
pause(14)
close all
clear
M=50;
N=50;
u(1,:)=0;
u(M,:)=0;
u(:,1)=0;
u(:,N)=0;
for i=2:M-1;
for j=2:N-1;
u(i,j)=rand;
end
end
for i=1:M;
for j=1:N;
muo(i,j)=5.1*10^-6;
end
end
u
dy=0.1;
tou(1,:)=0;
tou(M,:)=0;
tou(:,1)=0;
tou(:,N)=0;
for i=2:M-1;
for j=2:N-1;
tou(i,j)=muo(i,j).*(u(i+1,j+1)-u(i,j))/dy;
end
end
tou(:,:)
contour(u)
title('Velocity Field')
xlabel('x axis')
ylabel('y axis')
figure(2)
contour(tou)
title('Shear Stress')
xlabel('x axis')
ylabel('y axis')
pause(14)
close all
Applying a Fourth Order Derivative to a Non-Slip Boundary Condition
clc
clear
M=50;
N=50;
u(1:3,:)=0;
u(M-3:M,:)=0;
u(:,1:3)=0;
u(:,N-3:N)=0;
u;
for i=4:M-4;
for j=4:N-4;
u(i,j)=rand;
end
end
for i=1:M;
for j=1:N;
muo(i,j)=5.1*10^-6;
end
end
u
dy=0.1;
tou(1:3,:)=0;
tou(M-3:M,:)=0;
tou(:,1:3)=0;
tou(:,N-3:N)=0;
for i=4:M-3;
for j=4:N-3;
dudy(i,j)=(-u(i+2,j)+8*u(i+1,j)-8*u(i-1,j)+u(i-2,j))/(12*dy);
end
end
for i=4:M-3;
for j=4:N-3;
tou(i,j)=muo(i,j).*dudy(i,j);
end
end
tou(:,:)
contour(u)
title('Velocity Field')
xlabel('x axis')
ylabel('y axis')
grid on
axis equal
figure(2)
grid on
contour(tou)
title('Shear Stress')
xlabel('x axis')
ylabel('y axis')
pause(100)
close all
clear
M=50;
N=50;
u(1:3,:)=0;
u(M-3:M,:)=0;
u(:,1:3)=0;
u(:,N-3:N)=0;
u;
for i=4:M-4;
for j=4:N-4;
u(i,j)=rand;
end
end
for i=1:M;
for j=1:N;
muo(i,j)=5.1*10^-6;
end
end
u
dy=0.1;
tou(1:3,:)=0;
tou(M-3:M,:)=0;
tou(:,1:3)=0;
tou(:,N-3:N)=0;
for i=4:M-3;
for j=4:N-3;
dudy(i,j)=(-u(i+2,j)+8*u(i+1,j)-8*u(i-1,j)+u(i-2,j))/(12*dy);
end
end
for i=4:M-3;
for j=4:N-3;
tou(i,j)=muo(i,j).*dudy(i,j);
end
end
tou(:,:)
contour(u)
title('Velocity Field')
xlabel('x axis')
ylabel('y axis')
grid on
axis equal
figure(2)
grid on
contour(tou)
title('Shear Stress')
xlabel('x axis')
ylabel('y axis')
pause(100)
close all
Unless otherwise noted, all content on this site is @Copyright by Ahmed Al Makky 2012-2013 - http://cfd2012.com