======================== Thermodynamic Properties ======================== ThermoPhase ----------- .. mat:class:: ThermoPhase(r) ThermoPhase class constructor. :param r: If ``r`` is an instance of class :mat:func:`ThermoPhase`, a copy of the instance is returned. Otherwise, ``r`` must be an instance of class :mat:func:`XML_Node`. :return: Instance of class :mat:func:`ThermoPhase` .. mat:function:: atomicMasses(tp) Get the atomic masses of the elements. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase). :return: Vector of element atomic masses. Units: kg/kmol .. mat:function:: chemPotentials(tp) 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. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase). :return: Vector of species chemical potentials. Units: J/kmol This method returns an array containing the species chemical potentials [J/kmol]. The expressions used to compute these depend on the model implemented by the underlying kernel thermo manager.""" .. mat:function:: cp_R(tp) Get the non-dimensional specific heats at constant pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of specific heats of the species at constant pressure, non-dimensional basis .. mat:function:: cp_mass(tp) Get the mass-basis specific heats at constant pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of specific heats of the species at constant pressure. Units: J/kg-K .. mat:function:: cp_mole(tp) Get the molar-basis specific heats at constant pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of specific heats of the species at constant pressure. Units: J/kmol-K .. mat:function:: critDensity(tp) Get the critical density. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Critical density. Units: kg/m**3 .. mat:function:: critPressure(tp) Get the critical pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Critical pressure. Units: Pa .. mat:function:: critTemperature(tp) Get the critical temperature. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Critical temperature. Units: K .. mat:function:: cv_mass(tp) Get the mass-basis specific heats at constant volume. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of specific heats of the species at constant volume. Units: J/kg-K .. mat:function:: cv_mole(tp) Get the molar-basis specific heats at constant volume. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of specific heats of the species at constant volume. Units: J/kmol-K .. mat:function:: density(tp) Get the density. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Mass density. Units: kg/m**3 .. mat:function:: electricPotential(tp) Get the electric potential. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: The electric potential of the phase. Units: V .. mat:function:: elementIndex(tp, name) 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'); :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param name: String or cell array of strings of elements to look up :return: Integer or vector of integers of element indices .. mat:function:: elementName(tp, m) Get the name of an element given its index. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param m: Scalar or vector of integers of element indices :return: 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. .. mat:function:: enthalpies_RT(tp) Get the non-dimensional enthalpies. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: 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. .. mat:function:: enthalpy_mass(tp) Get the mass specific enthalpy. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of mass specific enthalpies of the species. Units: J/kg .. mat:function:: enthalpy_mole(a) Get the mole specific enthalpy. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of molar specific enthalpies of the species. Units: J/kmol .. mat:function:: entropies_R(tp) Get the non-dimensional entropy. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of species non-dimensional entropies. .. mat:function:: entropy_mass(tp) Get the mass specific entropy. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of mass specific entropies of the species. Units: J/kg-K .. mat:function:: entropy_mole(tp) Get the mole specific entropy. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of molar specific entropies of the species. Units: J/kg .. mat:function:: eosType(tp) Get the type of the equation of state. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: An integer flag identifying the type of equation of state. See the definitions in include/cantera/thermo/mix_defs.h .. mat:function:: equilibrate(tp, xy, solver, rtol, maxsteps, maxiter, loglevel) Set the phase to a state of chemical equilibrium. :param XY: A two-letter string, which must be one of the set ``['TP','TV','HP','SP','SV','UV','UP']``, indicating which pair of properties should be held constant. Not all of the properties to be held constant are available with all of the solvers. :param solver: Specifies the equilibrium solver to use. If solver = 0, a fast solver using the element potential method will be used. If solver = 1, a slower but more robust Gibbs minimization solver will be used. If solver >= 2, a version of the VCS algorithm will be used. If solver < 0 or is unspecified, the fast solver will be tried first, then if it fails the Gibbs minimization solver will be tried. :param rtol: The relative error tolerance. :param maxsteps: Maximum number of steps in composition to take to find a converged solution. :param maxiter: For the Gibbs minimization solver only, this specifies the number of 'outer' iterations on T or P when some property pair other than TP is specified. :param loglevel: Set to a value > 0 to write diagnostic output. Larger values generate more detailed information. .. mat:function:: gibbs_RT(tp) Get the non-dimensional Gibbs function. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of non-dimensional Gibbs functions of the species. .. mat:function:: gibbs_mass(tp) Get the mass specific Gibbs function. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of mass specific Gibbs functions of the species. Units: J/kg .. mat:function:: gibbs_mole(tp) Get the mole specific Gibbs function. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of mole specific Gibbs functions of the species. Units: J/kmol .. mat:function:: intEnergy_mass(tp) Get the mass specific internal energy. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of mass specific internal energies of the species. Units: J/kg .. mat:function:: intEnergy_mole(tp) Get the mole specific internal energy. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of mole specific internal energies of the species. Units: J/kmol .. mat:function:: isIdealGas(tp) Get a flag indicating whether the phase is an ideal gas. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: True (1) if the phase is an ideal gas or ideal gas mixture, and false (0) otherwise. .. mat:function:: isothermalCompressibility(tp) Get the isothermal compressibility. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Isothermal Compressibility. Units: 1/Pa .. mat:function:: massFraction(tp, species) Get the mass fraction of a species. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param species: String or cell array of strings of species whose mass fraction is desired :return: Scalar or vector double mass fractions .. mat:function:: massFractions(tp) Get the mass fractions of all species. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of species mass fractions for input phase. If no output argument is specified, a bar plot is produced. .. mat:function:: maxTemp(tp) 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: :mat:func:`minTemp` :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of maximum temperatures of all species .. mat:function:: meanMolarMass(tp) Get the mean molecular weight. Deprecated in favor of :mat:func:`meanMolecularWeight` See also: :mat:func:`meanMolecularWeight` .. mat:function:: meanMolecularWeight(tp) 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. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Scalar double mean molecular weight. Units: kg/kmol .. mat:function:: minTemp(tp) 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: :mat:func:`maxTemp` :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of minimum temperatures of all species .. mat:function:: molarDensity(tp) Get the molar density. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Molar density. Units: kmol/m^3 .. mat:function:: molarMasses(tp) Get the molecular weights of all the species. Deprecated in favor of :mat:func:`molecularWeights` See also: :mat:func:`molecularWeights` .. mat:function:: moleFraction(tp, species) Get the mole fraction of a species. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param species: String or cell array of strings of species whose mole fraction is desired :return: Scalar or vector double mole fractions .. mat:function:: moleFractions(tp) Get the mole fractions of all species. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of species mole fractions for input phase. If no output argument is specified, a bar plot is produced. .. mat:function:: molecularWeights(tp) Get the molecular weights of the species. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Vector of species molecular weights. Units: kg/kmol .. mat:function:: nAtoms(tp,k,m) Get the number of atoms of an element in a species. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param k: String species name or integer species number :param m: String element name or integer element number :return: Number of atoms of element ``m`` in species ``k``. .. mat:function:: nElements(tp) Get the number of elements. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Number of elements in the phase. .. mat:function:: nSpecies(tp) Get the number of species. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Number of species in the phase. .. mat:function:: name(tp) Get the name of the phase. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: String name of the input phase .. mat:function:: ph(tp) Get the ph field of the phase. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: .. mat:function:: pressure(tp) Get the pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Pressure. Units: Pa .. mat:function:: refPressure(tp) Get the reference pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :return: Reference pressure in Pa. All standard-state thermodynamic properties are for this pressure. .. mat:function:: satPressure(tp, T) Get the saturation pressure for a given temperature. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param T: Temperature Units: K :return: Saturation pressure for temperature T. Units: Pa .. mat:function:: satTemperature(tp, p) Get the saturation temperature for a given pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param p: Pressure. Units: Pa :return: Saturation temperature for pressure p. Units: K .. mat:function:: set(tp, varargin) Set properties of a phase. The properties that may be set are * Temperature (T) * Density (Rho) * Volume (V) * Pressure (P) * Enthalpy (H) * Entropy (S) * Mole Fractions (X) * Mass Fractions (Y) * Vapor Fraction (Vapor) * Liquid Fraction (Liquid) 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 :mat:func:`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: :mat:func:`setDensity`, :mat:func:`setMassFractions`, :mat:func:`setMoleFractions`, :mat:func:`setPressure`, :mat:func:`setState_HP`, :mat:func:`setState_Psat`, :mat:func:`setState_SP`, :mat:func:`setState_SV`, :mat:func:`setState_Tsat`, :mat:func:`setState_UV`, :mat:func:`setTemperature` :param tp: Instance of class :mat:func:`ThermoPhase` (or another object that derives from ThermoPhase) :param varargin: Comma separated list of ``property, value`` pairs to be set .. mat:function:: setDensity(tp, rho) Set the density. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param rho: Density. Units: kg/m**3 .. mat:function:: setElectricPotential(tp,phi) Set the electric potential. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param phi: Electric potential. Units: V .. mat:function:: setMassFractions(tp, y, norm) Set the species mass fractions. Note that calling :mat:func:`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 :mat:func:`set` and specify the mass fractions and the pressure, or call :mat:func:`setPressure` after calling :mat:func:`setMassFractions`. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param y: Vector of mass fractions whose length must be the same as the number of species. Alternatively, a string in the format ``'SPEC:Y,SPEC2:Y2'`` that specifies the mass fraction of specific species. :param norm: If ``'nonorm'`` is specified, ``y`` will be normalized. This only works if ``y`` is a vector, not a string. Since unnormalized mass fractions can lead to unphysical results, ``'nonorm'`` should be used only in rare cases, such as computing partial derivatives with respect to a species mass fraction. .. mat:function:: setMoleFractions(tp, x, norm) Set the species mole fractions. Note that calling :mat:func:`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 :mat:func:`set` and specify the mole fractions and the pressure, or call :mat:func:`setPressure` after calling :mat:func:`setmoleFractions`. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param y: Vector of mole fractions whose length must be the same as the number of species. Alternatively, a string in the format ``'SPEC:Y,SPEC2:Y2'`` that specifies the mole fraction of specific species. :param norm: If ``'nonorm'`` is specified, ``y`` will be normalized. This only works if ``y`` is a vector, not a string. Since unnormalized mole fractions can lead to unphysical results, ``'nonorm'`` should be used only in rare cases, such as computing partial derivatives with respect to a species mole fraction. .. mat:function:: setName(tp, name) Set the name of the phase. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param name: String, name of the phase .. mat:function:: setPressure(tp, p) Set the pressure. The pressure is set by changing the density holding the temperature and chemical composition fixed. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param p: Pressure. Units: Pa .. mat:function:: setState(a, job, values) Set the state. Deprecated in favor of :mat:func:`set` See also: :mat:func:`set` .. mat:function:: setState_HP(tp, hp) Set the specific enthalpy and pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param hp: Vector of length 2 containing the desired values for the specific enthalpy (J/kg) and pressure (Pa). .. mat:function:: setState_Psat(tp, px) 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 :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param px: Vector of length 2 containing the desired values for the pressure (Pa) and the vapor fraction .. mat:function:: setState_SP(tp, sp) Set the specific entropy and pressure. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param sp: Vector of length 2 containing the desired values for the specific entropy (J/kg-K) and pressure (Pa). .. mat:function:: setState_SV(tp, sv) Set the specific entropy and specific volume. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param sv: Vector of length 2 containing the desired values for the specific entropy (J/kg-K) and specific volume (m**3/kg). .. mat:function:: setState_Tsat(tp, tx) 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 :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param tx: Vector of length 2 containing the desired values for the temperature (K) and the vapor fraction (quality) .. mat:function:: setState_UV(tp, uv) Set the specific internal energy and specific volume. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param uv: Vector of length 2 containing the desired values for the specific internal energy (J/kg) and specific volume (m**3/kg). .. mat:function:: setState_satLiquid(tp) Set the fluid to the saturated liquid state at the current temperature. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) .. mat:function:: setState_satVapor(tp) Set the fluid to the saturated vapor state at the current temperature. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) .. mat:function:: setTemperature(tp,t) Set the temperature. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param t: Temperature. Units: K .. mat:function:: soundspeed(tp) Get the speed of sound. If the phase is an ideal gas, the speed of sound is calculated by: .. math:: c = \sqrt{\gamma * R * T} where :math:`\gamma` is the ratio of specific heats, :math:`R` is the specific gas constant, and :math:`T` is the temperature. If the phase is not an ideal gas, the speed of sound is calculated by .. math:: c = \sqrt{\left(\frac{\partial p}{\partial \rho}\right)_s} where :math:`p` is the pressure and :math:`\rho` is the density, and the subscript :math:`s` indicates constant entropy. This is approximated by slightly increasing the density at constant entropy and computing the change in pressure. .. math:: c = \sqrt{\frac{p_1 - p_0}{\rho_1-\rho_0}} :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :return: The speed of sound. Units: m/s .. mat:function:: speciesIndex(tp, name) 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'); :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param name: 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. :return: Scalar or array of integers .. mat:function:: speciesName(tp, k) Get the name of a species given the index. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :param k: Scalar or array of integer species numbers :return: Cell array of strings .. mat:function:: speciesNames(tp) Get the species names. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :return: Cell array of strings of all of the species names .. mat:function:: temperature(tp) Get the temperature. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :return: Temperature. Units: K .. mat:function:: thermalExpansionCoeff(tp) Get the thermal expansion coefficient. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :return: Thermal Expansion Coefficient. Units: 1/K .. mat:function:: vaporFraction(tp) Get the vapor fraction. :param tp: Instance of class :mat:func:`ThermoPhase` (or another class derived from ThermoPhase) :return: Vapor fraction.