RMG-Py icon indicating copy to clipboard operation
RMG-Py copied to clipboard

Cantera version 2.5

Open ChrisBNEU opened this issue 3 years ago • 4 comments

Motivation or Problem

addresses issue #2270. Cantera is deprecating the ".cti" output file type that RMG currently uses. for nicer features like coverage dependant thermo and kinetics, we need to upgrade cantera to v2.5 and switch to the yaml output file type.

Description of Changes

Changed the input parser from ck2cti to ck2yaml. there were some syntax changes for the parser from v2.3 to 2.5.

Testing

update all of the unit tests that involve writing or reading a cantera output file ensure that a ct.Solution and ct.interface object load correctly externally.

Reviewer Tips

Any suggestions for what should be tested would be appreciated, I have not put any in.

ChrisBNEU avatar Mar 28 '22 21:03 ChrisBNEU

currently generated a chem_annotated.yaml and a chem.yaml. chem.yaml looks fine but the chem_annotated.yaml does not store the comments under "notes" for the reactions.

ChrisBNEU avatar Mar 28 '22 21:03 ChrisBNEU

Codecov Report

Merging #2288 (c149f79) into main (f8b136e) will decrease coverage by 0.04%. The diff coverage is 82.35%.

@@            Coverage Diff             @@
##             main    #2288      +/-   ##
==========================================
- Coverage   48.15%   48.12%   -0.04%     
==========================================
  Files         110      110              
  Lines       30654    30653       -1     
  Branches     7994     7995       +1     
==========================================
- Hits        14762    14751      -11     
- Misses      14357    14372      +15     
+ Partials     1535     1530       -5     
Impacted Files Coverage Δ
rmgpy/tools/canteramodel.py 33.59% <81.48%> (-2.80%) :arrow_down:
rmgpy/rmg/main.py 22.09% <85.71%> (ø)

... and 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Aug 17 '22 19:08 codecov[bot]

This passes all tests and fixes the issue of not getting the coverage dependent parameters into the Cantera output file. I believe this needs to be merged before we can merge #2321.

ChrisBNEU avatar Aug 18 '22 13:08 ChrisBNEU

One other thing to note is the test for generating an output file with the ck2yaml parser behaves a little differently. If we do not specify all of the elements used (e.g. we forget to add "C" for our carbon atom in the elements list) it will not throw an error. The error only appears when the output file is validated, which is not something cantera coded into the parser (you can do it with the command line ck2yaml parser however). I just changed the test case so it fails for another reason, since the point is not to exhaustively test every error possible when generating a yaml file. see this thread for more info: https://groups.google.com/g/cantera-users/c/eiTX-2O5zfQ

ChrisBNEU avatar Aug 18 '22 13:08 ChrisBNEU

upgrading to version 2.6 in environment.yml

ChrisBNEU avatar Mar 02 '23 14:03 ChrisBNEU

Hey @ChrisBNEU, with this branch, are you experiencing an issue with installing PyCall in Julia (or add/installing new packages in Julia)

calvinp0 avatar Mar 02 '23 19:03 calvinp0

A fix for that issue is we need to make it use the libcurl packaged with Julia.

For my env, I had to do this

export LD_LIBRARY_PATH="/home/calvin/mambaforge/envs/rmg_env/share/julia/site/julia-1.6.7/lib/julia:$LD_LIBRARY_PATH"

calvinp0 avatar Mar 02 '23 19:03 calvinp0

A fix for that issue is we need to make it use the libcurl packaged with Julia.

For my env, I had to do this

export LD_LIBRARY_PATH="/home/calvin/mambaforge/envs/rmg_env/share/julia/site/julia-1.6.7/lib/julia:$LD_LIBRARY_PATH"

@mjohnson541 - Return of the LD_LIBRARY_PATH issue

calvinp0 avatar Mar 02 '23 20:03 calvinp0

I am rebasing this branch to try and push this feature through now that the CI has been fixed.

JacksonBurns avatar Apr 14 '23 18:04 JacksonBurns

So there are a number of new issues with cantera 2.6 and beyond that have done my best to address:

Older versions of cantera used different Reaction objects for each reaction type (like ArrheniusReaction, PlogReaction, InterfaceReaction, etc.). There was a concerted effort to consolidate all reactions into the cantera.Reaction object, and differentiate with new ReactionRate objects (e.g. LindemannRate, PlogRate, InterfaceArrheniusRate). This was partially implemented in 2.6, but it is not fully implemented for ThirdBodyReaction types. These use the ThirdBodyReaction type, but with a ThirdBodyRate.

FalloffReaction is used for Lindemann and Troe reactions because it is what cantera.Reaction.from_yaml and cantera.Solution(<yaml_file>) creates in v2.6. In v3.0, cantera.Reaction.from_yaml will correctly create cantera.Reaction objects with TroeRate and LindemannRate. The reactionTest.py unit test is written such that it will only look at the rate, which will remain the same in v3.0

For versions <=3.0, we will not need to worry about third body reactions and falloff reactions. however, past version 3.0, we will need to recode so all reactions are type cantera.Reaction. Third body reactions will need a third_body object specified for the Reaction() object. For more info on reactions and rates in the newer release of cantera, refer to the documentation.

All cti output file references are removed, since cti references are deprecated in v2.6, and will not work in later versions. additionally, cti files will not correctly write coverage dependencies, but yaml files will.

I have not updated the surface reaction to_cantera methods. they did not exist before, and they require a fair bit of additional coding for unit conversion. I think that should live in a separate pr.

ChrisBNEU avatar May 05 '23 18:05 ChrisBNEU