Thermodynamicist is a C# program made to calculate basic thermodynamic properties of chemical systems. Many equations used in this code, as well as the built-in data tables, are pulled directly from Sandler’s Chemical, Biochemical, and Engineering Thermodynamics (5th edition). When used, sources are marked in the code with a comment.

The spiritual predecessor to this program was written in MATLAB by Professor Ali Mohraz from the University of California, Irvine. I originally began writing this program in Java but was convinced to switch to C#/.NET for better UI and performance. Construction began around the beginning of May 2022 and had successfully implemented all features that the original MATLAB code had included in late June 2022.

Features

Screenshot of Thermodynamicist from June 2023 showing thermodynamic variables for water at 273 K and atmospheric pressure, as well as pressure-volume isotherms, vapor pressures, and the vapor-liquid coexistence region. All calculations completed using the Peng-Robinson equation of state.

Thermodynamicist provides users with the ability to…

  • Do thermodynamic calculations using common equations of state, such as the van der Waals or Peng-Robinson equation of state.
  • Estimate pure component state variables, such as fugacity, molar volume for each phase, and enthalpy.
  • Estimate enthalpy, entropy, and free energies with respect to an ideal reference state (currently defaults to 25°C and 100 kPa).
  • Determine present phases in single-component equilibrium.
  • Calculate vapor pressure and plot isotherms.

Code Structure

In mid-July 2022, the first dynamic inputs were added to the UI, allowing users to select a temperature, pressure, and chemical species to be used for calculations. After a few months of being kept busy with summer classes, the first plotting output (for pressure-volume isotherms) was added in late September 2022. By November, this plot could correct the S-curve behavior exhibited by equations of state using the vapor pressure.

By far, the most important piece of code is the PhaseFinder code for cubic equations of state. It uses the cubic form of an equation of state and some basic differential calculus theorems to quickly and efficiently find the molar volume of the liquid and vapor phases of a pure component.

Devlogs & Posts

    Comments

    No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *