YAML to Chemkin

354 views
Skip to first unread message

Mickey Sakata

unread,
Mar 14, 2024, 12:56:28 PM3/14/24
to Cantera Users' Group
Hi,
 
I am trying to convert a yaml-formatted file to a Chemkin-formatted file, but I got the following error. Can anyone let me know how to resolve this?

[Error]
$ yaml2ck --mechanism=chem.inp --thermo=therm.dat --overwrite org.yaml
Traceback (most recent call last):
  File "/u/user/anaconda3/bin/yaml2ck", line 11, in <module>
    sys.exit(main())
             ^^^^^^
  File "/u/user/anaconda3/lib/python3.11/site-packages/cantera/yaml2ck.py", line 807, in main
    output_paths = convert(
                   ^^^^^^^^
  File "/u/user/anaconda3/lib/python3.11/site-packages/cantera/yaml2ck.py", line 704, in convert
    mechanism_text.append(build_reactions_text(all_reactions))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/u/user/anaconda3/lib/python3.11/site-packages/cantera/yaml2ck.py", line 356, in build_reactions_text
    max_reaction_length = max(len(r.equation) for r in reactions)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: max() arg is an empty sequence

[Machine]
 OS Type:            linux
 OS Name:            AlmaLinux release 8.9 (Midnight Oncilla)
 OS Kernel:          4.18.0-513.11.1.el8_9.x86_64 (linux)
 CPU Type:           x86
 CPU Addressability: 64bit (46bit physical)
 CPU Model:          Intel(R) Xeon(R) Gold 6230 CPU @ 2.10GHz

Thanks in advance,
Mickey
org.yaml

Ray Speth

unread,
Mar 17, 2024, 11:56:32 PM3/17/24
to Cantera Users' Group

Hi Mickey,

Thanks for reporting this problem. The error message here is not very helpful, but I think it stems from having reactions: none specified in the phase definition of the YAML file. Is the intention to create a CK input file with no reactions? If so, the easiest workaround might be to just convert the mechanism with at least one reaction, and then remove that section in the output file after the fact.

I’ve created Issue #1679 to keep track of this on GitHub.

Regards,
Ray

Mickey Sakata

unread,
Mar 18, 2024, 6:27:02 AM3/18/24
to Cantera Users' Group
Hi Ray,

Thank you very much for your prompt reply!I would like to include reactions.
I was able to resolve this error with following modificaitons.

[modification#1]
reaction: none
->
reaction: all 

[modification#2]
one of examples)
efficiencies: {H2: 2.5, CO2: 3.8, AR: 0.5, HE: 0.5, CO: 1.9, H2O: 12.0}
->
efficiencies: {H2: 2.5, AR: 0.5, HE: 0.5, H2O: 12.0}

[error after modification#1]
*******************************************************************************
InputFileError thrown by ThirdBody::checkSpecies:
Error on line 225 of /tmp/tmpdg1ky4t9/test_mech.yaml:
Reaction '2 H + M <=> H2 + M'
defines third-body efficiencies for undeclared species: 'CO', 'CO2'
....
....

Best Regards,
Mickey


2024年3月18日月曜日 12:56:32 UTC+9 Ray Speth:

Mickey Sakata

unread,
Mar 18, 2024, 8:39:36 AM3/18/24
to Cantera Users' Group

Additional comment.
The following statemments do not seems to work in yaml2ck.

  skip-undeclared-elements: true
  skip-undeclared-third-bodies: true

2024年3月18日月曜日 19:27:02 UTC+9 Mickey Sakata:

Ray Speth

unread,
Mar 29, 2024, 1:10:11 PM3/29/24
to Cantera Users' Group

Hi Mickey,

In addition to these options, you also need to skip reactions involving excluded species. To do this, you should define the reactions entry in the phase definition as:

reactions: [{reactions: declared-species}]

You’re correct that the skip-undeclared-third-bodies: true is incorrectly ignored. The result is that the output CK file still contains these 3rd body efficiencies. I don’t know what Chemkin does with such cases, but I expect it just ignores them given the frequency with which these show up. The error reported by Cantera only affects validation, since there’s no way for the CK file to indicate that this flag should be included when converting back to YAML. I’ve created an issue on our tracker for this problem (https://github.com/Cantera/cantera/issues/1683).

Regards,
Ray

Reply all
Reply to author
Forward
0 new messages