5 CALCULATION OF THE CONCENTRATION PROFILES: CASE II, COMPLEX MECHANISMS
Tải bản đầy đủ - 0trang
DK4712_C007.fm Page 242 Thursday, February 2, 2006 9:41 AM
242
Practical Guide to Chemometrics
[A]0
Slope = [A
]0
[A]1
Slope = [A
]1
[A]2
Slope = [A
]2
[A]3
t0
t1
t2
t3
FIGURE 7.12 Euler’s method for numerical integration.
(according to MATLAB’s symbolic toolbox). However, knowing the rate law and
concentrations at any time, one can calculate the derivatives of the concentrations
of A and B at this time numerically.
[ A] = −2k+ [ A]2 + 2k− [ B]
(7.28)
[ B] = k+ [ A]2 − k− [ B]
Euler’s method [15, 28] represented in Figure 7.12 is the simplest way to perform
this task. Because of its simplicity it is ideally suited to demonstrate the general
principles of the numerical integration of ordinary differential equations.
Starting at time t0, the initial concentrations are [A]0 and [B]0; the derivatives [ A]0 and
[ B]0 are calculated according to Equation 7.28. This allows the computation of new
concentrations, [A]1 and [B]1, for the species A and B after a short time interval Dt = t1 – t0.
[ A]1 = [ A]0 + ∆t[ A]0
(7.29)
[ B]1 = [ B]0 + ∆t[ B]0
These new concentrations in turn allow the determination of new derivatives and
thus another set of concentrations [A]2 and [B]2 after the second time interval t2 – t1.
As shown in Figure 7.12, this procedure is simply repeated until the desired final
reaction time is reached.
With Euler’s simple method, very small time intervals must be chosen to achieve
reasonably accurate profiles. This is the major drawback of this method and there
are many better methods available. Among them, algorithms of the Runge-Kutta
type [15, 28, 29] are frequently used in chemical kinetics [3]. In the following
subsection we explain how a fourth-order Runge-Kutta method can be incorporated
into a spreadsheet and used to solve nonstiff ODEs.
7.5.1 FOURTH-ORDER RUNGE-KUTTA METHOD
IN
EXCEL
The fourth order Runge-Kutta method is the workhorse for the numerical integration
of ODEs. Elaborate routines with automatic step-size control are available in
MATLAB. We will show their usage in several examples later.
© 2006 by Taylor & Francis Group, LLC
DK4712_C007.fm Page 243 Tuesday, January 31, 2006 12:04 PM
Kinetic Modeling of Multivariate Measurements with Nonlinear Regression
243
First, without explaining the details [15], we will develop an Excel spreadsheet
k
for the numerical integration of the reaction mechanism 2A k+ B , as seen in
−
Figure 7.13. The fourth-order Runge-Kutta method requires four evaluations of
concentrations and derivatives per step. This appears to be a serious disadvantage,
but as it turns out, significantly larger step sizes can be taken for the same accuracy,
and the overall computation times are much shorter. We will comment on the choice
of appropriate step sizes after this description.
We explain the computations for the first time interval ∆t (cell E5) between
t0 = 0 and t1 = 1, representative of all following intervals. Starting from the initial
concentrations [A]t 0 and [B]t0 (cells B5 and C5), the concentrations [A]t1 and [B]t1
(cells B6 and C6) can be computed in the following way:
1. Calculate the derivatives of the concentrations at t0:
[ A]t0 = −2k+ [ A]t2 + 2k− [ B]t0
0
[ B]t0 = k+ [ A]t2 − k− [ B]t0
0
In the Excel language, for A, this translates into = −2*$B$1*B5^2+2*
$B$2*C5, as indicated in Figure 7.13. Note, in the figure we only give
the cell formulae for the computations of component A; those for B are
written in an analogous way.
2. Calculate approximate concentrations at intermediate time point t = t0 + ∆t/2:
[ A]1 = [ A]t +
∆t
[ A]0
2
[ B]1 = [ B]t +
∆t
[ B]0
2
0
0
Again, the Excel formula for component A is given in Figure 7.13.
3. Calculate the derivatives at intermediate time point t = t0 + ∆t/2:
[ A]1 = −2k+ [ A]12 + 2k− [ B]1
[ B]1 = k+ [ A]12 − k− [ B]1
4. Calculate another set of concentrations at the intermediate time point
t = t0 + ∆t/2, based on the concentrations at t0 but using the derivatives
[ A]1 and [ B]1:
[ A]2 = [ A]t +
∆t
[ A]1
2
[ B]2 = [ B]t +
∆t
[ B]1
2
0
0
© 2006 by Taylor & Francis Group, LLC
=B5+E5/2*J5
=-2*$B$1*B5^2+2*$B$2*C5
=-2*$B$1*L5^2+2*$B$2*M5
=B5+E5/2*F5
=B5+E5*N5
=-2*$B$1*H5^2+2*$B$2*I5
=-2*$B$1*P5^2+2*$B$2*Q5
FIGURE 7.13 Excel spreadsheet for the numerical integration of the rate law for the reaction 2A
Runge-Kutta equations.
© 2006 by Taylor & Francis Group, LLC
k+
k−
B using fourth-order
Practical Guide to Chemometrics
=A6-A5
DK4712_C007.fm Page 244 Tuesday, January 31, 2006 12:04 PM
244
=B5+E5/6*(F5+2*J5+2*N5+R5)
DK4712_C007.fm Page 245 Tuesday, January 31, 2006 12:04 PM
Kinetic Modeling of Multivariate Measurements with Nonlinear Regression
245
5. Compute another set of derivatives at the intermediate time point t = t0 + ∆t/2:
[ A]2 = −2k+ [ A]22 + 2k− [ B]2
[ B]2 = k+ [ A]22 − k− [ B]2
6. Next, the concentrations at time t1 after the complete time interval ∆t =
t1 − t0 are computed based on the concentrations at time t0 and the
derivatives [ A]2 , [ B]2 , at time t = t0 + ∆t/2:
[ A]3 = [ A]t + ∆t[ A]2
0
[ B]3 = [ B]t + ∆t[ B]2
0
7. Computation of the derivatives at time t1:
[ A]3 = −2k+ [ A]32 + 2k− [ B]3
[ B]3 = k+ [ A]32 − k− [ B]3
8. Finally, the new concentrations after the full time interval ∆t = t1 − t0 are
computed as:
[ A]t = [ A]t +
∆t
([ A]t + 2[ A]1 + 2[ A]2 + [ A]3 )
0
6
[ B]t = [ B]t +
∆t
([ B]t + 2[ B]1 + 2[ B]2 + [ B]3 )
0
6
1
1
0
0
These concentrations are put as the next elements into cells B6 and C6 and
provide the new start concentrations to repeat steps 1 through 8 for the
next time interval ∆t (cell E6) between t1 = 1 and t2 = 2.
Figure 7.14 displays the resulting concentration profiles for species A and B.
For fast computation, the determination of the best step size (interval) is crucial.
Steps that are too small result in correct concentrations at the expense of long
computation times. On the other hand, intervals that are too big save computation
time but result in poor approximation. The best intervals lead to the fastest computation of concentration profiles within the predefined error limits. The ideal step size
is not constant during the reaction and thus needs to be adjusted continuously.
One particular class of ordinary differential equation solvers (ODE-solvers)
handles stiff ODEs and these are widely known as stiff solvers. In our context, a
system of ODEs sometimes becomes stiff if it comprises very fast and also very
slow steps or relatively high and low concentrations. A typical example would be
an oscillating reaction. Here, a highly sophisticated step-size control is required to
achieve a reasonable compromise between accuracy and computation time. It is well
outside the scope of this chapter to expand on the intricacies of modern numerical
© 2006 by Taylor & Francis Group, LLC
DK4712_C007.fm Page 246 Tuesday, January 31, 2006 12:04 PM
246
Practical Guide to Chemometrics
1
Concentration
0.8
0.6
0.4
0.2
0
0
2
4
6
Time
8
10
k
FIGURE 7.14 Concentration profiles for a reaction 2A k+ B ( A, … B) as modeled in
−
Excel using a fourth-order Runge-Kutta for numerical integration.
integration routines. MATLAB provides an excellent selection of routines for this
task. For further reading, consult the relevant literature and the MATLAB manuals
[15, 28, 29].
7.5.2 INTERESTING KINETIC EXAMPLES
Next, we will look into various kinetic examples of increasing complexity and
determine solely concentration profiles (C). This can be seen as kinetic simulation,
since the calculations are all based on known sets of rate constants. Naturally, in an
iterative fitting process of absorbance, data on these parameters would be varied
until the sum of the squared residuals between measured absorbances (Y) and BeerLambert’s model (C × A) is at its minimum.
7.5.2.1 Autocatalysis
Processes are called autocatalytic if the products of a reaction accelerate their own
formation. An extreme example would be a chemical explosion. In this case, it is
usually not a chemical product that directly accelerates the reaction; rather, it is the
heat generated by the reaction. The more heat produced, the faster is the reaction;
and the faster the reaction, the more heat that is produced, etc.
A very basic autocatalytic reaction scheme is presented in Equation 7.30.
1
→B
A
k
A + B → 2 B
k2
© 2006 by Taylor & Francis Group, LLC
(7.30)
DK4712_C007.fm Page 247 Tuesday, January 31, 2006 12:04 PM
Kinetic Modeling of Multivariate Measurements with Nonlinear Regression
247
1
Concentration (M)
0.8
0.6
0.4
0.2
0
0
5
10
Time (s)
15
20
1
FIGURE 7.15 Concentration profiles for the autocatalytic reaction A
→ B; A + B
k2
→ 2B.
k
Starting with component A, there is a relatively slow first reaction to form the
product B. The development of component B opens another path for its formation
in the second reaction, which is of the order two. Therefore, the higher the concentration
of B, the faster is the decomposition of A to form more B.
[ A] = − k1[ A] − k2 [ A][ B]
[ B] = − k1[ A] + k2 [ A][ B]
(7.31)
Figure 7.15 shows the calculated corresponding concentration profiles using the
rate constants k1 = 10−4 s−1 and k2 = 1 M−1s−1 for initial concentrations [A]0 = 1 M
and [B]0 = 0 M. We used MATLAB’s Runge–Kutta-type ODE-solver ode45. In
MATLAB Example 7.6b, the function is given that generates the differential equations. It is repeatedly called by the ODE-solver in MATLAB Example 7.6a.
MATLAB Example 7.6a
% autocatalysis
% A --> B
% A + B --> 2 B
c0=[1;0];
% initial conc of A and B
k=[1e-4;1];
% rate constants k1 and k2
[t,C]=ode45('ode_autocat',20,c0,[],k); call ode-solver
plot(t,C)
% plotting C vs t
© 2006 by Taylor & Francis Group, LLC
DK4712_C007.fm Page 248 Tuesday, January 31, 2006 12:04 PM
248
Practical Guide to Chemometrics
MATLAB Example 7.6b
function c_dot=ode_autocat(t,c,flag,k)
% A --> B
% A + B --> 2 B
c_dot(1,1)=-k(1)*c(1)-k(2)*c(1)*c(2);
% A_dot
c_dot(2,1)= k(1)*c(1)+k(2)*c(1)*c(2);
% B_tot
7.5.2.2 Zeroth-Order Reaction
Zeroth-order reactions do not really exist; they are always macroscopically observed
reactions only where the rate of the reaction is independent of the concentrations of
the reactants. Formally, the ODE is:
[ A] = − k[ A]0 = − k
(7.32)
A simple mechanism that mimics a zeroth-order reaction is the catalytic transformation of A to C. A reacts with the catalyst Cat to form an intermediate activated
complex B. B in turn reacts further to form the product C, releasing the catalyst,
which in turn continues reacting with A.
1
A + Cat
→B
k
(7.33)
B → C + Cat
k2
The total concentration of catalyst is much smaller than the concentrations of
the reactants or products. Note that, in real systems, the reactions are reversible and
usually there are more intermediates, but for the present purpose this minimal
reaction mechanism is sufficient.
[ A] = − k1[ A][Cat ]
[Cat ] = − k1[ A][Cat ] + k2 [ B]
[ B] = k1[ A][Cat ] − k2 [ B]
(7.34)
[C ] = k2 [ B]
The production of C is governed by the amount of intermediate B, which is constant
over an extended period of time. As long as there is an excess of A with respect to
the catalyst, essentially all of the catalyst exists as complex, and thus this concentration is constant. The crucial differential equation is the last one; it is a zerothorder reaction as long as [B] is constant.
© 2006 by Taylor & Francis Group, LLC
DK4712_C007.fm Page 249 Tuesday, January 31, 2006 12:04 PM
Kinetic Modeling of Multivariate Measurements with Nonlinear Regression
249
1
Concentration (M)
0.8
0.6
0.4
0.2
0
0
50
100
Time (s)
150
200
1
2
FIGURE 7.16 Concentration profiles for the reaction A + Cat
→ B; B
→ C + Cat.
The reaction is zeroth order for about 100 s.
k
k
The kinetic profiles displayed in Figure 7.16 have been integrated numerically
with MATLAB’s stiff solver ode15s using the rate constants k1 = 1000 M−1s−1, k2 =
100 s−1 for the initial concentrations [A]0 = 1 M, [Cat]0 = 10−4 M, and [B]0 = [C]0 =
0 M. For this model, the standard Runge-Kutta routine is far too slow and thus useless.
In MATLAB Example 7.7b, the function is given that generates the differential equations. It is repeatedly called by the ODE-solver in MATLAB Example 7.7a.
MATLAB Example 7.7a
% 0th order kinetics
% A + Cat --> B
% B --> C + Cat
c0=[1;1e-4;0;0];
% initial conc of A, Cat, B and C
k=[1000;100];
% rate constants k1 and k2
[t,C] = ode15s('ode_zero_order',200,c0,[],k);
plot(t,C)
% call ode-solver
% plotting C vs t
MATLAB Example 7.7b
function c_dot=ode_zero_order(t,c,flag,k)
% 0th order kinetics
% A + Cat --> B
% B --> C + Cat
c_dot(1,1)=-k(1)*c(1)*c(2);
% A_dot
c_dot(2,1)=-k(1)*c(1)*c(2)+k(2)*c(3);
% Cat_dot
c_dot(3,1)= k(1)*c(1)*c(2)-k(2)*c(3);
% B_dot
c_dot(4,1)= k(2)*c(3);
% C_dot
© 2006 by Taylor & Francis Group, LLC
DK4712_C007.fm Page 250 Tuesday, January 31, 2006 12:04 PM
250
Practical Guide to Chemometrics
7.5.2.3 Lotka-Volterra (Sheep and Wolves)
This example is not chemically relevant, but is all the more exciting. It models the
dynamics of a population of predators and preys in a closed system. Consider an
island with a population of sheep and wolves. In the first “reaction,” the sheep are
breeding. Note that there is an unlimited supply of grass and that this reaction could
go on forever. But there is the second “reaction,” where wolves eat sheep and breed
themselves. To complete the system, wolves have to die a natural death.
1
sheep
→ 2 sheep
k
2
wolf + sheep
→ 2 wolves
k
(7.35)
3
wolf
→ dead wolf
k
The following differential equations have to be solved:
[sheep] = k1[sheep] − k2 [ wolf ][sheep]
(7.36)
[ wolf ] = k2 [ wolf ][sheep] − k3[ wolf ]
The kinetic population profiles displayed in Figure 7.17 have been obtained by
numerical integration using MATLAB’s Runge-Kutta solver ode45 with the rate
constants k1 = 2, k2 = 5, k3 = 6 for the initial populations [sheep]0 = 2, [wolf]0 = 2.
For simplicity, we ignore the units. In MATLAB Example 7.8b, the function is given
that generates the differential equations. It is repeatedly called by the ODE-solver
in MATLAB Example 7.8a.
3.5
3
Population
2.5
2
1.5
1
0.5
0
0
2
4
6
Time
FIGURE 7.17 Lotka-Volterra’s predator and prey “kinetics.”
© 2006 by Taylor & Francis Group, LLC
8
10
DK4712_C007.fm Page 251 Tuesday, January 31, 2006 12:04 PM
Kinetic Modeling of Multivariate Measurements with Nonlinear Regression
251
MATLAB Example 7.8a
% lotka volterra
% sheep --> 2 sheep
% wolf + sheep --> 2 wolves
% wolf --> dead wolf
c0=[2;2];
% initial 'conc' of sheep and wolves
k=[2;5;6];
% rate constants k1, k2 and k3
[t,C] = ode45('ode_lotka_volterra',10,c0,[],k);
%call ode-solver
plot(t,C)
% plotting C vs t
MATLAB Example 7.8b
function c_dot=ode_lotka_volterra(t,c,flag,k)
% lotka volterra
% sheep --> 2 sheep
% wolf + sheep --> 2 wolves
% wolf --> dead wolf
c_dot(1,1)=k(1)*c(1)-k(2)*c(1)*c(2);
% sheep_dot
c_dot(2,1)=k(2)*c(1)*c(2)-k(3)*c(2);
% wolf_dot
Surprisingly, the dynamics of such a population is completely cyclic. All properties of the cycle depend on the initial populations and the “rate constants.” The
1
“reaction” sheep k
→ 2 sheep contradicts the law of conservation of mass and,
thus, cannot directly represent reality. However, as we will see in the next example,
oscillating reactions do exist.
7.5.2.4 The Belousov-Zhabotinsky (BZ) Reaction
Chemical mechanisms for real oscillating reactions are very complex and are not
understood in every detail. Nevertheless, there are approximate mechanisms that
correctly represent several main aspects of real reactions. Often, not all physical
laws are strictly obeyed, e.g., the law of conservation of mass.
The Belousov-Zhabotinsky (BZ) reaction involves the oxidation of an organic
species such as malonic acid (MA) by an acidified aqueous bromate solution in the
presence of a metal ion catalyst such as the Ce(III)/Ce(IV) couple. At excess [MA], the
stoichiometry of the net reaction is
2 BrO3− + 3CH 2 (COOH )2 + 2 H + catalyst
→ 2 BrCH (COOH )2 + 3CO2 + 4 H 2O
(7.37)
A short induction period is typically followed by an oscillatory phase visible by an
alternating color of the aqueous solution due to the different oxidation states of the
© 2006 by Taylor & Francis Group, LLC
DK4712_C007.fm Page 252 Tuesday, January 31, 2006 12:04 PM
252
Practical Guide to Chemometrics
metal catalyst. Addition of a colorful redox indicator, such as the FeII/III(phen)3
couple, results in more dramatic color changes. Typically, several hundred oscillations with a periodicity of approximately a minute gradually die out within a couple
of hours, and the system slowly drifts toward its equilibrium state.
In an effort to understand the BZ system, Field, Körös, and Noyes developed
the so-called FKN mechanism [30]. From this, Field and Noyes later derived the
Oregonator model [31], an especially convenient kinetic model to match individual
experimental observations and predict experimental conditions under which oscillations might arise.
1
BrO3− + Br −
→ HBrO2 + HOBr
k
2
BrO3− + HBrO2
→ 2 HBrO2 + 2 M ox
k
3
HBrO2 + Br −
→ 2 HOBr
k
(7.38)
4
2 HBrO2
→ BrO3− + HOBr
k
5
MA + M ox
→ 12 Br −
k
Mox represents the metal ion catalyst in its oxidized form. Br− and BrO3− are not
protonated at pH ≈ 0.
It is important to stress that this model is based on an empirical rate law that
clearly does not comprise elementary processes, as is obvious from the unbalanced
equations. Nonetheless, the five reactions in the model provide the means to kinetically describe the four essential stages of the BZ reaction [32]:
1.
2.
3.
4.
Formation of HBrO2
Autocatalytic formation of HBrO2
Consumption of HBrO2
Oxidation of malonic acid (MA)
For the calculation of the kinetic profiles displayed in Figure 7.18, we used the
rate constants k1 = 1.28 M−1s−1, k2 = 33.6 M−1s−1, k3 = 2.4 × 106 M−1s−1, k4 = 3 × 103
M−1s−1, k5 = 1 M−1s−1 for [H]+ = 0.8 M at the initial concentrations [BrO3−]0 = 0.063 M,
[Ce(IV)]0 = 0.002 M (= [Mox]0), and [MA]0 = 0.275 M [3, 32]. We applied again
MATLAB’s stiff solver ode15s. Note that for this example, MATLAB’s default
relative and absolute error tolerances (RelTol and AbsTol) for solving ODEs have to
be adjusted to increase numerical precision.
For this example, we do not give the MATLAB code for the differential equations. The code can be fairly complex and, thus, its development is prone to error.
The problem is even more critical in the spreadsheet application where several cells
need to be rewritten for a new mechanism. We will address this problem later when
we discuss the possibility of automatic generation of computer code based on
traditional chemical equations.
© 2006 by Taylor & Francis Group, LLC