Chemkin to YAML conversion#
See also
For documentation of the command line interface, see the ck2yaml section. For a tutorial, refer to the Converting Chemkin Format Files page.
Module-level documentation#
Convert Chemkin-format mechanism files to YAML.
There are two main entry points to this script, main and convert. The former is
used from the command line interface and parses the arguments passed. The latter uses
arguments that correspond to options of the command line interface.
- class cantera.ck2yaml.Arrhenius(A=0.0, b=0.0, Ea=0.0, *, parser)#
- Bases: - object- Represent a modified Arrhenius rate. - Parameters:
- A – The pre-exponential factor, given as a tuple consisting of a floating point value and a units string 
- b – The temperature exponent 
- Ea – The activation energy, given as a tuple consisting of a floating point value and a units string 
 
 - as_yaml(extra=())#
 
- class cantera.ck2yaml.Chebyshev(coeffs, *, Tmin, Tmax, Pmin, Pmax, quantity_units, **kwargs)#
- Bases: - KineticsModel- A rate calculated in terms of a bivariate Chebyshev polynomial. See Chebyshev Reaction Rate Expressions. - Parameters:
- coeffs – Matrix of Chebyshev coefficients, dimension N_T by N_P 
- Tmin – Minimum temperature for which the parameterization is valid 
- Tmax – Maximum temperature for which the parameterization is valid 
- Pmin – Minimum pressure for which the parameterization is valid, given as a - (value, units)tuple
- Pmax – Maximum pressure for which the parameterization is valid, given as a - (value, units)tuple
- quantity_units – Quantity units for the rate constant 
 
 - pressure_dependent = True#
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- class cantera.ck2yaml.ChemicallyActivated(low_rate=None, F=None, **kwargs)#
- Bases: - ThreeBody- A rate for a chemically-activated reaction. See Chemically-Activated Reactions. - Parameters:
- low_rate – The Arrhenius kinetics at the low-pressure limit 
- high_rate – The Arrhenius kinetics at the high-pressure limit 
- efficiencies – A mapping of species names to collider efficiencies 
- F – Falloff function parameterization 
 
 - reaction_string_suffix(species)#
- Suffix for reactant and product strings, used for pressure-dependent reactions 
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- class cantera.ck2yaml.ElementaryRate(rate, **kwargs)#
- Bases: - KineticsModel- A reaction rate described by a single Arrhenius expression. See Arrhenius Rate Expressions. - Parameters:
- rate – The Arrhenius expression describing this reaction rate. 
 - pressure_dependent = False#
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- class cantera.ck2yaml.ErrorFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)#
- Bases: - Formatter- Initialize the formatter with specified format strings. - Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format. - Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting, - str.format()(- {}) formatting or- string.Templateformatting in your format string.- Changed in version 3.2: Added the - styleparameter.- format(record: LogRecord)#
- Format the specified record as text. - The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message. 
 
- class cantera.ck2yaml.Falloff(low_rate=None, F=None, **kwargs)#
- Bases: - ThreeBody- A rate for a pressure-dependent falloff reaction. See Falloff Reactions. - Parameters:
- low_rate – The Arrhenius kinetics at the low-pressure limit 
- high_rate – The Arrhenius kinetics at the high-pressure limit 
- efficiencies – A mapping of species names to collider efficiencies 
- F – Falloff function parameterization 
 
 - reaction_string_suffix(species)#
- Suffix for reactant and product strings, used for pressure-dependent reactions 
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- cantera.ck2yaml.FlowList(*args, **kwargs)#
- cantera.ck2yaml.FlowMap(*args, **kwargs)#
- exception cantera.ck2yaml.InputError(message)#
- Bases: - Exception- An exception class for exceptional behavior involving Chemkin-format mechanism files. Pass a string describing the circumstances that caused the exceptional behavior. 
- class cantera.ck2yaml.KineticsModel#
- Bases: - object- A base class for kinetics models - pressure_dependent = None#
 - reaction_string_suffix(species)#
- Suffix for reactant and product strings, used for pressure-dependent reactions 
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- class cantera.ck2yaml.Nasa7(*, Tmin, Tmax, Tmid, low_coeffs, high_coeffs, note='')#
- Bases: - object- Thermodynamic data parameterized as two seven-coefficient NASA polynomials. See The NASA 7-Coefficient Polynomial Parameterization. - classmethod to_yaml(representer, node)#
 
- class cantera.ck2yaml.Nasa9(*, parser, data, note='')#
- Bases: - object- Thermodynamic data parameterized as any number of nine-coefficient NASA polynomials. See The NASA 9-Coefficient Polynomial Parameterization. - Parameters:
- data – List of polynomials, where each polynomial is written as - ` [(T_low, T_high), [a_0, a_1, ..., a_8]] `
 - classmethod to_yaml(representer, node)#
 
- class cantera.ck2yaml.PDepArrhenius(*, pressures, pressure_units, arrhenius, **kwargs)#
- Bases: - KineticsModel- A rate calculated by interpolating between Arrhenius expressions at various pressures. See Pressure-Dependent Arrhenius Rate Expressions (P-Log). - Parameters:
- pressures – A list of pressures at which Arrhenius expressions are given. 
- pressure_units – A string indicating the units used for the pressures 
- arrhenius – A list of - Arrheniusobjects at each given pressure
 
 - pressure_dependent = True#
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- class cantera.ck2yaml.Parser#
- Bases: - object- static convert_mech(input_file, thermo_file=None, transport_file=None, surface_file=None, phase_name='gas', extra_file=None, out_name=None, single_intermediate_temperature=False, quiet=False, permissive=None, verbose=False, exit_on_error=False)#
 - entry(where='entry', kind='Error')#
 - static get_rate_constant_units(length_dims, length_units, quantity_dims, quantity_units, time_dims=1, time_units='s')#
 - load_chemkin_file(path, surface=False)#
- Load a Chemkin-format input file from - pathon disk.
 - load_extra_file(path)#
- Load YAML-formatted entries from - pathon disk.
 - load_transport_file(path)#
 - static parse_composition(elements, nElements, width)#
- Parse the elemental composition from a 7 or 9 coefficient NASA polynomial entry. 
 - parse_elements_section(lines)#
- Parse the ELEMENTS section of a Chemkin-format input file - Parameters:
- lines – A list of - (line number, section name, line content, comment)tuples
 
 - parse_nasa7_section(lines)#
- Parse a THERMO section containing species defined using the 7-coefficient NASA polynomial format. - Parameters:
- lines – A list of - (line number, section name, line content, comment)tuples
 
 - parse_nasa9_section(lines)#
- Parse a THERMO section containing species defined using the 9-coefficient NASA polynomial format. - Parameters:
- lines – A list of - (line number, section name, line content, comment)tuples
 
 - parse_reactions_section(lines, surface)#
- Parse the REACTIONS section of a Chemkin-formatted input file. - Parameters:
- lines – A list of - (line number, section name, line content, comment)tuples
- surface – Boolean indicating whether this is a surface reaction mechanism 
 
 
 - parse_site_section(lines)#
- Parse the SITE (surface species) section of a Chemkin-format input file - Parameters:
- lines – A list of - (line number, section name, line content, comment)tuples
 
 - parse_species_section(lines)#
- Parse the SPECIES section of a Chemkin-format input file - Parameters:
- lines – A list of - (line number, section name, line content, comment)tuples
 
 - parse_transport_section(lines)#
- Parse Chemkin-format transport data in - linesand add that transport data to the previously-loaded species.- Parameters:
- lines – A list of - (line number, section name, line content, comment)tuples
 
 - read_NASA7_entry(lines, TintDefault, comments)#
- Read a thermodynamics entry for one species in a Chemkin-format file (consisting of two 7-coefficient NASA polynomials). Returns the label of the species, the thermodynamics model as a - Nasa7object, and the elemental composition of the species.- For more details on this format, see Debugging common errors in CK files. 
 - read_NASA9_entry(entry, comments)#
- Read a thermodynamics - entryfor one species given as one or more 9-coefficient NASA polynomials, written in the format described in Appendix A of NASA Reference Publication 1311 (McBride and Gordon, 1996). Returns the label of the species, the thermodynamics model as a- Nasa9object, and the elemental composition of the species
 - read_kinetics_entry(entry, surface)#
- Read a kinetics - entryfor a single reaction as loaded from a Chemkin-format file. Returns a- Reactionobject with the reaction and its associated kinetics.
 - show_duplicate_reactions(error_message)#
 - write_yaml(name='gas', out_name='mech.yaml')#
 
- class cantera.ck2yaml.ParserLogger(parser)#
- Bases: - Handler- Initializes the instance - basically setting the formatter to None and the filter list to empty. 
- class cantera.ck2yaml.Reaction(index=-1, reactants=None, products=None, kinetics=None, reversible=True, duplicate=False, forward_orders=None, third_body=None)#
- Bases: - object- Parameters:
- index – A unique nonnegative integer index 
- reactants – A list of - (stoichiometry, species name)tuples
- products – A list of - (stoichiometry, species name)tuples
- kinetics – A - KineticsModelinstance which describes the rate constant
- reversible – Boolean indicating whether the reaction is reversible 
- duplicate – Boolean indicating whether the reaction is a known (permitted) duplicate 
- forward_orders – A dictionary specifying a non-default reaction order (value) for each specified species (key) 
- third_body – A string name used for the third-body species written in pressure-dependent reaction types (usually “M”) 
 
 - classmethod to_yaml(representer, node)#
 
- class cantera.ck2yaml.Species(label, sites=None)#
- Bases: - object- classmethod to_yaml(representer, node)#
 
- class cantera.ck2yaml.Sri(*, A, B, C, D=None, E=None)#
- Bases: - object- The SRI falloff function, described with either 3 or 5 parameters. See The SRI Falloff Function. - reduce(output)#
 
- class cantera.ck2yaml.SurfaceRate(*, rate, coverages, is_sticking, motz_wise, **kwargs)#
- Bases: - KineticsModel- An Arrhenius-like reaction occurring on a surface See Surface Reactions. - Parameters:
- rate – The Arrhenius expression describing this reaction rate. 
- coverages – A list of tuples where each tuple specifies the coverage dependencies for a species, in the form - (species_name, a_k, m_k, E_k)
- is_sticking – True if the Arrhenius expression is a parameterization of a sticking coefficient, rather than the rate constant itself. 
- motz_wise – True if the sticking coefficient should be translated into a rate coefficient using the correction factor developed by Motz & Wise for reactions with high (near-unity) sticking coefficients 
 
 - pressure_dependent = False#
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- class cantera.ck2yaml.ThreeBody(high_rate=None, efficiencies=None, **kwargs)#
- Bases: - KineticsModel- A rate calculated for a reaction which includes a third-body collider. See Three-Body Reactions. - Parameters:
- high_rate – The Arrhenius kinetics (high-pressure limit) 
- efficiencies – A mapping of species names to collider efficiencies 
 
 - pressure_dependent = True#
 - reaction_string_suffix(species)#
- Suffix for reactant and product strings, used for pressure-dependent reactions 
 - reduce(output)#
- Assign data from this object to the YAML mapping - output
 
- class cantera.ck2yaml.TransportData(parser, label, geometry, well_depth, collision_diameter, dipole_moment, polarizability, z_rot, note='')#
- Bases: - object- geometry_flags = ['atom', 'linear', 'nonlinear']#
 - classmethod to_yaml(representer, node)#
 
- class cantera.ck2yaml.Troe(A=0.0, T3=0.0, T1=0.0, T2=None)#
- Bases: - object- The Troe falloff function, described with either 3 or 4 parameters. See The Troe Falloff Function. - reduce(output)#
 
- cantera.ck2yaml.compatible_quantities(quantity_basis, units)#
- cantera.ck2yaml.contains(seq, value)#
- cantera.ck2yaml.convert(input_file, thermo_file=None, transport_file=None, surface_file=None, phase_name='gas', extra_file=None, out_name=None, single_intermediate_temperature=False, quiet=False, permissive=None, verbose=False)#
- cantera.ck2yaml.convert_mech(input_file, thermo_file=None, transport_file=None, surface_file=None, phase_name='gas', extra_file=None, out_name=None, single_intermediate_temperature=False, quiet=False, permissive=None, verbose=False)#
- Deprecated since version 3.0: To be removed after Cantera 3.1; renamed to - convert().
- cantera.ck2yaml.create_argparser()#
- cantera.ck2yaml.float2string(data)#
- cantera.ck2yaml.fortFloat(s)#
- Convert a string representation of a floating point value to a float, allowing for some of the peculiarities of allowable Fortran representations. 
- cantera.ck2yaml.get_index(seq, value)#
- Find the first location in seq which contains a case-insensitive, whitespace-insensitive match for value. Returns None if no match is found. 
- cantera.ck2yaml.main(argv=None)#
- Parse command line arguments and pass them to - Parser.convert_mech.
- cantera.ck2yaml.represent_float(self, data)#
- cantera.ck2yaml.strip_nonascii(s)#
