-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when parsing ck2cti or ck2yaml with large element number(more than 3 digits) #853
Comments
I don't think the values here are accidental / erroneous, but they don't seem to follow input file format rules. Those rules pretty clearly describe the format for the elemental composition in columns 25–44 as consisting of 4 entries of 5 characters where the first two characters are for the element name and the remaining three characters are for the number of atoms of that element. This file doesn't even work in a certain commercial tool where one might expect it to. To allow for additional elements / longer element names / larger molecules, the format does allow a syntax where those are given on additional lines of the input file, e.g. as shown here: cantera/test/data/soot-therm.dat Lines 39 to 49 in 7d87534
I think the only modification that should be made to Cantera here would be to provide a more helpful error message, for example showing the entire thermo entry for the offending species, like we do for some other thermo errors. |
Thanks for the response @speth , I think showing entire entry is helpful and I can work on it. I forgot to mention that the conversion was completed with CanteraError when I was using ck2yaml as converter. The message is shown as
In this case, if I want to make changes like showing the entire entry, should I make it in the .cpp file or should I add another function into ck2yaml file to prevent the completed conversion by ck2yaml with wrong species compositions in it and throw an error message? Here is the yaml file. |
I would try to raise error with the entire thermo entry from ck2yaml. To my understanding, the |
Yes, that sounds correct. I think this could be detected at the time the composition is parsed, perhaps using the fact that an element name shouldn't start with a number as a criterion for identifying this kind of error. |
symbol string which includes number in it, issue Cantera#853
symbol string which includes number in it, issue Cantera#853
symbol string which includes number in it, issue Cantera#853
symbol string which includes number in it, issue Cantera#853
…lement symbol during ck2yaml conversion Cantera#857
System information
Expected behavior
Regarding to the issue on Cantera google user group. The expected behavior is a successful conversion.
Actual behavior
It was not clear where is the error position when the user used ck2cti in Cantera 2.4.0 and python 3.7, so I tried Cantera 2.5.0 and python 3.8. The reason was that there are several species has element numbers more than 3 digits, for example,
BIN7AJ C 1250H 812 G 300.00 3500.00 1260.00 1
.The function in ck2cti, readThermoEntry(line 1032
composition = self.parseComposition(lines[0][24:44], 4, 5)
) does not split the string correctly,[24:44]
only covers part of the element symbols and numbers, especially when the element number is very large (speciesBIN12AJ
in the thermo file). Besides, the input value to function parseComposition on line 1032 only successfully converts when the element number has less than 3 digits.I am not sure if these large number are added in the file accidentally, but should Cantera add some feature to enable conversion for species with large element number?
To Reproduce
Steps to reproduce the behavior:
ck2cti --input=input.CKI --thermo=thermo.CKT --transport=trans.TRC --output=new.cti --debug --permissive
Attachments
input.txt
thermo.txt
trans.txt
Additional context
The text was updated successfully, but these errors were encountered: