Cantera

Table Of Contents

Previous topic

Built-In Thermochemical Data

Next topic

Index of Examples

This Page

Warning

This documentation is for an old version of Cantera. You can find docs for newer versions here.

Utility Functions

Utilities

adddir(d)

Add a directory to the search path.

Adds directory d to the set of directories where Cantera looks for input and data files.

Parameters:d – Path to add to the MATLAB search path.
ck2cti(infile, thermo, transport)

Convert a CHEMKIN input file to Cantera format.

Examples:

f = ck2cti('chem.inp')
f = ck2cti('chem.inp', 'therm.dat')
f = ck2cti('chem.inp', 'therm.dat', 'tran.dat')

These 3 statements all create a Cantera input file ‘chem.cti.’ In the first case, the CK-format file contains all required species thermo data, while in the second case some or all thermo data is read from file ‘therm.dat.’ In the third form, the input file created will also contain transport property parameters. The function return value is a string containing the output file name.

Parameters:
  • infile – Chemistry input file in CHEMKIN format. Required.
  • thermo – Thermodynamic input file in CHEMKIN format. Optional if thermodynamic data is specified in the chemistry input file.
  • transport – Transport input file in CHEMKIN format. Optional.
Returns:

String with CTML output filename.

cleanup()

Delete all stored Cantera objects and reclaim memory.

geterr()

Get the error message from a Cantera error.

XML_Node

class XML_Node(name, src, wrap)

XML_Node class constructor

Parameters:
  • name – String name of the XML_Node that should be created.
  • src – String XML file name from which an instance of XML_Node should be created. Reads the XML tree from the input file.
  • wrap – Specify the ID of the XML_Node.
Returns:

Instance of class XML_Node()

addChild(root, name, val)

Add a child to the root.

Parameters:
  • root – Instance of class XML_Node()
  • name – String ID of the child to be added.
  • val – String value to be added to the child.
Returns:

Instance of class XML_Node()

attrib(x, key)

Get the XML_Node attribute with a given key.

Parameters:
  • x – Instance of class XML_Node()
  • key – String key to look up.
Returns:

Instance of class XML_Node()

build(x, file, pre)

Build an XML_Node in memory from an input file.

Parameters:
  • x – Instance of class XML_Node()
  • file – String input file name.
  • pre – Determine the method of building. If not specified or less than zero, use XML_Node::build. Otherwise, use XML_Node::get_XML_File.
Returns:

Instance of class XML_Node()

child(x, loc)

Get the child of an XML_Node instance.

Parameters:
  • x – Instance of class XML_Node()
  • loc – String loc to search for.
Returns:

Instance of class XML_Node()

findByID(root, id)

Get an XML element given its ID.

Parameters:
  • root – Instance of class XML_Node()
  • id – String ID of the element to search for.
Returns:

Instance of class XML_Node()

findByName(root, name)

Get an XML element given its name.

Parameters:
  • root – Instance of class XML_Node()
  • name – String name of the element to search for.
Returns:

Instance of class XML_Node()

nChildren(root)

Get the number of children of an XML_Node.

Parameters:root – Instance of class XML_Node()
Returns:Integer number of children of the input XML_Node
value(x, loc)

Get the value at a location in an XML_Node

value(x) returns the value of the XML element. value(x, loc) is shorthand for value(child(x,loc))

Parameters:
Returns:

Instance of class XML_Node()

write(x, file)

Write XML_Node to file.

Parameters:
  • x – Instance of class XML_Node()
  • file – Name of the output file to be written.
Returns:

Instance of class XML_Node()