Thermo#

class Thermo(chemicals, mixture=None, Gamma=None, Phi=None, PCF=None, cache=None, skip_checks=False)[source]#

Create a Thermo object that defines a thermodynamic property package

Parameters:
  • chemicals (Iterable[Chemical or 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 (PoyintingCorrectionFactors subclass, optional) – Class for computing poynting correction factors.

  • cache (optional) – Whether or not to use cached chemicals.

  • skip_checks (bool, optional) – Whether to skip checks for missing or invalid properties.

Examples

Create a property package for water and ethanol:

>>> import thermosteam as tmo
>>> thermo = tmo.Thermo(['Ethanol', 'Water'], cache=True)
>>> thermo.show()
Thermo(
    chemicals=CompiledChemicals([Ethanol, Water]),
    mixture=IdealMixture(...
        include_excess_energies=False
    ),
    Gamma=DortmundActivityCoefficients,
    Phi=IdealFugacityCoefficients,
    PCF=MockPoyintingCorrectionFactors
)

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()
IdealThermo(
    chemicals=CompiledChemicals([Ethanol, Water]),
    mixture=IdealMixture(...
        include_excess_energies=False
    ),
)

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  30
                    Water    16
                (l) Ethanol  70
                    Water    84
>>> # Modified Roult's law:
>>> tmo.settings.set_thermo(thermo)
>>> 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  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=IdealMixture(...
        include_excess_energies=False
    ),
    Gamma=DortmundActivityCoefficients,
    Phi=IdealFugacityCoefficients,
    PCF=MockPoyintingCorrectionFactors
)
chemicals#

Pure component chemical data.

Type:

Chemicals or Iterable[str]

mixture#

Calculates mixture properties.

Type:

Mixture, optional

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

ideal()[source]#

Ideal thermodynamic property package.

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')