About PYroMat

Scope and purpose

PYroMat is a Python package for conveniently retrieving the thermodynamic properties of substances. PYroMat is and will always be free and open. The original source data will always be fully disclosed. If you'd like to help support the project, please consider supporting me.

As of version 3.0.1, PYroMat has over 1,000 individual fluid models, including 33 multi-phase (gas, liquid, and super-critical) models. There are plans to expand the ideal gas database further, and there are also loose plans to start including the thermodynamics of solids.

If you find out that PYroMat doesn't do something you need, don't stay silent! My favorite way for users to make feature requests is on the Github issues page. You can also just email me. Many of the features available in PYroMat today are because users told us they wanted it.

We really like PYroMat because it does things a little differently from other sofware working in this space. It is open, free, and inherently pythonic -- but more than that -- the interface is written to be a joy to use. It is has been a genuine privilege to correspond with engineers, scientists, students, and educators around the world who have all found something they were looking for in PYroMat. Thanks for your interest.

Who maintains PYroMat?

My name is Chris Martin, an Associate Professor of Mechanical Engineering at Penn State Altoona. I wrote the original core of the PYroMat package in 2015, and it has evolved steadily ever since.

It wasn't long after the project's founding, that Joe Ranalli picked up a keen interest in the project. Today, he pours in effort and code alike to helping PYroMat be as reliable as we can make it.

Jacob Moore is our team's pedagogist. A non-Python user (we'll convert him one day!), he keeps us honest - forcing us to keep the interface simple, clean, and clearly documented. Not least of all, he has helped us run multiple user studies in thermodynamics classrooms.

History

A little poem

There once was a student
with work ethic prudent
she scripted to speed her work.

In Python t'was coded,
so when it was loaded,
she could all the tedium shirk.

A thermodynamic
fluid mechanic
problem she had solved.

Her colleagues were avid
she share the package
frustration to resolve.

Good, was the mood.
Researchers all cooed,
until she read her mail.

With no contradiction,
viscosity-friction;
with it her package would sail.

She furiously typed
new modules to write.
The people, they must be heard.

What thanks had it gotten?
why, STEAM she'd forgotten!
Without it, the code was absurd.

Downtrodden indeed,
she sat at the screen,
multiphase soon to add.

Though coffee was drunk
and sleepless nights sunk,
her code, it really was bad!

The syntax was rambling
no hope of unscrambling
the endless nonsensical edits.

Compatible, reverse,
a programmer's curse
no fixing - it's time to shred it.

"I'm done," she then plead.
To the airport, she fled.
"I'll fly off to someplace that's random."

Her useful creation
was once a sensation;
forgotten and now is abandoned.

Her colleagues still moan,
"Please pick up your phone!
Your software, it just isn't working."

Ye coders beware
the fate most unfair,
within all your projects is lurking.

The story behind PYroMat

If you're still reading, you must be pretty curious. Good for you!

Origins: In 2006, I needed to calculate enthalpies of lots of ideal gases for combustion modeling, and I was disappointed with my options. I created HOT for Matlab and Octave, and it's still available from Sourceforge and the Mathworks File Exchange. In my opinion, that code is a HOT mess, and I haven't supported it since 2010. I moved to Python for all my scientific computing in 2011, and I've never looked back.

In 2015, I shared PYroMat version 1.1 on Sourceforge. Even though there isn't much left of my original code, users have rarely ever needed to tolerate changes in the API. Releases do not break reverse compatibility without a major revision change. Since 2015, that has only happened twice, leading us to the version 3.X.X. In each case, the changes were minor; marked for deprecation and removed from documentation years in advance.

The name: PYroMat is constructed from "PY" for PYthon, the Greek "pyro" for fire, and the suffix "Mat", doubling both as a reference to "automat" and a shortening of "material." My earliest working title was "HOTpy," which still has vestiges in the data file extensions, *.hpd, or originally "Hot Py Data" file.

The evolution of the substance models: The first release of PYroMat only supported ideal gas data through two classes; igfit and igtab. The igfit class supplied properties through the so-called NASA polynomials. Meanwhile, igtab objects simply performed interpolation on tabulated data.

At the close of 2017, I abandoned table lookups, and version 2.0.1 marked a total transition to the ig class, implementing the Shomate Equation for ideal gas data. Even though this let me dramatically expand the number of substances PYroMat offered, I quickly reinstating the NASA polynomials in the ig2 class in version 2.0.7. The folks at NIST do a great job, but the temperature ranges on these fits are narrower, and I even identified the occasional discontinuity in the specific heat functions. As of version 3.0.1, ig was finally demoted to ig1, which still implements a number of species using the Shomate Equation, while the ig2 class uses the NASA polynomials for the most commonly used gases.

In 2018, the first multi-phase substances found their debut in PYroMat, and I began experimenting with different back-end codes. The first liquid-vapor substance model was the IF-97 industrial steam formulation implemented in the if97 class. The IF-97 formulation seemed especially useful for engineers, because it provides direct functions for calculating properties both "forward" and "backwards," but is built on a piece-wise formulation that makes its implementation tricky and highly substance dependent. By version 2.0.7, the Span and Wagner model was implemented in the mp1 class, which replaced if97, and allowed the inclusion of many more substances.

Up to 2026, the vast majority of the work was incrementally adding features (like more flexibility in the property interface, search, and info functions), applying bugfixes, addressing user comments and questions, and adding new substances (like refrigerants). Finally, the release of version 3.0.1 saw the addition of the mp2 class, which enabled the most rapid addition new multi-phase models in the project's history, dramatically better computational performance, and the most flexible property interface yet.

Units: Version 2.0.1 also saw the addition of a user-configurable system of units. Because unit conversion is dangerously more complicated than one might expect at first glance, the PYroMat unit conversion system is carefully documented in the PYroMat User and Developer Handbook.

Numerical methods: From its original inception, inversion and polynomial evaluation in PYroMat has always been implemented in custom numerical codes written in pure Python. A number of programmers out there are screaming, "WHY!?"

  1. It reduces the number of back-end dependencies that need to be installed and working correctly,
  2. These algorithms have been studied and tuned specifically for the types of functions one is likely to get in thermodynamic property calculations,
  3. Design control over the algorithm makes studying and correcting numerical convergence issues much easier,
  4. It is much easier to carefully engineer a balance between speed and reliable numerical convergence, and
  5. Because it's fun!

In PYroMat version 1, the psolve function was exposed to the user alongside the methods that calculated properties. The user was expected to just "figure it out." It was slow, buggy, had no array support, and required quite a bit from the user. By version 1.4, I abandoned this approach in favor of class- and property-specific methods like T_h(). By version 2.2.0, those methods are still in the core code for reverse compatibility, but now we use a different approach.

The oldest codes used in PYroMat were variations on Newton-Rhapson iteration with maximum and minimum guesses set to guard against divergence. That approach is still implemented in the back-end _iter1 method. While it works well with ideal gas properties, _iter1 fails miserably with multi-phase properties unless very good initial guesses can be found. Tests with bisection methods were highly stable, but disappointingly slow. The mp1._hybrid1 back-end method was introduced in version 2.1.0, which implements a custom hybrid of Newton and bisection iteration. It is described in detail in the User and Developer Handbook.

In sharp contrast, the mp2 class was introduced in 2026 with version 3.0.1, which automatically builds lookup tables for saturation lines and multi-dimensional property data. These are used to establish close initial guesses, which merely need to be polished by fast and flexible Newton-Rhapson algorithm. With the exception of the mp1 class, the vast majority of the back-end numerical iteration is some variant of Newton-Rhapson. I experimented with simplex-based global search algorithms, but rested with this incredibly simple approach when I realized how reliable and how fast it is.

PYroMat also uses its own codes for evaluating polynomials and their derivatives. Of course, Numpy has algorithms for this, but they use a one-dimensional "dense" list of coefficients. In multi-phase models with two-dimensional polynomials on both temperature and density, there might be hundreds of possible combinations of powers of the two, but most of them will not be represented in the model. PYroMat implements a two-dimensional "sparse" polynomial representation, where only non-zero terms are stored and dealt with, and derivatives can be calculated simultaneously. See the numerical methods chapter of the User and Developer Handbook for more information.

Big improvements: Version 2.1.0 represented the single largest rewrite of the back-end since PYroMat's original release. It was released in 2021 after a long investment in writing and testing, and it made a number of important improvements to back-end numerical methods, added a number of new multi-phase substances, and finally exceeded 1,000 total substances. With more substances came better methods to search them; the info() function was improved as well, allowing users to search for substances by class, collection, atomic contents, name, and more.

Released in 2022, version 2.2.0 competes with 2.1.0 for the biggest back-end rewrite. The most substantial change was that all inverse property methods are now hidden from the user in a generic back-end argument parsing system, _argparse(), which remains the back-end structure today. To calculate temperature from enthalpy (an "inverse" operation), users can simply call T(h=...), and the argument parsing automatically algorithm automatically handles determining the thermodynamic state. A new search() and info() function were added to the package front-end, which allow users to view and search the database entries more easily. Substance meta-data were added to the back-end like common name lists, InChI, and CAS designations, and these fields were made searchable.

In 2026, version 3.0.1 finally released the long awaited mp2 class, which automatically explores the properties of a multi-phase equation of state models to generate its saturation lines with no ancillary data needed. Rather than making the algorithm slower, the multi-dimensional table lookup system implemented in the mp2 primitives actually dramatically speeds numerical iteration, while allowing the most flexible _argparse() algorithm yet.

The PYroMat logo is entirely thanks to the wonderful and talented Janet Montgomery. I mentioned to her that the package needed an icon, and before I had time to think I had a multitude of options of every color and shape. Together, we whittled it down to a snake's head combined with a flame to represent the union of Python and thermal properties. Thanks, Janet.

Future plans

The project has three primary priorities:

Long term aspirations still include adding transport properties to ideal gasses, and I have long had aspirations to write ig3 to explicitly model the raw rotational, vibrational, and electronic energies used to generate the JANAF tables from which the polynomials are derived. Then, the mind-numbingly large effort will be systematically encoding the coefficients into HPD files.

License

PYroMat is released under the GNU Public License version 3. You, the user, are free to copy the code. You are free to edit the program (please do). You are free to share your changes with anyone you like as long as you tell people you made changes. In fact, I'd really love to hear about it if you make your own additions!

While I will continue to pour effort into verifying the integrity of the code and the data I maintain, PYroMat is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Contact:
Christopher R. Martin, Ph.D.
Associate Professor of Mechanical Engineering
The Pennsylvania State University, Altoona College
crm28@psu.edu

©2026 Released under the GPLv3 License