-
-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Problem description
While trying to convert a mechanism posted in the Users' Group from CTI to YAML, I ran into a couple of issues where cti2yaml has trouble with syntax that is handled by ctml_writer.
Steps to reproduce
Run cti2yaml on Mayur-ISSP.cti.txt. The attached file is modified from what is posted in the Users' Group to replace the use of the now-removed incompressible_solid phase type (Se the related issue #1008).
Behavior
The first error is related to setting the kinetics model of the ideal_gas phases in the input file, and gives the partial traceback:
File ".../cantera/cti2yaml.py", line 1108, in to_yaml
node.get_yaml(out)
File ".../cantera/cti2yaml.py", line 1147, in get_yaml
out['kinetics'] = _newNames[self.kinetics]
KeyError: 'None'
which is associated with the phase definition in the input file:
ideal_gas(
name = "gas_anode",
elements = " O H C N",
species = "N2 C3H4O3 C2H4 O2 CO2 H2O H2",
initial_state = state(mole_fractions = "N2: 0.99999993, C3H4O3:1.0e-8, C2H4:1.0e-8, O2:1.0e-8, CO2:1.0e-8, H2O:1.0e-8, H2:1.0e-8"),
reactions = "None",
kinetics = "None",
transport = "None"
)Modifying these to specify kinetics = None instead works, but is different from what ctml_writer requires, which is the string rather than the built-in None object. After that, the next error is:
File ".../cantera/cti2yaml.py", line 991, in to_yaml
out['X'] = FlowMap(get_composition(node.X).items())
File ".../cantera/cti2yaml.py", line 219, in get_composition
d[b[0]] = float(b[1])
ValueError: could not convert string to float: ''
which appears to caused by not being able to handle the space after the first colon in the composition string "N2: 0.99999993, C3H4O3:1.0e-8, C2H4:1.0e-8, O2:1.0e-8, CO2:1.0e-8, H2O:1.0e-8, H2:1.0e-8".
After fixing that, the mechanism finally converts, with several warnings:
WARNING: Reaction specification 'None' not supported
WARNING: Reaction specification 'None' not supported
WARNING: Reaction specification 'rxn-SEI-comp' not supported
The first two warnings are basically harmless, since they're for phases with no corresponding kinetics model, but the last one corresponds to an error in generated phase definition for interface_SEIformation that prevents it from being imported using the YAML input file. Instead of creating a reactions section containing just the reaction with ID rxn-SEI-comp, that reaction is just placed in the main reactions section.
System information
- Cantera version: 2.6.0a1 (b42989f)
- OS: Ubuntu 20.04
- Python 3.8.3
Attachments
Additional context