EGU General Assembly 2020
© Author(s) 2022. This work is distributed under
the Creative Commons Attribution 4.0 License.

Introducing Thermolab: a toolbox for Thermodynamics in MATLAB

Johannes C. Vrijmoed1 and Yury Y. Podladchikov2
Johannes C. Vrijmoed and Yury Y. Podladchikov
  • 1Freie Universität Berlin, Mineralogy and Petrology, Department of Earth Sciences, Berlin, Germany (
  • 2University of Lausanne, Institute of Earth Sciences, Lausanne, Switzerland

We present a set of MATLAB codes that can be used to perform equilibrium and non-equilibrium thermodynamic calculations. This will be of general use in geomaterial research and education, from the calculation of equilibrium phase diagrams to the development of dynamic models of reaction, deformation, mass and heat transport processes. The main MATLAB function calculates Gibbs energies of pure substances and mixtures using internally consistent thermodynamic databases, for rocks, minerals, melts and fluids. A general formulation of calculating Gibbs energy of mixtures based on linear algebra allows users to add custom solution models in an easy manner. The main Gibbs energy function can also be further extended, updated and customized, for example to involve other thermodynamic databases and equations of state.

We show three methods on how these Gibbs energies can be used to calculate chemical equilibrium based on optimization techniques and linear programming: 1) A brute-force method in which Gibbs energies of all possible phases and solutions are generated as a set of discrete phases. 2) A method of refining and restricting the Gibbs energies of solution phases to save computational resources and 3) A method that further saves computational resources by using system composition to generate Gibbs energies of solutions in a subset of the compositional space.

Finally, we demonstrate how these codes can be used in non-equilibrium thermodynamic processes such as reactive-fluid flow involving density and porosity changes.

How to cite: Vrijmoed, J. C. and Podladchikov, Y. Y.: Introducing Thermolab: a toolbox for Thermodynamics in MATLAB, EGU General Assembly 2020, Online, 4–8 May 2020, EGU2020-20069,, 2020.