Difference between revisions of "Multiple reactions  2013"
Jump to navigation
Jump to search
Kevin Dunn (talk  contribs) m 
Kevin Dunn (talk  contribs) m 

Line 133:  Line 133:  
grid on  grid on  
</syntaxhighlight>  </syntaxhighlight>  
=== 14 March 2013 ===  
{ class="wikitable"  
  
! MATLAB  
! Polymath  
  
  
<syntaxhighlight lang="matlab">  
</syntaxhighlight>  
  
<syntaxhighlight lang="text">  
k1 = 0.014 # L^{0.5} / mol^{0.5} / s  
k2 = 0.007 # L/(mol.s)  
k3 = 0.14 # 1/s  
k4 = 0.45 # L/(mol.s)  
alpha = 0.002 # 1/L  
CT0 = 1.0 # mol/L  
FA0 = 10 # mol/s  
FB0 = 5.0 # mol/s  
FT0 = FA0 + FB0  
# Concentration functions (isothermal conditions)  
CA = CT0 * FA/FT * y  
CB = CT0 * FB/FT * y  
CC = CT0 * FC/FT * y  
CD = CT0 * FD/FT * y  
CE = CT0 * FE/FT * y  
CG = CT0 * FG/FT * y  
CW = CT0 * FW/FT * y  
FT = FA + FB + FC + FD + FE + FW + FG  
# Reaction 1: A + 0.5B > C  
r1A = k1*(CA)*(CB)^(0.5)  
r1B = 0.5*r1A  
r1C = r1A  
# Reaction 2: 2A > D  
r2A = k2*(CA)^2  
r2D = r2A/2  
# Reaction 3: C > E + W  
r3C = k3*(CC)  
r3E = r3C  
r3W = r3C  
# Reaction 4: D + W > G + C  
r4D = k4*(CD)*(CW)  
r4W = r4D  
r4G = r4D  
r4C = r4D  
# ODE's  
d(FA) / d(W) = r1A + r2A  
FA(0) = 10  
d(FB) / d(W) = r1B  
FB(0) = 5  
d(FC) / d(W) = r1C + r3C + r4C  
FC(0) = 0  
d(FD) / d(W) = r2D + r4D  
FD(0) = 0  
d(FE) / d(W) = r3E  
FE(0) = 0  
d(FW) / d(W) = r3W + r4W  
FW(0) = 0  
d(FG) / d(W) = r4G  
FG(0) = 0  
W(0) = 0 # kg  
W(f) = 500 # kg  
Yield_C = if (W>0.001) then (FC / (FA0  FA)) else (0)  
S_CE = if (W>0.001) then (FC/FE) else (0)  
S_CD = if (W>0.001) then (FC/FD) else (0)  
d(y) / d(W) = alpha/(2*y) * (FT / FT0)  
y(0) = 1.0  
</syntaxhighlight>  
} 
Revision as of 22:58, 14 March 2013
Class date(s):  06 March  
 
 
 
 
Textbook references
 F2011: Chapter 8
 F2006: Chapter 6
Suggested problems
Will be posted soon
Class materials
06 March 2013 (08B2)
07 March 2013
Polymath code for example in class. Make sure you plot the instantaneous selectivity, overall selectivity and yield over time. Compare these 3 plots during the batch to understand what each of these 3 variables mean.
# ODEs
d(CA) / d(t) = k1*CA
d(CB) / d(t) = k1*CA  k2*CB
d(CC) / d(t) = k2*CB
# Initial conditions
CA(0) = 2 # mol/L
CB(0) = 0 # mol/L
CC(0) = 0 # mol/L
# Algebraic equations
k1 = 0.5 # 1/hr
k2 = 0.2 # 1/hr
# The 3 important algebraic variables: plot these 3 against time and interpret them.
S_DU = if (t>0.001) then (k1*CA  k2*CB) / (k2*CB) else 0
Overall_SDU = if (t>0.001) then CB/CC else 0
Yield = if (t>0.001) then CB / (2  CA) else 0
# Independent variable details
t(0) = 0
t(f) = 3.1 # hours
11 March 2013
13 March 2013
Code for the CSTR example:
tau = 0:0.05:10;
CA0 = 2; % mol/L
k1 = 0.5; % 1/hr
k2 = 0.2; % 1/hr
CA = CA0 ./ (1 + k1 .* tau);
CB = tau .* k1 .* CA ./ (1 + k2 .* tau);
CC = tau .* k2 .* CB;
instant_selectivity = (k1.*CA  k2.*CB) ./ (k2.*CB);
overall_selectivity = CB ./ CC;
overall_yield = CB ./ (CA0  CA);
conversion = (CA0  CA)./CA0;
plot(tau, CA, tau, CB, tau, CC)
grid on
xlabel('\tau')
ylabel('Concentrations [mol/L]')
figure
plot(tau, overall_selectivity)
xlabel('\tau')
ylabel('Overall Selectivity')
grid on
figure
plot(tau, overall_yield)
xlabel('\tau')
ylabel('Overall Yield')
grid on
figure
plot(tau, conversion)
xlabel('\tau')
ylabel('Conversion')
hold on
grid on
14 March 2013
MATLAB  Polymath 

k1 = 0.014 # L^{0.5} / mol^{0.5} / s
k2 = 0.007 # L/(mol.s)
k3 = 0.14 # 1/s
k4 = 0.45 # L/(mol.s)
alpha = 0.002 # 1/L
CT0 = 1.0 # mol/L
FA0 = 10 # mol/s
FB0 = 5.0 # mol/s
FT0 = FA0 + FB0
# Concentration functions (isothermal conditions)
CA = CT0 * FA/FT * y
CB = CT0 * FB/FT * y
CC = CT0 * FC/FT * y
CD = CT0 * FD/FT * y
CE = CT0 * FE/FT * y
CG = CT0 * FG/FT * y
CW = CT0 * FW/FT * y
FT = FA + FB + FC + FD + FE + FW + FG
# Reaction 1: A + 0.5B > C
r1A = k1*(CA)*(CB)^(0.5)
r1B = 0.5*r1A
r1C = r1A
# Reaction 2: 2A > D
r2A = k2*(CA)^2
r2D = r2A/2
# Reaction 3: C > E + W
r3C = k3*(CC)
r3E = r3C
r3W = r3C
# Reaction 4: D + W > G + C
r4D = k4*(CD)*(CW)
r4W = r4D
r4G = r4D
r4C = r4D
# ODE's
d(FA) / d(W) = r1A + r2A
FA(0) = 10
d(FB) / d(W) = r1B
FB(0) = 5
d(FC) / d(W) = r1C + r3C + r4C
FC(0) = 0
d(FD) / d(W) = r2D + r4D
FD(0) = 0
d(FE) / d(W) = r3E
FE(0) = 0
d(FW) / d(W) = r3W + r4W
FW(0) = 0
d(FG) / d(W) = r4G
FG(0) = 0
W(0) = 0 # kg
W(f) = 500 # kg
Yield_C = if (W>0.001) then (FC / (FA0  FA)) else (0)
S_CE = if (W>0.001) then (FC/FE) else (0)
S_CD = if (W>0.001) then (FC/FD) else (0)
d(y) / d(W) = alpha/(2*y) * (FT / FT0)
y(0) = 1.0
