thermo
Thermodynamics, phase equilibrium, transport properties and chemical database component of Chemical Engineering Design Library.
https://github.com/CalebBell/thermo
Category: Renewable Energy
Sub Category: Geothermal Energy
Keywords
chemical-engineering cheminformatics chemistry combustion density environmental-engineering equation-of-state heat-capacity mechanical-engineering molecule physics process-simulation solubility surface-tension thermal-conductivity thermodynamics vapor-pressure viscosity
Keywords from Contributors
pump heat-exchanger pressure-drop compressible-fluid-dynamics drag friction open-channel particle-size-distribution pipe reynolds
Last synced: about 1 hour ago
JSON representation
Repository metadata
Thermodynamics and Phase Equilibrium component of Chemical Engineering Design Library (ChEDL)
- Host: GitHub
- URL: https://github.com/CalebBell/thermo
- Owner: CalebBell
- License: mit
- Created: 2016-07-01T16:04:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-12-07T17:02:43.000Z (18 days ago)
- Last Synced: 2025-12-08T10:43:02.182Z (17 days ago)
- Topics: chemical-engineering, cheminformatics, chemistry, combustion, density, environmental-engineering, equation-of-state, heat-capacity, mechanical-engineering, molecule, physics, process-simulation, solubility, surface-tension, thermal-conductivity, thermodynamics, vapor-pressure, viscosity
- Language: Python
- Homepage:
- Size: 45.7 MB
- Stars: 710
- Watchers: 42
- Forks: 121
- Open Issues: 9
- Releases: 12
-
Metadata Files:
- Readme: README.rst
- Changelog: changelog.md
- License: LICENSE.txt
- Authors: AUTHORS
README.rst
======
Thermo
======
.. image:: http://img.shields.io/pypi/v/thermo.svg?style=flat
:target: https://pypi.python.org/pypi/thermo
:alt: Version_status
.. image:: http://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
:target: https://thermo.readthedocs.io/
:alt: Documentation
.. image:: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
:target: https://github.com/CalebBell/thermo/blob/master/LICENSE.txt
:alt: license
.. image:: https://img.shields.io/coveralls/CalebBell/thermo.svg
:target: https://coveralls.io/github/CalebBell/thermo
:alt: Coverage
.. image:: https://img.shields.io/pypi/pyversions/thermo.svg
:target: https://pypi.python.org/pypi/thermo
:alt: Supported_versions
.. image:: https://badges.gitter.im/CalebBell/thermo.svg
:alt: Join the chat at https://gitter.im/CalebBell/thermo
:target: https://gitter.im/CalebBell/thermo
.. image:: https://zenodo.org/badge/62404647.svg
:alt: Zendo
:target: https://zenodo.org/badge/latestdoi/62404647
.. contents::
What is Thermo?
---------------
Thermo is open-source software for engineers, scientists, technicians and
anyone trying to understand the universe in more detail. It facilitates
the retrieval of constants of chemicals, the calculation of temperature
and pressure dependent chemical properties (both thermodynamic and
transport), and the calculation of the same for chemical mixtures (including
phase equilibria) using various models.
Thermo runs on all operating systems which support Python, is quick to install, and is
free of charge. Thermo is designed to be easy to use while still providing powerful
functionality. If you need to know something about a chemical or mixture, give Thermo a try.
Installation
------------
Get the latest version of Thermo from
https://pypi.python.org/pypi/thermo/
If you have an installation of Python with pip, simple install it with:
$ pip install thermo
Alternatively, if you are using `conda `_ as your package management, you can simply
install Thermo in your environment from `conda-forge `_ channel with:
$ conda install -c conda-forge thermo
To get the git version, run:
$ git clone git://github.com/CalebBell/thermo.git
Documentation
-------------
Thermo's documentation is available on the web:
http://thermo.readthedocs.io/
Getting Started - Rigorous Interface
------------------------------------
Create a pure-component flash object for the compound "decane", using the Peng-Robinson equation of state. Perform a flash calculation at 300 K and 1 bar, and obtain a variety of properties from the resulting object:
.. code-block:: python
>>> from thermo import ChemicalConstantsPackage, PRMIX, CEOSLiquid, CEOSGas, FlashPureVLS
>>> # Load the constant properties and correlation properties
>>> constants, correlations = ChemicalConstantsPackage.from_IDs(['decane'])
>>> # Configure the liquid and gas phase objects
>>> eos_kwargs = dict(Tcs=constants.Tcs, Pcs=constants.Pcs, omegas=constants.omegas)
>>> liquid = CEOSLiquid(PRMIX, HeatCapacityGases=correlations.HeatCapacityGases, eos_kwargs=eos_kwargs)
>>> gas = CEOSGas(PRMIX, HeatCapacityGases=correlations.HeatCapacityGases, eos_kwargs=eos_kwargs)
>>> # Create a flash object with possible phases of 1 gas and 1 liquid
>>> flasher = FlashPureVLS(constants, correlations, gas=gas, liquids=[liquid], solids=[])
>>> # Flash at 300 K and 1 bar
>>> res = flasher.flash(T=300, P=1e5)
>>> # molar enthalpy and entropy [J/mol and J/(mol*K) respectively] and the mass enthalpy and entropy [J/kg and J/(kg*K)]
>>> res.H(), res.S(), res.H_mass(), res.S_mass()
(-48458.137745529726, -112.67831317511894, -340578.897757812, -791.9383098029132)
>>> # molar Cp and Cv [J/(mol*K)] and the mass Cp and Cv [J/(kg*K)]
>>> res.Cp(), res.Cv(), res.Cp_mass(), res.Cv_mass()
(295.17313861592686, 269.62465319082014, 2074.568831461133, 1895.0061117553582)
>>> # Molar volume [m^3/mol], molar density [mol/m^3] and mass density [kg/m^3]
>>> res.V(), res.rho(), res.rho_mass()
(0.00020989856076374984, 4764.206082982839, 677.8592453530177)
>>> # isobatic expansion coefficient [1/K], isothermal compressibility [1/Pa], Joule Thomson coefficient [K/Pa]
>>> res.isobaric_expansion(), res.kappa(), res.Joule_Thomson()
(0.0006977350520992281, 1.1999043797490713e-09, -5.622547043844744e-07)
>>> # Speed of sound in molar [m*kg^0.5/(s*mol^0.5)] and mass [m/s] units
>>> res.speed_of_sound(), res.speed_of_sound_mass()
(437.61281158744987, 1160.1537167375043)
The following example shows the retrieval of chemical properties for a two-phase system with methane, ethane, and nitrogen, using a few sample kijs:
.. code-block:: python
>>> from thermo import ChemicalConstantsPackage, CEOSGas, CEOSLiquid, PRMIX, FlashVL
>>> from thermo.interaction_parameters import IPDB
>>> constants, properties = ChemicalConstantsPackage.from_IDs(['methane', 'ethane', 'nitrogen'])
>>> kijs = IPDB.get_ip_asymmetric_matrix('ChemSep PR', constants.CASs, 'kij')
>>> kijs
[[0.0, -0.0059, 0.0289], [-0.0059, 0.0, 0.0533], [0.0289, 0.0533, 0.0]]
>>> eos_kwargs = {'Pcs': constants.Pcs, 'Tcs': constants.Tcs, 'omegas': constants.omegas, 'kijs': kijs}
>>> gas = CEOSGas(PRMIX, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)
>>> liquid = CEOSLiquid(PRMIX, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)
>>> flasher = FlashVL(constants, properties, liquid=liquid, gas=gas)
>>> zs = [0.965, 0.018, 0.017]
>>> PT = flasher.flash(T=110.0, P=1e5, zs=zs)
>>> PT.VF, PT.gas.zs, PT.liquid0.zs
(0.10365, [0.881788, 2.6758e-05, 0.11818], [0.97462, 0.02007, 0.005298])
>>> flasher.flash(P=1e5, VF=1, zs=zs).T
133.6
>>> flasher.flash(T=133, VF=0, zs=zs).P
518367.4
>>> flasher.flash(P=PT.P, H=PT.H(), zs=zs).T
110.0
>>> flasher.flash(P=PT.P, S=PT.S(), zs=zs).T
110.0
>>> flasher.flash(T=PT.T, H=PT.H(), zs=zs).T
110.0
>>> flasher.flash(T=PT.T, S=PT.S(), zs=zs).T
110.0
There is also a N-phase flash algorithm available, FlashVLN. There are no solid models implemented in this interface at this time.
Getting Started - Simple Interface
----------------------------------
The library is designed around base SI units only for development
convenience. All chemicals default to 298.15 K and 101325 Pa on
creation, unless specified. All constant-properties are loaded on
the creation of a Chemical instance.
.. code-block:: python
>>> from thermo.chemical import Chemical
>>> tol = Chemical('toluene')
>>> tol.Tm, tol.Tb, tol.Tc
(179.2, 383.75, 591.75)
>>> tol.rho, tol.Cp, tol.k, tol.mu
(862.238, 1706.07, 0.13034, 0.0005522)
For pure species, the phase is easily
identified, allowing for properties to be obtained without needing
to specify the phase. However, the properties are also available in the
hypothetical gas phase (when under the boiling point) and in the hypothetical
liquid phase (when above the boiling point) as these properties are needed
to evaluate mixture properties. Specify the phase of a property to be retrieved
by appending 'l' or 'g' or 's' to the property.
.. code-block:: python
>>> from thermo.chemical import Chemical
>>> tol = Chemical('toluene')
>>> tol.rhog, tol.Cpg, tol.kg, tol.mug
(4.0320096, 1126.553, 0.010736, 6.97332e-06)
Creating a chemical object involves identifying the appropriate chemical by name
through a database, and retrieving all constant and temperature and pressure dependent
coefficients from Pandas DataFrames - a ~1 ms process. To obtain properties at different
conditions quickly, the method calculate has been implemented.
.. code-block:: python
>>> tol.calculate(T=310, P=101325)
>>> tol.rho, tol.Cp, tol.k, tol.mu
(851.1582219886011, 1743.280497511088, 0.12705495902514785, 0.00048161578053599225)
>>> tol.calculate(310, 2E6)
>>> tol.rho, tol.Cp, tol.k, tol.mu
(852.7643604407997, 1743.280497511088, 0.12773606382684732, 0.0004894942399156052)
Each property is implemented through an independent object-oriented method, based on
the classes TDependentProperty and TPDependentProperty to allow for shared methods of
plotting, integrating, differentiating, solving, interpolating, sanity checking, and
error handling. For example, to solve for the temperature at which the vapor pressure
of toluene is 2 bar. For each property, as many methods of calculating or estimating
it are included as possible. All methods can be visualized independently:
.. code-block:: python
>>> Chemical('toluene').VaporPressure.solve_property(2E5)
409.5909115602903
>>> Chemical('toluene').SurfaceTension.plot_T_dependent_property()
Mixtures are supported and many mixing rules have been implemented. However, there is
no error handling. Inputs as mole fractions (`zs`), mass fractions (`ws`), or volume
fractions (`Vfls` or `Vfgs`) are supported. Some shortcuts are supported to predefined
mixtures.
.. code-block:: python
>>> from thermo.chemical import Mixture
>>> vodka = Mixture(['water', 'ethanol'], Vfls=[.6, .4], T=300, P=1E5)
>>> vodka.Prl,vodka.Prg
(35.13075699606542, 0.9822705235442692)
>>> air = Mixture('air', T=400, P=1e5)
>>> air.Cp
1013.7956176577836
Warning: The phase equilibria of Chemical and Mixture are not presently
as rigorous as the other interface. The property model is not particularly
consistent and uses a variety of ideal and Peng-Robinson methods together.
Latest source code
------------------
The latest development version of Thermo's sources can be obtained at
https://github.com/CalebBell/thermo
Bug reports
-----------
To report bugs, please use the Thermo's Bug Tracker at:
https://github.com/CalebBell/thermo/issues
License information
-------------------
See ``LICENSE.txt`` for information on the terms & conditions for usage
of this software, and a DISCLAIMER OF ALL WARRANTIES.
Although not required by the Thermo license, if it is convenient for you,
please cite Thermo if used in your work. Please also consider contributing
any changes you make back, and benefit the community.
Citation
--------
To cite Thermo in publications use::
Caleb Bell and Contributors (2016-2024). Thermo: Chemical properties component of Chemical Engineering Design Library (ChEDL)
https://github.com/CalebBell/thermo.
Owner metadata
- Name: Caleb Bell
- Login: CalebBell
- Email:
- Kind: user
- Description:
- Website:
- Location: Calgary
- Twitter:
- Company: University of New Brunswick
- Icon url: https://avatars.githubusercontent.com/u/16520296?u=073b09b425f3d8ed17ebbfdd895043db9e40562e&v=4
- Repositories: 17
- Last ynced at: 2024-06-11T15:42:50.384Z
- Profile URL: https://github.com/CalebBell
GitHub Events
Total
- Create event: 6
- Release event: 3
- Issues event: 16
- Watch event: 73
- Issue comment event: 25
- Push event: 38
- Pull request event: 13
- Fork event: 6
Last Year
- Create event: 3
- Release event: 2
- Issues event: 6
- Watch event: 49
- Issue comment event: 12
- Push event: 18
- Pull request event: 9
- Fork event: 5
Committers metadata
Last synced: 7 days ago
Total Commits: 3,195
Total Committers: 14
Avg Commits per committer: 228.214
Development Distribution Score (DDS): 0.032
Commits in past year: 217
Committers in past year: 3
Avg Commits per committer in past year: 72.333
Development Distribution Score (DDS) in past year: 0.032
| Name | Commits | |
|---|---|---|
| Caleb Bell | C****l@g****m | 3092 |
| Yoel | y****s@g****m | 68 |
| cortespea | c****a@a****u | 10 |
| Seimen | s****n@c****e | 8 |
| Enrique Cintron | c****j@g****m | 4 |
| tedhyu | t****u@y****m | 3 |
| Andreas | a****s@g****m | 2 |
| Alex | 6****l | 2 |
| shimwell | m****l@j****m | 1 |
| Tuomo Keskitalo | t****o@i****i | 1 |
| Rory Kurek | r****k@g****m | 1 |
| Kobi Felton | k****f@g****m | 1 |
| Diego Volpatto | v****o@l****r | 1 |
| Alexandr Vasilyev | a****v@g****m | 1 |
Committer domains:
- lncc.br: 1
- iki.fi: 1
- jshimwell.com: 1
- cloasdata.de: 1
- ad.engr.wisc.edu: 1
Issue and Pull Request metadata
Last synced: 18 days ago
Total issues: 124
Total pull requests: 55
Average time to close issues: 5 months
Average time to close pull requests: about 2 months
Total issue authors: 85
Total pull request authors: 21
Average comments per issue: 2.47
Average comments per pull request: 1.42
Merged pull request: 43
Bot issues: 0
Bot pull requests: 0
Past year issues: 8
Past year pull requests: 10
Past year average time to close issues: 4 days
Past year average time to close pull requests: 1 day
Past year issue authors: 5
Past year pull request authors: 3
Past year average comments per issue: 1.63
Past year average comments per pull request: 0.7
Past year merged pull request: 9
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- alexchandel (12)
- yoelcortes (6)
- cloasdata (6)
- BenPortner (4)
- gamafreire (3)
- allanc1 (3)
- mikeyj777 (3)
- gbrault (2)
- shimwell (2)
- OdhranOOC (2)
- tbridel (2)
- aegis4048 (2)
- mcgeochd (2)
- dejac001 (2)
- dkchung22 (2)
Top Pull Request Authors
- CalebBell (17)
- yoelcortes (10)
- cloasdata (6)
- AndreasMatthias (2)
- apthorpe (2)
- alexchandel (2)
- marcosfelt (2)
- tkeskita (1)
- volpatto (1)
- tedhyu (1)
- danieldjewell (1)
- edgarsmdn (1)
- alex-s-v (1)
- YifeiLu (1)
- RoryKurek (1)
Top Issue Labels
- bug (2)
- enhancement (2)
- question (1)
Top Pull Request Labels
- enhancement (1)
Package metadata
- Total packages: 2
-
Total downloads:
- pypi: 99,733 last-month
- Total dependent packages: 12 (may contain duplicates)
- Total dependent repositories: 19 (may contain duplicates)
- Total versions: 79
- Total maintainers: 1
pypi.org: thermo
Chemical properties component of Chemical Engineering Design Library (ChEDL)
- Homepage: https://github.com/CalebBell/thermo
- Documentation: https://thermo.readthedocs.io/
- Licenses: MIT
- Latest release: 0.6.0 (published about 2 months ago)
- Last Synced: 2025-12-04T15:36:45.968Z (21 days ago)
- Versions: 65
- Dependent Packages: 11
- Dependent Repositories: 16
- Downloads: 99,733 Last month
-
Rankings:
- Dependent packages count: 0.753%
- Stargazers count: 2.804%
- Average: 3.007%
- Downloads: 3.367%
- Dependent repos count: 3.66%
- Forks count: 4.45%
- Maintainers (1)
conda-forge.org: thermo
thermo is an open-source software for engineers, scientists, technicians and anyone trying to understand the universe in more detail. It facilitates the retrieval of constants of chemicals, the calculation of temperature and pressure dependent chemical properties (both thermodynamic and transport), the calculation of the same for chemical mixtures (including phase equilibria), and assorted information of a regulatory or legal nature about chemicals. The thermo library depends on the SciPy library to provide numerical constants, interpolation, integration, differentiation, and numerical solving functionality. thermo all operating systems which support Python, is quick to install, and is free of charge. thermo is designed to be easy to use while still providing powerful functionality. If you need to know something about a chemical, give thermo a try.
- Homepage: https://github.com/CalebBell/thermo
- Licenses: MIT
- Latest release: 0.2.21 (published over 3 years ago)
- Last Synced: 2025-12-13T09:34:17.988Z (12 days ago)
- Versions: 14
- Dependent Packages: 1
- Dependent Repositories: 3
-
Rankings:
- Dependent repos count: 17.914%
- Forks count: 18.023%
- Stargazers count: 18.193%
- Average: 20.771%
- Dependent packages count: 28.954%
Dependencies
- actions/cache v2 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/cache v4 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- actions/checkout v4 composite
- docker/setup-qemu-action v3 composite
- extractions/setup-just v2 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- astral-sh/setup-uv v7 composite
- extractions/setup-just v2 composite
- actions/checkout v4 composite
- actions/download-artifact v4 composite
- pypa/gh-action-pypi-publish release/v1 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- actions/upload-artifact v4 composite
- astral-sh/setup-uv v7 composite
- extractions/setup-just v3 composite
- r-lib/actions/setup-pandoc v2 composite
- matplotlib
- numpy
- pandas
- python
- scipy
- chemicals >=1.4.0
- fluids >=1.2.0
- pandas *
- scipy >=1.6.0
- chemicals >=1.4.0
- fluids >=1.2.0
- numpy >=1.5.0
- pandas *
- scipy >=1.6.0
Score: 20.72749138672294