KPP – A Software Environment for the Simulation of Chemical Kinetics

Adrian Sandu Computer Science Department Virginia Tech NIST, May 25, 2004 Acknowledgements

„ Dr. Valeriu Damian

„ Dr. Florian Potra

„ Dr. Gregory Carmichael

„ Dr. Dacian Daescu

„ Dr. Tianfeng Chai

„ Dr. Mirela Damian

Part of this work is supported by

™ NSF ITR AP&IM-0205198

May 25, 2004 Related Work

CHEMKIN (http://www.reactiondesign.com/lobby/open) Translates symbolic chemical system in a data file that is then used by internal libraries for simulation. Gas-phase kinetics, surface kinetics, reversible equations, transport, mixing, deposition for different types of reactors, direct sensitivity analysis (Senkin). Database of reaction data, graphical postprocessor for results. KINALC (http://www.chem.leeds.ac.uk/Combustion/kinalc.htm) Postprocessor to CHEMKIN for sensitivity and uncertainty analysis, parameter estimation, and mechanism reduction; etc. KINTECUS (http://www.kintecus.com) Compiler/ chemical modeling software. Can run heterogeneous and equilibrium chemistry, generates analytical Jacobians, fit/optimize rate constants, initial concentrations, etc. from data; sensitivity analysis; Excel interface. Can use Chemkin models and databases. (http://rayleigh.cds.caltech.edu/~goodwin/cantera) Object-oriented package for chemically-reacting flows. ++ kernel, STL, standard numerical libraries, Interfaces for MATLAB, Python, C++, and . Capabilities: homogeneous and heterogeneous kinetics, equilibria, reactor modeling, multicomponent transport. LARKIN/LIMKIN (http://www.zib.de/nowak/codes/limkin_1.0/full) Simulation of LARge systems of chemical reaktion KINetics and parameter identification. Parser generates Fortran code for function and Jacobian, or internal data arrays. DYNAFIT (http://www.biokin.com/dynafit) Performs nonlinear least-squares regression of chemical kinetic, enzyme kinetic, or ligand- receptor binding data using experimental data. Parses symbolic equations.

May 25, 2004 KPP in a Nutshell

„ The Kinetic PreProcessor „ Purposesimulations: automatically implement building blocks for large-scale

„ Parses chemical mechanisms

„ Generates Fortran and C code for simulation, and direct and adjoint sensitivity analysis

„ Function, Jacobian, Hessian, Stoichiometric matrix, derivatives of function&Jacobian w.r.t. rate coefficients

„ Treatment of sparsity

„ Comprehensive library of numerical integrators

„ Used in several countries by academia/research/industry

„ Free! http://www.cs.vt.edu/~asandu/Software/KPP

May 25, 2004 KPP Architecture

kinetic description files

IntegratorC file Utility fileC atoms Fortran Fortran species equations options inline code Driver fileC I/O fileC Fortran Fortran KPP

Scanner / Parser Error checking

Compute best sparsity structure C Fortran Code generation Reorder species for Substitution best sparsity pre-processor

Compute expression trees for assignments

May 25, 2004

C Fortran prod/destr function integrator function utility functions jacobian code sparsity structure driver function(main) I/O functions KPP Example

#INCLUDE atoms SUBROUTINE FunVar ( V, R, F, RCT, A_VAR ) INCLUDE 'small.h' REAL*8 V(NVAR), R(NRAD), F(NFIX) #DEFVAR REAL*8 RCT(NREACT), A_VAR(NVAR) O = O; O1D = O; O3 = O + O + O; C A - rate for each equation NO = N + O; NO2 = N + O + O; REAL*8 A(NREACT) C Computation of equation rates #DEFFIX A(1) = RCT(1)*F(2) A(2) = RCT(2)*V(2)*F(2) O2 = O + O; M = ignore; A(3) = RCT(3)*V(3) A(4) = RCT(4)*V(2)*V(3) #EQUATIONS { Small Stratospheric } A(5) = RCT(5)*V(3) O2 + hv = 2O : 2.6E-10*SUN**3; A(6) = RCT(6)*V(1)*F(1) A(7) = RCT(7)*V(1)*V(3) O + O2 = O3 : 8.0E-17; A(8) = RCT(8)*V(3)*V(4) O3 + hv = O + O2 : 6.1E-04*SUN; A(9) = RCT(9)*V(2)*V(5) O + O3 = 2O2 : 1.5E-15; A(10) = RCT(10)*V(5) C Aggregate function O3 + hv = O1D + O2 : 1.0E-03*SUN**2; A_VAR(1) = A(5)-A(6)-A(7) O1D + M = O + M : 7.1E-11; A_VAR(2) = 2*A(1)-A(2)+A(3)-A(4)+A(6)- O1D + O3 = 2O2 : 1.2E-10; &A(9)+A(10) NO + O3 = NO2 + O2 : 6.0E-15; A_VAR(3) = A(2)-A(3)-A(4)-A(5)-A(7)-A(8) A_VAR(4) = -A(8)+A(9)+A(10) NO2 + O = NO + O2 : 1.0E-11; A_VAR(5) = A(8)-A(9)-A(10) NO2 + hv = NO + O : 1.2E-02*SUN; RETURN END

May 25, 2004 Sparse Jacobians

E.g. SAPRC-99 74+5 spc./211 react. IDEAS: NZ=839, NZLU=920 • Chem. interactions: sparsity pattern (off-line) • Min. fill-in reordering 1

• Expand sparsity structure 10 • Row compressed form • Doolitle LU factorization 20

• Loop-free substitution 30

40 #JACOBIAN [ ON | OFF | SPARSE ] 50 JacVar(…), JacVar_SP(…), JacVar_SP_Vec(…), JacVarTR_SP_Vec(…) 60

KppDecomp(…) 70 74 KppSolve(…), KppSolveTR(…) 1 10 20 30 40 50 60 70 74

May 25, 2004 Computational Efficiency

(1/Lapack) Dec Sol Dec+7Sol Linear Algebra Harwell S−rodas0.61 Lsodes0.21 rodas 0.35 KPP 0.23 0.06 0.12

5

4.5

4

3.5 S−sdirk4 vode 3 Stiff Integrators sdirk4 2.5

2 Number of Accurate Digits S−vode chemeq 1.5 qssa 1

0.5 8 9 10 20 30 50 80 CPU time [seconds]

May 25, 2004 Sparse Hessians

E.g. SAPRC99. NZ = 848x2 (0.2%)

2 ∂ fi Hi, j,k = ∂y j∂yk

•3-tensor • sparse coordinate format • account for symmetry

#HESSIAN [ ON | OFF ] HessVar(…) HessVar_Vec(…) HessVarTR_Vec(…)

May 25, 2004 Stoichiometric Form

#STOICMAT [ ON | OFF ]

STOICM (column compressed) dFunVar_dRcoeff(…) ReactantProd(…) dJacVar_dRcoeff(…) JacVarReactantProd(…)

SAPRC−99. Stoichiometric Matrix. NZ = 1024 ( 6 % ) 1

20

40 Species

60

79 1 20 40 60 80 100 120 140 160 180 200 211 Reaction

May 25, 2004 Requirements for Numerics

„ Numerical stability (stiff chemistry) -6 -2 „ Accuracy: medium-low (relerr~10 -10 )

„ Low Computational Time

„ Mass Balance

„ Positivity

May 25, 2004 Stiff Integration Methods

α k k [n] n−i [n] n−i BDF ∑ i y = hn ∑ βi f ()y i=0 i=0

s n+1 n y = y + ∑bj f ()Yj , Implicit j=1 Runge-Kutta s () n Yi = y + ∑ ai, j f Yj j=1

May 25, 2004 Rosenbrock Methods

4

s 3.5 n +1 n y = y + ∑ m j k j j =1 3 i −1 n 2.5 Yi = y + ∑ a i , j k j j =1 Ros3 i −1 2 SDA 1 n 1 ()hγ I − J ⋅ k i = f ()Yi + ∑ h ci , j k j j =1 1.5

Rodas3

„ No Newton Iterations 1

„ TWOSTEP RODAS VODE Suitable for Stiff Systems 0.5 „ Mass Conservative SEULEX

0 „ Efficient: Low/Med Accuracy 0.6 0.8 9 1 2 3 4 5 6 7 8 10 CPU time [seconds]

May 25, 2004 Direct Decoupled Sensitivity

⎧ y′ = f (t, y, p) S = ∂y ∂p Problem ⎨ l l S′ = J()t, y, p ⋅ S + f p t, y, p ()1≤ ≤ m ⎩ l l l l γ

I − h J = PT LU ⇒

T ⎡ P L 0 L 0 ⎤ γ ⎢ ⎥ ⎡U 0 ⎤ −γ h []()JS + J U −1 PT L 0 L I − h ℑ = ⎢ 1 y p1 L ⎥ ⋅ ⎢ ⎥ ⎢ 0 ⎥ ⎢ M O M ⎥ ⎢ M O M ⎥ ⎢ 0 U ⎥ − hγ []()JS + J U −1 0 PT L ⎣ L ⎦ ⎣⎢ m y pm L ⎦⎥

May 25, 2004 DDM with KPP

β k −1 yn+1 = ∑ yn−i +βh f n+1 i=0 k −1 BDF n+1 n+1 n−i n+1 []I − h J ⋅ S = S + hβ f p , 1≤ ≤ m l ∑ l l l (Dunker, ’84) i=0

s s i−1 yn+1 = yn + m k 0 , S n+1 = S n + m k l , Y i = yn + a k 0 ∑ i i l l ∑∑i i ij j i=1 i=1 j=1 i−1 γ 1 n 0 i i 1 0 n []h I − J ⋅ki = f ()T ,Y , p + ∑ h cij k j + h i ft γ j=1 Rosenbrock ⎛ i−1 ⎞ (Sandu et. al. ‘02) 1 n l i i ⎜ n l ⎟ i i []hγ I − J ⋅ki = J()T ,Y , p ⋅ S + aij k j + f p T ,Y , p () ⎜ l ∑ ⎟ l ⎝ j=1 γ ⎠ i−1 1 l n 0 n n 0 n n n + cij k j + J p ⋅ ki + ()H × S ⋅ki + h i Jt S + hγ i f p ,t ∑ h l l l l j=1

May 25, 2004 λ Adjoint Sensitivity Analysis λ Problem: Stiff ODE, scalar functional.ψ

0 λf f y'= f ()t, y , t ≤ t ≤ t , (y(t)) ⇒ ∇ 0ψ (y(t )) ψ y

Continuousλ: Take adjoint of problem, then discretize.

T f 0 f f ψ 0 '= −J ()t, y ⋅ , t ≥ t ≥ t , (t )= (∇ )(y(t )) ⇒ ∇ 0 = λ(t ) λ y y Discrete: Discretize the problem, then take adjoint:ψ

k+1 k k y = F ()y , k = 0,1,L, N −1 ψ k()()k T k N N N 0 = ∇ F y , = ()∇ ()y ⇒ ∇ 0 y = λ () y y y

Note: In both approaches the forward solution needs to be precomputed and stored.

May 25, 2004 Linear Multistep Methods α k k α [n] yn−i = h β [n] f ()yn−i Method ∑ i λ n ∑ i i=0 i=0 β k k [m] m+i [m] T m+i m+i Continuous Adjoint α = h J ()y ⋅λ ∑ i λ m ∑ i i=0 i=0

k k [m+i] m+i T m β [m+i] m+i Discrete Adjoint ∑ i = J ()y ⋅∑ hm+i i λ i=0 i=0

Consistency: ~one-leg method, in general not consistent with continuous adj. eqn. Implementation: with KPP

May 25, 2004 Runge Kutta Methods

λ s s λ n+1 n i i n j Method y = y + h∑bi f ()Y , Y = y + h∑ ai, j f Y ( ) λ i=1 i=1 Continuous Adjoint λ s θ s n n+1 T n+1 i θi n+1 T n+1 j = + h∑bi J ()y(t − cih) ⋅Λ , Λ = λ + h∑ ai, j J y(t − cih) ⋅Λ () i=1 j=1 λ Discrete Adjoint s ⎡ s ⎤ n = n+1 + i , i = hJ T ()Y i ⋅ b n+1 + a θ j (Hager, 2000) ∑ ⎢ i ∑ j,i ⎥ i=1 ⎣ j=1 ⎦

Consistency (Sandu, 2003) Consider a Runge-Kutta method of order p. Its discrete adjoint is an order p numerical discretization of the continuous adjoint equation. (Proof: use elementary differentials of transfer fcns). Implementation: with KPP

May 25, 2004 Singular Perturbation

Test problem relevant for stiff systems: λ y'= f (y, z), ε z'= g(y, z), t 0 ≤ t ≤ t f ψ

Distinguish between derivatives w.r.t. stiff/non-stiff variables µ f f f f (t) = ∇ y(t) (y(t ), z(t )), (t) = ∇ z(t) ψ (y(t ), z(t ))

(Sandu, 2003) If RK with invertible coefficient matrix A and R(∞) = 0; and the cost function depends only on the non-stiff variable y Then µ= 0 and λ are solved with the same accuracy as the original method, within O(ε). A similar conclusion holds for continuous RK adjoints.

May 25, 2004 λ Rosenbrock Methods α i−1 s i n+1 i n+1 λn n+1 Λ = + ∑ ai, j z j , Y = y(t − h i ), = λ + ∑ m j z j Continuous j=1 j=1 i−1 Adjoint 1 n+1 T T i i 1 []hγ I −()J ⋅ zi = J ()Y ⋅Λ + ∑ h ci, j z j , 1≤ i ≤ s j=1

s 1 n T n+1 1 [hγ I − ()J ]⋅ui = mi + ∑ ()a j,iv j + h c j,iu j j=i+1 Discrete λ v = J T ()Y ⋅u s ≥ i ≥1 Adjoint i i i s s λn n+1 n T = λ + ∑()H × ki ⋅ui + ∑vi i=1 i=1

Consistency (Sandu, 2003) Similar to Runge-Kutta Implementation: with KPP

May 25, 2004 Computational Efficiency

„ Tdiscrete adjoint≤ 5 Tforward (Griewank, 2000) „ KPP/Rodas-3 on SAPRC-99:

Tcont-adj Tcont-grad Tdiscr-adj Tdiscr-grad /T /Tfwd fwd /Tfwd /Tfwd 1.2 3.3 2.3 4.4

May 25, 2004 KPP Numerical Library

„ Simulation Sparse: BDF (VODE, LSODES), Runge-Kutta (Radau5), Rosenbrock (Ros-{1,2,3,4},Rodas- {3,5}. QSSA. Drivers „ Direct Decoupled Sensitivity Sparse: ODESSA, Rosenbrock, I.C. and R.C. „ Adjoint Sensitivity Continuous Adj. with any simulation method Discrete Adj. Rosenbrock. Drivers.

May 25, 2004 Swedish Meteo & Hydro Inst.

[email protected], www.smhi.se

May 25, 2004 Max Planck Institute

May 25, 2004 MISTRA-MPIC, U. Heidelberg

“Chemical reactions in the gas phase are considered in all model layers, aerosol chemistry only in layers where the relative humidity is greater than the crystallization humidity. […] The set of chemical reactions is solved using KPP.” (http://www.iup.uni-heidelberg.de/institut/f

orschung/groups/atmosphere/modell/glasow)

May 25, 2004 User Contributions to KPP

Artenum SARL ParisCyberVillage 101-103 Bld Mac Donald 75019 Paris 19ème France www.artenum.com (Consulting company)

May 25, 2004 Example: Modeling Air Pollution

May 25, 2004 The Forward Model

Mass Balance Equations. C =ρ moleρ fraction. ρ = air density.

dCi r 1 1 = − u ⋅∇Ci + ∇()K ⋅∇Ci + ρ fi ()ρC + Ei dt 0 0 0 F Ci ()t , x = Ci ()x , t ≤ t ≤ t ()IN () IN Ci t, x = Ci t, x on Γ ∂C K i = 0 on ΓOUT ∂n ∂C K i = V DEPC − Q on ΓGROUND ∂n i i i

May 25, 2004 Discrete Forward Model

Operator Splitting: „ Conservative Methods for Transport „ Stiff Methods for Chemistry (KPP), „ Specific Methods for Aerosols, „ Different Time Steps.

k+1 k C =N[t,t+∆t] oC ∆t ∆t ∆t ∆t ∆t N[t,t+∆t] =THORoTVERTo RCHEMoTVERToTHOR

May 25, 2004 Chemical Data Assimilation Inverse Modeling Improved Air Quality for Improved and Chemical Emission Estimates   weather forecasts     Emission Estimates       Atmospheric Models  Optimal Analysis State  Meteorological (CTMs)Chemical provide theModels Model Outputs: evolution, including Concentrations Modelsprovide  production and Fluxes Budgets Physical aspects  destruction of the  ofthe atmosphere chemical components e.g. clouds, winds. and optical properties Better design Evaluation; of observation networks/ Model measurement strategies Improved repre− Performance; sentation of Feedbacks Improved transport features Applications Meteorological forecasts; cloud fluxes assimilated Better analysis fields Retrieval Algorithms Assimilation Techniques: Adjoint Modeling Chemical & Optical Meteorological Observations Variational (4D−Var) New Approaches Observations: Sattelite, ground, aircraft Winds, Temperature, Clouds Column (integral) quantities

May 25, 2004 4D-Var Data Assimilation

N T T 1 k k k −1 k k k 1 b −1 b min ψ ()p = 2 ∑()()H y − o Rk H y − o + 2 ()()p − p B p − p k=1 (Note: Need the gradient of J)

FORWARD y0 yN y1 y2 y3 ψ 0 ∇ p = λ λN λ1 λ2 λ3 ADJOINT

May 25, 2004 λ Continuous Adjoint Model λ λ d ρ λ⎛ ⎞ i =−∇⋅()ur −∇⋅⎜ K ⋅∇ i ⎟−()FT ( C)⋅ − dt λ i ⎜ ⎟ i i ()λ ⎝ρ ρ⎠ F F F λ o i t , x = i ()x , t ≥ t ≥ t φ ()λ t, x = 0 on ΓIN i ρ λ ρ ∂() ur + K i = 0 on ΓOUT ρ i λ ρ ∂n ∂() K i =V DEPλ on ΓGROUND ∂n i i

Note : Linearized chemistry generated by KPP.

May 25, 2004 Discrete Adjoint Model

δ Operator Split Tangent Linear and Adjoint Discrete Models

k+1 δ k C = N[′t,t+∆t] o C λ ∆t ' ∆t ' ∆t ' ∆t ' ∆t ' N[′t,t+∆t] = ()()()()()THOR o TVERT o RCHEM o TVERT o THOR k '* k+1 = N [t,t+∆t()()()()()] oλ '* ∆t '* ∆t '* ∆t '* ∆t '* ∆t '* N [t,t+∆t] = THOR o TVERT o RCHEM o TVERT o THOR

Note : Chemical Model Discrete/Continuous Adjoints

automatically generated by KPP

May 25, 2004 Adjoint STEM-III

¾ Measurement info used to I/O Data adjust initial fields and

Master improve predictions;

Node Node Node Node ¾ East Asia. Grid: 80 x 80Km. Time: [0,6] GMT, 03/01/01.

Local Chkpt Local Chkpt Local Chkpt Local Chkp t ¾ SAPRC 99 (Ros-2); 3rd order 20 Ideal Speedup Relative Speedup upwind FD; LBFGS; 15

¾ 10 Parallelization with PAQMSG Relative Speedup 5 ¾ Distributed Level-2 0 0 5 10 15 20 No. Workers Checkpointing Scheme

May 25, 2004 NASA Trace-P Experiment

¾Transport and Chemical Evolution over the Pacific

¾March-April 2001

¾Quantify Asian transport

¾Understand chemistry over West Pacific

May 25, 2004 Computational Setting

Computational domain: • Area: 7.200 x 4.800 km • Horizontal grid: 80 x 80 Km • Vertical grid: 18 layers,10 km.

Model Size ~ 8,000,000 variables

May 25, 2004 Trace-P Simulation

March 01-04, 2001

O3 NO2 SO2

May 25, 2004 Model vs. Observations

• Cost functional = model-observation gap. Modeled O vs. Measured O 90 3 3 12000 Observed O3 Modeling O3 Flight Height (m) • The analysis produces 80 10000 an optimal state of the 70 atmosphere using: 8000 60 ¾ Model information 50 6000

O3 (ppbv) consistent with Altitude (m) 40 4000 physics/chemistry

30

2000 ¾ Measurement 20 information 10 0 24 25 26 27 28 29 30 31 32 33 consistent with TIME (GMT) reality

May 25, 2004 More Observations

NO: Observation vs. Model SO2: Observation vs. Model

DC-8 Flight #6 NO on 3/3/2001 DC-8 Flight #6 SO2 on 3/3/2001 0.2 12000 4 12000 Observed NO Observed SO2 Modeling NO Modeling SO2 0.18 Flight Height (m) Flight Height (m) 3.5 10000 10000 0.16 3 0.14 8000 8000 2.5 0.12

0.1 6000 2 6000 Altitude (m) SO2 (ppbv) NO (ppbv) Altitude (m) 0.08 1.5 4000 4000 0.06 1

0.04 2000 2000 0.5 0.02

0 0 0 0 24 25 26 27 28 29 30 31 32 33 24 25 26 27 28 29 30 31 32 33 TIME (GMT) TIME (GMT)

May 25, 2004 Target: O3 at Cheju Island

March 4-6, 2001: Strong NE flow, Beijing-Cheju

March 22-25, 2001: Weaker Flow

May 25, 2004 Cones of Influence

Isosurfaces of time integrals of adjoint vars. (ψ = O3 at Cheju). March 4-6, 2001 March 22-25, 2001

O3

NO2

HCHO

May 25, 2004 Areas of Influence

¾Ψ = Ozone at Cheju, 0GMT, 03/04/2001 ¾Influence areas (adjoint isosurfaces) depend on meteo, but cannot be determined solely by them (nonlinear chemistry). ¾Boundary condition uncertainties 3 days before. d d ψ / d O3 ψ / d dHCHO 2

ψ / d NO

May 25, 2004 Flights on March 07, 2001

DC-8Taiwan (120E-122E, 22N-25N) P3-B

May 25, 2004 Assimilation of DC-8 O3

Control = Initial O O along 3 3 Assim. window [0,12] GMT O3 along DC-8 flight P3-B flight

90 120

+ observation (ppbv) x model result (ppbv) (before DA) model result (ppbv) (After DA) + observation (ppbv) ++ 80 x model result (ppbv) (before DA) ++ model result (ppbv) (After DA) 100 + +

+ 70 + + + +++ + x +x ++++ + + + + + +x x + ++ ++ xx+ + xxxx xx+x + + + + + + + ++ +x xx+ + 80 + + + +x +x ++ ++++ + 60 + + + x x x ++ + + + + + + + x xx + + + + ++++ + + +x +xx ++ + + + + ++ + + x+ + + + + + + ++ xx++ + + + + + + + x + x + + + + + xx x x + + + x +x x x xxxxx+xxx x + + + x ++ 50 xxxx x x x xxxx + ++ x+++++x+ ++ xx + x+++++ xxx 60 x x + + xx ++++x + x + + xxxx x x x xx x xx ++x+ x + x x xx x xxx x x xx + + xx xx x x x+ x x xxxx x+ + xxx xx x + x + x x + xxx xx x + x+ xx +xx + x x xx + 40 + xx +++ ++ + xx x xx+x+xx +x ++ +x + x x + +x x+ + xx xx + x + x + xxx x+++ x x 40 + x + xxx x x x + x xx x x x x x xxx xx xx x xx 30 x xxxxx xxxx observation (ppbv), model result (ppbv) observation (ppbv), model result (ppbv) +++++++

20 20 2 4 6 8 10 2 4 6 8 10 time (GMT hr) time (GMT hr)

May 25, 2004 Assimilation of P3-B O3

Control = Initial O O3 along 3 O along Assim. Window [0,12] GMT 3 DC-8 flight P3-B flight

100 120

+ observation (ppbv) + observation (ppbv) ++ x model result (ppbv) (before DA) + x model result (ppbv) (before DA) model result (ppbv) (After DA) ++ model result (ppbv) (After DA) 100 + 80 + + +++ + + + + x+x +++ + 80 + ++ + + x+ ++x+x+ + + ++ + + +xx xxx+ ++xxx ++ + + + + ++ + +x xxx +x + + + ++ + + + + x+ ++ + ++ + +++ + + + + + 60 + x x ++ ++ + + x x xx +++ + ++ + + + + + x xx ++ + + + + ++ ++ x+x + x +++ + ++ x ++x + + + ++ x++++++x+ + + xx ++x xxxx + 60 xx x x + x + xxxx xx x x x+ xxx x + + x x xx x x xx x+x x xxxxxx++ + x x x xx x x+++ xx xx + x + + xx xx xx x xx x++ ++ xx +++x x x + xx x x + + xxx x x + ++ +xxx + xxx xx x + x x x + xxx x x xx xxx+ + xx x + + xx x ++xx 40 x x x xx x + xx + + + x+ + x+ + xxx x + x + x ++++++x + xx x+++ + x+ 40 x + x + xxx x x x x +x + x x x xx +x x xx xx x xxxxxxxx xxxx xx x x observation (ppbv), model result (ppbv) observation (ppbv), model result (ppbv) +++++++

20 20 2 4 6 8 10 2 4 6 8 10 time (GMT hr) time (GMT hr)

May 25, 2004 Assimilation of Multiple Species

P3-B Obs: O (8%); NO, NO (20%); HNO , PAN, RNO (100%) ++ 3 2 3 3 + 120 ++ + 0.14 100 0.12 + + + X 0.1 80 X XX +++ XX X X X 0.08 X O3 X X X X X NO O + X X +X XX X + 3 60 X+ X+ XX XX 0.06 NO X XXX XX ++++ X+ X+X XX + + XXX + + X XXX+ + ++++X 0.04 40 + + + X + X X XXXXX + X X + + + + XX 0.02 X X X + XXX + + + X + X+ + X X X XX + + + X X X + X + X + 20 X X 4 X + + XXX + X 6 8 10 0 + + XXXXXXXX 4 X XXXXXX XXX 6 8 10 X + + ++ + X XTime GMTXX (hr) XXX+XXXXX XX + X X XTimeX X XX GMTX (hr) X + ++++ X ++ XX XXXXXXXXXXXX XXXX+XX+XXXXXXX X + X XX XXXXXXX XX XX X XX X XX + + XXXXXXXXX XXXX X+XXXX + + X XX + 0.4 + X ++ + +++ + + X +X + + + X 2 ++ + ++ + + + + +++ ++ + + ++ + ++ + + ++ ++ + + 0.3 + ++ + + + + + + + X + 1.5 + ++ + XX ++ ++ + + X +++ ++ ++ + + +++ +++ + + X X ++++ +++ + + + NO 0.2 + + + NO2 X 2 HNO3 1 + + HNO X + X + X 3 X + + 0.1 X XX ++ X + 0.5 ++ X + X X + + + + X++ X X + X X + ++ + X X+ ++ +++ X XX + X XX X X + +++ X++ + +++ +X++ 0 XXXXXXXX + XXXX XXX X 0 X + XXXX++ X ++++ +XX XX X +X X XXXXXX XXXX 4 X XX XTime GMTXXXXXX (hr)6 8 10 + ++ + 4 +X X X TimeX GMT (hr)6 8 10 XXXXXXXXXXXX XXXXXXXXXXXX XXXXX + + X XXXXX++++X+ + + + X X X X + + X X X XX X ++ + + + X + XXXX X X X XX XXXXX + + ++ ++++ + +++++ X X 1.2 + + X XXXXX X X X + + +++++++++ + + + + 0.12 XXXXXX XXX X XXX XXXX + + + + ++++ ++++ + + XXXXXXXXXXX 1 + ++ X + + + X ++ +++ X + 0.1 X + ++ + 0.8 X X + ++++ + + X+ + + 0.08 + + + PAN + X +++ + ++ + PAN XX X + 0.6 + X 0.06RNO3 ++ RNO X X + + X ++ + X X 3 X X X X XX X 0.4 + XX XX X 0.04 ++ +X + + + + X+X X+X+ +++ ++ +++X+ ++X + + + ++ + X X+ X + + X +X+X+ XX ++ ++ + 0.2 + X XX 0.02 + X+ ++ X + X+X +X + + X X X + XX X + + + + XX ++ + X ++X X +++ + + + ++++ + + X 0 + XX+ X+ 0 ++++++++ X ++ ++++ X ++ XXXXXX+ 4 ++X+ XXXXXXXXXX X 6 8 10 X + XX 4 XX XXX 6 8 10 +X+X+XXXX+XXX+XX + +XXX+X+XTime+ XX GMT+X+X+X+X+ (hr) XXXXX XXX TimeXX GMT (hr) +++++ ++ + ++++++ XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXX

May 25, 2004 Sensitivity Analysis

Sensitivity magnitude ψ = NOY (P3-B) Averaged gradients help with choice of control variables

1E-09 1E-08 1E-07 1E-06 1E-05 0.0001 0.001 0.01

15

10

etcllevel Vertical 5

0 5 10 15 20 25 30 35 40 45 50 55 60 65 Species Index 1. O3 11. H2SO4 21. CCO_OH 31. PROD2 41. ALK3 51. PHEN 61. OPM25 2. H2O2 12. CO 22. RCO_OH 32. DCB1 42. ALK4 52. PAN 62. DUST1 3. NO 13. HCHO 23. GLY 33. DCB2 43. ALK5 53. PAN2 63. DUST2 4. NO2 14. CCHO 24. MGLY 34. DCB3 44. ARO1 54. PBZN 64. DUST3 5. NO3 15. RCHO 25. BACL 35. ETHENE 45. ARO2 55. MA_PAN 65. DMS 6. N2O5 16. ACET 26. CRES 36. ISOPRENE 46. OLE1 56. BC 66. CO2 7. HONO 17. MEK 27. BALD 37. C2H6 47. OLE2 57. OC 8. HNO3 18. HCOOH 28. ISOPROD 38. C3H8 48. TERP 58. SSF 9. HNO4 19. MEOH 29. METHACRO39. C2H2 49. RNO3 59. SSC 10. SO2 20. ETOH 30. MVK 40. C3H6 50. NPHE 60. OPM10

May 25, 2004 Assimilation of DC-8 CO

Control: Control: Initial CO Conc. Initial Conc. of 50 spc. v) 400 400 XX XX + CO Observation (ppbv) X CO model prediction (ppbv) (before DA) 350 CO model prediction (ppbv) (after 4 iterations) 350 + Observations X X Model (before DA) X X Model (after 10 iterations) X + + + ++ + ++ 300 + 300 + X +X X +X +X + X +X + X + + + + + + 250 ++ + + 250 + + +++ + + + + + + + ++ X + X X + X + X X X X X X + X ++XXX + + 200 X 200 X X ++X + X ++X + X + X ++ X X X + X+ +X X X X + ++++++ XX + + +++ XXXX XXXX ++++ X XXXXXX 150 X X XXXXXXX 150 + + X+X+X+XX+XX X X XXXXXX X X X X ++ X X X + + +++++ X XXXX X +XXXX + +X + XXXXX X+ X X X XXXXX X X X X ++ + + ++ X +X + X + X + + X X ++ ++ + + + X++ +++ ++++ + + +X+ +++ + + ++ + X X+ + + +XX+ + CO100 concetrations (ppbv) + X X + 100 + X +XX X X X +X + X++ +XX +++++ +X X X++ +X +X + ++ X X X + ++X X + +X X+ X + X +++++X++ +++ + ++++X X ++++++++ +XX+XXXXXX++ XXX X+X+XXX+XX XX+++ XXXXXXXXX XXX +XXXXXXX+ +X XX + XXXXX ++ ++ +++++++++ +XXX X XXXXX + XXXXXX 50 50

0 0 2 4 6 8 10 0 2 4 6 8 10 12 CO Observation (ppbv), CO model prediction (ppb Time (GMT hr) Time (GMT hr)

May 25, 2004 Assimilation of DC-8 CO

Control: CO along Initial Conc. 50 spc. CO along DC-8 flight P3-B flight 400 450 XX + p3 Observations Observations X Model (before DA) 350 + 400 + Model (after 10 iterations) X X Model (before DA) X Model (after 10 iterations) + X + X + ++ ++ + + 350 + + X 300 + + X+ + X X X ++ + X + + X + X X X + X + + + 300 ++++ X ++ + + X X 250 + + X + + +++ X + +X + + + + ++ X X X X X + X 250 X X X X + + ++XXX + XX XX X +X 200 ++ X + X ++ +X + X X X X X X ++ X XX +++ X X X X + XX + X++ + ++ 200 X + + X++X + XX + +++++ XX ++ + X X X X +++++ XX 150 X X XXXXXXXX X X XXXXXX X +XX + X XXXXX X + + ++++ XX ++ + + X ++XXXX 150 + + + X XXXXX X X X + X X +X + X + X + X X + X++ + + ++ XXX X XXX X + X + ++ + XX X

+ CO concetrations (ppbv) CO100 concetrations (ppbv) + XXX + X X+X X + X++ +XXX ++++X++ +X X X++ + + XXX + + X + +++++ 100 X X ++ ++ +X+++X X +X X ++ +X XXX X + + XXXXXXXX+ XX +XX+X+XX+X+++ ++XXX X XXXXXXX XXXX +++ + +++ XXXXXXXX +++++ ++ ++++++ +++++ 50 50

0 0 0 2 4 6 8 10 12 2 4 6 8 10 Time (GMT hr) Time (GMT hr)

May 25, 2004 Different Control Sets

Observed: NOY (P3-B)

NOY= NO+NO2+NO3+2*N2O5+HONO+HNO3+HNO4+RNO3+PAN+PAN2+PBZN+MA_PAN

(NO,NO2,PAN) > (NO,NO2,O3) 50 spc > (NO,NO2,HNO2,PAN,PAN2) 3.5 4.5 + Observation X + Observation X Model (Without 4D-Var) X Model (Without 4D-Var) + Model (Ctrls: NO + NO2 +PAN) 4 Model (Ctrls: NO + NO2 + HNO3 + PAN +PAN2) 3 ++ Model(Ctrls:NO+NO2+O3) Model (50 Ctrls) + 3.5 ++ X 2.5 + + 3 X XX ++ X X + 2 + + X + + X + X X 2.5 ++ + + X XX + + + X X X ++ + + X 1.5 + X + 2 X +X X NOy (ppbv) + + + X X + NOy (ppbv) + + X ++ +X + + X + X + + + + ++ X XX + X X 1.5 X+ + + X X + + + 1 X X+ X ++ + + + X XX +X X + + X +X + +X + + +X X + ++ X + X ++ + + X +XX X + XX X X X XX + X X + XX + X XX + + X X + + XX+X 1 X X+ X +++ X + + X + +X XX+ X + + + XX XX X X+ X X + X XX +++ X X+ X + X + +++ X+X + X XXXXX 0.5 ++ X + + XX +X + + X XX+X + XXXX + ++ X X + X + X + X + + ++ X + XX + XX XX X X+ X X + + +XX 0.5 + XX + + X +++X +X+ ++XXX+X+X+ X ++ XXXX + + +++ X XX + X+ XXXXX+ +X+X+X+X+ + +++ X + XXXX X+ +X+X+XX+ + +XXXXXX+X++ +X+X+X+X+X 0 0 2 4 6 8 10 2 4 6 8 10 TIME (GMT hr) TIME (GMT hr)

May 25, 2004 Effect on Unobserved Species

Observed: NOY (P3-B) Control: Initial NO, NO2, HNO3, PAN, PAN2

NO2 (unobserved) PAN (unobserved) 0.4 X X 1.2 XX XX X X 1 0.3 X X +X X X X + X X 0.8 ++ X X X + + X + X X + + 0.2 + X ++ PAN NO2 0.6 +++ X + + + ++ +++ X X X++ ++ X ++ + XX + + ++ + X +X + X + ++ + + 0.4 + XX + X + + X X 0.1 X XX X ++XX XX X + + + X+X X+X + + X X X+ X + X + + + 0.2 + +X XX + ++ + X X +++ X+X X + + X +X X + ++++ X + X+ ++X + XX ++ + X + X XXX+X+XXXX+X + + + XXX X XX+ X+ X XXX+ ++X+++++ +X +XXXXX X + XXXX X ++ XXXXXX+ ++X+ XXXXXXXXXX X 0 XXXXX+XXXXXXXXX+X + + XXXXXXXXXXX+X+XX+ ++++XX X XX 0 +X+X+XXXX+XXX+XX + +X+XX+X+X +++XX+X+X+X+X+ 4 6 XXX 8 + 10 +++++ 4 6 + + +8 +++ 10 Time GMT (hr) Time GMT (hr)

May 25, 2004 Conclusions

¾ KPP software tool for the simulation of chemical kinetics ¾ Code generation ¾ Useful (and widely used!) to build blocks for large-scale simulations ¾ Examples of chemical data assimilation which allows enhanced chemical weather forecasts

May 25, 2004 Quote of the Day

“Persons pretending to forecast the future shall be considered disorderly under subdivision 3, section 901 of the criminal code and liable to a fine of $250 and/or 6 months in prison.”

Section 889, New York State Code of Criminal Procedure (after M.D. Webster)

May 25, 2004 Thank you!

May 25, 2004