View
214
Download
2
Embed Size (px)
Citation preview
Constrained Fitting
400 420 440 460 480 500 520 540 560 580 6000
0.2
0.4
0.6
0.8
1
Spectral Profiles
Wavelength (nm)
Inte
nsity
400 420 440 460 480 500 520 540 560 580 6000
0.2
0.4
0.6
0.8
1
1.2
1.4Simulated Spectra
Wavelength (nm)
Abs
orba
nce
Calculation the rate constants for a consecutive reaction with known spectrum of the reactant
A = (AA + AB + AC) + R= C ET = (cAeA
T + cBeBT + cCeC
T ) + R
A - cAeAT = ( cBeB
T + cCeCT ) + R
A cA
eA A-AC’ E’T
R- = = +
r_cons2.m
Calculation the residual based on known spectrum of
reactant
?Compare the errors of parameters with and without known spectrum of reactant.
?How selectivity constraint (zero region) can be applied in calculation the residual vector?
Chemical Kinetics Modeling by Numerical Solving of Ordinary
Differential Equations
Calculation of kinetic concentration profilesThe central step in the fitting of a kinetic model to multivariate measured data is being able to calculate the concentration profiles of the species involved in a chemical reaction.
A = C E + RAccording to kinetic theory, the concentration prfiles of the species in a reaction mechanisms are defined by a system of ordinary differential equations (ODEs)
A Bk1
k2d[A]dt
= -k1 [A] + k2 [B]
d[B]dt
= k1 [A] - k2 [B]
A B Ck1 k2
d[A]dt
= -k1 [A]
d[B]dt
= k1 [A] - k2 [B]
d[C]dt
= k2 [B]
Complex Reactions
A B Ck1 k2
k3k4
Dd[A]dt
= -k1 [A]
d[B]dt
= k1 [A] - k2 [B] –k3 [B] + k4 [D]
d[C]dt
= k2 [B]
d[D]dt
= k3 [B] – k4[D]
k1
k2
A D + Ek3
B D + Fk4
C D + Gk5
k6
k7
d[A]dt
= -k1 [A] – k3 [A]
d[B]dt
= k1 [A] – k2 [B] – k4[B]
d[C]dt
= k2 [B] – k5 [C]
d[D]dt
= k3 [A] + k4 [B] + k5[C]
d[E]dt
= k3 [A] – k6 [E]
d[F]dt
= k6 [E] + k4 [B] – k7[F]
d[G]dt
= k7 [F] + k5 [C]
Numerical Integration of ODEs systemThere is a limited number of reaction mechanisms for which there are explicit formulae to calculate the concentrations of the reacting species as a function of time.To overcome this, numerical integration is used. Numerical integration allows an approximation to the explicit solution to be calculated for any system of ODEs, within limits of numerical accuracy and computation time.
An example
B C
2 A Bk1
k2
d(A]dt
d(B]dt
d(C]dt
= -2 k1 [A] 2
= k1 [A] 2 - k2[B]
= k2[B][A]0 =1
[B]0 =[C]0=0
The Euler MethodThe Euler method is the simplest method for the numerical integration of a system of differential equations. It can be seen as an adaptation of the truncated Taylor series expansion.
The Taylor series expansion
f (x + x) = f (x) + ( ) (x) + ( ) (x)2df (x) d x 2!
1
dnf (x) dn x
d2f (x) d2x
+ … + ( ) (x)n
n!1
f (x + x) = f (x) + ( ) (x) df (x) d x
C at t0 is C0
What is C at t=t0 +t ?C(t0 +t)= C(t0) + (dC(t0)/dt) t
d(A]dt
= -2 k1 [A] 2
The Euler Method[A]0 =1
[B]0 =[C]0=0If k1=0.2 k2=0.4
[A] 1 = [A] 0 + (d[A]0 / dt) t
(d[A]0 / dt) = - 2(0.2)(1)2 = - 0.4
for t = 0.2
[A] 1 = 1 – (0.4) (0.2) = 0.92
(d[A]1 / dt) = - 2(0.2)(0.92)2 = -0.3386
[A] 2 = 0.92 – (0.3386) (0.2) = 0.8523
[A] 2 = [A] 1 + (d[A]1 / dt) t
euler.m
0 2 4 6 8 10 12 14 16 18 200
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Time
Con
c.
Effect of time increment on calculated concentration profiles by Euler method
dt1=0.1dt2=0.2dt3=0.4dt4=0.6dt5=0.8dt6=1
?A Bk1
k2
Modify the euler.m file for calculating the concentration profiles for the following mechanism:
Fourth Order Runge-Kutta Method
The main disadvantage of the Euler method is that the calculated approximation for the concentrations are systematically wrong for each step. For a good accuracy, step sizes have to be very small.
Fourth order Runge-Kutta method is a modification of Euler method. It is called fourth order because the first derivative is calculated at four points along the increment of integration, allowing much larger increments and thus dramatically reduced computation times compared to the simple Euler method.
B C
2 A Bk1
k2
d(A]dt
d(B]dt
d(C]dt
= -2 k1 [A] 2
= k1 [A] 2 - k2[B]
= k2[B][A]0 =1
[B]0 =[C]0=0
Fourth Order Runge-Kutta Method
Step 1
Calculating the derivatives of the concentration at t0
(d[A]0 / dt) = - 2(0.4)(1)2 = - 0.8
(d[B]0 / dt) = (0.4)(1)2 – (0.2)(0) = 0.4
If k1=0.4 k2=0.2
(d[C]0 / dt) = (0.2)(0) = 0
Step 2
Calculating approximate concentration at the intermediate time point, t/2 based on concentration and derivative at t0
Fourth Order Runge-Kutta Method
[A] 1 = [A] 0 + (d[A]0 / dt) t/2
[A] 1 = 1 – (0.8) (0.1) = 0.92[B] 1 = [B] 0 + (d[B]0 / dt) t/2 [B] 1 = 0 + (0.4) (0.1) = 0.04
[C] 1 = [C] 0 + (d[C]0 / dt) t/2 [C] 1 = 0 + (0) (0.1) = 0
Step 3
Calculating the derivatives at the intermediate time point.
Fourth Order Runge-Kutta Method
(d[A]1 / dt) = - 2(0.4)(0.92)2 = - 0.6771
(d[B]1 / dt) = (0.4)(0.92)2 – (0.2)(0.04) = 0.3306
(d[C]1 / dt) = (0.2)(0.04) = 0.008
Step 4
Calculating another set of concentrations at the intermediate time point, now based on concentration at time 0 and derivatives at the intermediate time point.
Fourth Order Runge-Kutta Method
[A] 2 = [A] 0 + (d[A]1 / dt) t/2
[A] 2 = 1 – (0.6771) (0.1) = 0.9323[B]2 = [B] 0 + (d[B]1 / dt) t/2 [B] 2 = 0 + (0.3306) (0.1) = 0.03306
[C] 2 = [C] 0 + (d[C]1 / dt) t/2 [C] 2 = 0 + (0.008) (0.1) = 0.0008
Step 5
Calculating a new set of derivatives at the intermediate time point, based on the concentration just calculated
Fourth Order Runge-Kutta Method
(d[A]2 / dt) = - 2(0.4)(0.9323)2 = -0.6953
(d[B]2 / dt) = (0.4)(0.9323)2 – (0.2)(0.03306) = 0.3411
(d[C]2 / dt) = (0.2)(0.03306) = 0.00661
Step 6
Calculating the concentration at the new time point 1, after the complete time interval, based on the concentration at to and these new derivatives at the intermediate time point:
Fourth Order Runge-Kutta Method
[A] 3 = [A] 0 + (d[A]2 / dt) t
[A] 3 = 1 – (0.6953) (0.2) = 0.8609[B]3 = [B] 0 + (d[B]2 / dt) t[B] 3 = 0 + (0.3411) (0.2) = 0.0682
[C] 3 = [C] 0 + (d[C]2 / dt) t[C] 3 = 0 + (0.00661) (0.2) = 0.0013
Step 7
Computation of derivatives at time point 1:
Fourth Order Runge-Kutta Method
(d[A]3 / dt) = - 2(0.4)(0.8609)2 = -0.5929
(d[B]3 / dt) = (0.4)(0.8609)2 – (0.2)(0.0682) = 0.2828
(d[C]3 / dt) = (0.2)(0.0682) = 0.0136
Step 8
Computation the new concentration after the ful time interval based on weighted average of derivatives
Fourth Order Runge-Kutta Method
[A] new = [A] 0 + (d[A]new / dt) t
[A] 3 = 1 – (0.6896) (0.2) = 0.8621[B]new = [B] 0 + (d[B]new / dt) t[B] 3 = 0 + (0.3377) (0.2) = 0.0675
[C] new = [C] 0 + (d[C]new / dt) t
[C] 3 = 0 + (0.0071) (0.2) = 0.0014
d[A]new/dt) =d[A]0/dt) + 2 (d[A]1/dt) + 2(d[A]2/dt) +(d[A]3/dt)
6
Fourth Order Runge-Kutta Method and MATLAB
ODE1.m
RungeKutta.m
Comparison of results from Euler and Runge-Kutta methods with same time increment
0 2 4 6 8 10 12 14 16 18 200
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1Spectral Profiles
Time
Con
c
t=0.1 RKt=0.5 RKt=0.5 E
?A Bk1
k2
Use Runge-Kutta method for calculating the concentration ptofiles for the following mechanism:
Generalized model for different kinetic mechanismsA B
k1
k2d[A]dt
= -k1 [A] + k2 [B]
d[B]dt
= k1 [A] - k2 [B] 1 = k1 [A] = k1 [A]1 [B]0
d[A]dt = (-1) 1 + (1) 2
2 = k2 [B] = k2 [A]0 [B]1
d[B]dt = (1) 1 + (-1) 2
Generalized model for different kinetic mechanisms
A B Ck1 k2
d[A]dt
= -k1 [A]
d[B]dt
= k1 [A] - k2 [B]
d[C]dt
= k2 [B]
1 = k1 [A] = k1 [A]1 [B]0 [C]0
d[A]dt = (-1) 1 + (0) 2
d[B]dt = (1) 1 + (-1) 2
2 = k2 [B] = k2 [A]0 [B]1 [C]0
d[C]dt = (0) 1 + (1) 2
B C
2 A Bk1
k2
d(A]dt
d(B]dt
d(C]dt
= -2 k1 [A] 2
= k1 [A] 2 - k2[B]
= k2[B]
Generalized model for different kinetic mechanisms
1 = k1 [A]2 = k1 [A]2 [B]0 [C]0
d[A]dt = (-2) 1 + (0) 2
d[B]dt = (1) 1 + (-1) 2
2 = k2 [B] = k2 [A]0 [B]1 [C]0
d[C]dt = (0) 1 + (1) 2
1 = k1 [A] = k1 [A]1 [B]0
d[A]
dt = (-1) 1 + (1) 2
2 = k2 [B] = k2 [A]0 [B]1
d[B]
dt = (1) 1 + (-1) 2
1 = k1 [A] = k1 [A]1 [B]0 [C]0
d[A]
dt = (-1) 1 + (0) 2
d[B]
dt = (1) 1 + (-1) 2
2 = k2 [B] = k2 [A]0 [B]1 [C]0
d[C]
dt = (0) 1 + (1) 2
1 = k1 [A]2 = k1 [A]2 [B]0 [C]0
d[A]
dt = (-2) 1 + (0) 2
d[B]
dt = (1) 1 + (-1) 2
2 = k2 [B] = k2 [A]0 [B]1 [C]0
d[C]
dt = (0) 1 + (1) 2
Generalized model for different kinetic mechanisms
Generalized model for different kinetic mechanismsReactant stoichiometries matrix, Xr
B C
2 A Bk1
k2k1
k2
A B C
2 0 0
0 1 0
Product stoichiometries matrix, Xp
k1
k2
A B C
0 1 0
0 0 1
Stoichiometric coefficient matrix, X = Xp - Xr
k1
k2
A B C
-2 1 0
0 -1 1
1 = k1 [A]2 = k1 [A]2 [B]0 [C]0
d[A]
dt = (-2) 1 + (0) 2
d[B]
dt = (1) 1 + (-1) 2
2 = k2 [B] = k2 [A]0 [B]1 [C]0
d[C]
dt = (0) 1 + (1) 2
d ci
dt
j=1
np
i=1
ns
j= kj ciXr j, i
=
where j=1 to np
Xj, i j where i=1 to ns
Generalized model for different kinetic mechanisms
Once Xr and X have been determined, the differential equations can be constructed in a completely generalized way. j is the rate law of the j-th elementary step in the mechanism.
A generalised function for creating the ODEs system
kinfun.m
generalised modeling the reaction kinetics with known
mechanism
GKIN.m
Reactant stoichiometries matrix, Xr
B C
2 A Bk1
k2
k1
k2
A B C
2 0 0
0 1 0
Product stoichiometries matrix, Xp
k1
k2
A B C
0 1 0
0 0 1
Using GKIN.m file for modeling
Reactant stoichiometries matrix, Xr
k1
k2
A B C
2 0 0
0 1 0
Product stoichiometries matrix, Xr
k1
k2
A B C
0 1 0
0 0 1
?
Use yhe GKIN.m file for calculating the concentration profiles for the following mechanism:
k1
k2
A D + Ek3
B D + Fk4
C D + Gk5
k6
k7
A B Ck1 k2
k3k4
D