Fundamentals of air Pollution – Atmospheric Photochemistry - Part A
Presentation Slides for Chapter 12 of Fundamentals of Atmospheric Modeling 2 nd Edition
description
Transcript of Presentation Slides for Chapter 12 of Fundamentals of Atmospheric Modeling 2 nd Edition
Presentation Slides for
Chapter 12of
Fundamentals of Atmospheric Modeling 2nd Edition
Mark Z. JacobsonDepartment of Civil & Environmental Engineering
Stanford UniversityStanford, CA [email protected]
March 29, 2005
Initial Value Problems
Vector of concentrations at time t (12.1)
Concentration of species i is known at time t-h=0 (12.2)
ˆ N t = N1,t,N2,t,...,Ni,t,...,NK,t[ ]
Ni,t−h =Ni,0
Values are known at an initial time and desired at a final time
Properties of Good ODE SolversAccuracy
Mass conservation
Positive-definiteness
Speed
Normalized gross error (12.3)
NGE =1
Ntim
1Ks,tj
Ni,tj−Ei,tj
Ei,tji=1
Ks,t j
∑⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟ j=1
Ntim
∑ ×100%
Analytical Solution to ODEsNitrogen dioxide photolysis (12.4)
Time rate of change of NO2 concentration (12.5)
Analytical solution (12.6)
Example:[NO2]t-h = 1010 molec. cm-3
J = 0.02 s-1
---> [NO2]t = 1010 e-0.02t
NO2
+ h ν + NO O
d NO2[ ]dt
=−J NO2[ ]
NO2[ ]t = NO2[ ]t−he−Jh
Taylor Series Solution to ODEs
Taylor series expansion for NO2 (12.8)
Explicit Taylor series expansion for one species (12.7)
Ni,t =Ni,t−h+hdNi,t−h
dt+
h2
2
d2Ni,t−h
dt2+
h3
6
d3Ni,t−h
dt3+...
NO[ ]t = NO[ ]t−h +hd NO[ ]t−h
dt+
h2
2
d2 NO[ ]t−hdt2
+h3
6
d3 NO[ ]t−hdt3
+...
Taylor Series Example
Assume
(12.8-12.12)
d NO[ ]dt
=−kb NO[ ] O3[ ]
d2 NO[ ]
dt2=−kb
d NO[ ]dt
O3[ ]−kb NO[ ]d O3[ ]
dt
d3 NO[ ]
dt3=−kb
d2 NO[ ]
dt2O3[ ]−2kb
d NO[ ]dt
d O3[ ]dt
−kb NO[ ]d2 O3[ ]
dt2
NO[ ]t = NO[ ]t−h +hd NO[ ]t−h
dt+
h2
2
d2 NO[ ]t−hdt2
+h3
6
d3 NO[ ]t−hdt3
+...
NO + O3
NO2
+ O2
Taylor Series Solution
(12.13)
DisadvantagesUnstable unless small time step is usedHigh derivatives computationally demanding
d O3[ ]dt
=−d NO2[ ]
dt=
d NO[ ]dt
d2 O3[ ]
dt2=−
d2 NO2[ ]
dt2=
d2 NO[ ]
dt2
d3 O3[ ]
dt3=−
d3 NO2[ ]
dt3=
d3 NO[ ]
dt3
NO + O3
NO2
+ O2
Forward Euler Solution to ODEsExplicit forward Euler solution for an individual species (12.14)
Example set of three equations (12.15-17)
Ni,t =Ni,t−h+hdNi,t−h
dt
NO + O3
NO2
+ O2
NO2
+ O3
NO3
+ O2
NO2
+ h ν + NO O
(k1)
(k2)
(J)
d NO2[ ]t−hdt
=k1 NO[ ]t−h O3[ ]t−h −k2 NO2[ ]t−h O3[ ]t−h −J NO2[ ]t−h
First derivative of NO2 (12.18)
Forward Euler Solution to ODEsFirst derivative of NO2 (12.18)
Forward Euler equation (12.19)
d NO2[ ]t−hdt
=k1 NO[ ]t−h O3[ ]t−h −k2 NO2[ ]t−h O3[ ]t−h −J NO2[ ]t−h
NO2[ ]t = NO2[ ]t−h +h k1 NO[ ]t−h O3[ ]t−h−k2 NO2[ ]t−h O3[ ]t−h−J NO2[ ]t−h( )
Forward Euler Solution to ODEs
Rewrite in terms of production and loss (12.20-22)
AdvantagesMass conserving, easy to calculate derivatives
DisadvantageUnconditionally unstable
NO2[ ]t = NO2[ ]t−h +h Pc,NO2,t−h−Lc,NO2,t−h( )
Pc,NO2,t−h =k1 NO[ ]t−h O3[ ]t−h
Lc,NO2,t−h =k2 NO2[ ]t−h O3[ ]t−h+J NO2[ ]t−h
NO2[ ]t = NO2[ ]t−h +h k1 NO[ ]t−h O3[ ]t−h−k2 NO2[ ]t−h O3[ ]t−h−J NO2[ ]t−h( )
Forward Euler equation (12.19)
Mass Conservation of Forward EulerRequirement for mass conservation of nitrogen (12.28)
Forward Euler concentrations of nitrogen species (12.24,6)
NO2[ ]+ NO[ ]( )t = NO2[ ]+ NO[ ]( )t−h
NO[ ]t = NO[ ]t−h −hk1 NO[ ]t−h O3[ ]t−h
NO2[ ]t = NO2[ ]t−h +hk1 NO[ ]t−h O3[ ]t−h
Mass Conservation of Forward EulerRequirement for mass conservation of oxygen (12.29)
2 O2[ ]+3 O3[ ]+2 NO2[ ]+ NO[ ]( )t= 2 O2[ ]+3O3[ ]+2 NO2[ ]+ NO[ ]( )t−h
Forward Euler concentrations (12.24-7)
NO[ ]t = NO[ ]t−h −hk1 NO[ ]t−h O3[ ]t−h
O3[ ]t = O3[ ]t−h−hk1 NO[ ]t−h O3[ ]t−h
NO2[ ]t = NO2[ ]t−h +hk1 NO[ ]t−h O3[ ]t−h
O2[ ]t = O2[ ]t−h+hk1 NO[ ]t−h O3[ ]t−h
Backward Euler Solution to ODEsLinearized backward Euler solution for one species (12.30)
Example set of three equations (12.15-17)
NO + O3
NO2
+ O2
NO2
+ O3
NO3
+ O2
NO2
+ h ν + NO O
(k1)
(k2)
(J)
First derivative of NO2 (12.31)
d NO2[ ]t,t−hdt
=k1 NO[ ]t−h O3[ ]t−h −k2 NO2[ ]t O3[ ]t−h−J NO2[ ]t
Ni,t =Ni,t−h+hdNi,t,t−h
dt
Backward Euler Solution to ODEsFirst derivative of NO2 (12.30)
d NO2[ ]t,t−hdt
=k1 NO[ ]t−h O3[ ]t−h −k2 NO2[ ]t O3[ ]t−h−J NO2[ ]t
NO2[ ]t = NO2[ ]t−h +h k1 NO[ ]t−h O3[ ]t−h−k2 NO2[ ]t O3[ ]t−h −J NO2[ ]t( )
Linearized backward Euler equation (12.32)
Backward Euler Solution to ODEs
Rewrite in terms of production and loss (12.36)
Linearized backward Euler equation (12.32)
NO2[ ]t = NO2[ ]t−h +h k1 NO[ ]t−h O3[ ]t−h−k2 NO2[ ]t O3[ ]t−h −J NO2[ ]t( )
NO2[ ]t = NO2[ ]t−h +h Pc,NO2,t−h−Λc,NO2,t−h NO2[ ]t( )
Production term (12.33)
Loss term (12.34)
Implicit loss coefficient (12.35)
Pc,NO2,t−h =k1 NO[ ]t−h O3[ ]t−h
Lc,NO2,t,t−h =k2 NO2[ ]t O3[ ]t−h +J NO2[ ]t
Λc,NO2,t−h =Lc,NO2,t,t−h
NO2[ ]t=k2 O3[ ]t−h +J
Backward Euler Solution to ODEs
Rearrange (12.37)
AdvantagesAlways gives positive solutions to chemical ODEs
DisadvantagesRequires a small time step for accuracyNot mass conserving
NO2[ ]t 1+hΛc,NO2,t−h( )= NO2[ ]t−h +hPc,NO2,t−h
NO2[ ]t =NO2[ ]t−h +hPc,NO2,t−h
1+hΛc,NO2,t−h
NO2[ ]t = NO2[ ]t−h +h Pc,NO2,t−h−Λc,NO2,t−h NO2[ ]t( )
Backward Euler Solution to ODEs
Example of mass non-conservation of nitrogen (12.39)
NO[ ]t = NO[ ]t−h −hk1 NO[ ]t O3[ ]t−h
NO2[ ]t = NO2[ ]t−h +hk1 NO[ ]t−h O3[ ]t−h
Requirement for mass conservation of nitrogen (12.28)
NO2[ ]+ NO[ ]( )t = NO2[ ]+ NO[ ]( )t−h
Simple Exponential Solution to ODEsObtained by integrating a linearized first derivative.
AdvantagesAlways gives positive solutions to chemical ODEsEasy to implement
DisadvantagesRequires a small time step for accuracyNot mass conserving
Simple Exponential Solution to ODEsLinearized first derivative from backward Euler example (12.31)
Rewrite in terms of production and loss (12.43)
Integrate (12.44)
d NO2[ ]t,t−hdt
=k1 NO[ ]t−h O3[ ]t−h −k2 NO2[ ]t O3[ ]t−h−J NO2[ ]t
d NO2[ ]tdt
=Pc,NO2,t−h−Λc,NO2,t−h NO2[ ]t
NO2[ ]t = NO2[ ]t−he−hΛc,NO2,t−h +Pc,NO2,t−h
Λc,NO2,t−h1−e−hΛc,NO2,t−h( )
Simple Exponential Solution to ODEsGeneric solution (12.45)
When the implicit loss coefficient is zero (no loss term),
When the production term is zero,
When the implicit loss coefficient is large (short-lived species),
Ni,t =Ni,t−he−hΛc,i ,t−h +Pc,i,t−hΛc,i,t−h
1−e−hΛc,i ,t−h( )
Ni,t =Ni,t−h+hPc,i,t−h
Ni,t =Ni,t−he−hΛc,i ,t−h
Ni,t =Pc,i,t−hΛc,i,t−h
(steady state solution)
Quasi-Steady State ApproximationQSSA (12.46)
Use forward Euler for long-lived speciesUse simple exponential for medium-lived speciesUse steady-state solution for short-lived species
Ni,t =
Ni,t−h+h Pc,i,t−h −Lc,i,t−h( ) hΛc,i,t−h <0.01
Ni,t−he−hΛc,i ,t−h +Pc,i,t−hΛc,i,t−h
1−e−hΛc,i ,t−h( ) 0.01≤hΛc,i,t−h ≤10
Pc,i,t−h Λc,i,t−h hΛc,i,t−h >10
⎧
⎨
⎪ ⎪ ⎪
⎩
⎪ ⎪ ⎪
Multistep Implicit-Explicit (MIE) Solution
Premises:The forward Euler and linearized backward Euler solutions converge to each other upon iteration.
Since the converged backward Euler is always positive, so is the converged forward Euler.
Since the converged forward Euler always conserves mass, so does the converged backward Euler
--> The MIE solution, which requires iteration, conserves mass and is positive definite.
Multistep Implicit-Explicit Solution
1) Set initial estimates to initial concentrations (12.49)
2) Set initial maximum estimates to initial values (12.50)Maximum estimates are used to bound the backward Euler during the initial iteration steps.
3) Estimate reaction rates from backward-Euler values (12.51)These equation apply for any iteration number m
Ni,B,1 =Ni,t−h
Ni,MAX,1=Ni,t−h
Rc,n,B,m =knNi,B,mNj,B,m
Rc,n,B,m =J nNi,B,m
Multistep Implicit-Explicit Solution4) Sum production, loss, implicit loss terms (12.53)
(12.55)
(12.57)
Pc,i,B,m= Rc,nP (l,i),B,ml =1
Nprod,i
∑
Lc,i,B,m= Rc,nL (l,i),B,ml =1
Nloss,i
∑
Λc,i,B,m=
Lc,i,B,mNi,B,m
Multistep Implicit-Explicit SolutionExample reactions (12.47)
(12.48)
Estimate reaction rates. (12.52)
NO + O3
NO2
+ O2
O3
+ h ν O2
+ O λ > 310 nm
Rc,1,B,m=k1 NO[ ]B,m O3[ ]B,m
Rc,2,B,m =J O3[ ]B,m
k1
J
Multistep Implicit-Explicit SolutionSummed production terms (12.54)
Summed loss terms (12.56)
Pc,O,B,m=J O3[ ]B,m
Pc,NO2,B,m=k1 NO[ ]B,m O3[ ]B,m
Lc,NO,B,m=k1 NO[ ]B,mO3[ ]B,m
Lc,O3,B,m=k1 NO[ ]B,m O3[ ]B,m+J O3[ ]B,m
Multistep Implicit-Explicit Solution
Summed implicit loss coefficients (12.58)
Λc,NO,B,m=k1 O3[ ]B,m
Λc,O3,B,m=k1 NO[ ]B,m+J
Multistep Implicit-Explicit Solution5) Estimate concentrations with backward Euler (12.59)
6) Estimate concentrations with forward Euler (12.60)
Ni,B,m+1=
Ni,t−h+hPc,i,B,m1+hΛc,i,B,m
Ni,F,m+1=Ni,t−h+h Pc,i,B,m−Lc,i,B,m( )
Multistep Implicit-Explicit Solution7) Check convergence (12.61)
ˆ N F,m+1≥0→ nP =nP +1
Ni,F,m+1<0→ nP =0
⎧ ⎨ ⎪
⎩ ⎪
Method 1: Each iteration, check whether all concentrations from forward Euler ≥ zero. If so, update a counter, nP by 1. If one concentration < 0, reset nP to 0.
When nP=NP (all concentrations from forward Euler exceed 0 for NP iterations in a row), convergence has occurred
NP = 5 for large sets of equations = 30 for small sets of equations
Multistep Implicit-Explicit Solution7) Check convergence (12.62)
ˆ N F,m+1≥0 for specieswith hΛc,i,B,m<LT → nP =nP +1
Ni,F,m+1<0 and hΛc,i,B,m<LT → nP =0
⎧
⎨ ⎪
⎩ ⎪
Method 2: Each iteration, check whether all concentrations of medium- and long-lived species (those for which hLc,I,B,m<LT) from forward Euler ≥ zero. If so, update the counter nP by 1. If one such concentration < 0, reset nP to 0.
When nP=NP, convergence has occurred
LT = 102-106
Multistep Implicit-Explicit Solution
8) Upon convergence, set final concentrations (12.63)
9a) Recalculate maximum for next iteration (12.64)
9b) Bound backward Euler for next iteration (12.65)Note that this equation uses the MAX concentration from the previous iteration, not from the value just calculated.
Ni,t =Ni,B,m+1 backwardEuler( ) hΛc,i,B,m≥LT
Ni,F,m+1 forwardEuler( ) hΛc,i,B,m<LT
⎧ ⎨ ⎪
⎩ ⎪
Ni,MAX,m+1=maxNi,B,m+1, Ni,t−h( )
Ni,B,m+1=min Ni,B,m+1,Ni,MAX,m{ }
Multistep Implicit-Explicit Solution
Converged backward Euler equation (12.66)
Demonstration that iterated forward Euler solutions converge to iterated backward Euler solutions and to
positive numbers.
Converged forward Euler equation (12.64)
Thus, convergence of forward to backward Euler occurs when
where
Ni,B,m+1 =Ni,t−h +h Pc,i,B,m−Λc,i,B,mNi,B,m+1( )
Ni,F,m+1=Ni,t−h+h Pc,i,B,m−Λc,i,B,mNi,B,m( )
Λc,i,B,mNi,B,m=Lc,i,B,m
Ni,B,m+1=Ni,B,m
which occurs upon iteration of backward Euler (12.68)
Convergence of Forward Euler (FE) to Backward Euler (BE) Upon Iteration
Fig. 12.1
h = 10 seconds.
-1x10
15
-5x10
14
1x10
7
5x10
14
1x10
15
1000
10
5
10
7
10
9
10
11
10
13
10
15
1 10 100
NO
2
and O
3
(molecules cm
-3
)
O (molecules cm
-3
)
Iteration number
O (FE)
O (BE)
NO
2
(FE)
NO
2
(BE)
O
3
(FE)
O
3
(BE)
NO
2 and
O3 (
mol
ec. c
m-3)
O (m
olec. cm-3)
Comparison of MIE With Exact Solution
Fig. 12.2
MIE solution (circles); exact solution (lines); h = 10 seconds.
1x10
0
5x10
11
1x10
12
1.5x10
12
2x10
12
2.5x10
12
3x10
12
0 4 8 12 16 20 24
Concentration (molecules cm
-3
)
Hours from start of simulation
HNO
3
O
3
Con
cent
rati
on (
mol
ec. c
m-3)
Effects of Time Step on MIE Solution
Fig. 12.3
Time step sizes of 2, 10, 100, 500, and 1000 seconds are compared. Results in all cases are shown after 10,000 s.
2 10
4
4 10
4
6 10
4
8 10
4
1 10
5
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
1 10 100 1000
No. of iterations required
Average error per species (%)
Time step (s)
No.
of
iter
atio
ns r
equi
red A
verage error per species
Gear’s MethodDiscretize ODE time derivative over many past steps (12.69)
Rearrange for an individual species (12.70)
Set up predictor equation (12.71)
and for a set of species (12.70)
dNi,tdt
≈Ni,t −αs,1Ni,t−h −αs,2Ni,t−2h...−αs,sNi,t−sh
hβs=
Ni,t − αs, jNi,t−jhj=1
s
∑
hβs
0 =−ˆ N t + αs, jˆ N t−jh
j =1
s
∑ +hβsdˆ N tdt
Ptˆ N t,m+1− ˆ N t,m( ) =−ˆ N t,m+ αs, j
j =1
s
∑ ˆ N t−jh +hβsd ˆ N t,m
dt
0 =−Ni,t + αs, j Ni,t−jhj =1
s
∑ +hβsdNi,tdt
Gear’s MethodSimplify to (12.72)
where
Predictor matrix (12.77)
(12.73)
PtΔˆ N t,m= ˆ B t,m
Δ ˆ N t,m= ˆ N t,m+1− ˆ N t,m
ˆ B t,m=−ˆ N t,m+ αs, jj =1
s
∑ ˆ N t−jh +hβsd ˆ N t,m
dt
Pt ≈I −hβsJ t
Jacobian matrix of partial derivatives (12.78)
J t =∂2 ˆ N i,t,m∂Nk,t,m∂t
⎡
⎣ ⎢ ⎢
⎤
⎦ ⎥ ⎥ i,k=1
K,K
Gear’s Method
Iterate until
Solve
Δ ˆ N t,m
ˆ N t,m+1 = ˆ N t,m+Δ ˆ N t,m
PtΔˆ N t,m= ˆ B t,m
then update concentration with (12.74)
for
Δ ˆ N t,m≈0
Error TestsLocal error test (12.75)
Global error test (12.76)
NRMSt,m=1K
ΔNi,t,mRtolNi,t,1+Atol,t
⎛
⎝ ⎜
⎞
⎠ ⎟
2
i=1
K
∑
NRMSt =1K
ΔNi,t,mm∑RtolNi,t,1+Atol,t
⎛
⎝ ⎜ ⎜
⎞
⎠ ⎟ ⎟
2
i=1
K
∑
Example Reactions and 1st Derivatives
Example reactions (12.79)
(12.80)
(12.81)
NO + O3
NO2
+ O2
O + O2
+ M O3
+ M
NO2
+ h ν + NO O
Example Reactions and 1st Derivatives
First derivatives of NO, NO2, O, and O3 (12.82)
d NO[ ]dt
=J NO2[ ]−k1 NO[ ] O3[ ]
d NO2[ ]dt
=k1 NO[ ] O3[ ]−J NO2[ ]
d O[ ]dt
=J NO2[ ]−k2 O[ ] O2[ ] M[ ]
d O3[ ]dt
=k2 O[ ] O2[ ] M[ ]−k1 NO[ ]O3[ ]
Partial DerivativesPartial derivatives of NO (12.83)
Partial derivatives of NO2 (12.84)
∂2 NO[ ]∂ NO[ ]∂t
=−k1 O3[ ]∂2 NO[ ]
∂ NO2[ ]∂t=J
∂2 NO[ ]∂ O3[ ]∂t
=−k1 NO[ ]
∂2 NO2[ ]∂ NO[ ]∂t
=k1 O3[ ]∂2 NO2[ ]∂ NO2[ ]∂t
=−J
∂2 NO2[ ]∂ O3[ ]∂t
=k1 NO[ ]
Partial DerivativesPartial derivatives of O (12.85)
Partial derivatives of O3 (12.86)
∂2 O[ ]∂ NO2[ ]∂t
=J∂2 O[ ]∂ O[ ]∂t
=−k2 O2[ ] M[ ]
∂2 O3[ ]∂ NO[ ]∂t
=−k1 O3[ ]∂2 O3[ ]∂ O[ ]∂t
=k2 O2[ ] M[ ]
∂2 O3[ ]∂ O3[ ]∂t
=−k1 NO[ ]
Predictor Matrix
(12.87)
1−hβs∂2 NO[ ]∂ NO[ ]∂t
−hβs∂2 NO[ ]
∂ NO2[ ]∂t−hβs
∂2 NO[ ]∂ O[ ]∂t
−hβs∂2 NO[ ]∂ O3[ ]∂t
−hβs∂2 NO2[ ]∂ NO[ ]∂t
1−hβs∂2 NO2[ ]∂ NO2[ ]∂t
−hβs∂2 NO2[ ]∂ O[ ]∂t
−hβs∂2 NO2[ ]∂ O3[ ]∂t
−hβs∂2 O[ ]
∂ NO[ ]∂t−hβs
∂2 O[ ]∂ NO2[ ]∂t
1−hβs∂2 O[ ]∂ O[ ]∂t
−hβs∂2 O[ ]
∂ O3[ ]∂t
−hβs∂2 O3[ ]∂ NO[ ]∂t
−hβs∂2 O3[ ]
∂ NO2[ ]∂t−hβs
∂2 O3[ ]∂ O[ ]∂t
1−hβs∂2 O3[ ]∂ O3[ ]∂t
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
NO NO2 O O3
NO
NO2
O
O3
Substitute Partial Derivatives Into Predictor Matrix
(12.88)
NO NO2 O O3
NO
NO2
O
O3
1−hβs −k1O3[ ]( ) −hβs J( ) 0 −hβs −k1 NO[ ]( )
−hβs k1 O3[ ]( ) 1−hβs −J( ) 0 −hβs k1 NO[ ]( )0 −hβs J( ) 1−hβs −k2 O2[ ] M[ ]( ) 0
−hβs −k1 O3[ ]( ) 0 −hβs k2 O2[ ] M[ ]( ) 1−hβs −k1 NO[ ]( )
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
Matrix Equation
(12.89)
PtΔˆ N t,m= ˆ B t,m
1−hβs −k1O3[ ]( ) −hβs J( ) 0 −hβs −k1 NO[ ]( )
−hβs k1 O3[ ]( ) 1−hβs −J( ) 0 −hβs k1 NO[ ]( )0 −hβs J( ) 1−hβs −k2 O2[ ] M[ ]( ) 0
−hβs −k1 O3[ ]( ) 0 −hβs k2 O2[ ] M[ ]( ) 1−hβs −k1 NO[ ]( )
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
Δ NO[ ]t,mΔ NO2[ ]t,m
Δ O[ ]t,mΔ O3[ ]t,m
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
=
BNO,t,mBNO2,t,mBO,t,mBO3,t,m
⎡
⎣
⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥
Reordered Matrix
(12.90)
1−hβs −k2 O2[ ] M[ ]( ) −hβs J( ) 0 0
0 1−hβs −J( ) −hβs k1 O3[ ]( ) −hβs k1 NO[ ]( )
0 −hβs J( ) 1−hβs −k1 O3[ ]( ) −hβs −k1 NO[ ]( )
−hβs k2 O2[ ] M[ ]( ) 0 −hβs −k1 O3[ ]( ) 1−hβs −k1 NO[ ]( )
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
Δ O[ ]t,mΔ NO2[ ]t,mΔ NO[ ]t,mΔ O3[ ]t,m
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥
=
BO,t,mBNO2,t,mBNO,t,mBO3,t,m
⎡
⎣
⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥
Place species with most partial derivatives at the bottom and fewest partial derivatives at the top of the matrix
Effect of Sparse-Matrix Reductions on Matrix Fill in and Number of Multiplies
1427 Gases, 3911 Reactions
Table 12.2
Without With PercentQuantity Reductions Reductions ReductionOrder of matrix 1427 1427 0Initial fill-in 2,036,329 14,276 99.30Final fill-in 2,036,329 17,130 99.16Decomp. 1 967,595,901 47,596 99.995Decomp. 2 1,017,451 9,294 99.09Backsub. 1 1,017,451 9,294 99.09Backsub. 2 1,017,451 6,409 99.37
Vectorization of Inner Nested LoopVectorized inner loop
Nested Loop ADO 105 NK = 1, NBIMOLEC
JSP1 = JPROD1(NK)
JSP2 = JPROD2(NK)
DO 100 K = 1, KTLOOP
TRATE(K,NK) = RRATE(K,NK) * CONC(K,JSP1)
* CONC(K,JSP2)
100 CONTINUE
105 CONTINUE
Vectorization of Inner Nested LoopNon-vectorized inner loop
Nested Loop BDO 105 K = 1, KTLOOP
DO 100 NK = 1, NBIMOLECJSP1 = JPROD1(NK)JSP2 =JPROD2(NK) TRATE(K,NK) = RRATE(K,NK) * CONC(K,JSP1) * CONC(K,JSP2)
100 CONTINUE
105 CONTINUE
Stiffness Predictor(12.91)Sp =
1K
dNi,t dt
Ni,t+Atol,t
⎛
⎝ ⎜
⎞
⎠ ⎟
i=1
K
∑2
Number of backsubstitution calls as a function of the stiffness predictor. The more calls, the greater the stiffness of equations.
Fig. 12.40
50
100
150
200
10
-14
10
-12
10
-10
10
-8
10
-6
10
-4
0.01 1
No. of backsubstitution calls
Predictor value (s
-2
)
No.
of
back
subs
titu
tion
cal
ls
Family MethodOrganize short- and long-lived species into families, which are long-lived, solve for family concentration, then partition family concentrations into individual species concentrations
Odd chlorine family (12.95)
Odd hydrogen family (12.93)
Odd nitrogen family (12.94)
Odd oxygen family (12.92)
[OT] =[O]+[O(1D)]+[O3]+[NO2]
[HOT ]=[OH]+[HO2]+[H2O2]
[NOT ]=[NO]+[NO2]+[NO3]
[ClT ]=[Cl]+[ClO]+[ClO2]
Family Method
Example of species cycling within odd oxygen family (12.96)
O3
+ h νO
2 + (O
1
D )
O2
+ h ν O + O
O(
1
D ) O
M
O + O2
+ M O3
+ M
Solution with Family Method(1) Calculate reaction rates and first derivatives of all species
(2) Sum production and loss terms of each family
(3) Apply forward Euler to family concentration
(4) Repartition species concentrations in the family
Example with 4 total species and 2 families (12.97)
[Fam1]=[A]+[B]+[C]
[Fam2]=[D]
A → B
B → C
C → D
Reactions in the system (12.98)
ka
kb
kc
Solution with Family MethodFirst derivatives of A, B, C, and D (12.99)
d A[ ]dt
=−ka A[ ]
d B[ ]dt
=ka A[ ]−kb B[ ]
d C[ ]dt
=kb B[ ]−kc C[ ]
d D[ ]dt
=kc C[ ]
Example Family SolutionFirst derivatives of each family as a whole (12.100)
Apply forward Euler to family concentration with (12.101)
d Fam1[ ]dt
=d A[ ]dt
+d B[ ]dt
+d C[ ]dt
=−kc C[ ]
d Fam2[ ]dt
=d D[ ]dt
=kc C[ ]
Fam[ ]t = Fam[ ]t−h +hd Fam[ ]t−h
dtFor example, (12.102)
Fam1[ ]t = Fam1[ ]t−h−hkc C[ ]t−h
Fam2[ ]t = Fam2[ ]t−h +hkc C[ ]t−h
Partition Species in Family
Relate species to family concentration (12.103)
Concentration of D equals second family concentration
D[ ]t = Fam2[ ]t =hkc C[ ]t−h
Fam1[ ]t = A[ ]t + B[ ]t + C[ ]t = A[ ]t 1+B[ ]tA[ ]t
+C[ ]tA[ ]t
⎛
⎝ ⎜
⎞
⎠ ⎟
Repartitioning Species
Solve for A, B, and C, respectively (12.104)
Many ways to obtain partitioning ratios, and .
A[ ]t =Fam1[ ]t
1+B[ ]tA[ ]t
+C[ ]tA[ ]t
B[ ]t = A[ ]tB[ ]tA[ ]t
C[ ]t = A[ ]tC[ ]tA[ ]t
B[ ]tA[ ]t
C[ ]tA[ ]t
Estimating Partitioning Ratios1) Assume each species in steady state (12.105)
---> Partitioning ratios of B and C are (12.106)
d B[ ]dt
=ka A[ ]−kb B[ ]=0
d C[ ]dt
=kb B[ ]−kc C[ ] =0
B[ ]tA[ ]t
≈B[ ]A[ ]
=kakb
C[ ]tA[ ]t
≈C[ ]A[ ]
=C[ ]B[ ]
B[ ]A[ ]
=kbkc
kakb
=kakc
Estimating Partitioning Ratios---> Final species concentrations (12.107)
A[ ]t =Fam1[ ]t
1+kakb
+kakc
B[ ]t =
Fam1[ ]tkakb
1+kakb
+kakc
C[ ]t =
Fam1[ ]tkakc
1+kakb
+kakc
Estimating Partitioning Ratios2) First linearize the ODE of each species -- (12.108)
-- then integrate with simple exponential method -- (12.109)
d A[ ]tdt
=−ka A[ ]td B[ ]t
dt=ka A[ ]t−h −kb B[ ]t
d C[ ]tdt
=kb B[ ]t−h −kc C[ ]t
B[ ]t ≈ B[ ]t−he−kbh+ka A[ ]t−h
kb1−e−kbh( )
C[ ]t ≈ C[ ]t−he−kch+kb B[ ]t−h
kc1−e−kch( )
A[ ]t ≈ A[ ]t−he−kah
---> plug results into partitioning ratios
Estimating Partitioning Ratios3) First write each species ODE in finite difference form -- (12.110)
A[ ]t − A[ ]t−hh
=−ka A[ ]t
B[ ]t − B[ ]t−hh
=ka A[ ]t −kb B[ ]t
C[ ]t − C[ ]t−hh
=kb B[ ]t −kc C[ ]t
Estimating Partitioning Ratios-- then rearrange finite difference equations into a matrix -- (12.111)
1+hka 0 0
hka 1+hkb 0
0 hkb 1+hkc
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
A[ ]tB[ ]tC[ ]t
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
=
A[ ]t−hB[ ]t−hC[ ]t−h
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
---> then solve the matrix for [A]t, [B]t, and [C]t and plug results into partitioning ratios
ExampleAdd bimolecular reaction to the system
Linearized, finite difference forms of A, B, and C (12.112)
(12.113)
(12.114)
A +C → B+D
A[ ]t − A[ ]t−hh
=−ka A[ ]t −kac A[ ]t C[ ]t−h
B[ ]t − B[ ]t−hh
=ka A[ ]t −kb B[ ]t +0.5kac A[ ]t C[ ]t−h + A[ ]t−h C[ ]t( )
C[ ]t − C[ ]t−hh
=kb B[ ]t −kc C[ ]t −kac A[ ]t−h C[ ]t
Example With Bimolecular Reaction
Resulting matrix (12.115)
---> then solve the matrix for [A]t, [B]t, and [C]t and plug results into partitioning ratios
1+hka +hkac C[ ]t−h 0 0
−hka −0.5 hkac C[ ]t−h( ) 1+hkb −0.5 hkac A[ ]t−h( )0 −hkb 1+hkc +hkac A[ ]t−h
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
A[ ]tB[ ]tC[ ]t
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ =
A[ ]t−hB[ ]t−hC[ ]t−h
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥