| |
- Phase
class Phase |
|
Phases of matter.
Class Phase manages basic state and constituent property
information for a homogeneous phase of matter. It handles only
those properties that do not require the equation of state, namely
the temperature, density, chemical composition, and attributes of
the elements and species.
It does not know about the pressure, or any other thermodynamic property
requiring the equation of state -- class ThermoPhase derives from Phase
and adds those properties.
Class Phase is not usually instantiated directly. It is used as a
base class for class ThermoPhase. |
|
Methods defined here:
- atomicWeights(self, elements=[])
- Array of element molar masses [kg/kmol].
If a sequence of element symbols is supplied, only the values
for those elements are returned, ordered as in the
list. Otherwise, the values are for all elements in the phase,
ordered as in the input file.
- density(self)
- Mass density [kg/m^3].
- elementIndex(self, element)
- The index of element 'element', which may be specified as
a string or an integer index. In the latter case, the index is
checked for validity and returned. If no such element is
present, an exception is thrown.
- elementName(self, m)
- Name of the element with index number m.
- elementNames(self)
- Return a tuple of all element names.
- massFraction(self, species)
- Mass fraction of one species, referenced by name or
index number.
>>> ph.massFraction(4)
>>> ph.massFraction('CH4')
- massFractions(self, species=None)
- Species mass fraction array.
If optional argument 'species'
is supplied, then only the values for the selected species are
returned.
>>> y1 = ph.massFractions() # all species
>>> y2 = ph.massFractions(['OH', 'CH3'. 'O2'])
- meanMolarMass(self)
- Mean molar mass [kg/kmol].
- meanMolecularWeight(self)
- Mean molar mass [kg/kmol].
- molarDensity(self)
- Molar density [kmol/m^3].
- molarMasses(self, species=None)
- Array of species molar masses [kg/kmol].
- moleFraction(self, species)
- Mole fraction of a species, referenced by name or
index number.
>>> ph.moleFraction(4)
>>> ph.moleFraction('CH4')
- moleFractions(self, species=None)
- Species mole fraction array.
If optional argument 'species'
is supplied, then only the values for the selected species are
returned.
>>> x1 = ph.moleFractions() # all species
>>> x2 = ph.moleFractions(['OH', 'CH3'. 'O2'])
- molecularWeights(self, species=None)
- Array of species molar masses [kg/kmol].
- nAtoms(self, species=None, element=None)
- Number of atoms of element 'element' in species 'species'.
The element and species may be specified by name or by number.
>>> ph.nAtoms('CH4','H')
___ 4
- nElements(self)
- Number of elements.
- nSpecies(self)
- Number of species.
- phase_id(self)
- The integer index used to access the kernel-level object.
Internal.
- selectElements(self, f, elements)
- Given an array 'f' of floating-point element properties,
return a nummodule array of those values corresponding to elements
listed in 'elements'.
>>> f = ph.elementPotentials()
>>> lam_o, lam_h = ph.selectElements(f, ['O', 'H'])
- selectSpecies(self, f, species)
- Given an array 'f' of floating-point species properties,
return an array of those values corresponding to species
listed in 'species'. This method is used internally to implement
species selection in methods like moleFractions, massFractions, etc.
>>> f = ph.chemPotentials()
>>> muo2, muh2 = ph.selectSpecies(f, ['O2', 'H2'])
- setDensity(self, rho)
- Set the density [kg/m3].
- setMassFractions(self, x, norm=1)
- Set the mass fractions.
See: setMoleFractions
- setMolarDensity(self, n)
- Set the density [kmol/m3].
- setMoleFractions(self, x, norm=1)
- Set the mole fractions.
x - string or array of mole fraction values
norm - If non-zero (default), array values will be
scaled to sum to 1.0.
>>> ph.setMoleFractions('CO:1, H2:7, H2O:7.8')
>>> x = [1.0]*ph.nSpecies()
>>> ph.setMoleFractions(x)
>>> ph.setMoleFractions(x, norm = 0) # don't normalize values
- setState_TNX(self, t, n, x)
- Set the temperature, molardensity, and mole fractions. The mole
fractions may be entered as a string or array,
>>> ph.setState_TNX(600.0, 2.0e-3, 'CH4:0.4, O2:0.6')
- setState_TR(self, t, rho)
- Set the temperature and density, leaving the composition
unchanged.
- setState_TRX(self, t, rho, x)
- Set the temperature, density, and mole fractions. The mole
fractions may be entered as a string or array,
>>> ph.setState_TRX(600.0, 2.0e-3, 'CH4:0.4, O2:0.6')
- setState_TRY(self, t, rho, y)
- Set the temperature, density, and mass fractions.
- setTemperature(self, t)
- Set the temperature [K].
- speciesIndex(self, species)
- The index of species 'species', which may be specified as
a string or an integer index. In the latter case, the index is
checked for validity and returned. If no such species is
present, an exception is thrown.
- speciesName(self, k)
- Name of the species with index k.
- speciesNames(self)
- Return a tuple of all species names.
- temperature(self)
- Temperature [K].
- volume_mass(self)
- Specific volume [m^3/kg].
| |