Uncertainty Analysis in RMG

30
Uncertainty Analysis in RMG Connie Gao 12/15/2016 RMG Study Group

Transcript of Uncertainty Analysis in RMG

Page 1: Uncertainty Analysis in RMG

Uncertainty Analysis in RMG

Connie Gao12/15/2016

RMG Study Group

Page 2: Uncertainty Analysis in RMG

Uncertainty propagation in kinetic systems

In a nonlinear chemical system, uncertainty of certain input parameters become magnified while others are suppressed

Model

Refining most influential uncertain parameters is fastest way to improve a model

Input parameters (š€)Reaction rate coefficients (š’Œ)Species thermodynamics (š‘®)

Output (š’„)

Product concentrations

2

Page 3: Uncertainty Analysis in RMG

Outlineā€¢ Parameter estimation leads to uncertainty ā€¢ Local and global uncertainty analysis implementation in RMGā€¢ Demonstration of resultsā€¢ Proposal for a new model development workflow

3

Page 4: Uncertainty Analysis in RMG

Parameter estimation leads to uncertaintyā€¢ RMG uses many methods to estimate thermo and kinetic

parametersā€¢ Uncertainty assignment must correspond to the confidence we

have in various parameter sourcesā€¢ Library kinetics derived from quantum chemistry or experiment has a very

different uncertainty than a rate derived from averaging rate rulesā€¢ A parameterā€™s uncertainty cannot be decoupled from the

estimation methods used to derived that parameter!

4

Page 5: Uncertainty Analysis in RMG

Estimating thermochemistry: a decision treeā€¢ 3 types of sources

ā€¢ Thermo Libraryā€¢ QM (on-the-fly quantum mechanics)ā€¢ Group additivity (GAVs)

ā€¢ But actually 2 additional types of mixed sources for radicals!ā€¢ Thermo Library saturated value + HBI

correction from GAVsā€¢ QM saturated value + HBI correction

from GAVs

5

Found inThermoLibrary?

Thermo =libraryvalue IsitaRadical?

Thermo =saturatedThermo+HBIcorrection

IsQMon?

IsitCyclic?

Thermo =fromQMjob Thermo =

sum(GAVs)

Thermo =sum(GAVs

Y N

N

N

Y

Y

Y

N

For each resonance isomer

Prioritize resonance isomer thermo by rank

Page 6: Uncertainty Analysis in RMG

Thermo uncertainty assignmentā€¢ Assume a uniform uncertainty distribution in free energy

ā€¢ Assign uncertainties according to what parameter sources constitute the thermo estimate

6

Fixedsourceswithtruevalues;theseerrorsarecorrelatedwhenusedestimatemultipleparameters

Uncorrelatederrorassociatedwithusingthegroupadditivitymethodforthisparticularthermo parameter

Page 7: Uncertainty Analysis in RMG

Estimating reaction kinetics: a decision treeā€¢ 3 types of kinetics

sources:ā€¢ Library reaction kineticsā€¢ Training reaction kineticsā€¢ Rate rule kinetics

ā€¢ But there is 1 more type of mixed source!ā€¢ Rate rules + Rate rules

originating from training reactions

7

Found inSeedorReactionLibrary?

Kinetics=librarykinetics Doesitmatchatrainingreactionexactly?

Kinetics=training reactionkinetics UseRateRules

NY

Y N

Page 8: Uncertainty Analysis in RMG

Y_rad

C H

X H

C H

H

H

C H

H

C

HO

Y

C

C

H

H

H

X_H

Cs_H

C_pri

C/H3/CO

Cs_rad

C_methyl

O O

CH2

CH4CH3+ +

Rate rules (exact): k(T) = kC/H3/CO,C_methyl(T)Rate rules (estimate): k(T) = kX_H,C_methyl(T)

Group additivity: k(T) = kC/H3/CO(T)kC_methyl(T)k0(T)

1. Identify reaction

2. Determine most specific functional groups

3. Estimate rate coefficient

8

Rate Rule Kinetics

Over 40 Reaction Families in RMG

Page 9: Uncertainty Analysis in RMG

Kinetics uncertainty assignmentā€¢ Each reaction rate is assigned a loguniform uncertainty distribution

ā€¢ Assume that library, training, and pdep reactions have fixed uncertainties , ,

ā€¢ Rate rule estimated kineticsā€™ uncertainty:

9

Eachfamilyhasanassociatederror.Somefamiliesaremoresparselypopulatedthanothersandwillhavemoreerror.Butcurrentlyallsettothesamevalue

Errorassociatedwithusinganon-exactmatch.Usedforweightingagainstratesusinglotsofaverages(N=numberofrulesaveraged).(Distancemaybeabettersubstituteeventually)

Intrinsicrateruleerror

Page 10: Uncertainty Analysis in RMG

Demontration: Track parameters and assign uncertainties

ā€¢ Test it live in findParameterSourcesAndAssignUncertainies.ipynb

ā€¢ A variety of new database functions programmed to trace all parameter estimation sources and their weights

ā€¢ New class Uncertainty contains function extractSourcesFromModel()

10

Page 11: Uncertainty Analysis in RMG

Model

Input parameters (š€)Reaction rate coefficients (š’Œ)Species thermodynamics (š‘®)

Output (š’„)

Concentration

Local uncertainty propagation

11

š‘ š‘”, šœ†+ + Ī”šœ† = š‘ š‘”, šœ†+ + āˆ‘ 01023

Ī”šœ†4 +67

ļæ½4 āˆ‘ āˆ‘ 01

023ļæ½9

0102:

Ī”šœ†4Ī”šœ†9 + ā€¦ļæ½4

šœŽ7 š‘ ā‰ˆ>šœ•š‘šœ•šœ†4

7

šœŽ7 šœ†4

ļæ½

4

š‘‘š‘š‘‘š‘” = š‘“ š‘, š‘”; šœ†

š‘(š‘”+) = š‘+

Assumptionsā€¢ Linear dependence on šœ†(first-order, evaluated at nominal input values)ā€¢ Independent inputs šœ† with no covariance

š‘†4 =Variancecontributedbyšœ†4Totaloutputvariance ā‰ˆ

šœ•š‘šœ•šœ†4

7šœŽ7 šœ†4

šœŽ7 š‘

First-order sensitivity index

Page 12: Uncertainty Analysis in RMG

Local uncertainty propagation: implementation

12

Parse rate rules and thermodynamic

groups from model

Assign uncertainties

Compute first order sensitivities PyDAS DASPK3.1

Local output uncertainties

Python FortranPython wrapper

L. Petzold, DASPK 3.1, http://www.engineering.ucsb.edu/~cse/software.html

rmgpy.tools.uncertainty

Page 13: Uncertainty Analysis in RMG

Global uncertainty analysis

Methodsā€¢ Simplest but slowest: Monte Carloā€¢ Optimize the sampling

ā€¢ Latin hypercube sampling ā€¢ Sobol sequences

ā€¢ Basis set expansionsā€¢ Fourier Amplitude Sensitivity Test (FAST)ā€¢ High-dimensional model representations (HDMR)ā€¢ Polynomial Chaos Expansions (PCE)

13

Model

Input parameters (š€) Output (š’„)

Samplefromentireparameteruncertaintyprobabilitydistribution

Aftermanysimulations,youcanapproximatetheoutputuncertaintydistribution

Eliminates linearity assumption, but is computationally expensiveā€¦

Page 14: Uncertainty Analysis in RMG

14

Legendre Polynomials Polynomial Chaos Expansions (PCE) *

š‘ šœ‰ ā‰ˆ >š›¼9ĪØ9 šœ‰6, šœ‰7, ā€¦ , šœ‰X Y

9Z+šœ‰ is set of random, uniformly distributed independent variables āˆˆ [āˆ’1, 1]ĪØ9 are Legendre polynomials that form an orthogonal basis set

Compute coefficients using Galerkin projectionš›¼9 =

1`:`:

a

Moments and variance of š‘ šœ‰ can then be computed

* D. Xiu, SIAM J. Sci. Comput., 2002.** P. Conrad and Y. Marzouk, SIAM J. Sci. Comput., 2013.

Adaptive Smolyak Pseudospectral Approximations **

ā€¢ Sampling performed adaptively done using a sparse grid, leading to faster convergence

ā€¢ 3 ways to construct PCE: ā€¢ adapt to fixed orderā€¢ adapt to a heuristic error toleranceā€¢ select wall clock time

Page 15: Uncertainty Analysis in RMG

Global uncertainty analysis: rmgpy.tools.muq

15

Random Uniform Inputs šƒ

Map šœ‰ to parameters: kinetics ln(km) and thermodynamics Gn

Modify Cantera objects using RMG

Simulate reactor with Cantera

Product Concentration c

ReactorModPiece

Initialize with Legendre Polynomials ĪØ9

Load kinetic modeland initializeReactorModPiece

CreateSmolyakPCEFactory

Sample parameter space

Obtain PCE and variance statistics

MIT Uncertainty

Quantification Library

http://muq.mit.edu

http://cantera.org

PackageforanacondanowavailableforUbuntu

Page 16: Uncertainty Analysis in RMG

Uncertainty analysis for a toy phenyldodecane model

Pyrolysis reaction conditionsT = 350 Ā°CP = 35 MPa72 hours

16

Model81 species18 group additivity values17 thermo library values35 independent thermodynamic parameters

1427 reactions4 reaction families:ā€¢ H_Abstraction (14 rate rules)ā€¢ R_Recombination (6 rate rules)ā€¢ R_Addition_MultipleBond (7 rate rules)ā€¢ Disproportionation (13 rate rules)40 independent rate rules

Page 17: Uncertainty Analysis in RMG

17

Phenyldodecane Undecene

Global Local Global Local

Mole fraction 0.187 0.146 0.141 0.108Total variance šˆšŸ š„š§ š’„ 0.58 1.64 0.53 1.28

Reaction kinetics Sensitivity Index š‘ŗš’‹ (%)

25.1 43.3 3.5 12.7

18.6 22.4 2.3 7.0

Species thermochemistry Sensitivity Index š‘ŗš’‹ (%)

15.1 2.3 82.4 61.0

2.7 0.7 9.1 10.2

16.1 31.1 0.9 9.1

Independent parameter uncertainty: global vs. local

Page 18: Uncertainty Analysis in RMG

Correlated uncertainty propagationā€¢ Conventional methods assume kinetic and thermo parameter

uncertainties are independent, even though they are composed of correlated sources

ā€¢ There are contributions from correlated and uncorrelated uncertainties:

18

Page 19: Uncertainty Analysis in RMG

Correlated uncertainty propagation: implementationā€¢ Classes KineticParameterUncertainty and ThermoParameterUncertainty now have the function getPartialUncertainty(), which can retrieve the relative contribution of uncertainty towards a parameter from a correlated source such as a rate rule

ā€¢ Class Uncertainty has the function assignParameterUncertainties(correlated=True) which can now be used to assign correlated uncertainties

ā€¢ Use the resulting objects that store correlated source information and partial uncertainty to propagate within the existing local and global uncertainty classes

19

Page 20: Uncertainty Analysis in RMG

Demonstration of resultsā€¢ findParameterSourcesAndAssignUncertainies.ipynb

demonstrates what the partial uncertainty objects look likeā€¢ localUncertainty.ipynb demonstrates uncorrelated and

correlated uncertainty propagationā€¢ globalUncertainty.ipynb demonstrates uncorrelated and

correlated global uncertainty propagation

20

Page 21: Uncertainty Analysis in RMG

Model construction workflow: old

21

Generate model

Simulate model in CHEMKIN, compare against experiment

Sensitivity analysis

Perform quantum chemistry

calculations to improve most

sensitive parameters, add to RMG

database

Experimental conditions

Cycle is repeated until we have reasonable confidence in our model

Page 22: Uncertainty Analysis in RMG

Model construction workflow: new

22

Generate model

Simulate model in CHEMKIN, compare against experiment

Investigate possible model discrepancies

Perform quantum chemistry calculations to improve most influential

parameters; update RMG database

Experimental conditions

Uncertainty analysis

Cycle is repeated until we have reasonable confidence in our model

Page 23: Uncertainty Analysis in RMG

Summary

23

Conclusionsā€¢ Local uncertainties are inaccurate when parameter uncertainties are large due

to the nonlinearity of chemical kinetic reaction systemsā€¢ Kineticists should consider correlations in their uncertainty analysis due to the

inherent cancellation errors between groups

Page 24: Uncertainty Analysis in RMG

Local uncertainty analysis: correlated vs. independent parameters

24

Loss of degrees of freedomā€¦1427 reactions collapses to 40 independent rate rules81 species collapse to 35 independent thermodynamic parameters

Independent parameters

Correlated parameters

Total variance š›”šŸ š„š§ šœ 1.47 0.47

Independent Reaction Rate Coefficients Rate Rules

Page 25: Uncertainty Analysis in RMG

Drastic reduction in uncertainty introduced by thermochemistry when group additivity values accounted for

25

āˆ†šŗmnX= > āˆ†šŗĀ°p āˆ’ > āˆ†šŗĀ°p

ļæ½

mqr1srXst

ļæ½

umvwx1st

6Cb-Hbenzenegroups

6 Cb-Hbenzenegroups

Cancellation of group values reduces thermochemistry error

Page 26: Uncertainty Analysis in RMG

Isthereanexactraterulematchforthereactiontemplate?

Use therateruleFindmoregeneralnodescontaining

data

FilterbyminimumEuclidieandistance.Istheremorethanone

raterule?

Averagethem Usetheraterule

NY

Y N

Understanding how rate rules work: new method minimizes Euclidean distance to select the best match

26

Identify reaction template: the most specific set of leaves in the tree

1 A/ \ / \2 3 B C/ \ / \4 5 D E

XH + Yrad

Functionalgroupsmorespecifictowardsleaves

5D

2B,1D

2B

2BPreviously,weusedminimumManhattandistanceD(2B,5D)=2,andD(1D,5D)=2

WithEuclideandistance:D(2B,5D)= 1 + 1ļæ½ ,andD(1D,5D)= 0 + 4ļæ½

Minimizes usage of highly general nodes

Page 27: Uncertainty Analysis in RMG

Preparing the rate rule trees1. Each family contains Training Reactions. Add these as rate rules to

the most specific template in the trees.2. Average up to fill up the treesā€¢ Find all cross layer template combinations i.e. 1A, 1B, 1C, 1D, 1E, etc.ā€¢ Average the distance 1 children that exist, i.e. 1A = avg(1B, 1C, A2, A3) IF

the original template contains no kinetics data

27

1 A/ \ / \2 3 B C/ \ / \4 5 D E

XH + YradPreviously:ā€¢ Didnotaverageallcross-layercombinations

Ć  reactionstendtousemoregeneralnodesasestimates

ā€¢ Usedpurechildrenaverages,i.e.1A=avg(2B,2C,3B,3C)Ć  childrenarenotmutuallyexclusiveandmayleadtobiasingoftheirparents

Page 28: Uncertainty Analysis in RMG

ā€¢ Species source

ā€¢ Reaction source

28

Source tracking to original database objects for easy investigation

Page 29: Uncertainty Analysis in RMG

When is uncertainty analysis useful

29

Page 30: Uncertainty Analysis in RMG

Understanding the discrepancy between model and dataā€¢ Errors bars on input parameters in the model

are underestimatedā€¢ Error bars on experimental data are

underestimatedā€¢ Propagated error bounds on model due to

input parameter uncertainties are underestimated

ā€¢ Model structure is missing key features such as reaction paths or species

ā€¢ Simulation is missing key approximations or using incorrect assumptions about experimental conditions and physics

30Uncertaintyanalysisaddressesprimarilythebulletpointsinred