-
Notifications
You must be signed in to change notification settings - Fork 251
Description
Motivation or Problem
- Cantera has moved away from reading .cti files and reads kinetic models in YAML files. The language is extensible and allows new features, such as blowers-masel rate expressions, coverage-dependent surface kinetics, advanced mixing rules, etc. RMS also reads YAML files, in a (I think and hope) fully compatible format. It also has extra features not in Chemkin or Cantera. We should output models in YAML format that are compatible with Cantera.
- The YAML writer for RMS is apparently slow. See yaml writer slows down execution #2499 and Allow disabling of RMS yaml writer for speedup #2508 (there's some helpful comments in the discussion on both, about why the yaml library is inherently slow to write)
- In Create YAML file outputs in RMG for use in Cantera #2321 we (mostly Nora) made a cantera yaml writer, that mostly worked by creating in-memory Cantera objects, then requesting Cantera to turn them into dictionaries of input data, then getting the yaml library to write the dictionaries as yaml. This works - and should be merged because it has side-effect of fixing some to_cantera methods, etc. But it is probably much slower than needed.
- When trying to compare Create YAML file outputs in RMG for use in Cantera #2321 with the current main branch quickly yesterday, I got confused - as if a lot of things (rms writer) have disappeared entirely since I last looked. Maybe I looked too quickly, but maybe this is now more complicated (or simpler?) than I thought.
Desired Solution
Since we only have a few types of object, a totally general approach of using the yaml library, isn't needed. We could just template how each type of object should be rendered, as an f-string, and format to text quite quickly. Further optimizations might be possible by caching results (though you then have to figure out when to clear or update the cache, in case people do things outside of a typical RMG run like modifying objects on the fly).
Maybe a good approach is to rebase and merge #2321 then look at speeding it up?
Potential Alternatives
Stick with the current RMS approach, but tweak it slightly to be cantera-friendly?
Additional Context
New student @ntietje1 is willing to put some time into this now. Any thoughts to get him started (or before he gets started doing the wrong thing) would be appreciated. We could have a zoom call if that's more efficient than posting - but there's something to be said for having discussion here on github, because it persists. I expect @JacksonBurns and @mjohnson541 may have helpful input, but likely other people too. Thanks