You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge assign_parameter_uncertainties and intermediate_uncertainties
There's a lot of repeated code between the old UQ's assign_parameter_uncertainties and the new UQ's assign_intermediate_uncertainties, so this combines them into a single function in order to reuse a lot of that repeated code and make it easier to keep them consistent.
self.dG_dqs= [] # a list of dictionaries to store the intermediate derivatives dG_i/dq for each parameter q that contributes to the uncertainty of species i's G
920
+
self.dlnk_dqs= [] # a list of dictionaries to store the intermediate derivatives dlnk_i/dq for each parameter q that contributes to the uncertainty of reaction i's k
raiseValueError('Weight for adsorption group contribution to thermo should be 1, but got weight={weight} for {adsGroupType} in species {species}'.format(weight=weight, adsGroupType=adsGroupType, species=species))
953
+
dG_dq[label] =weight# This should be 1 because there's only one group contribution per adsorption correction
Assign uncertainties to the intermediate parameters based on the sources of the species thermo and reaction kinetics.
1022
-
1023
-
This fills out the class variables thermo_intermediate_uncertainties and kinetic_intermediate_uncertainties
1024
-
these are each list of dictionaries. For every species or reaction, it lists all the intermediate sources contributing to that parameter's uncertainty.
1025
-
1026
-
So for example, thermo_intermediate_uncertainties might look something like this:
self.thermo_intermediate_uncertainties= [] # store the intermediate dG_i/dq for each parameter q that contributes to the uncertainty of G_i, for use in correlated uncertainty analysis
self.thermo_intermediate_uncertainties.append(dG) # in the uncorrelated case, the intermediate is just the uncertainty value itself, since there is only one parameter that contributes to the uncertainty
1050
-
else:
1051
-
source=self.species_sources_dict[species]
1052
-
dGdq= {}
1053
-
if'Library'insource:
1054
-
label=source['Library'][2]
1055
-
dGdq[label] =1# dG/dG_lib = 1, because the parameter is never scaled by anything other than 1 when it is used
1056
-
if'Surface_Library'insource:
1057
-
label=source['Surface_Library'][2]
1058
-
dGdq[label] =1# dG/dG_surf = 1, because the parameter is never scaled by anything other than 1 when it is used
raiseValueError('Weight for adsorption group contribution to thermo should be 1, but got weight={weight} for {adsGroupType} in species {species}'.format(weight=weight, adsGroupType=adsGroupType, species=species))
dGdq[label] =1# dG/dG_est = 1, because the estimation error is added on top of the group additivity value, so it is never scaled by anything other than 1 when it is used
self.kinetic_intermediate_uncertainties.append(dlnk) # in the uncorrelated case, the intermediate is just the uncertainty value itself, since there is only one parameter that contributes to the uncertainty
dlnkdq[label] =weight# dlnk/dlnk_rule = weight, because the rate rule is scaled by the weight when it is used in the kinetics estimation
1099
-
1100
-
forruleEntry, trainingEntry, weightintraining:
1101
-
# TODO - test that training reactions in a tree are correlated with the exact match kind of training reaction
1102
-
# for now, we follow the old convention of treating these as rate rules
1103
-
label='{}Rate Rule {} {}'.format(surface_prefix, family, ruleEntry) # ruleEntry should probably be the reaction equation itself
1104
-
dlnkdq[label] =weight# dlnk/dlnk_training = weight, because the training entry is scaled by the weight when it is used in the kinetics estimation
1105
-
1106
-
# There is also estimation error if rate rules are used
1107
-
# Record dlnk/dlnk_family, the derivative with respect to the family estimation uncertainty
1108
-
label='Estimation Family {}'.format(reaction.to_chemkin(self.species_list, kinetics=False))
1109
-
dlnkdq[label] =1# dlnk/dlnk_family = 1, because the family estimation uncertainty is added on top of the rate rule values, so it is never scaled by anything other than 1 when it is used
1110
-
1111
-
# Record the non-exact estimation error if not an exact match for a rate rule
0 commit comments