Cantera
2.1.2
|
Classes | |
class | Unit |
Unit conversion utility. More... | |
Functions | |
void | addDataDirectory (const std::string &dir) |
Add a directory to the data file search path. More... | |
std::string | findInputFile (const std::string &name) |
Find an input file. More... | |
void | setDefaultDirectories () |
Set the default directories for input files. More... | |
void | ct2ctml (const char *file, const int debug=0) |
Convert a cti file into a ctml file. More... | |
std::string | findInputFile (const std::string &name) |
Find an input file. More... | |
void | addDirectory (const std::string &dir) |
Add a directory to the data file search path. More... | |
string | canteraRoot () |
Returns root directory where Cantera is installed. More... | |
bool | buildSolutionFromXML (XML_Node &root, const std::string &id, const std::string &nm, ThermoPhase *th, Kinetics *k) |
Build a single-phase ThermoPhase object with associated kinetics mechanism. More... | |
ThermoPhase * | newPhase (XML_Node &phase) |
Create a new ThermoPhase object and initializes it according to the XML tree. More... | |
The properties of phases and interfaces are specified in text files. These procedures handle various aspects of reading these files.
For input files not specified by an absolute pathname, Cantera searches for input files along a path that includes platform-specific default locations, and possibly user-specified locations.
The current directory (".") is always searched first. Then, on Windows platforms, if environment variable COMMONPROGRAMFILES is set (which it should be on Win XP or Win 2000), then directories under this one will be added to the search path. The Cantera Windows installer installs data files to this location.
On the Mac, directory '/Applications/Cantera/data' is added to the search path.
On any platform, if environment variable CANTERA_DATA is set to a directory name, then this directory is added to the search path.
Finally, the location where the data files were installed when Cantera was built is added to the search path.
Additional directories may be added by calling function addDirectory.
There are two different types of input files within Cantera:
Cantera can take its input from both types of files. However, given a file in cti format, the initial operation that Cantera will perform is to translate the cti file into a ctml file. The translation is carried out via a system call to a python interpreter program that actually carries out the translation. In general, a new ctml file is created by the translation that is written to the current local directory. The ctml file is then read back into Cantera as the input.
Other input routines in other modules:
void addDataDirectory | ( | const std::string & | dir | ) |
Add a directory to the data file search path.
dir | String name for the directory to be added to the search path |
Definition at line 656 of file application.cpp.
References Cantera::dir_mutex, Application::inputDirs, Application::setDefaultDirectories(), and Cantera::stripnonprint().
Referenced by Cantera::addDirectory().
std::string findInputFile | ( | const std::string & | name | ) |
Find an input file.
This routine will search for a file in the default locations specified for the application. See the routine setDefaultDirectories() listed above.
The default set of directories specified for the application will be searched if a '/' or an '\' is found in the name. If either is found then a relative path name is presumed, and the default directories are not searched.
The presence of the file is determined by whether the file can be opened for reading by the current user.
name | Name of the input file to be searched for |
If the file is not found, a message is written to stdout and a CanteraError exception is thrown.
Definition at line 675 of file application.cpp.
References Cantera::dir_mutex, Application::inputDirs, and Cantera::npos.
Referenced by Cantera::findInputFile(), and Application::get_XML_File().
|
protected |
Set the default directories for input files.
Cantera searches for input files along a path that includes platform- specific default locations, and possibly user-specified locations. This function installs the platform-specific directories on the search path. It is invoked at startup by appinit(), and never should need to be called by user programs.
The current directory (".") is always searched first. Then, on Windows platforms, if environment variable COMMONPROGRAMFILES is set (which it should be on Win XP or Win 2000), then directories under this one will be added to the search path. The Cantera Windows installer installs data files to this location.
On the Mac, directory '/Applications/Cantera/data' is added to the search path.
On any platform, if environment variable CANTERA_DATA is set to a directory name, then this directory is added to the search path.
Finally, the location where the data files were installed when Cantera was built is added to the search path.
Additional directories may be added by calling function addDirectory.
Definition at line 598 of file application.cpp.
References Application::inputDirs.
Referenced by Application::addDataDirectory(), and Application::Application().
void ct2ctml | ( | const char * | file, |
const int | debug = 0 |
||
) |
Convert a cti file into a ctml file.
file | Pointer to the file |
debug | Turn on debug printing |
Definition at line 55 of file ct2ctml.cpp.
References ctml::pypath(), Cantera::stripws(), and Cantera::writelog().
Referenced by ctml::get_CTML_Tree(), and Application::get_XML_File().
std::string findInputFile | ( | const std::string & | name | ) |
Find an input file.
This routine will search for a file in the default locations specified for the application. See the routine setDefaultDirectories() listed above.
The default set of directories specified for the application will be searched if a '/' or an '\' is found in the name. If either is found then a relative path name is presumed, and the default directories are not searched.
The presence of the file is determined by whether the file can be opened for reading by the current user.
name | Name of the input file to be searched for |
If the file is not found, a message is written to stdout and a CanteraError exception is thrown.
Definition at line 191 of file global.cpp.
References Cantera::app(), and Application::findInputFile().
Referenced by PDSS_ConstVol::constructPDSSFile(), PDSS_IdealGas::constructPDSSFile(), PDSS_IonsFromNeutral::constructPDSSFile(), PDSS_HKFT::constructPDSSFile(), PDSS_Water::constructPDSSFile(), PDSS_SSVol::constructPDSSFile(), IonsFromNeutralVPSSTP::constructPhaseFile(), HMWSoln::constructPhaseFile(), ctml::get_CTML_Tree(), and ThermoPhase::initThermoFile().
void addDirectory | ( | const std::string & | dir | ) |
Add a directory to the data file search path.
dir | String name for the directory to be added to the search path |
Definition at line 186 of file global.cpp.
References Application::addDataDirectory(), and Cantera::app().
std::string canteraRoot | ( | ) |
Returns root directory where Cantera is installed.
Definition at line 216 of file global.cpp.
bool buildSolutionFromXML | ( | XML_Node & | root, |
const std::string & | id, | ||
const std::string & | nm, | ||
ThermoPhase * | th, | ||
Kinetics * | k | ||
) |
Build a single-phase ThermoPhase object with associated kinetics mechanism.
In a single call, this routine initializes a ThermoPhase object and a homogeneous kinetics object for a phase.
root | pointer to the XML tree which will be searched to find the XML phase element. |
id | Name of the phase to be searched for. |
nm | Name of the XML element. Should be "phase" |
th | Pointer to a bare ThermoPhase object, which will be initialized by this operation. |
k | Pointer to a bare Kinetics object, which will be initialized by this operation to a homogeneous kinetics manager |
For Example
Definition at line 1021 of file importKinetics.cpp.
References Cantera::get_XML_NameID(), Cantera::importKinetics(), and Cantera::importPhase().
ThermoPhase * newPhase | ( | XML_Node & | phase | ) |
Create a new ThermoPhase object and initializes it according to the XML tree.
This routine first looks up the identity of the model for the solution thermodynamics in the model attribute of the thermo child of the xml phase node. Then, it does a string lookup using Cantera's internal ThermoPhase Factory routines on the model to figure out what ThermoPhase derived class should be assigned. It creates a new instance of that class, and then calls importPhase() to populate that class with the correct parameters from the XML tree.
phase | XML_Node reference pointing to the phase XML element. |
Definition at line 226 of file ThermoFactory.cpp.
References XML_Node::child(), IonsFromNeutralVPSSTP::constructPhaseXML(), HMWSoln::constructPhaseXML(), Cantera::importPhase(), and Cantera::newThermoPhase().
Referenced by IonsFromNeutralVPSSTP::constructPhaseXML(), IonsFromNeutralVPSSTP::initThermoXML(), and LatticeSolidPhase::setParametersFromXML().