Sunteți pe pagina 1din 14

2.

c) Evaluate the velocity field numerically with = 1, T=1


() = ||/
The Fourier Transform of the velocity above is:
() =

2
1 + ()2

We set out integration limit so the value of this function becomes very small (10-9).
2
= 109 = 44,721
1 + ()2
Because we have a significant high upper integration bound, our step also needs to be refined, thus:
= 0.000001

Figure 1- Problem 2c) velocity distribution profile for various t

2. c) Evaluate the wall shear stress numerically, and plot it for = , = , = .

Figure 2-Problem 2.d) Shear stress and velocity for

3. b) Evaluate numerically the velocity profile for the plate velocity


() =

2
( )

For this velocity profile, we need to set the upper bound of integration following the same procedure
used in the lecture notes (page 61), thus:

() =
=

2
)
2

= 109

9.1

The integration step was chosen to be 0.001 for a good accuracy.

4.b) Plot the temperature solution for k=1, To=1.

Figure 3- Problem 4.b) Temperature distribution over an infinite rod

MATLAB code:

%%MAE 200B HW4


%%Laura Novoa
%% Problem 2
clc
clear all
close all
%Solves for the velocity distribution of a semi-infinite Newtonian fluid
%over an infinite plate with velocity u0(t)=exp[-(abs(t)*T]
%Kinematic viscosity
T = 1;
nu=1.0;
%Time and Y vectors
t=T*[-5:1:5];

y=[0:0.05:10];
%Integration limit
Omega=sqrt((2*T-(1e-9))/(1e-9)*T^2);
%Omega increment
domega=0.000001*Omega; % since we increased integration limits by a factor of
10,
%Resulting omega vector
omega=[0:domega:Omega];
%Plotting velocity profile
%================ Start Time and Y loops ==============
for i=1:length(t)
for j=1:length(y)
%Fourier transform: integration versus omega
u(i,j)=0;
for k=1:length(omega)
beta=sqrt(0.5*omega(k)/nu);
uo = 2*T/(1+(omega(k).*T).^2);
exp1=exp(-beta*y(j));
oscillation=cos(omega(k)*t(i)-beta*y(j));
u(i,j)=u(i,j)+domega*uo*exp1*oscillation;
end
end
end
%================ End time and Y loops ==============
%Scale the answer
u=u*T/(pi);
%Legend text
for i=1:length(t)
legtext{i}=['t / T = ', num2str(t(i)/T)];
end
%Plot colors
c(1,:)=[0.0 ,0.0 ,0.0];
c(2,:)=[0.0 ,0.0 ,1.0];
c(3,:)=[0.0 ,0.7 ,0.0];
c(4,:)=[1.0 ,0.0 ,1.0];
c(5,:)=[1.0 ,0.0 ,0.0];
c(6,:)=[1.0 ,0.5, 0.0];
c(7,:)=[0.5, 1.0, 1.0];
c(8,:)=[1.0 ,0.5, 0.5];
c(9,:)=[0.5 ,1.0, 0.5];
%Line plots for different times
close
figure('Position',[150,150,400,500],'Color','w')
subplot('Position', [0.14,0.11,0.81,0.85])
for i=1:length(t)

plot(u(i,:), y, 'linewidth', 1.5)


% , 'color', c(i,:))
hold on
end
hold off
%axis([0,1,0,max(y)])
axis 'auto'
set(gca,'fontsize',14)
xlabel('{\it u/U}','FontName', 'Times','FontAngle', 'normal','fontsize',18);
ylabel('{\it y}','FontName', 'Times','FontAngle', 'normal','fontsize',18);
legend(legtext, 1)
text(0.1, 9.5, ['{\it T} = ', num2str(T)], 'FontName', 'Times',
'fontsize',20)
%% Plotting

shear stress

%run the other section first


%increasing time resolution for plotting
t = T*[-5:0.01:5];
rho = 1;
mu = nu*rho;
%================ Start Time and Y loops ==============
for i=1:length(t)
%Fourier transform: integration versus omega
tau(i)=0;
for k=1:length(omega)
beta=sqrt(0.5*omega(k)/nu);
uo = 2*T/(1+(omega(k).*T).^2);
oscillation=sin(omega(k)*t(i))-cos(omega(k)*t(i));
tau(i)=tau(i)+domega*beta*uo*oscillation;
end
end
%================ End time and Y loops ==============
%Scaling the solution
tau = mu/pi.*tau;
%Legend text
for i=1:length(t)
legtext{i}=['t / T = ', num2str(t(i)/T)];
end
%Plot colors
c(1,:)=[0.0 ,0.0 ,0.0];
c(2,:)=[0.0 ,0.0 ,1.0];
c(3,:)=[0.0 ,0.7 ,0.0];
c(4,:)=[1.0 ,0.0 ,1.0];
c(5,:)=[1.0 ,0.0 ,0.0];
c(6,:)=[1.0 ,0.5, 0.0];
c(7,:)=[0.5, 1.0, 1.0];
c(8,:)=[1.0 ,0.5, 0.5];
c(9,:)=[0.5 ,1.0, 0.5];

for i=1:length(t)
uo(i) = exp(-abs(t(i))/T);
end
%Line plots for different times
close
figure
plot(t,uo)
xlabel('{\it t}','FontName', 'Times','FontAngle', 'normal','fontsize',18);
ylabel('{\it u_o and \tau_w}','FontName', 'Times','FontAngle',
'normal','fontsize',18);
hold on
plot(t,tau)
axis 'auto'
set(gca,'fontsize',14)
xlabel('{\it t}','FontName', 'Times','FontAngle', 'normal','fontsize',18);
ylabel('{\it \tau_w}','FontName', 'Times','FontAngle',
'normal','fontsize',18);
legend('u_o','\tau_w')
%legend(legtext, 1)
text(0.1, 9.5, ['{\it T} = ', num2str(T)], 'FontName', 'Times',
'fontsize',20)
%% PROBLEM 3
clc
clear all
close all
%Solves for the velocity distribution of a semi-infinite Newtonian fluid
%over an infinite plate with velocity u0(t)=exp[-(abs(t)*T]
%Kinematic viscosity
T=1;
nu=1;
h=3;
%Time and Y vectors
t=T*[0:1:10];
y=[0:0.05:10];
%Integration limit
Omega=9.1/T;
%Omega increment
domega=0.01*Omega;
%Resulting omega vector
omega=[0:domega:Omega];
%Plotting velocity profile
%================ Start Time and Y loops ==============
for n=1:length(t)
for j=1:length(y)

%Fourier transform: integration versus omega


u(n,j)=0;
for k=1:length(omega)
uo = T.*sqrt(pi).*exp(-(omega(k).*T/2).^2);
uo2 = T.*sqrt(pi).*exp(-(-omega(k).*T/2).^2);
beta=sqrt(0.5*omega(k)/nu);
a1=real(-beta*(1+i));
a2=real(beta*(-1+i));
A1 = uo/(1-exp(2*a1*h));
B1 = uo/(1-exp(-2*a1*h));
A2 = uo2/(1-exp(2*a2*h));
B2 = uo2/(1-exp(-2*a2*h));
f=(A1.*exp(a1*y(j))+B1.*exp(a1*y(j))).*exp(real(i.*omega(k).*t(n)))+(A2.*exp(a2*y(j))+B2.*exp(a2*y(j))).*exp(real(-i*omega(k)*t(n)));
u(n,j)=u(n,j)+domega.*f;
end
end
end
%================ End time and Y loops ==============
%Scale the answer
u=u*1/2*pi;
%Legend text
for i=1:length(t)
legtext{i}=['t / T = ', num2str(t(i)/T)];
end
%Plot colors
c(1,:)=[0.0 ,0.0 ,0.0];
c(2,:)=[0.0 ,0.0 ,1.0];
c(3,:)=[0.0 ,0.7 ,0.0];
c(4,:)=[1.0 ,0.0 ,1.0];
c(5,:)=[1.0 ,0.0 ,0.0];
c(6,:)=[1.0 ,0.5, 0.0];
c(7,:)=[0.5, 1.0, 1.0];
c(8,:)=[1.0 ,0.5, 0.5];
c(9,:)=[0.5 ,1.0, 0.5];
%Line plots for different times
close
figure('Position',[150,150,400,500],'Color','w')
subplot('Position', [0.14,0.11,0.81,0.85])
for i=1:length(t)
plot(u(i,:), y, 'linewidth', 1.5)
hold on
end
hold off
%axis([0,1,0,max(y)])
axis 'auto'
set(gca,'fontsize',14)
xlabel('{\it u/U}','FontName', 'Times','FontAngle', 'normal','fontsize',18);
ylabel('{\it y}','FontName', 'Times','FontAngle', 'normal','fontsize',18);
legend(legtext, 1)

text(0.1, 9.5, ['{\it T} = ', num2str(T)], 'FontName', 'Times',


'fontsize',20)
%% PROBLEM 4
clc
clear all
close all
%Solves for the temperature distribution with initial temperature the
%scaled Heaviside function
%Kinematic viscosity
k=1.0;
To=1;
%Time and Y vectors
[X,T] = meshgrid(-2:0.05:2,0:.05:5);
%Function
U=(To/2).*(1-erf(-X./sqrt(4.*k.*T)));
%U=(To/2).*(erfc(-X./sqrt(4.*k.*T)));
surf(X,T,U)
xlabel('x')
ylabel('t')
zlabel('u')

S-ar putea să vă placă și