Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

The first order reactions A B C occurs within a tank. The rate constants are k 1=0.

1 hr-1,
k2=0.2 hr-1 and k3=0.1 hr-1for A B, B C and C B, respectively. The initial concentrations
of species are CA0=5 M and CB0=CC0=0.
a) Derive the set of differential equations describing the change in concentration three
species in the tank.

b) Solve the system of equations and plot the change in concentration of each species over
time (in the same figure) by using MATLAB. Select an appropriate time interval for the
integration.

MATLAB Code;
%CHE 386 - HW 2-question 1-b
%Pnar ALP, Gizem BAYRAM, Semra TUNCAY
close all
clear all
format compact
format long
clc
tic
% time interval for the integration can be taken as an input
Tfinal = input('Please give an end time [hr]: ');
k1=1;
k2=2;
k3=1;
Ca0=5;
Cb0=0;
Cc0=0;

options = odeset('RelTol',1e-10,'AbsTol',[1e-10 1e-10 1e-15]);


[T, C]= ode23(@(t,C) concfuntttt(t,C,k1,k2,k3) ,[0 Tfinal],[Ca0 Cb0 Cc0],options);
%calculating the max Cb and the time where Cb is max
maxCb=max(C(:,2));
j=1;
while abs(max(C(:,2))-C(j,2))>=0.005
j=j+1;
end
tmaxCbhr=T(j); %hour
tmaxCbmin=T(j)*60;%minute
%calculating the time of balance
h=1;
while C(h,1)>=0.005
if h< length(T)
h=h+1;
timeofbalance=T(h);%hr
else
timeofbalance=Tfinal;
disp('Concentrations have not reached to balance yet')
break
end
2

end
maxi=max(C);
maxim=max(maxi);
if timeofbalance==Tfinal
figure
plot(T,C(:,1),'-',T,C(:,2),'-.',T,C(:,3),'--')
title('Concentration vs Time')
grid on
%no matter what you enter as Tfinal the graph shows the appropriate time interval
%where concentrations reached balance and easy to be seen on the graph
xlim([0 round(timeofbalance)])
ylim([0 round(maxim+0.5)])
legend('Ca(t)','Cb(t)','Cc(t)')
xlabel('Time [hr]')
ylabel('Concentration [M]')
else
figure
plot(T,C(:,1),'-',T,C(:,2),'-.',T,C(:,3),'--')
title('Concentration vs Time')
grid on
%no matter what you enter as Tfinal the graph shows the appropriate time interval
%where concentrations reached balance and easy to be seen on the graph
xlim([0 round(timeofbalance+0.5)])
ylim([0 round(maxim+0.5)])
legend('Ca(t)','Cb(t)','Cc(t)')
xlabel('Time [hr]')
ylabel('Concentration [M]')
end
toc
The function (concfuntttt) that is used above is;
function dC=concfuntttt(t,C,k1,k2,k3)
dC=zeros(3,1);
dC(1)=-k1*C(1);
dC(2)=k1*C(1)-k2*C(2)+k3*C(3);
dC(3)=k2*C(2)-k3*C(3);
end

c) The rate constants for different reaction conditions, R1, R2 and R3, are given below.
Imagine that you will perform the experiments in different conditions with given initial
concentrations. Your aim is to obtain product B as much as possible. Before performing
the experiments, you want to model the system and simulate them in MATLAB. Run your
MATLAB code written in question b for the six experiments. Select an appropriate time
interval for the integration in each simulation. You will obtain six figures and comment
them. Write your comments below each figure, and answer below questions. Which
experiment condition (reaction condition and initial concentration) do you prefer for
achieving your aim? Why? How much time do you need for one batch?

For the 1st experiment the conditions are;


Experiment #

Conditions

k1, hr-1

k2, hr-1

k3, hr-1

CA0, M

CB0, M

CC0, M

R1

0.1

0.2

0.1

The graph drawn by using MATLAB is;

In the 1st experiment, reaction reaches to balance in about 7 hours and concentration of B reaches
to 1.67 M at the end of the reaction. k2 is higher than k3 which means conversion of B to C is
higher than conversion of C to B. At the end concentration of C is higher than B, thus this
experiment is more favorable for high concentration of C.

For the 2nd experiment the conditions are;


Experiment #

Conditions

k1, hr-1

k2, hr-1

k3, hr-1

CA0, M

CB0, M

CC0, M

R1

0.1

0.2

0.1

The graph drawn by using MATLAB is;

This experiment reaches to balance about same as experiment 1 in about 7 hours. Concentration
of B reaches to 3.3 M higher than the 1st experiment since although it has the same k values it has
extra 5M of C at the beginning. k2 is higher than k3 which means conversion of B to C is higher
than conversion of C to B. At the end concentration of C is higher than B, thus this experiment is
favorable for high concentration of C.

For the 3rd experiment the conditions are;


Experiment #

Conditions

k1, hr-1

k2, hr-1

k3, hr-1

CA0, M

CB0, M

CC0, M

R2

0.2

0.3

0.3

The graph drawn by using MATLAB is;

This experiment is reached to balance in about 3.5 hours shorter than first two experiments.
Concentration of B reaches to about 2.5M. It has higher concentration of B than 1st experiment
since they both have same start up conditions with 5M of A and 0 M of C at the beginning,
however k values are higher in the 3rd experiment. Although it has higher k values than 2nd
experiment, 2nd experiment reaches to higher concentration of B since it has 5M of both A and C
at the beginning whereas 3rd experiment has only A. k2 and k3 is equal to each other which means
the rate of conversion of C to B and B to C is equal to each other. This is not the best conditions
for higher concentration of B.

For the 4th experiment the conditions are;


Experiment #

Conditions

k1, hr-1

k2, hr-1

k3, hr-1

CA0, M

CB0, M

CC0, M

R2

0.2

0.3

0.3

The graph drawn by using MATLAB is;

This experiment is reached to balance in about 3.5 hours than first two experiments almost same
with the 3rd experiment. The concentration of B reaches to 5M. This experiment reaches to balance
since k1 is higher than it is in first two experiments and consumed faster however almost same
with the 3rd experiment since both of them have the same k values. Moreover k2 and k3 values are
higher as well. k2 and k3 is equal to each other which means the rate of conversion of C to B and B
to C is equal to each other. Since both k values are higher in this experiment than first two
concentration of B is higher at the end. The concentration of B is higher than experiment 3 since at
the beginning of the experiment there are 5M of both A and C, as they both converted to B.

For the 5th experiment the conditions are;


Experiment #

Conditions

k1, hr-1

k2, hr-1

k3, hr-1

CA0, M

CB0, M

CC0, M

R3

0.3

0.4

0.6

The graph drawn by using MATLAB is;

The reaction is reached to balance earlier than experiments 1, 2, 3 and 4 since k values are higher
than others. Moreover, as it can be seen from the graph, concentration of B is reached to 3M. It
should be noted that conversion of C to B is faster and more than conversion of B to C since k3 is
higher than k2 which increases the concentration of B makes it relatively higher. The
concentration of B is a little bit higher in the 2nd experiment since there are 5M of both A and B
at the beginning whereas there is only 5M of A in the beginning of the experiment 5 however
really close since k values are higher in the 5th experiment whereas the concentration of B is lot
higher in the 4th experiment since there are 5M of both A and B at the beginning whereas there is
only 5M of A in the beginning of the experiment 5 and k values are relatively closer. At the end
when the reaction reached to balance A is all used up, concentration of B is higher than C as
expected. About 2 hours needed for this batch to reach equilibrium.

For the 6th experiment the conditions are;


Experiment #

Conditions

k1, hr-1

k2, hr-1

k3, hr-1

CA0, M

CB0, M

CC0, M

R3

0.3

0.4

0.6

The graph drawn by using MATLAB is;

The reaction is reached to balance earlier than experiments 1, 2, 3 and 4 since k values are higher
than others. It is almost same with experiment 5 as the k values are the same. Moreover, as it can
be seen from the graph, concentration of B is reached to 6M, which is the highest of them all
although it has the same k vales as experiment 5. This result makes sense since at the beginning
of the reaction there are 5M of both A and C, as both of them is converted to B. Also conversion
of C to B is faster and more than conversion of B to C since k3 is higher than k2 which increases
the concentration of B makes it higher than others. At the end when the reaction reached to
balance A is all used up, concentration of B is higher than C as expected. About 2 hours needed
for this batch to reach equilibrium. This experiment has the best conditions for the higher
concentration of B.

10

The graph above shows 6 experiments on the same graph. Different colors indicates different
experiments such as black ones are the concentrations of experiment 6, green ones are the
concentrations of experiment 1 etc. Different shapes indicate the concentration of different
materials. As it can clearly be seen from the graphs experiments 5 and 6 used up A and reached
the equilibrium faster than experiments 3 and 4 which are faster than experiments 1 and 2. In
these experiments the aim is to produce most of the B. Straight lines that increases from 0
indicates concentration material B since there is no B in the beginning of the any experiment.
.the best condition for the material B is provided by 6th experiment. The last experiment reaches
balance statement faster and produces most of B. This result makes sense since there are5 M of
both A and C at the beginning of the reaction as both of them is converted to B. Moreover, k3 is
higher than k2, which indicates that C is converted to B faster than B is converted to C. The 6th
experiment which is favorable for the aim which is to get most of B, needs about 2 hours to
reach to balance.

11

Appendix
MATLAB code for question c;
%CHE 386 - HW 2-question 1-c
%Pnar ALP, Gizem BAYRAM, Semra TUNCAY
close all
clear all
format compact
format long
clc
tic
% time interval for the integration can be taken as an input
Tfinal = input('Please give an end time [hr]: ');
%Experimet 1
k1=1;
k2=2;
k3=1;
Ca0=5;
Cb0=0;
Cc0=0;
[ T, C,maxCb, tmaxCbhr,tmaxCbmin,timeofbalance,maxim] = experiment( k1,k2,k3,Ca0, Cb0,
Cc0,Tfinal);
%Experimet 2
k1=1;
k2=2;
k3=1;
Ca0=5;
Cb0=0;
Cc0=5;
[ T2, C2,maxCb2, tmaxCbhr2,tmaxCbmin2,timeofbalance2,maxim2]
k1,k2,k3,Ca0, Cb0, Cc0,Tfinal);
%Experimet 3
k1=2;
k2=3;
k3=3;
Ca0=5;
Cb0=0;
Cc0=0;
[ T3, C3,maxCb3, tmaxCbhr3,tmaxCbmin3,timeofbalance3,maxim3]
k1,k2,k3,Ca0, Cb0, Cc0,Tfinal);
%Experimet 4
k1=2;
k2=3;

experiment(

experiment(

12

k3=3;
Ca0=5;
Cb0=0;
Cc0=5;
[ T4, C4,maxCb4, tmaxCbhr4,tmaxCbmin4,timeofbalance4,maxim4]
k1,k2,k3,Ca0, Cb0, Cc0,Tfinal);
%Experimet 5
k1=3;
k2=4;
k3=6;
Ca0=5;
Cb0=0;
Cc0=0;
[ T5, C5,maxCb5, tmaxCbhr5,tmaxCbmin5,timeofbalance5,maxim5]
k1,k2,k3,Ca0, Cb0, Cc0,Tfinal);
%Experimet 6
k1=3;
k2=4;
k3=6;
Ca0=5;
Cb0=0;
Cc0=5;
[ T6, C6,maxCb6, tmaxCbhr6,tmaxCbmin6,timeofbalance6,maxim6]
k1,k2,k3,Ca0, Cb0, Cc0,Tfinal);

experiment(

experiment(

experiment(

timeofbalancee=[timeofbalance timeofbalance2 timeofbalance3 timeofbalance4 timeofbalance5


timeofbalance6];
timeofbalancem=max(timeofbalancee);
figure(7)
if timeofbalancem==Tfinal
plot(T,C(:,1),'g.',T,C(:,2),'g-',T,C(:,3),'g-.',...
T2,C2(:,1),'m.',T2,C2(:,2),'m-',T2,C2(:,3),'m-.',...
T3,C3(:,1),'c.',T3,C3(:,2),'c-',T3,C3(:,3),'c-.',...
T4,C4(:,1),'b.',T4,C4(:,2),'b-',T4,C4(:,3),'b-.',...
T5,C5(:,1),'r.',T5,C5(:,2),'r-',T5,C5(:,3),'r-.',...
T6,C6(:,1),'k.',T6,C6(:,2),'k-',T6,C6(:,3),'k-.')
title('Concentration vs Time')
grid on
maxime=[maxim maxim2 maxim3 maxim4 maxim5 maxim6];
maximem=max(maxime);
%no matter what you enter as Tfinal the graph shows the appropriate time interval
%where concentrations reached balance and easy to be seen on the graph
xlim([0 round(timeofbalancem) ])
ylim([0 round(maximem+0.5)])
legend('Ca(t)ex1','Cb(t)ex1','Cc(t)ex1',...
13

'Ca(t)ex2','Cb(t)ex2','Cc(t)ex2',...
'Ca(t)ex3','Cb(t)ex3','Cc(t)ex3',...
'Ca(t)ex4','Cb(t)ex4','Cc(t)ex4',...
'Ca(t)ex5','Cb(t)ex5','Cc(t)ex5',...
'Ca(t)ex6','Cb(t)ex6','Cc(t)ex6')
xlabel('Time [hr]')
ylabel('Concentration [M]')
else
plot(T,C(:,1),'g.',T,C(:,2),'g-',T,C(:,3),'g-.',...
T2,C2(:,1),'m.',T2,C2(:,2),'m-',T2,C2(:,3),'m-.',...
T3,C3(:,1),'c.',T3,C3(:,2),'c-',T3,C3(:,3),'c-.',...
T4,C4(:,1),'b.',T4,C4(:,2),'b-',T4,C4(:,3),'b-.',...
T5,C5(:,1),'r.',T5,C5(:,2),'r-',T5,C5(:,3),'r-.',...
T6,C6(:,1),'k.',T6,C6(:,2),'k-',T6,C6(:,3),'k-.')
title('Concentration vs Time')
grid on
timeofbalancee=[timeofbalance timeofbalance2 timeofbalance3 timeofbalance4 timeofbalance5
timeofbalance6];
timeofbalancem=max(timeofbalancee);
maxime=[maxim maxim2 maxim3 maxim4 maxim5 maxim6];
maximem=max(maxime);
%no matter what you enter as Tfinal the graph shows the appropriate time interval
%where concentrations reached balance and easy to be seen on the graph
xlim([0 round(timeofbalancem+0.5) ])
ylim([0 round(maximem+0.5)])
legend('Ca(t)ex1','Cb(t)ex1','Cc(t)ex1',...
'Ca(t)ex2','Cb(t)ex2','Cc(t)ex2',...
'Ca(t)ex3','Cb(t)ex3','Cc(t)ex3',...
'Ca(t)ex4','Cb(t)ex4','Cc(t)ex4',...
'Ca(t)ex5','Cb(t)ex5','Cc(t)ex5',...
'Ca(t)ex6','Cb(t)ex6','Cc(t)ex6')
xlabel('Time [hr]')
ylabel('Concentration [M]')
end
toc

The experiment function that is used above is;


function [ T, C,maxCb, tmaxCbhr,tmaxCbmin,timeofbalance, maxim] = experiment(
k1,k2,k3,Ca0, Cb0, Cc0,Tfinal)
options = odeset('RelTol',1e-10,'AbsTol',[1e-10 1e-10 1e-15]);
[T, C]= ode23(@(t,C) concfuntttt(t,C,k1,k2,k3) ,[0 Tfinal],[Ca0 Cb0 Cc0],options);
%calculating the max Cb and the time where Cb is max
14

maxCb=max(C(:,2));
j=1;
while abs(max(C(:,2))-C(j,2))>=0.005
j=j+1;
end
tmaxCbhr=T(j); %hour
tmaxCbmin=T(j)*60;%minute
maxi=max(C);
maxim=max(maxi);
h=1;
while C(h,1)>=0.005
if h< length(T)
h=h+1;
timeofbalance=T(h);%hr
else
disp('Concentrations have not reached to balance yet')
break
end
end
if timeofbalance==Tfinal
figure
plot(T,C(:,1),'-',T,C(:,2),'-.',T,C(:,3),'--')
title('Concentration vs Time')
grid on
%no matter what you enter as Tfinal the graph shows the appropriate time interval
%where concentrations reached balance and easy to be seen on the graph
xlim([0 round(timeofbalance)])
ylim([0 round(maxim+0.5)])
legend('Ca(t)','Cb(t)','Cc(t)')
xlabel('Time [hr]')
ylabel('Concentration [M]')
else
figure
plot(T,C(:,1),'-',T,C(:,2),'-.',T,C(:,3),'--')
title('Concentration vs Time')
grid on
%no matter what you enter as Tfinal the graph shows the appropriate time interval
%where concentrations reached balance and easy to be seen on the graph
xlim([0 round(timeofbalance+0.5)])
ylim([0 round(maxim+0.5)])
legend('Ca(t)','Cb(t)','Cc(t)')
xlabel('Time [hr]')
ylabel('Concentration [M]')
15

end
end
The function (concfuntttt) that is used in the experiment function is;
function dC=concfuntttt(t,C,k1,k2,k3)
dC=zeros(3,1);
dC(1)=-k1*C(1);
dC(2)=k1*C(1)-k2*C(2)+k3*C(3);
dC(3)=k2*C(2)-k3*C(3);
end

16

You might also like