Engineering textbooks routinely introduce gas dynamics under the convenient assumption of constant specific heats. Students memorize that air has a heat capacity ratio ( γ ) of 1.4, calculate cycle efficiencies on a pocket calculator, and move on.
Inside a gas turbine combustor or a rocket nozzle, that simplification collapses. At 1500 K, molecular nitrogen and oxygen absorb energy in quantized vibrational modes. Heat capacity rises, enthalpy curves bend, and thermodynamic efficiency drops below elementary predictions.
Real engineering demands real property data.
While the core pyglenn library packages 2,035 chemical species into a fast, typed SQLite engine, raw property lookups are only the starting line. To show how professional thermal modeling works in practice, Dr. Reginaldo G. Leão Jr. (GESESC / IFMG) assembled pyglenn-notebooks, an open-source collection of twelve self-contained, pre-executed Jupyter notebooks covering combustion, power cycles, chemical equilibrium, and CFD integration.
Here is an architectural tour of what the repository contains, the physical pitfalls it exposes, and how you can run these workflows on your own machine.
The Cold-Air Standard Delusion in Gas Turbines
Notebook 09 tackles a classic aerospace problem: the air-standard Brayton cycle powering jet engines and industrial gas turbines.
Introductory thermodynamics texts evaluate Brayton cycle efficiency using the cold-air formula:
For a pressure ratio rp=10 and γ=1.4 , this textbook relation predicts a thermal efficiency of 48.2%.
When you evaluate the same cycle in pyglenn by matching entropy across compressor and turbine stages with temperature-dependent Cp(T) , the real thermal efficiency drops to 45.6%.
That 2.6 percentage point gap is the difference between a viable commercial engine and an expensive test-cell failure. Because gas heat capacity increases at high turbine inlet temperatures, the turbine extracts less work per unit temperature drop than constant-property theory suggests. The notebook models this non-linear expansion numerically:
from scipy.optimize import root_scalar from pyglenn import ThermochemicalCalculator with ThermochemicalCalculator() as calc: air = calc.get_available_species('AIR', exact_match=True)[0] # Target entropy at compressor exit for isentropic compression s_inlet = calc.calculate_properties(air.id, 300.0).s p_ratio = 10.0 r_gas = calc.r_ref s_target = s_inlet + r_gas * 2.302585 * (p_ratio ** (1/10)) # delta S adjustment # Solve for compressor discharge temperature def entropy_error(temp): return calc.calculate_properties(air.id, temp).s - s_target sol = root_scalar(entropy_error, bracket=[400.0, 800.0], method='brentq') print(f"Real compressor exit temperature: {sol.root:.1f} K") Energy-Balance Solvers for Flame Temperature
Notebook 06 moves from gas cycles to reactive thermochemistry. When methane burns in dry air under adiabatic, constant-pressure conditions, the total enthalpy of the unburned reactants equals the total enthalpy of the hot combustion products:
Because pyglenn standardizes absolute enthalpy ( H∘ ) directly to the enthalpy of formation at 298.15 K, you do not need separate lookup tables for heat of combustion. Stoichiometric summations yield exact enthalpy balances automatically:
from scipy.optimize import brentq from pyglenn import ThermochemicalCalculator with ThermochemicalCalculator() as calc: ch4 = calc.get_available_species('CH4', exact_match=True)[0] o2 = calc.get_available_species('O2', exact_match=True)[0] n2 = calc.get_available_species('N2', exact_match=True)[0] co2 = calc.get_available_species('CO2', exact_match=True)[0] h2o = calc.get_available_species('H2O', exact_match=True)[0] # Reactants at 298.15 K: CH4 + 2(O2 + 3.76 N2) h_reactants = ( calc.calculate_properties(ch4.id, 298.15).h_relative + 2.0 * calc.calculate_properties(o2.id, 298.15).h_relative + 7.52 * calc.calculate_properties(n2.id, 298.15).h_relative ) # Balance against products: CO2 + 2 H2O + 7.52 N2 def enthalpy_residual(t_flame): h_products = ( calc.calculate_properties(co2.id, t_flame).h_relative + 2.0 * calc.calculate_properties(h2o.id, t_flame).h_relative + 7.52 * calc.calculate_properties(n2.id, t_flame).h_relative ) return h_products - h_reactants t_ad = brentq(enthalpy_residual, 1500.0, 2600.0) print(f"Methane-air adiabatic flame temperature: {t_ad:.1f} K") The notebook extends this formulation across varying fuel-air equivalence ratios ( ϕ ) and reactant preheat temperatures, charting the thermal peak at stoichiometric operation.
Benchmarking Biofuels and Sustainable Aviation Fuels
Decarbonizing transport requires evaluating fuels against multiple competing physical metrics: gravimetric energy density, volumetric energy content, stoichiometric air-fuel ratio, and carbon dioxide emissions per megajoule released.
Notebook 07 benchmarks ethanol and methanol against conventional gasoline and kerosene jet fuel. Rather than pulling generic textbook numbers, the calculations evaluate lower heating values (LHV) and higher heating values (HHV) directly from NASA polynomial integrations.
The resulting tables expose the engineering trade-offs cleanly: while ethanol produces less carbon per kilogram of fuel burned, its lower energy density requires significantly higher fuel mass flow rates to achieve identical thermal output in aircraft engines.
Supplying Thermochemistry to CFD and Reaction Kinetics
High-performance reacting flow simulations in tools like OpenFOAM or custom finite-volume codes cannot afford repeated SQL database lookups inside spatial grid loops.
Notebook 10 demonstrates how to convert pyglenn into an in-memory property provider for computational fluid dynamics (CFD) and ordinary differential equation (ODE) integrators. By pre-allocating contiguous NumPy arrays or extracting raw polynomial coefficients into vectorized evaluators, the notebook establishes property evaluation pipelines capable of millions of state queries per second.
The Complete Twelve-Notebook Curriculum
The repository is organized as a graduated progression from basic toolchain setup to advanced multidisciplinary modeling:
| Index | Notebook Title | Technical Scope |
|---|---|---|
| 01 | Getting Started | Connection management, case-insensitive exact species lookup, error handling |
| 02 | NASA Polynomials Under the Hood | Piecewise interval mechanics, polynomial reconstruction, integration constants |
| 03 | Temperature Curves and Plotting | Vibrational excitation physics, sensible enthalpy, analytical derivatives |
| 04 | Formation Enthalpy Recovery | Reconciling standardized enthalpy scales with reference formation values |
| 05 | Reaction Enthalpies | Kirchhoff laws, heat of combustion, stoichiometric summation |
| 06 | Adiabatic Flame Temperature | Enthalpy-balance root-finding, equivalence ratio sweeps, reactant preheating |
| 07 | Comparing Fuels and Biofuels | LHV, HHV, air-fuel ratios, CO2 emission indices for renewable fuels |
| 08 | Chemical Equilibrium | Gibbs energy, equilibrium constants, water-gas shift reaction, dissociation |
| 09 | Brayton Gas-Turbine Cycle | Real-gas entropy tracking vs cold-air models, compressor-turbine matching |
| 10 | Property Provider for CFD | High-throughput property tables, ODE kinetics integration, memory caching |
| 11 | Gas Mixture Thermochemistry | Mole-fraction weighting, mass basis conversion, composition validation |
| 12 | NASA-7 Coefficient Fitting | Multi-interval least-squares regression with C0 and C1 continuity constraints |
Running the Examples Locally
Every notebook in the repository is checked into version control with its graphical plots and numeric outputs already rendered, allowing you to browse the results directly on GitHub or through the documentation site.
To execute and modify the notebooks locally, install the dependencies using either package manager:
# Using pip pip install pyglenn numpy pandas matplotlib scipy jupyter # Using conda-forge conda install -c conda-forge pyglenn numpy pandas matplotlib scipy jupyter Clone the repository and launch the Jupyter server:
git clone https://github.com/ProfLeao/pyglenn-notebooks.git cd pyglenn-notebooks jupyter lab If you wish to re-execute the entire suite programmatically in batch mode, the repository includes a headless execution pipeline:
jupyter nbconvert --to notebook --execute --inplace notebooks/en/*.ipynb Project Links and Citation
The entire collection is distributed under open-source terms and maintained alongside the core library:
- Repository: github.com/ProfLeao/pyglenn-notebooks
- Interactive Documentation: profleao.github.io/pyglenn-notebooks
- Core Library: github.com/ProfLeao/pyglenn
- DOI Reference: doi.org/10.5281/zenodo.21324685




