You are on page 1of 9

Homework #9

December 1, 2021
CHE 492 - Computer Methods in Chemical Engineering - Dr. Jason Bara
By: Abdulaziz Alhouti

1. Question 1:

1.1. Objective:
The first problem asks us to determine the rate constants of 3 reactions where the initial and
final concentrations of some chemical species are given. A MATLAB script was developed in
order to determine the variation of reactants and products with time and the trial and error as
well as the midpoint method were used to estimate these constants.

1.2. Methods:
To solve this problem 3 rate constants were defined as k1, k2 and k3 respectively
representing the rate constants of reactions 1, 2 and 3 respectively. In order to determine these
constants, the concentration of the reactants and products needed to be plotted vs. time. The
variation of the concertation of the chemical species were inserted as differential equations as
a function of time using the expression f = @(t,y) rendering y as a matrix form collecting
concentration calculations. The concertation of the chemical species were inserted through the
following equations:

𝑑[𝐶2 𝐻6 ]
−𝑘1 [𝐶2 𝐻6 ] − 𝑘2 [𝐶2 𝐻6 ][𝐻2 ] − 𝑘3 [𝐶2 𝐻6 ][𝐶2 𝐻4 ] = − 𝑒𝑞. 1
𝑑𝑡

𝑑[𝐶2 𝐻4 ]
𝑘1 [𝐶2 𝐻6 ] − 𝑘3 [𝐶2 𝐻6 ][𝐶2 𝐻4 ] = − 𝑒𝑞. 2
𝑑𝑡

𝑑[𝐻2 ]
𝑘1 [𝐶2 𝐻6 ] − 𝑘2 [𝐶2 𝐻6 ][𝐻2 ] = − 𝑒𝑞. 3
𝑑𝑡

𝑑[𝐶𝐻4 ]
𝑘2 [𝐶2 𝐻6 ][𝐻2 ] + 𝑘3 [𝐶2 𝐻6 ][𝐶2 𝐻4 ] = − 𝑒𝑞. 4
𝑑𝑡

𝑑[𝐶3 𝐻6 ]
𝑘3 [𝐶2 𝐻6 ][𝐻2 ] = − 𝑒𝑞. 5
𝑑𝑡

The initial concentrations of the reactants and products were defined as parameters and the
MATLAB script was run numerous times using trial and error as well the midpoint method till
the required final concentrations were reached thus obtaining approximate values of the rate
constants. The full MATALAB script of the code used to determine the rate constants of the
given chemical reactions is found in Appendix A.

1
1.3. Results:
The value of k3 was first determined since the chemical species 𝐶3 𝐻6 was a function of this
single parameter making it the most logical option to start with. The MATLAB script was
tested for several trials until the value of k3 was determined and was equal to equal to 0.00042
where the required final concentration of 𝐶3 𝐻6 was reached. The value of k2 was then set as
that of k3. Finally, applying the previously mentioned method, the value of k1 was
determined and found to be equal to 0.00248 where the final concentration of 𝐶2 𝐻4 was equal
to 1.5 mol/L. The variation of the concentrations of 𝐶2 𝐻6, 𝐶2 𝐻4 and 𝐶3 𝐻6 vs. time are
represented in Figure 1 below.

Figure 1. The variation of the concentrations of the 3 chemical species 𝐶2 𝐻6 (blue legend), 𝐶2 𝐻4
(red legend) and 𝐶3 𝐻6 (yellow legend) vs. time
As can be seen in Figure 1 above, the concentrations of 𝐶2 𝐻6 , 𝐶2 𝐻4 and 𝐶3 𝐻6 as a function of
time were plotted where the final concentrations of 𝐶2 𝐻6 and 𝐶3 𝐻6 were equal to 1.5 mol/L
and 0.25 mol/L respectively indicating a close approximation of the rate constants.
1.4. Discussion
The trial and error method incorporated with the midpoint method did give us approximate
results, however, it was time consuming. Further development can be implemented into this
MATLAB script where approximative and iterative methods could be used saving time and
energy for the user as well as giving more accurate and precise results.

2
2. Question 2:
2.1. Objective:
The second problem asks us to develop a MATLAB script that evaluates the complete
combustion reaction of hydrocarbons including alkanes, alkenes and alkynes. The wet and dry
basis of the combustion gases were evaluated as well.

2.2. Methods:
The code was configured to ask an input of a hydrocarbon from the user. The molecular formula
as well as the number of carbon and hydrogen atoms of the species entered were then
determined using case conditional statements. The molecular formula, number of carbon and
hydrogen atoms were represented by the variables MF, x and y respectively thus giving the
general form of the hydrocarbon as 𝐶𝑥 𝐻𝑦 . The stoichiometric mol ratios of oxygen, air, carbon
dioxide and water were then determined by assigning the values of each as follows:
𝑦
𝑛𝑂2 = 𝑥 +
4
𝑛𝑂2
𝑛𝑎𝑖𝑟 =
0.21
𝑛𝐶𝑂2 = 𝑥
𝑦
𝑛 𝐻2 𝑂 =
2

The complete combustion reaction is then configured and displayed in the following form:
𝑦 𝑦
𝐶𝑥 𝐻𝑦 + (𝑥 + ) 𝑂2 → (𝑥)𝐶𝑂2 + ( ) 𝐻2 𝑂
4 2

The dry and wet basis are finally determined where the dry basis is based on the number of
moles of carbon dioxide formed solely whereas the wet basis is that of the number of moles of
carbon dioxide and water formed. The full MATALAB script can be found in Appendix B.

2.3. Results:
I tested the MATLAB script for several runs varying the inputs from alkanes to alkenes and
alkynes as well as invalid inputs. The code performed greatly as it gave accurate results when
the input was valid providing the user with the overall heat combustion reaction, stochiometric
air ratio as well as the dry and wet basis of combustion gases formed. Figures 2, 3 and 4
represent 3 cases where an alkane, alkene, and alkyne were chosen as inputs respectively.

3
Input name of alkane: pentane

pentane C5H12

Complete combustion reaction:

C5H12 + 8O2 = 5CO2 + 6H2O

Stoichiometric air ratio needed for complete combustion = 38.0952

Dry Basis of Effluent gases constituted of pure CO2 where nCO2 = 5

Wet Basis = 0.454545 mol percent CO2 0.545455 mol percent H2O where nCO2 = 5 and nH2O = 6>>

Figure 2. Combustion reaction of pentane

Input name of alkane: pentene

pentene C5H10

Complete combustion reaction:

C5H10 + 7.5O2 = 5CO2 + 5H2O

Stoichiometric air ratio needed for complete combustion = 35.7143

Dry Basis of Effluent gases constituted of pure CO2 where nCO2 = 5

Wet Basis = 0.5 mol percent CO2 0.5 mol percent H2O where nCO2 = 5 and nH2O = 5>>

Figure 3. Combustion reaction of pentene

Input name of alkane: pentyne

pentyne C5H8

Complete combustion reaction:

C5H8 + 7O2 = 5CO2 + 4H2O

Stoichiometric air ratio needed for complete combustion = 33.3333

Dry Basis of Effluent gases constituted of pure CO2 where nCO2 = 5

Wet Basis = 0.555556 mol percent CO2 0.444444 mol percent H2O where nCO2 = 5 and nH2O = 4>>

Figure 4. Combustion reaction of pentyne


Figures 2, 3 and 4 above represent the combustion reactions of pentane, pentene and pentyne
respectively where the reaction of pentane seems to require the most amount of oxygen for
combustion among the others.

2.4. Discussion:
This problem gave great insight on the combustion reactions of hydrocarbons where it
revealed alkanes consume the most oxygen followed by alkenes and alkynes. This is
due to fact that alkanes are heavier molecules than their attributes. Finally, further
development can be implemented into this program providing the user with the amount
of heat released from each reaction.

4
3. New Question:

Write a MATLAB code to help the user evaluate the heat loss in copper vs aluminum
conduction wires for a length of 1 m and a diameter of 1 inch.

5
Appendix A
A.1: Full script used to determine the rate constants of 3 reactions
occurring simultaneously.

A.1: Full script used to determine the rate constants of 3 reactions occurring simultaneously:
k1 = 0.00215; % set rate
constant k1
k2 = 0.00019; % set rate
constant k2
k3 = 0.00019; % set rate
constant k3
f = @(t,y)[-k1*y(1) - k2*y(1)*y(2) - k3*y(1)*y(3); k1*y(1) - k3*y(1)*y(2);
k1*y(1) - k2*y(1)*y(3); k2*y(1)*y(3) + k3*y(1)*y(2); k3*y(1)*y(2)]; %
define differential equations
tspan = [0 250]; % set interval
of integration
% set initial conditions for reactants
Ao = 4; % C2H6 at t=0
Bo = 0; % H2 at t=0
Co = 0; % C2H4 at t=0
Do = 0; % C3H6 at t=0
Eo = 0; % CH4 at t=0
y0 = [Ao; Bo; Co; Do; Eo]; % set vector of
initial values
[t, y] = ode45(f,tspan,y0); % call
integrator
plot(t,y(:,1),'-o',t,y(:,3),'-o',t,y(:,4),'-o') %Plot C2H6,
C2H4, C3H6 vs time

1A
Appendix B
B.1: Full script used to showcase the complete combustion reaction
of alkanes, alkenes, and alkynes.

B.1: Full script used to showcase the complete combustion reaction of alkanes, alkenes, and alkynes:
clc
HYDROCARBON = input('Input name of alkane: ', 's'); %request input from the user

switch HYDROCARBON %evaluate the molecular formula of the chosen hydrocarbon as well as the
number of carbon and hydrogen atoms
case 'methane' %alkanes from C1 to C10
MF = 'CH4';
x = 1;
y = 4;
case 'ethane'
MF = 'C2H6';
x = 2;
y = 6;
case 'propane'
MF = 'C3H8';
x = 3;
y = 8;
case 'butane'
MF = 'C4H10';
x = 4;
y = 10;
case 'pentane'
MF = 'C5H12';
x = 5;
y = 12;
case 'hexane'
MF = 'C6H14';
x = 6;
y = 14;
case 'heptane'
MF = 'C7H16';
x = 7;
y = 16;
case 'octane'
MF = 'C8H18';
x = 8;
y = 18;
case 'nonane'
MF = 'C9H20';
x = 9;
y = 20;
case 'decane'
MF = 'C10H22';
x = 10;
y = 22;
case 'ethene' %alkenes from C1 to C10
MF = 'C2H4';
x = 2;
y = 4;
case 'propene'
MF = 'C3H6';
x = 3;
y = 6;
case 'butene'
MF = 'C4H8';

1A
x = 4;
y = 8;
case 'pentene'
MF = 'C5H10';
x = 5;
y = 10;
case 'hexene'
MF = 'C6H12';
x = 6;
y = 12;
case 'heptene'
MF = 'C7H14';
x = 7;
y = 14;
case 'octene'
MF = 'C8H16';
x = 8;
y = 16;
case 'nonene'
MF = 'C9H18';
x = 9;
y = 18;
case 'decene'
MF = 'C10H20';
x = 10;
y = 20;
case 'ethyne' %alkynes from C1 to C10
MF = 'C2H2';
x = 2;
y = 2;
case 'propyne'
MF = 'C3H4';
x = 3;
y = 4;
case 'butyne'
MF = 'C4H6';
x = 4;
y = 6;
case 'pentyne'
MF = 'C5H8';
x = 5;
y = 8;
case 'hexyne'
MF = 'C6H10';
x = 6;
y = 10;
case 'septyne'
MF = 'C7H12';
x = 7;
y = 12;
case 'octyne'
MF = 'C8H14';
x = 8;
y = 14;
case 'nonyne'
MF = 'C9H16';
x = 9;
y = 16;
case 'decyne'
MF = 'C10H18';
x = 10;
y = 18;

otherwise
disp('Invalid input, please try again')
return
end
fprintf('%s\t %s\n',HYDROCARBON, MF)
nO2 = x+y/4; %stochiometric ratio of oxygen
nCO2 = x; %stochiometric ratio of carbon dioxide
2A
nH2O = y/2; %stochiometric ratio of water
fprintf('Complete combustion reaction:\n')
fprintf('C%gH%g + %gO2 = %gCO2 + %gH2O\n',x,y,nO2,nCO2,nH2O) %display the overall combustion
reaction
nair = (x+y/4)/0.21; %stochiometric air ratio where O2 constitutes 21% of air
fprintf('Stoichiometric air ratio needed for complete combustion = %g \n',nair)
fprintf('Dry Basis of Effluent gases constituted of pure CO2 where nCO2 = %g \n',nCO2) %only CO2
mol fraction is considered
fprintf('Wet Basis = %g mol percent CO2\t %g mol percent H2O\t where nCO2 = %g and nH2O = %g',
x/(x+y/2), y/2/(x+y/2), nCO2, nH2O) %water and CO2 are considered

3A

You might also like