Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional argument for Parameter Uncertainties in Cantera Input Files and Objects #62

Closed
AdityaSavara opened this issue Dec 3, 2019 · 4 comments
Labels
feature-request New feature request

Comments

@AdityaSavara
Copy link

The Goal
To perform uncertainty informed parameter estimation (conventional and Bayesian) with kinetic simulations and Cantera. The suggested solution below would also facilitate uncertainty quantification of the outputs of Cantera simulations.

Describe the desired solution
To include an optional "uncertainty" field in the input files. For example, like this:

  1. Is anyone else working on or quite far along in a similar effort? *(I found one parameter optimization thread linked at the bottom of this post, but it's not so general).
  2. I have a suggestion/request that the ctml writer and internal objects be expanded to have a new optional term within reactions for parameterUncertainties, like this:

example 1:

surface_reaction( "Acetaldehyde-Ce(S) => Acetaldehyde + CeCation(S)",
                  Arrhenius(1.0E13, 0, 67400,
                  coverage = ['Acetaldehyde(S)', 0.0, 0.0, -6000.0], 
                 parameterUncertainties=[2.0,0.0, 10000, 0.1, 0.1, 1000.0])

Six parameters, six uncertainties, each representing 1 standard deviation, with the one for the preexponential being after a log transform: log(1.0E13)+/-2. Or, maybe the recommended syntax would be better like this:
reaction( .... , parameterUncertainties ="logA:2.0 b:0.0 E:10000" )

The advantage of the 2nd syntax being that people could specify an uncertainty for logA or directly for A (the distinction matters for some cases).

Ideally, in the python version of Cantera we could then do things like this:
reactionObject.rate.parameterUncertainties
reactionObject.parameterUncertainties
reactionObject.parameterUncertainties.E

Describe alternatives you have considered
I am currently going forward even without this feature, and will store the uncertainties in an external csv file. This is not an ideal solution because the cantera cti/ctml/yaml files are essentially like a database storage medium. So right now, to perform the several kinds of analyses I am describing requires a person to make two files, two parsers etc. Uncertainties (typically based on the simple case of 1 standard deviation) are a very general part of modeling, so I think it is a good long-term solution to support including that in the fields when making a reaction.

Additional context
This was first posted with more details in the usergroup, and a longer form is posted there.
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/cantera-users/AU7donb9wp0/cxgZJUfNAwAJ

@AdityaSavara
Copy link
Author

I do hope to have the code I am developing for conventional and Bayesian parameter estimation to end up as part of the python Cantera package (and someday extended into the core gradually). Since what I am working on will continue even without internal cantera object support, I will continue working and will report back once our package is ready for release.

@speth
Copy link
Member

speth commented Dec 4, 2019

The ability to include data that is not specifically used by Cantera in an input file, but still have it accessible to user applications, was one of the reasons for introducing the YAML format. This feature is currently implemented at the C++ level, but not yet accessible through any of the other language interfaces.

In the case of reactions, all of the fields of the reaction entry in the YAML file are stored in the input member variable of each C++ Reaction object. When this is implemented in Python, my plan was for the information to be automatically converted to the various Python native types, i.e. input will be equivalent to what you would get if you loaded that bit of YAML in Python.

@AdityaSavara
Copy link
Author

Using safe_load to allow us to access arbitrarily defined user tags into python is a great idea. That's definitely a big benefit of YAML.

@bryanwweber bryanwweber transferred this issue from Cantera/cantera Jul 11, 2020
@bryanwweber bryanwweber added the feature-request New feature request label Feb 8, 2021
@speth
Copy link
Member

speth commented May 3, 2022

With user-specified YAML data fully accessible and modifiable in Python (Cantera/cantera#984, Cantera/cantera#1014, Cantera/cantera#1031), I think we have provided a very flexible interface for this capability.

@speth speth closed this as completed May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request
Projects
None yet
Development

No branches or pull requests

3 participants