Open speth opened 3 months ago
@speth would the desired behavior be to simply skip the build_reactions_text
call if n_reactions
(or in this case just len(all_reactions)
) for the phase is zero? If so, I can implement a quick fix.
Yeah, that sounds like it would be sufficient. Or I guess, the most Pythonic check would be if all_reactions: ...
.
I just noticed the comment that @bryanwweber had put in where this is called:
# TODO: Handle phases without reactions
And this is why TODO comments aren't helpful 🤣🤣🤣
I need to go ahead and add a test case. I've already confirmed the fix works for roundtripping with ck2yaml
, but does Chemkin require a REACTIONS
section to be present or is it okay if it's missing? The barebones example I tested with the fix referenced gives a reactions file like so:
ELEM
H
END
SPECIES
H2
END
If Chemkin requires it, I could modify build_reactions_text
to at least do:
REACTIONS
END
but I figured I'd ask since I'm only somewhat familiar with Chemkin's file requirements.
Yeah, that's a test we can't easily run. I'd be inclined to assume that the REACTIONS
section is optional.
Problem description
Trying to convert a YAML mechanism to CK format fails when the phase has no reactions.
Steps to reproduce
org.yaml.txt
and save asorg.yaml
yaml2ck --mechanism=chem.inp --thermo=therm.dat --overwrite org.yaml
Behavior
yaml2ck
fails with the following error:System information
main
branch at 64ed2b732Attachments
org.yaml.txt
Additional context
Originally reported on the Cantera Users' Group