ck2cti method (v2.4) vs ck2yaml method (v2.6)

50 views
Skip to first unread message

Chris

unread,
Aug 4, 2022, 7:16:54 PM8/4/22
to Cantera Users' Group
Hey, I have a few question concerning the ck2yaml method. I am trying to update software (MITs Reaction Mechanism Generator) that used to use ck2cti. Out unit testing involves checking to make sure it throws an error when a chemkin input file is written improperly. One of these tests gives it an incomplete list of elements, like the example below:

ELEMENTS
CI /13.003/
O
OI /18.000/
N

END

SPECIES
ethane(1)
CH3(4)
END

THERM ALL
300.000 1000.000 5000.000

ethane(1) HI6 C 2 G100.000 5000.000 954.52 1
4.58987205E+00 1.41507042E-02-4.75958084E-06 8.60284590E-10-6.21708569E-14 2
-1.27217823E+04-3.61762003E+00 3.78032308E+00-3.24248354E-03 5.52375224E-05 3
-6.38573917E-08 2.28633835E-11-1.16203404E+04 5.21037799E+00 4

CH3(4) H 3 C 1 G100.000 5000.000 1337.62 1
3.54144859E+00 4.76788187E-03-1.82149144E-06 3.28878182E-10-2.22546856E-14 2
1.62239622E+04 1.66040083E+00 3.91546822E+00 1.84153688E-03 3.48743616E-06 3
-3.32749553E-09 8.49963443E-13 1.62856393E+04 3.51739246E-01 4

END

This is a really small thing but it's important for our test: I find that in v 2.4 with ck2cti, it gives an InputParserError, whereas with 2.6 ck2yaml I do not get an InputError, it will only throw an error if I validate. Our software uses ck2yaml.parser, and it does not throw any errors for this, and I would like it to. My questions are:
1. Is this expected behavior? 
2. Is there a way to get the parser to validate the mechanism so I will get an error?

Thanks!
Chris B.

Chris

unread,
Aug 5, 2022, 11:50:46 AM8/5/22
to Cantera Users' Group
Also, just checked with the most recent commit on the development branch, it has the same issue.

Ray Speth

unread,
Aug 5, 2022, 5:06:22 PM8/5/22
to Cantera Users' Group

Hi Chris,

Yes, I think this behavior is expected. To avoid having redundant checks, Cantera does most of the mechanism validation when you import the YAML file. This way, we can detect errors in files that are created in the YAML format, and not only converted Chemkin files. Generating the YAML file doesn’t require us to know anything about the link between the elements in each species and the elements declared in the phase, so this doesn’t get checked in ck2yaml.

To validate the mechanism, you should just import it as a Solution object. This is exactly what the ck2yaml does for this purpose when you run it as a command line script rather than using the ck2yaml.Parser.convert_mech method directly.

Regards,
Ray

Chris

unread,
Aug 8, 2022, 6:10:39 PM8/8/22
to Cantera Users' Group
Gotcha. That makes sense. Importing as a solution object works for my purposes. Thanks Ray.
Reply all
Reply to author
Forward
0 new messages