Preserve units in PLOG entries in ck2cti #435
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
but you read it from a file in kcal/mol then your output looks like
After this PR it becomes
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.