Warning
This documentation is for an old version of Cantera. You can find docs for newer versions here.
Solution class constructor.
Class Solution() represents solutions of multiple species. A solution is defined as a mixture of two or more constituents (species) that are completely mixed on molecular length scales. The macroscopic intensive thermodynamic state of a solution is specified by two thermodynamic properties (for example, the temperature and pressure), and the relative amounts of each species, which may be given as mole fractions or mass fractions.
>> s = Solution('input.xml'[, phase_name[, transport_model]])
constructs a Solution object from a specification contained in file input.xml. Optionally, the name of the phase to be imported can be specified with phase_name. If a Transport model is included in input.xml, it will be included in the Solution instance with the default transport modeling as set in the input file. To specify the transport modeling, set the input argument trans to one of 'default', 'Mix', or 'Multi'. In this case, the phase name must be specified as well. Alternatively, change the transport node in the CTML file, or transport property inthe CTI file before loading the phase. The transport modeling cannot be changed once the phase is loaded.
Class Solution() derives from three more basic classes, and most of its methods are inherited from these classes. These are:
- class ThermoPhase() - composition information and thermodynamic properties
- class Kinetics() - homogeneous kinetics
- class Transport() - transport properties
See also: ThermoPhase(), Kinetics(), Transport()
Parameters: |
|
---|---|
Returns: | Instance of class Solution() |
Create a mixture of ideal gases.
Create a Solution() instance representing an ideal gas mixture.
gas1 = IdealGasMix('ctml_file'[,'transport_model'])
gas2 = IdealGasMix('ck_file'[,'thermo_db'[,'tran_db'[,'transport_model']]])
creates an object that represents an ideal gas mixture. The species in the mixture, their properties, and the reactions among the species, if any, are specified in file ‘ctml_file’ and ‘ck_file’. Two input file formats are supported - CTML and CK (CHEMKIN-compatible). Examples:
g1a = IdealGasMix('mech.xml')
g1b = IdealGasMix('mech.xml', 'Multi')
g2 = IdealGasMix('mech2.inp')
g3 = IdealGasMix('mech3.inp', 'therm.dat')
g4 = IdealGasMix('mech4.inp', 'therm.dat', 'tran.dat')
Objects g1a and g1b are created from a CTML file. CTML files contain all data required to build the object, and do not require any additional database files. Objects g2 - g4 are created from CK-format input files. For g2, ‘mech2.inp’ contains all required species thermo data. File ‘mech3.inp’ is missing some or all species thermo data, and requires database file ‘therm.dat.’ Object g4 is created including transport data.
Note that calling IdealGasMix() with a CK-format input file also creates an equivalent CTML file that may be used in future calls. If the initial call includes a transport database, then the CTML file will contain transport data.
See also: ck2cti(), Solution()
Parameters: |
|
---|---|
Returns: | Instance of class Solution() |
Import a phase from a CTI file
See Phases and their Interfaces.
See also: Solution()
Parameters: |
|
---|---|
Returns: | Instance of class Solution() |
Multiphase mixture class constructor.
Class Mixture() represents mixtures of one or more phases of matter. To construct a mixture, supply a cell array of phases and mole numbers:
>> gas = importPhase('gas.cti');
>> graphite = importPhase('graphite.cti');
>> mix = Mixture({gas, 1.0; graphite, 0.1});
Phases may also be added later using the addPhase method:
>> water = importPhase('water.cti');
>> addPhase(mix, water, 3.0);
Note that the objects representing each phase compute only the intensive state of the phase - they do not store any information on the amount of this phase. Mixture objects, on the other hand, represent the full extensive state.
Mixture objects are ‘lightweight’ in the sense that they do not store parameters needed to compute thermodynamic or kinetic properties of the phases. These are contained in the (‘heavyweight’) phase objects. Multiple mixture objects may be constructed using the same set of phase objects. Each one stores its own state information locally, and synchronizes the phase objects whenever it requires phase properties.
Parameters: | phases – Cell array of phases and mole numbers |
---|---|
Returns: | Instance of class Mixture() |
Add a phase to a mixture.
Parameters: |
|
---|
Get the chemical potentials of species in a mixture.
Parameters: | self – Instance of class Mixture() |
---|---|
Returns: | Vector of chemical potentials. Units: J/kmol |
Get the index of an element.
Parameters: |
|
---|---|
Returns: | Index of element with name name |
Set the mixture to a state of chemical equilibrium.
This method uses a version of the VCS algorithm to find the composition that minimizes the total Gibbs free energy of the mixture, subject to element conservation constraints. For a description of the theory, see Smith and Missen, “Chemical Reaction Equilibrium.” The VCS algorithm is implemented in Cantera kernel class MultiPhaseEquil.
The VCS algorithm solves for the equilibrium composition for specified temperature and pressure. If any other property pair other than “TP” is specified, then an outer iteration loop is used to adjust T and/or P so that the specified property values are obtained.
>> equilibrate(mix, 'TP')
>> equilibrate('TP', 1.0e-6, 500)
Parameters: |
|
---|---|
Returns: | The error in the solution |
Get the number of elements in a mixture.
Parameters: | self – Instance of class Mixture() |
---|---|
Returns: | Number of elements in the input |
Get the number of phases in a mixture.
Parameters: | self – Instance of class Mixture() |
---|---|
Returns: | Number of phases in the input |
Get the number of species in a mixture.
Parameters: | self – Instance of class Mixture() |
---|---|
Returns: | Number of species in the input |
Get the number of moles of a phase in a mixture.
Parameters: |
|
---|---|
Returns: | Moles of phase number n. Units: kmol |
Get the pressure of the mixture.
Parameters: | self – Instance of class Mixture() |
---|---|
Returns: | Pressure. Units: Pa |
Set the number of moles of a phase in a mixture.
Parameters: |
|
---|
Set the pressure of the mixture.
Parameters: |
|
---|
Set the moles of the species.
Set the moles of the species in kmol. The moles may be specified either as a string, or as an vector. If a vector is used, it must be dimensioned at least as large as the total number of species in the mixture. Note that the species may belong to any phase, and unspecified species are set to zero.
>> setSpeciesMoles(mix, 'C(s):1.0, CH4:2.0, O2:0.2');
Parameters: |
|
---|
Set the mixture temperature.
Parameters: |
|
---|