mirror of
https://github.com/Cantera/cantera.git
synced 2026-08-09 04:28:30 -05:00
Move element check out of else
Clarify reason for error and comment. The code does not need to be inside the else statement, since the if can only raise the error.
This commit is contained in:
@@ -886,15 +886,18 @@ class Parser:
|
||||
if not composition:
|
||||
raise InputError("Error parsing elemental composition for "
|
||||
"species '{}'", species)
|
||||
else:
|
||||
for symbol in composition.keys():
|
||||
|
||||
# check if self.parse_composition parses composition correctly
|
||||
if any(map(str.isdigit, symbol)) and symbol not in self.elements:
|
||||
raise InputError("Error parsing elemental composition for "
|
||||
"species thermo entry\n{}"
|
||||
"\n the first line has an incorrect format", "".join(lines))
|
||||
|
||||
for symbol in composition.keys():
|
||||
# Some CHEMKIN input files may have quantities of elements with
|
||||
# more than 3 digits. This violates the column-based input format
|
||||
# standard, so the entry cannot be read and we need to raise a
|
||||
# more useful error message.
|
||||
if any(map(str.isdigit, symbol)) and symbol not in self.elements:
|
||||
raise InputError("Error parsing elemental composition for "
|
||||
"species thermo entry:\n{}\nElement amounts"
|
||||
"can have no more than 3 digits",
|
||||
"".join(lines))
|
||||
|
||||
# Extract the NASA polynomial coefficients
|
||||
# Remember that the high-T polynomial comes first!
|
||||
Tmin = fortFloat(lines[0][45:55])
|
||||
|
||||
@@ -15,8 +15,8 @@ BIN6BJ
|
||||
END
|
||||
|
||||
THERMO ALL
|
||||
270.000 1000.000 3500.000
|
||||
BIN7AJ C 1250H 812 G 300.00 3500.00 1260.00 1
|
||||
270.000 1000.000 3500.000
|
||||
BIN7AJ C 1250H 812 G 300.00 3500.00 1260.00 1
|
||||
2.35938249e+03 3.50442304e+00-1.25852280e-03 2.00397985e-07-1.15957197e-11 2
|
||||
2.45225502e+05-1.29759728e+04-1.05686227e+03 1.43496445e+01-1.41695007e-02 3
|
||||
7.03160324e-06-1.36699359e-09 1.10611918e+06 4.29496756e+03 4
|
||||
@@ -36,12 +36,12 @@ CO C 1O 1 G 200.00 3500.00 960.00 1
|
||||
-1.41723335e+04 7.41443560e+00 3.75723891e+00-2.14465241e-03 5.42079005e-06 3
|
||||
-4.17025963e-09 1.11901127e-12-1.43575530e+04 2.79976799e+00 4
|
||||
|
||||
BIN6AJ C 640H 43 G 300.00 3500.00 1290.00 1
|
||||
BIN6AJ C 640H 43 G 300.00 3500.00 1290.00 1
|
||||
1.23762821e+03 1.77026241e+00-6.22545371e-04 9.54207658e-08-5.13173999e-12 2
|
||||
1.25536835e+05-6.67884001e+03-5.26755261e+02 7.24121890e+00-6.98412269e-03 3
|
||||
3.38305762e-06-6.42270665e-10 5.80747770e+05 2.28257683e+03 4
|
||||
|
||||
BIN6BJ C 640H 127 G 300.00 3500.00 1390.00 1
|
||||
BIN6BJ C 640H 127 G 300.00 3500.00 1390.00 1
|
||||
1.08992363e+03 1.08035536e+00-3.02579890e-04 2.55048499e-08 8.09218683e-13 2
|
||||
-2.94595285e+05-5.83854863e+03-5.54531539e+02 5.81260044e+00-5.40931919e-03 3
|
||||
2.47478029e-06-4.39707947e-10 1.62563251e+05 2.63652221e+03 4
|
||||
|
||||
Reference in New Issue
Block a user