Warning
This documentation is for an old version of Cantera. You can find docs for newer versions here.
ThermoPhase class constructor.
Parameters: | r – If r is an instance of class ThermoPhase(), a copy of the instance is returned. Otherwise, r must be an instance of class XML_Node(). |
---|---|
Returns: | Instance of class ThermoPhase() |
Get the atomic masses of the elements.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase). |
---|---|
Returns: | Vector of element atomic masses. Units: kg/kmol |
Get the chemical potentials of the species.
The expressions used to compute the chemical potential depend on the model implemented by the underlying kernel thermo manager.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase). |
---|---|
Returns: | Vector of species chemical potentials. Units: J/kmol
|
Get the non-dimensional specific heats at constant pressure.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of specific heats of the species at constant pressure, non-dimensional basis |
Get the mass-basis specific heats at constant pressure.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of specific heats of the species at constant pressure. Units: J/kg-K |
Get the molar-basis specific heats at constant pressure.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of specific heats of the species at constant pressure. Units: J/kmol-K |
Get the critical density.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Critical density. Units: kg/m**3 |
Get the critical pressure.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Critical pressure. Units: Pa |
Get the critical temperature.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Critical temperature. Units: K |
Get the mass-basis specific heats at constant volume.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of specific heats of the species at constant volume. Units: J/kg-K |
Get the molar-basis specific heats at constant volume.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of specific heats of the species at constant volume. Units: J/kmol-K |
Get the density.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Mass density. Units: kg/m**3 |
Get the electric potential.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | The electric potential of the phase. Units: V |
Get the index of an element given its name.
The index is an integer assigned to each element in sequence as it is read in from the input file.
If name is a single string, the return value will be a integer containing the corresponding index. If it is an cell array of strings, the output will be an array of the same shape containing the indices.
NOTE: In keeping with the conventions used by Matlab, this method returns 1 for the first element. In contrast, the corresponding method elementIndex in the Cantera C++ and Python interfaces returns 0 for the first element, 1 for the second one, etc.
>> ic = elementIndex(gas, 'C');
>> ih = elementIndex(gas, 'H');
Parameters: |
|
---|---|
Returns: | Integer or vector of integers of element indices |
Get the name of an element given its index.
Parameters: |
|
---|---|
Returns: | If m is a scalar integer, the return value will be a string containing the name of the m^th species. If it is an array of integers, the output will be a cell array of the same shape containing the name strings. |
Get the non-dimensional enthalpies.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of sensible species enthalpies divided by RT, where R is the universal gas constant and T is the temperature. For gaseous species, these values are ideal gas enthalpies. |
Get the mass specific enthalpy.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of mass specific enthalpies of the species. Units: J/kg |
Get the mole specific enthalpy.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of molar specific enthalpies of the species. Units: J/kmol |
Get the non-dimensional entropy.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of species non-dimensional entropies. |
Get the mass specific entropy.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of mass specific entropies of the species. Units: J/kg-K |
Get the mole specific entropy.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of molar specific entropies of the species. Units: J/kg |
Get the type of the equation of state.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | An integer flag identifying the type of equation of state. See the definitions in include/cantera/thermo/mix_defs.h |
Set the phase to a state of chemical equilibrium.
Parameters: |
|
---|
Get the non-dimensional Gibbs function.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of non-dimensional Gibbs functions of the species. |
Get the mass specific Gibbs function.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of mass specific Gibbs functions of the species. Units: J/kg |
Get the mole specific Gibbs function.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of mole specific Gibbs functions of the species. Units: J/kmol |
Get the mass specific internal energy.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of mass specific internal energies of the species. Units: J/kg |
Get the mole specific internal energy.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of mole specific internal energies of the species. Units: J/kmol |
Get a flag indicating whether the phase is an ideal gas.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | True (1) if the phase is an ideal gas or ideal gas mixture, and false (0) otherwise. |
Get the isothermal compressibility.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Isothermal Compressibility. Units: 1/Pa |
Get the mass fraction of a species.
Parameters: |
|
---|---|
Returns: | Scalar or vector double mass fractions |
Get the mass fractions of all species.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of species mass fractions for input phase. If no output argument is specified, a bar plot is produced. |
Get the maximum temperature of the parameter fits.
The parameterizations used to represent the temperature-dependent species thermodynamic properties are generally only valid in some finite temperature range, which may be different for each species in the phase.
See also: minTemp()
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of maximum temperatures of all species |
Get the mean molecular weight.
Deprecated in favor of meanMolecularWeight()
See also: meanMolecularWeight()
Get the mean molecular weight.
The mean molecular weight is the mole-fraction-weighted sum of the molar masses of the individual species in the phase.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Scalar double mean molecular weight. Units: kg/kmol |
Get the minimum temperature of the parameter fits.
The parameterizations used to represent the temperature-dependent species thermodynamic properties are generally only valid in some finite temperature range, which may be different for each species in the phase.
See also: maxTemp()
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of minimum temperatures of all species |
Get the molar density.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Molar density. Units: kmol/m^3 |
Get the molecular weights of all the species.
Deprecated in favor of molecularWeights()
See also: molecularWeights()
Get the mole fraction of a species.
Parameters: |
|
---|---|
Returns: | Scalar or vector double mole fractions |
Get the mole fractions of all species.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of species mole fractions for input phase. If no output argument is specified, a bar plot is produced. |
Get the molecular weights of the species.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Vector of species molecular weights. Units: kg/kmol |
Get the number of atoms of an element in a species.
Parameters: |
|
---|---|
Returns: | Number of atoms of element m in species k. |
Get the number of elements.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Number of elements in the phase. |
Get the number of species.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Number of species in the phase. |
Get the name of the phase.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | String name of the input phase |
Get the ph field of the phase.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: |
Get the pressure.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Pressure. Units: Pa |
Get the reference pressure.
Parameters: | tp – Instance of class ThermoPhase() (or another object that derives from ThermoPhase) |
---|---|
Returns: | Reference pressure in Pa. All standard-state thermodynamic properties are for this pressure. |
Get the saturation pressure for a given temperature.
Parameters: |
|
---|---|
Returns: | Saturation pressure for temperature T. Units: Pa |
Get the saturation temperature for a given pressure.
Parameters: |
|
---|---|
Returns: | Saturation temperature for pressure p. Units: K |
Set properties of a phase.
The properties that may be set are
Either the full property name or the symbol may be specified. For the extensive properties (V,H,U,S), the values must be given per unit mass. H, U, and S must be set in conjunction with pressure (for H,S) or volume (for U,S). Either (specific) volume or density may be specified. Mole and mass fractions must be input as vectors (either row or column) with length equal to the number of species. Two properties may be specified in a single call to set(), plus one of mass fractions or mole fractions.
Examples:
>> set(gas,'Temperature',600.0);
>> set(gas,'T',600.0);
>> set(gas,'T',600.0,'P',2*oneatm,'Y',massfracs);
>> set(gas,'H',0.5*enthalpy_mass(gas),'P',pressure(gas));
>> set(gas,'S',entropy_mass(gas),'P',0.5*pressure(gas));
>> set(gas,'X',ones(nSpecies(gas),1));
>> set(gas,'T',500.0,'Vapor',0.8)
Alternatively, individual methods to set properties may be called (setTemperature, setMoleFractions, etc.)
See also: setDensity(), setMassFractions(), setMoleFractions(), setPressure(), setState_HP(), setState_Psat(), setState_SP(), setState_SV(), setState_Tsat(), setState_UV(), setTemperature()
Parameters: |
|
---|
Set the density.
Parameters: |
|
---|
Set the electric potential.
Parameters: |
|
---|
Set the species mass fractions.
Note that calling setMassFractions() leaves the temperature and density unchanged, and therefore the pressure changes if the new composition has a molar mass that is different than the old composition. If it is desired to change the composition and hold the pressure fixed, use method set() and specify the mass fractions and the pressure, or call setPressure() after calling setMassFractions().
Parameters: |
|
---|
Set the species mole fractions.
Note that calling setMoleFractions() leaves the temperature and density unchanged, and therefore the pressure changes if the new composition has a molar mass that is different than the old composition. If it is desired to change the composition and hold the pressure fixed, use method set() and specify the mole fractions and the pressure, or call setPressure() after calling setmoleFractions().
Parameters: |
|
---|
Set the name of the phase.
Parameters: |
|
---|
Set the pressure.
The pressure is set by changing the density holding the temperature and chemical composition fixed.
Parameters: |
|
---|
Set the specific enthalpy and pressure.
Parameters: |
|
---|
Set the fluid state using the given pressure and quality.
The fluid state will be set to a saturated liquid-vapor state using the input pressure and vapor fraction (quality) as the independent, intensive variables. :param tp:
Instance of class ThermoPhase() (or another class derived from ThermoPhase)
Parameters: | px – Vector of length 2 containing the desired values for the pressure (Pa) and the vapor fraction |
---|
Set the specific entropy and pressure.
Parameters: |
|
---|
Set the specific entropy and specific volume.
Parameters: |
|
---|
Set the fluid state using the given temperature and quality.
The fluid state will be set to a saturated liquid-vapor state using the input temperature and vapor fraction (quality) as the independent, intensive variables. :param tp:
Instance of class ThermoPhase() (or another class derived from ThermoPhase)
Parameters: | tx – Vector of length 2 containing the desired values for the temperature (K) and the vapor fraction (quality) |
---|
Set the specific internal energy and specific volume.
Parameters: |
|
---|
Set the fluid to the saturated liquid state at the current temperature.
Parameters: | tp – Instance of class ThermoPhase() (or another class derived from ThermoPhase) |
---|
Set the fluid to the saturated vapor state at the current temperature.
Parameters: | tp – Instance of class ThermoPhase() (or another class derived from ThermoPhase) |
---|
Set the temperature.
Parameters: |
|
---|
Get the speed of sound.
If the phase is an ideal gas, the speed of sound is calculated by:
where \(\gamma\) is the ratio of specific heats, \(R\) is the specific gas constant, and \(T\) is the temperature. If the phase is not an ideal gas, the speed of sound is calculated by
where \(p\) is the pressure and \(\rho\) is the density, and the subscript \(s\) indicates constant entropy. This is approximated by slightly increasing the density at constant entropy and computing the change in pressure.
Parameters: | tp – Instance of class ThermoPhase() (or another class derived from ThermoPhase) |
---|---|
Returns: | The speed of sound. Units: m/s |
Get the index of a species given the name.
The index is an integer assigned to each species in sequence as it is read in from the input file.
NOTE: In keeping with the conventions used by Matlab, this method returns 1 for the first species, 2 for the second, etc. In contrast, the corresponding method speciesIndex in the Cantera C++ and Python interfaces returns 0 for the first species, 1 for the second one, etc.
>> ich4 = speciesIndex(gas, 'CH4');
>> iho2 = speciesIndex(gas, 'HO2');
Parameters: |
|
---|---|
Returns: | Scalar or array of integers |
Get the name of a species given the index.
Parameters: |
|
---|---|
Returns: | Cell array of strings |
Get the species names.
Parameters: | tp – Instance of class ThermoPhase() (or another class derived from ThermoPhase) |
---|---|
Returns: | Cell array of strings of all of the species names |
Get the temperature.
Parameters: | tp – Instance of class ThermoPhase() (or another class derived from ThermoPhase) |
---|---|
Returns: | Temperature. Units: K |
Get the thermal expansion coefficient.
Parameters: | tp – Instance of class ThermoPhase() (or another class derived from ThermoPhase) |
---|---|
Returns: | Thermal Expansion Coefficient. Units: 1/K |
Get the vapor fraction.
Parameters: | tp – Instance of class ThermoPhase() (or another class derived from ThermoPhase) |
---|---|
Returns: | Vapor fraction. |