How can I run Cantera functions on .cti files in MATLAB?

19 views (last 30 days)
I am mostly asking this question so I can answer it for the next person who has this problem, though I still don't really understand what is going on. After installing Cantera, Python, and Cantera's MATLAB toolbox, the Cantera test functions that involve .yaml files seem to work, but as soon as I try to run any function on a .cti file MATLAB hangs for a very long time (and force quit doesn't seem to work). The functions that have this problem include Solution(), ThermoPhase(), and ctmethods().

Accepted Answer

David
David on 27 Aug 2021
Cantera 2.5 and Python 3.7 seem like they are supposed to be compatible with .cti files, but starting in Cantera 2.5 .cti files are obsolete. The best solution I found is to convert .cti files to .yaml files, the new recommended chemistry file format. At least on my system, all of these functions perform well on .yaml files. You can test this with the files that come with the Cantera installation (Program Files/Cantera/data for the standard installation).
To complicate things further, Cantera's MATLAB toolbox does not include the cti2yaml function (or apparently the ck2yaml function). My solution was to find the Python function cti2yaml.py (installed with Cantera) and use Python to create the desired .yaml file. Now all those MATLAB functions run quickly on the .yaml file with no hangs. For converting Chemkin files, the MATLAB toolbox has ck2cti.m, then the process above can convert cti to yaml.
This is mostly a Cantera problem, but it seems unique to running Cantera in MATLAB.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!