Thermo
- class thermosteam.Thermo(chemicals, mixture=None, Gamma=<class 'thermosteam.equilibrium.activity_coefficients.DortmundActivityCoefficients'>, Phi=<class 'thermosteam.equilibrium.fugacity_coefficients.IdealFugacityCoefficients'>, PCF=<class 'thermosteam.equilibrium.poyinting_correction_factors.IdealPoyintingCorrectionFactors'>, cache=None)[source]
Create a Thermo object that defines a thermodynamic property package
- Parameters
chemicals (Chemicals or Iterable[str]) – Pure component chemical data.
mixture (Mixture, optional) – Calculates mixture properties.
Gamma (ActivityCoefficients subclass, optional) – Class for computing activity coefficients.
Phi (FugacityCoefficients subclass, optional) – Class for computing fugacity coefficients.
PCF (PoyntingCorrectionFactor subclass, optional) – Class for computing poynting correction factors.
cache (optional) – Whether or not to use cached chemicals.
Examples
Create a property package for water and ethanol:
>>> import thermosteam as tmo >>> thermo = tmo.Thermo(['Ethanol', 'Water'], cache=True) >>> thermo Thermo(chemicals=CompiledChemicals([Ethanol, Water]), mixture=Mixture(rule='ideal mixing', ..., include_excess_energies=False), Gamma=DortmundActivityCoefficients, Phi=IdealFugacityCoefficients, PCF=IdealPoyintingCorrectionFactors) >>> thermo.show() # May be easier to read Thermo( chemicals=CompiledChemicals([Ethanol, Water]), mixture=Mixture( rule='ideal mixing', ... include_excess_energies=False ), Gamma=DortmundActivityCoefficients, Phi=IdealFugacityCoefficients, PCF=IdealPoyintingCorrectionFactors )
Note that the Dortmund-UNIFAC is the default activity coefficient model. The ideal-equilibrium property package (which assumes a value of 1 for all activity coefficients) is also available:
>>> ideal = thermo.ideal() >>> ideal.show() Thermo( chemicals=CompiledChemicals([Ethanol, Water]), mixture=Mixture( rule='ideal mixing', ... include_excess_energies=False ), Gamma=IdealActivityCoefficients, Phi=IdealFugacityCoefficients, PCF=IdealPoyintingCorrectionFactors )
Thermodynamic equilibrium results are affected by the choice of property package:
>>> # Ideal >>> tmo.settings.set_thermo(ideal) >>> stream = tmo.Stream('stream', Water=100, Ethanol=100) >>> stream.vle(T=361, P=101325) >>> stream.show() MultiStream: stream phases: ('g', 'l'), T: 361 K, P: 101325 Pa flow (kmol/hr): (g) Ethanol 32.2 Water 17.3 (l) Ethanol 67.8 Water 82.7 >>> # Modified Roult's law: >>> tmo.settings.set_thermo(thermo) >>> stream = tmo.Stream('stream', Water=100, Ethanol=100) >>> stream.vle(T=360, P=101325) >>> stream.show() MultiStream: stream phases: ('g', 'l'), T: 360 K, P: 101325 Pa flow (kmol/hr): (g) Ethanol 100 Water 100
Thermodynamic property packages are pickleable:
>>> tmo.utils.save(thermo, "Ethanol-Water Property Package") >>> thermo = tmo.utils.load("Ethanol-Water Property Package") >>> thermo.show() Thermo( chemicals=CompiledChemicals([Ethanol, Water]), mixture=Mixture( rule='ideal mixing', ... include_excess_energies=False ), Gamma=DortmundActivityCoefficients, Phi=IdealFugacityCoefficients, PCF=IdealPoyintingCorrectionFactors )
- Gamma
Class for computing activity coefficients.
- Type
ActivityCoefficients subclass, optional
- Phi
Class for computing fugacity coefficients.
- Type
FugacityCoefficients subclass, optional
- PCF
Class for computing poynting correction factors.
- Type
PoyntingCorrectionFactor subclass, optional
- as_chemical(chemical)[source]
Return chemical as a Chemical object.
- Parameters
chemical (str or Chemical) – Name of chemical being retrieved.
Examples
>>> import thermosteam as tmo >>> thermo = tmo.Thermo(['Ethanol', 'Water'], cache=True) >>> thermo.as_chemical('Water') is thermo.chemicals.Water True >>> thermo.as_chemical('Octanol') # Chemical not defined, so it will be created Chemical('Octanol')
- subgroup(IDs)[source]
Create a Thermo object from a subset of chemicals.
- Parameters
IDs (Iterable[str]) – Names of chemicals.
Examples
>>> import thermosteam as tmo >>> thermo = tmo.Thermo(['Ethanol', 'Water'], cache=True) >>> thermo_water = thermo.subgroup(['Water']) >>> thermo_water.show() Thermo( chemicals=CompiledChemicals([Water]), mixture=Mixture( rule='ideal mixing', ... include_excess_energies=False ), Gamma=DortmundActivityCoefficients, Phi=IdealFugacityCoefficients, PCF=IdealPoyintingCorrectionFactors )