Skip to main content

pyglenn — Thermochemical Properties Calculator

CI Docs License: MIT

Computes Cp(T), H°(T), S°(T) from NASA polynomial coefficients stored in a SQLite database, converted from FORTRAN thermo.inp files.

Author: Dr. Reginaldo G. Leão Jr. — prof.reginaldo.leao@gmail.com

📖 Documentation: profleao.github.io/pyglenn

Features

  • Parse NASA-format thermo.inp (FORTRAN Appendix C) → SQLite3 database
  • Query species by name, phase, molecular weight
  • Filter condensed species by solid vs liquid (phase_detail)
  • Calculate Cp(T), H°(T), S°(T) at any valid temperature
  • Sensible enthalpy, analytical dCp/dT and Cp/Cv (γ)
  • Mixture properties (molar and mass basis) for a fixed composition
  • Enthalpy of formation lookup
  • Per-species uncertainty estimates validated against NIST-JANAF
  • Enthalpy change between two temperatures
  • Command-line interface
  • 2,035 species, 3,795 temperature intervals

Installation

From PyPI (pip)

pip install pyglenn

From source

git clone https://github.com/ProfLeao/pyglenn.git
cd pyglenn
pip install .

Conda

conda install conda-forge::pyglenn

Quick Start

The database is bundled with the package — no manual build step needed.

Python API

from pyglenn import ThermochemicalCalculator

# No need to specify a DB file — uses the bundled thermo.db
calc = ThermochemicalCalculator()
calc.connect()

# Find O2 (exact match — returns only O2, not Be3N2 or Al2O2)
species = calc.get_available_species('O2', exact_match=True)
o2 = species[0]

# Calculate properties at 1000 K
props = calc.calculate_properties(o2.id, 1000.0)
print(f"Cp = {props.cp:.2f} J/(mol·K)")
print(f"H° = {props.h_relative:.1f} J/mol")
print(f"S° = {props.s:.3f} J/(mol·K)")

calc.close()

Or use the context manager for automatic cleanup:

from pyglenn import ThermochemicalCalculator

with ThermochemicalCalculator() as calc:
    # exact_match=True guarantees the correct species (case-insensitive)
    species = calc.get_available_species('CH4', exact_match=True)
    props = calc.calculate_properties(species[0].id, 500.0)
    print(f"Cp = {props.cp:.2f} J/(mol·K)")

Mixtures

Compute mixture properties (e.g. dry air) from mole fractions, on both the molar and mass basis:

from pyglenn import Mixture, ThermochemicalCalculator

with ThermochemicalCalculator() as calc:
    n2 = calc.get_available_species('N2', exact_match=True)[0]
    o2 = calc.get_available_species('O2', exact_match=True)[0]

    air = Mixture(((n2.id, 0.79), (o2.id, 0.21)))  # mole fractions
    mix = calc.mixture_properties(air, 1000.0)

print(f"mean molar mass = {mix.molar_mass * 1000.0:.3f} g/mol")
print(f"cp_mass         = {mix.cp_mass:.2f} J/(kg·K)")

CLI

pyglenn query -s O2

Rebuilding the database

Only needed if the database is corrupted or you modify thermo.inp manually:

pyglenn build -i thermo.inp -o thermo.db

Database Structure

Table Description
species Chemical species (name, formula, phase, MW, ΔH°f)
temperature_intervals Valid T ranges per species
coefficients NASA-7 polynomial coefficients (a1–a7, b1, b2)
file_metadata Global file metadata
metadata Dataset metadata, including its reference gas constant

Gas Constants

R_UNIVERSAL = 8.31446261815324 J/(mol·K) is the universal CODATA value and remains available through the compatibility alias R. NASA Glenn/CEA polynomials in newly built databases declare their fitted reference constant as R_GLENN = 8.314510 J/(mol·K) in SQLite metadata. The calculator reads that value automatically when it connects; legacy databases fall back to R_UNIVERSAL until explicitly migrated.

Citing

If you use pyglenn in your research, please cite it as:

@software{goncalves_leao_junior_2026_21324586,
  author    = {Gonçalves Leão Junior, Reginaldo},
  title     = {pyglenn: A Python Toolkit for Thermochemical
               Properties Calculation from NASA Polynomials},
  month     = jul,
  year      = 2026,
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.21324586},
  url       = {https://doi.org/10.5281/zenodo.21324586},
}

Requirements

  • Python ≥ 3.10
  • NumPy ≥ 1.21
  • SQLite3 (stdlib)

Contributing

Contributions are welcome. See CONTRIBUTING.md for the development setup, checks, and release process.

License

MIT — see LICENSE file.

Metadata

Release files for pyglenn 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyglenn 0.5.1
File Size Uploaded Provenance Actions
pyglenn-0.5.1.tar.gz 813.6 kB Without provenance Details for pyglenn-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyglenn 0.5.1
File Interpreter ABI Platform Actions
pyglenn-0.5.1-py3-none-any.whl Python 3 none any Details for pyglenn-0.5.1-py3-none-any.whl

Total release size: 1.6 MB

Release files / pyglenn-0.5.1.tar.gz

Download URL pyglenn-0.5.1.tar.gz
Size 813.6 kB
Tags Source
SHA-256 checksum
How to use checksums
99be6041c20c5630f8397d754f34e4f29530ca0ece11ef9eff4bfcf89d8703eb
BLAKE2b-256 checksum
How to use checksums
1127f8cf4823a0f887477e655f4242b9dea103049c6d35771734a708128a980c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyglenn-0.5.1-py3-none-any.whl

Download URL pyglenn-0.5.1-py3-none-any.whl
Size 819.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c42b6b7d1ddbc8a7b051140d8a46bebf0da6ff39afca75524349537ce02b98bd
BLAKE2b-256 checksum
How to use checksums
64a42d53e443bd761cf90e8a510daa52fe0abd290b2fc69e083e23153566695e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pyglenn 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page