This assignment is for my Thermodynamics course

1 answer below »
This assignment is for my Thermodynamics course
Answered Same DayApr 23, 2021

Answer To: This assignment is for my Thermodynamics course

Rahul answered on Apr 24 2021
145 Votes
Matlab_Code/~$rdfile_screenshot.docx
Matlab_Code/Impulse_part_b_v2.m
% Matlab Code for the trajectory of single particale with vx_i in x
% direction initial velocity and vy in y dircetion initial velocity
n = 60;% Code occur for nymber of position
%current position
r = 0.05; % radius of the particale
x = zeros(1,n); y = zeros(1,n);
%current velocity
vx = zeros(1,n);% Velocity of single particale in x - direction
vy = zeros(1,n); % Velocity of single particale in y-direction
%initial velocity
vx_i = 1; % initial x direction velocity
vy_i = 2; % initial y direction velocity
vx(1) = vx_i; % particale start with initial vx_i velocity in x direction
vy(1) = vy_i; % particale start with initial vy_i velocity in y direction
clf;figure(1);
dt = 1; % timestep
m = 1;
jy = zeros(1,n);% Change in momentum during collison with right hand side y axis wall
j_y = zeros(1,n);% Total change in momentum during collison with right hand side y axis wall
jx = zeros(1,n);% Change in momentum during collison with upper wall side x axis wall
j_x = zeros(1,n);% Total change in momentum during collison with upper side x axis wall
for i=2:n

x(i)=x(i-1)+vx(i-1)*dt;
y(i)=y(i-1)+vy(i-1)*dt;

if x(i)<=-10+r % Collision with left hand side y axis wall
x(i)=-20-x(i)+r; % Change the cordinate after the collison
vx(i)=-vx(i-1);% Change the x axis velocity after the collison
vy(i)=vy(i-1);% y axis velocity remain same
elseif x(i)>=10-r % Collision with right hand side y axis wall
x(i)=20-x(i)-r;% Change the cordinate after the collison
vx(i)=-vx(i-1);% Change the x axis velocity after the collison
vy(i)=vy(i-1);% y axis velocity remain same
jy(i) = -m*(vx(i) - vx(i-1));% Change in momentum at right hand side y axis wall

elseif y(i)<=-10+r % Collision with lower side side x axis wall
y(i)=-20-y(i)+r;% Change the cordinate after the collison
vx(i)=vx(i-1);% Change the y axis velocity after the collison
vy(i)=-vy(i-1);% x axis velocity remain same
elseif y(i)>=10-r % Collision with upper side side x axis wall
y(i)=20-y(i)-r;% Change the cordinate after the collison
vx(i)=vx(i-1);% Change the y axis velocity after the collison
vy(i)=-vy(i-1);% x axis velocity remain same
jx(i) = -m*(vy(i) - vy(i-1));% Change in momentum at upper side x axis wall
else% Condition during the non collision
vx(i)=vx(i-1);
vy(i)=vy(i-1);
end
j_y(i) = sum(jx(1:i));% Total change in momentum during collison with right side y axis wall
j_x(i) = sum(jy(1:i));% Total change in momentum during collison with upper side x axis wall
plot(x(i),y(i),'o','MarkerSize',5);hold off;
xlabel('x-axis')
ylabel('y-axis')
axis([-10 10 -10 10])
pause(0.1)
end
q = 1:n;
figure
stairs(q,j_y,'Linewidth',2);% Plot of total impulse with respect to time
xlabel('time');
ylabel('Total Impulse')
avg_F = j_y(n)/n; % Average force at left side y axis wall
disp(['Average Force = ',num2str(avg_F),' N'])
% Output: Avergae force on right y axis wall and plot b/w total impulse vs
% time
Matlab_Code/Impulsevstime_partb.png
Matlab_Code/Mean_temperature_par_d.m
%Confirmation of mean temperature with ifeal gas temperature
rng(0,'twister');
N = 10000; % Number of molecules
k = 1.38e-23;% Boltzman Constant
T = 300;% Temperature of the molecule
m = 5.31e-26; % mass of the oxygen molecule
sigma = sqrt((k*T)/m);% Standard deviation
E = zeros(60,N);%Total translational kinetic energy of single particale
T1 = zeros(60,1);% mean temperature at particular instant
for t = 1:60
vx = sigma*randn(N,1); % Intializing the x direction velocity in every step
vy = sigma*randn(N,1); % Intializing the x direction velocity in every step
for n_1 = 1:N
E(t,n_1) = (1/2)*(m*((((vx(n_1)^2))+(((vy(n_1)^2))))))/N;% using equipartition theory for thermal equilibirium
end
%Formula : E = kT and E = (1/2)*(m*vx*vx) + (1/2)*(m*vy*vy)
T1(t) = (sum(E(t,:))/(k));% Temperature at every instand from the formula
%Formula: Total energy = (2/2)*k*T
end
T_static = mean(T1);%mean temperature
dT = T - T_static;
disp(['Difference between ideal gas temperature and statical calculation temperature = ',num2str(dT)]);
% Comment: Displayed value showed the difference between ideal temperaure
% and statical temperature
%Output: Comparison b/w ideal gas temperature and statical calculated
%temperature
Matlab_Code/Multiple_Particales_collision_part_c.m
clear all
figure(1)
r = 0.5; % Radius of the sphere
rng(0,'twister');
n = 60;%total number of time
N = 5; % Number of molecules
k = 1.38e-23;% Boltzman Constant
T = 300;% Temperature of the molecule
m = 5.31e-26; % mass of the oxygen molecule
sigma = sqrt((k*T)/m);% standard deviation of norma distribution
x = 20*rand(N,1)-10;% initial x axis position for every molecules
y = 20*rand(N,1)-10;% initial y axis position for every...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here