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

Preserve units in PLOG entries in ck2cti #435

Merged
merged 1 commit into from
Feb 21, 2017
Merged

Conversation

rwest
Copy link
Member

@rwest rwest commented Feb 20, 2017

This PR preserves the units when converting PLOG entries from a chemkin file.

For example of how it should work, if you read and output both in cal/mol then you get this for an Arrhenius
reaction('ch3co3h <=> ch3co2 + oh', [5.010000e+14, 0.0, 40150.0])
but if you read in kcal/mol and output in cal/mol then you get this
reaction('ch3co3h <=> ch3co2 + oh', [5.010000e+14, 0.0, (40.15, 'kcal/mol')])
which is great. It preserves the units on Ea.
Also works for high and low pressure limits of all the fall-off types, as far as I can tell.
But if you have a pdep_arrhenius (PLOG) reaction the units are ignored.
Eg. if you have a reaction that ought to look (in cal/mol) like

pdep_arrhenius('ch2cho + o2 <=> o2ch2cho',
               [(0.01, 'atm'), 1.580000e+77, -21.9, 19350.0],
               [(0.1, 'atm'), 3.880000e+69, -18.84, 19240.0],
               [(1.0, 'atm'), 7.800000e+59, -15.4, 17650.0],
               [(10.0, 'atm'), 3.050000e+50, -12.2, 15630.0])

but you read it from a file in kcal/mol then your output looks like

pdep_arrhenius('ch2cho + o2 <=> o2ch2cho',
               [(0.01, 'atm'), 1.580000e+77, -21.9, 19.35],
               [(0.1, 'atm'), 3.880000e+69, -18.84, 19.24],
               [(1.0, 'atm'), 7.800000e+59, -15.4, 17.65],
               [(10.0, 'atm'), 3.050000e+50, -12.2, 15.63])

After this PR it becomes

pdep_arrhenius('ch2cho + o2 <=> o2ch2cho',
               [(0.01, 'atm'), 1.580000e+77, -21.9, (19.35, 'kcal/mol')],
               [(0.1, 'atm'), 3.880000e+69, -18.84, (19.24, 'kcal/mol')],
               [(1.0, 'atm'), 7.800000e+59, -15.4, (17.65, 'kcal/mol')],
               [(10.0, 'atm'), 3.050000e+50, -12.2, (15.63, 'kcal/mol')])

because we re-use the unit-preserving code in the Arrhenius class.

I haven't actually checked that the resulting .cti syntax can be parsed by Cantera....
I guess that should be done before merging the PR :)

Also, chemkin syntax is a minefield (and usually the documentation is not nearly pedantic enough), so please check this! But I thought I'd start with a patch not just an issue.

When converting chemkin into cti using ck2cti, the units were not preserved
in PLOG (pdep_arrhenius) reactions. Now they are.
@speth
Copy link
Member

speth commented Feb 21, 2017

Thanks! Looks good to me, and Cantera can indeed parse these input files.

This might also be an issue for Chebyshev reactions.

@speth speth merged commit 7b7aea2 into Cantera:master Feb 21, 2017
speth added a commit to speth/cantera that referenced this pull request Feb 26, 2019
Since the leading Chebyshev coefficient has effective units like
log(cm^3/kmol), it needs to be converted directly to the default units of
the CTI file.

Analagous to the fix for PLOG reactions in Cantera#435.
speth added a commit to speth/cantera that referenced this pull request Feb 26, 2019
Since the leading Chebyshev coefficient has effective units like
log(cm^3/kmol), it needs to be converted directly to the default units of
the CTI file.

Analogous to the fix for PLOG reactions in Cantera#435.
speth added a commit to speth/cantera that referenced this pull request Feb 26, 2019
Since the leading Chebyshev coefficient has effective units like
log(cm^3/kmol), it needs to be converted directly to the default units of
the CTI file.

Analogous to the fix for PLOG reactions in Cantera#435.
speth added a commit to speth/cantera that referenced this pull request Mar 1, 2019
Since the leading Chebyshev coefficient has effective units like
log(cm^3/kmol), it needs to be converted directly to the default units of
the CTI file.

Analogous to the fix for PLOG reactions in Cantera#435.
speth added a commit that referenced this pull request Mar 1, 2019
Since the leading Chebyshev coefficient has effective units like
log(cm^3/kmol), it needs to be converted directly to the default units of
the CTI file.

Analogous to the fix for PLOG reactions in #435.
srikanthallu pushed a commit to srikanthallu/cantera that referenced this pull request Sep 17, 2020
Since the leading Chebyshev coefficient has effective units like
log(cm^3/kmol), it needs to be converted directly to the default units of
the CTI file.

Analogous to the fix for PLOG reactions in Cantera#435.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants