I’m happy to announce Glenn.jl v0.30, a Julia package that computes thermochemical properties (Cp(T) , H°(T), S°(T)) from NASA-7 polynomial coefficients stored in a bundled SQLite database.
The package is a Julia port of my Python library [pyglenn]( GitHub - ProfLeao/pyglenn: A Python package for calculating thermodynamic properties using NASA polynomial coefficients. · GitHub ), built for the Julia community.
Highlights
- Zero-config —
Calculator()uses the bundledthermo.db; no setup required - Context manager — automatic connection management with `do`-block syntax
- Exact-match species lookup —
exact_match=truefor case-insensitive exact search (e.g."N2"returns only N₂, not Be₃N₂) - Query species by name, phase, molecular weight - Calculate Cp(T), H°(T), S°(T) at any valid temperature - Enthalpy of formation lookup
- Enthalpy change between two temperatures (ΔH)
- Properties over arbitrary temperature ranges
- Build databases from NASA FORTRAN `thermo.inp` files
- Command-line interface (
buildandquery) - NIST-JANAF cross-validation — validated against reference data for 7 species (CO₂, N₂, CO, H₂O, O₂, NH₃, SO₂)
- ~2030 species, 3772 temperature intervals
- Full Documenter.jl documentation.
Installation
julia using Pkg Pkg.add("Glenn")
Quick Start — Basic usage
The database ships inside the package — Calculator() works immediately with zero configuration. All properties are returned in SI units (Cp, S° → J/(mol·K); H° → J/mol).
using Glenn
# No setup needed — uses the bundled thermo.db
calc = Calculator()
# exact_match=true: case-insensitive exact lookup
# "O2" returns only O₂, not Al₂O₂ or Be₃N₂
o2 = only(get_available_species(calc, "O2", exact_match = true))
# Single-point calculation at 1000 K
props = calculate_properties(calc, o2.id, 1000.0)
println("Species: ", props.species_name, " (", props.phase, ")")
println("T = ", props.temperature, " K")
println("Cp = ", round(props.cp, digits = 2), " J/(mol·K)")
println("H° = ", round(props.h_relative, digits = 1), " J/mol")
println("S° = ", round(props.s, digits = 3), " J/(mol·K)")
# Enthalpy of formation
hf = calculate_formation_enthalpy(calc, o2.id) # J/mol
# Enthalpy change between two temperatures
dh = calculate_enthalpy_change(calc, o2.id, 300.0, 1500.0)
# Properties over a temperature range (vectorized — fast)
results = get_properties_range(calc, o2.id, 300:50:2000)
close(calc)
Context manager (do-block)
Use the do-block syntax for automatic connection management — the database is opened before the block and closed after, even if an exception occurs.
using Glenn
# Recommended pattern: no manual connect/close needed
Calculator() do calc
ch4 = only(get_available_species(calc, "CH4", exact_match = true))
props = calculate_properties(calc, ch4.id, 500.0)
println("Cp(CH₄, 500 K) = ", round(props.cp, digits = 2), " J/(mol·K)")
end
# Database is automatically closed here
Command-line interface
Quick access to species data and database operations without opening a REPL.
# Quick species lookup
julia --project -e 'using Glenn; Glenn.cli_main()' -- query -s CH4
julia --project -e 'using Glenn; Glenn.cli_main()' -- query -s CO2
# Or use the convenience script
julia --project bin/glenn.jl query -s O2
# Database rebuild (only if needed — see section above)
julia --project -e 'using Glenn; Glenn.cli_main()' -- build
julia --project bin/glenn.jl build -i custom.inp -o custom.db
NIST-JANAF Cross-Validation
Run the cross-validation audit to compare Glenn.jl against NIST-JANAF reference data:
julia --project docs/audit/audit.jl
Outputs: glenn_vs_nist.csv (point-by-point comparison) and validation_summary.txt (aggregated statistics).
Database
The thermo.db database is bundled with the package (data/thermo.db), generated by pyglenn from the NASA Glenn FORTRAN thermochemical tables.
| Table | Records | Description |
|---|---|---|
species |
2030 | Chemical species (name, formula, phase, MW, ΔH°f) |
temperature_intervals |
3772 | Valid T ranges per species |
coefficients |
3772 | NASA-7 polynomial coefficients (a1–a7, b1, b2) |
file_metadata |
1 | Global file metadata |
Requirements: Julia ≥ 1.6 · SQLite.jl
Links:
- GitHub: GitHub - ProfLeao/Glenn.jl: A Julia Lang package to access the NASA Glenn Coefficients for Calculating Thermodynamic Properties of Individual Species · GitHub
- Documentation: Home · Glenn.jl
- pyglenn (Python version): GitHub - ProfLeao/pyglenn: A Python package for calculating thermodynamic properties using NASA polynomial coefficients. · GitHub
Feedback, issues, and contributions are very welcome!