{"id":15018287,"url":"https://github.com/calebbell/thermo","last_synced_at":"2025-05-14T07:09:26.160Z","repository":{"id":37336607,"uuid":"62404647","full_name":"CalebBell/thermo","owner":"CalebBell","description":"Thermodynamics and Phase Equilibrium component of Chemical Engineering Design Library (ChEDL)","archived":false,"fork":false,"pushed_at":"2025-03-16T21:26:58.000Z","size":46222,"stargazers_count":675,"open_issues_count":8,"forks_count":119,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-05-10T19:37:54.675Z","etag":null,"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"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CalebBell.png","metadata":{"files":{"readme":"README.rst","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-07-01T16:04:56.000Z","updated_at":"2025-05-02T17:28:53.000Z","dependencies_parsed_at":"2025-04-11T02:52:32.207Z","dependency_job_id":null,"html_url":"https://github.com/CalebBell/thermo","commit_stats":{"total_commits":2923,"total_committers":14,"mean_commits":"208.78571428571428","dds":0.0328429695518303,"last_synced_commit":"32207b56cc9dc4467cfb050f06f82e669c45d714"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalebBell%2Fthermo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalebBell%2Fthermo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalebBell%2Fthermo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalebBell%2Fthermo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CalebBell","download_url":"https://codeload.github.com/CalebBell/thermo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092787,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"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"],"created_at":"2024-09-24T19:51:47.121Z","updated_at":"2025-05-14T07:09:26.111Z","avatar_url":"https://github.com/CalebBell.png","language":"Python","readme":"======\nThermo\n======\n\n.. image:: http://img.shields.io/pypi/v/thermo.svg?style=flat\n   :target: https://pypi.python.org/pypi/thermo\n   :alt: Version_status\n.. image:: http://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat\n   :target: https://thermo.readthedocs.io/\n   :alt: Documentation\n.. image:: http://img.shields.io/badge/license-MIT-blue.svg?style=flat\n   :target: https://github.com/CalebBell/thermo/blob/master/LICENSE.txt\n   :alt: license\n.. image:: https://img.shields.io/coveralls/CalebBell/thermo.svg\n   :target: https://coveralls.io/github/CalebBell/thermo\n   :alt: Coverage\n.. image:: https://img.shields.io/pypi/pyversions/thermo.svg\n   :target: https://pypi.python.org/pypi/thermo\n   :alt: Supported_versions\n.. image:: https://badges.gitter.im/CalebBell/thermo.svg\n   :alt: Join the chat at https://gitter.im/CalebBell/thermo\n   :target: https://gitter.im/CalebBell/thermo\n.. image:: https://zenodo.org/badge/62404647.svg\n   :alt: Zendo\n   :target: https://zenodo.org/badge/latestdoi/62404647\n\n\n.. contents::\n\nWhat is Thermo?\n---------------\n\nThermo is open-source software for engineers, scientists, technicians and\nanyone trying to understand the universe in more detail. It facilitates \nthe retrieval of constants of chemicals, the calculation of temperature\nand pressure dependent chemical properties (both thermodynamic and \ntransport), and the calculation of the same for chemical mixtures (including\nphase equilibria) using various models.\n\nThermo runs on all operating systems which support Python, is quick to install, and is\nfree of charge. Thermo is designed to be easy to use while still providing powerful\nfunctionality. If you need to know something about a chemical or mixture, give Thermo a try.\n\nInstallation\n------------\n\nGet the latest version of Thermo from\nhttps://pypi.python.org/pypi/thermo/\n\nIf you have an installation of Python with pip, simple install it with:\n\n    $ pip install thermo\n    \nAlternatively, if you are using `conda \u003chttps://conda.io/en/latest/\u003e`_ as your package management, you can simply\ninstall Thermo in your environment from `conda-forge \u003chttps://conda-forge.org/\u003e`_ channel with:\n\n    $ conda install -c conda-forge thermo\n\nTo get the git version, run:\n\n    $ git clone git://github.com/CalebBell/thermo.git\n\nDocumentation\n-------------\n\nThermo's documentation is available on the web:\n\n    http://thermo.readthedocs.io/\n\nGetting Started - Rigorous Interface\n------------------------------------\n\nCreate 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:\n\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from thermo import ChemicalConstantsPackage, PRMIX, CEOSLiquid, CEOSGas, FlashPureVLS\n    \u003e\u003e\u003e # Load the constant properties and correlation properties\n    \u003e\u003e\u003e constants, correlations = ChemicalConstantsPackage.from_IDs(['decane'])\n    \u003e\u003e\u003e # Configure the liquid and gas phase objects\n    \u003e\u003e\u003e eos_kwargs = dict(Tcs=constants.Tcs, Pcs=constants.Pcs, omegas=constants.omegas)\n    \u003e\u003e\u003e liquid = CEOSLiquid(PRMIX, HeatCapacityGases=correlations.HeatCapacityGases, eos_kwargs=eos_kwargs)\n    \u003e\u003e\u003e gas = CEOSGas(PRMIX, HeatCapacityGases=correlations.HeatCapacityGases, eos_kwargs=eos_kwargs)\n    \u003e\u003e\u003e # Create a flash object with possible phases of 1 gas and 1 liquid\n    \u003e\u003e\u003e flasher = FlashPureVLS(constants, correlations, gas=gas, liquids=[liquid], solids=[])\n    \u003e\u003e\u003e # Flash at 300 K and 1 bar\n    \u003e\u003e\u003e res = flasher.flash(T=300, P=1e5)\n    \u003e\u003e\u003e # molar enthalpy and entropy [J/mol and J/(mol*K) respectively] and the mass enthalpy and entropy [J/kg and J/(kg*K)]\n    \u003e\u003e\u003e res.H(), res.S(), res.H_mass(), res.S_mass()\n    (-48458.137745529726, -112.67831317511894, -340578.897757812, -791.9383098029132)\n    \u003e\u003e\u003e # molar Cp and Cv [J/(mol*K)] and the mass Cp and Cv [J/(kg*K)]\n    \u003e\u003e\u003e res.Cp(), res.Cv(), res.Cp_mass(), res.Cv_mass()\n    (295.17313861592686, 269.62465319082014, 2074.568831461133, 1895.0061117553582)\n    \u003e\u003e\u003e # Molar volume [m^3/mol], molar density [mol/m^3] and mass density [kg/m^3]\n    \u003e\u003e\u003e res.V(), res.rho(), res.rho_mass()\n    (0.00020989856076374984, 4764.206082982839, 677.8592453530177)\n    \u003e\u003e\u003e # isobatic expansion coefficient [1/K], isothermal compressibility [1/Pa], Joule Thomson coefficient [K/Pa]\n    \u003e\u003e\u003e res.isobaric_expansion(), res.kappa(), res.Joule_Thomson()\n    (0.0006977350520992281, 1.1999043797490713e-09, -5.622547043844744e-07)\n    \u003e\u003e\u003e # Speed of sound in molar [m*kg^0.5/(s*mol^0.5)] and mass [m/s] units\n    \u003e\u003e\u003e res.speed_of_sound(), res.speed_of_sound_mass()\n    (437.61281158744987, 1160.1537167375043)\n\nThe following example shows the retrieval of chemical properties for a two-phase system with methane, ethane, and nitrogen, using a few sample kijs:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from thermo import ChemicalConstantsPackage, CEOSGas, CEOSLiquid, PRMIX, FlashVL\n    \u003e\u003e\u003e from thermo.interaction_parameters import IPDB\n    \u003e\u003e\u003e constants, properties = ChemicalConstantsPackage.from_IDs(['methane', 'ethane', 'nitrogen'])\n    \u003e\u003e\u003e kijs = IPDB.get_ip_asymmetric_matrix('ChemSep PR', constants.CASs, 'kij')\n    \u003e\u003e\u003e kijs\n    [[0.0, -0.0059, 0.0289], [-0.0059, 0.0, 0.0533], [0.0289, 0.0533, 0.0]]\n    \u003e\u003e\u003e eos_kwargs = {'Pcs': constants.Pcs, 'Tcs': constants.Tcs, 'omegas': constants.omegas, 'kijs': kijs}\n    \u003e\u003e\u003e gas = CEOSGas(PRMIX, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)\n    \u003e\u003e\u003e liquid = CEOSLiquid(PRMIX, eos_kwargs=eos_kwargs, HeatCapacityGases=properties.HeatCapacityGases)\n    \u003e\u003e\u003e flasher = FlashVL(constants, properties, liquid=liquid, gas=gas)\n    \u003e\u003e\u003e zs = [0.965, 0.018, 0.017]\n    \u003e\u003e\u003e PT = flasher.flash(T=110.0, P=1e5, zs=zs)\n    \u003e\u003e\u003e PT.VF, PT.gas.zs, PT.liquid0.zs\n    (0.10365, [0.881788, 2.6758e-05, 0.11818], [0.97462, 0.02007, 0.005298])\n    \u003e\u003e\u003e flasher.flash(P=1e5, VF=1, zs=zs).T\n    133.6\n    \u003e\u003e\u003e flasher.flash(T=133, VF=0, zs=zs).P\n    518367.4\n    \u003e\u003e\u003e flasher.flash(P=PT.P, H=PT.H(), zs=zs).T\n    110.0\n    \u003e\u003e\u003e flasher.flash(P=PT.P, S=PT.S(), zs=zs).T\n    110.0\n    \u003e\u003e\u003e flasher.flash(T=PT.T, H=PT.H(), zs=zs).T\n    110.0\n    \u003e\u003e\u003e flasher.flash(T=PT.T, S=PT.S(), zs=zs).T\n    110.0\n\nThere is also a N-phase flash algorithm available, FlashVLN. There are no solid models implemented in this interface at this time.\n\n\nGetting Started - Simple Interface\n----------------------------------\n\nThe library is designed around base SI units only for development\nconvenience. All chemicals default to 298.15 K and 101325 Pa on \ncreation, unless specified. All constant-properties are loaded on\nthe creation of a Chemical instance.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from thermo.chemical import Chemical\n    \u003e\u003e\u003e tol = Chemical('toluene')\n    \u003e\u003e\u003e tol.Tm, tol.Tb, tol.Tc\n    (179.2, 383.75, 591.75)\n    \u003e\u003e\u003e tol.rho, tol.Cp, tol.k, tol.mu\n    (862.238, 1706.07, 0.13034, 0.0005522)\n\n\nFor pure species, the phase is easily\nidentified, allowing for properties to be obtained without needing\nto specify the phase. However, the properties are also available in the\nhypothetical gas phase (when under the boiling point) and in the hypothetical\nliquid phase (when above the boiling point) as these properties are needed\nto evaluate mixture properties. Specify the phase of a property to be retrieved \nby appending 'l' or 'g' or 's' to the property.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from thermo.chemical import Chemical\n    \u003e\u003e\u003e tol = Chemical('toluene')\n    \u003e\u003e\u003e tol.rhog, tol.Cpg, tol.kg, tol.mug\n    (4.0320096, 1126.553, 0.010736, 6.97332e-06)\n\nCreating a chemical object involves identifying the appropriate chemical by name\nthrough a database, and retrieving all constant and temperature and pressure dependent\ncoefficients from Pandas DataFrames - a ~1 ms process. To obtain properties at different\nconditions quickly, the method calculate has been implemented. \n    \n.. code-block:: python\n\n    \u003e\u003e\u003e tol.calculate(T=310, P=101325)\n    \u003e\u003e\u003e tol.rho, tol.Cp, tol.k, tol.mu\n    (851.1582219886011, 1743.280497511088, 0.12705495902514785, 0.00048161578053599225)\n    \u003e\u003e\u003e tol.calculate(310, 2E6)\n    \u003e\u003e\u003e tol.rho, tol.Cp, tol.k, tol.mu\n    (852.7643604407997, 1743.280497511088, 0.12773606382684732, 0.0004894942399156052)\n\nEach property is implemented through an independent object-oriented method, based on \nthe classes TDependentProperty and TPDependentProperty to allow for shared methods of\nplotting, integrating, differentiating, solving, interpolating, sanity checking, and\nerror handling. For example, to solve for the temperature at which the vapor pressure\nof toluene is 2 bar. For each property, as many methods of calculating or estimating\nit are included as possible. All methods can be visualized independently:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e Chemical('toluene').VaporPressure.solve_property(2E5)\n    409.5909115602903\n    \u003e\u003e\u003e Chemical('toluene').SurfaceTension.plot_T_dependent_property()\n\nMixtures are supported and many mixing rules have been implemented. However, there is\nno error handling. Inputs as mole fractions (`zs`), mass fractions (`ws`), or volume\nfractions (`Vfls` or `Vfgs`) are supported. Some shortcuts are supported to predefined\nmixtures.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from thermo.chemical import Mixture\n    \u003e\u003e\u003e vodka = Mixture(['water', 'ethanol'], Vfls=[.6, .4], T=300, P=1E5)\n    \u003e\u003e\u003e vodka.Prl,vodka.Prg\n    (35.13075699606542, 0.9822705235442692)\n    \u003e\u003e\u003e air = Mixture('air', T=400, P=1e5)\n    \u003e\u003e\u003e air.Cp\n    1013.7956176577836\n\nWarning: The phase equilibria of Chemical and Mixture are not presently\nas rigorous as the other interface. The property model is not particularly\nconsistent and uses a variety of ideal and Peng-Robinson methods together.\n\nLatest source code\n------------------\n\nThe latest development version of Thermo's sources can be obtained at\n\n    https://github.com/CalebBell/thermo\n\n\nBug reports\n-----------\n\nTo report bugs, please use the Thermo's Bug Tracker at:\n\n    https://github.com/CalebBell/thermo/issues\n\n\nLicense information\n-------------------\n\nSee ``LICENSE.txt`` for information on the terms \u0026 conditions for usage\nof this software, and a DISCLAIMER OF ALL WARRANTIES.\n\nAlthough not required by the Thermo license, if it is convenient for you,\nplease cite Thermo if used in your work. Please also consider contributing\nany changes you make back, and benefit the community.\n\n\nCitation\n--------\n\nTo cite Thermo in publications use::\n\n    Caleb Bell and Contributors (2016-2024). Thermo: Chemical properties component of Chemical Engineering Design Library (ChEDL)\n    https://github.com/CalebBell/thermo.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalebbell%2Fthermo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalebbell%2Fthermo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalebbell%2Fthermo/lists"}