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.
getDataDirectories
()¶Get a cell array of the directories searched for data files.
Get a cell array of the directories Cantera searches for data files
Returns: Cell array with strings representing the data file search directories
canteraVersion
()¶Get Cantera version information
Returns: A string containing the Cantera version
canteraGitCommit
()¶Get Cantera Git commit hash
Returns: A string containing the Git commit hash for the current version of Cantera
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()
- root – Instance of class
-
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()
- x – Instance of class
-
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()
- x – Instance of class
-
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()
- x – Instance of class
-
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()
- root – Instance of class
-
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()
- root – Instance of class
-
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: - x – Instance of class
XML_Node()
- loc –
Returns: Instance of class
XML_Node()
- x – Instance of class
-
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()
- x – Instance of class