General remarks
The examples here are focused on the calculation of Gibbs energy using the main thermolab function tl_gibbs_energy. The purpose is to show various ways of using the function and what the input and output variables are. It assumes that the user is familiar with how to use Gibbs energy in thermodynamic calculations. The documentation behind the tl_gibbs_energy function is described in Vrijmoed and Podladchikov (2022).
Example 1
- Line 1 clears the Matlab memory and adds a folder to the MATLAB path. In this case the relative path: one level up in the folder structure. It can also be a complete path to the folder in which the main Thermolab functions are stored.
- Line 2 defines the temperature in Kelvin.
- Line 3 defines the pressure in Pascal.
- Line 4 specifies the phase for which the Gibbs energy will be calculated. It uses the abbreviation of the phase in a thermodynamic dataset and the abbreviation for the dataset from which this phase is taken. Here it is the tc-ds633 dataset from THERMOCALC (Holland and Powell, 2011). Abbreviations of the phase follow the naming by the authors of the dataset.
- Line 5 is the call to the Gibbs energy function (tl for Thermolab), and here takes the temperature, pressure and phase abbreviation as the minimum input parameters. The output will be Gibbs energy in Joule per mole of phase.
Example 2
A small modification of Example 1 to calculate Gibbs energy of multiple phases for a list of temperatures (T) pressures (P).
- Line 2: Creates list of 30 linearly spaced temperatures from 300 to 1000 °C.
- Line 3: Similar to Line 2, for pressures from 0.1 to 4 GPa.
- Line 4: Add more phases to the list separated by comma's.
- Line 5: Creates grid of P-T points (this is similar to looping over domain of discrete P-T points, see loop version here.)
- Line 6: T and P are input into tl_gibbs_energy as two vectors of P-T coordinates.
Exercise: Plot coesite-quartz reaction. Add other SiO2 polymorphs.
Example 3
Calculate Gibbs energy of multiple phases including solid solutions for a list of temperatures (T) pressures (P).
- Line 4: Add more phases to the list separated by comma's. Minerals that form a solid solution use naming as defined in the sheetnames of the solution model Excel file.
- Line 5: Select components in the system using the symbols of the periodic table of elements
- Line 6: Initialize thermodynamic data. This function creates a MATLAB structure array "td" which contains all static information of thermodynamic data for each phase in the list. The third input parameter into this function is the name of the Excel file that holds the solution model file. To find which solution models are available, open this Excel file and look for the names of the Excel sheets.
- Line 8: Calculate Gibbs energy using additional input variable "td". Multiple output variables can be obtained from the function: the gibbs energy, the composition of the discrete phase compounds of the solid solutions and an identifier of each discrete phase compound in the list. The indexing follows the order of the phases in the list in line 4. For example, if there are 15 discrete compositions of Olivine produced, then there will be 15 Olivine Gibbs energies (for each P-T), and the pc_id list will start with 15 '1's, followed by the Orthopyroxene phase compounds etc. The first 15 Gibbs energies in the list then correspond to Olivine with different composition, which can be found in the first 15 compositions in the Npc array.
References
- Thermolab: A Thermodynamics Laboratory for Nonlinear Transport Processes in Open Systems
- Geochemistry, Geophysics, Geosystems, https://doi.org/10.1029/2021GC010303
- An improved and extended internally consistent thermodynamic dataset for phases of petrological interest, involving a new equation of state for solids
- Journal of Metamorphic Geology,29, 3, p. 333-383, https://doi.org/10.1111/j.1525-1314.2010.00923.x