Thermochemical Calculations

Preparing Thermochemical Data

The auxi.tools.chemistry.thermochemistry module provides a number of useful functions for doing thermochemical calculations that would otherwise have been quite cumbersome to do. To make these calculations possible, some thermochemical data is needed. The auxi distribution package currently contains data for around 80 compounds. This may, however, not be sufficient for your process calculations. FactSage data can be converted into auxi thermochemical data using the auxi.tools.chemistry.thermochemistry.convert_fact_file_to_auxi_thermo_file function.

To prepare your own compound data files with FactSage, follow these steps:

Open FactSage. Click on the "View Data" button. Select the "Compound" option, NOT "Solution". Select the database that you want to use. "FactPS" should be OK. Type the formula of the compound you need in the box at the bottom. Click OK. Click on the "Cp(T)" tab. Select "File" from the menu and then "Save As ...". Select the folder where you want to store all your thermochemical data files. The filename must have a specific format. Taking "Ar" as an example, use "Compound_Ar.txt" for the file name. Click "Save". You will have to repeat this procedure for all the compounds that you need to include in your calculations.

To convert the factsage file to an auxi thermochemical file use the following code:


In [15]:
from auxi.tools.chemistry import thermochemistry as thermo

#TODO: The following line of code is not working, and must be fixed.
#thermo.convert_fact_file_to_auxi_thermo_file("path/to/factsage_file", "path/to/new_auxi_thermo_file")

Loading Thermochemical Data

If you are going to use the default set of data provided with auxi, you do not need to do anything. The entire data set will be available by default. You can obtain a list of all the compounds and their phases by using the following code:


In [16]:
thermo.list_compounds()


Compounds currently loaded:
Ag[L]
Ag[S]
AgCl[L]
AgCl[S]
AgI[S1]
Al[G]
Al[L]
Al[S]
Al2O3[S]
AlSb[S]
As[S]
As2O3[S]
As4[S]
Br2[G]
C[Sgr]
CH4[G]
CO2[G]
COCl2[G]
COS[G]
Ca[L]
Ca[S1]
Ca[S2]
CaCO3[S]
CaO[S]
CaS[S]
CaSiO3[S]
Cd[G]
Cd[L]
Cd[S]
CdO[S]
CdS[S]
Cl2[G]
Co[L]
Co[Salpha]
Co[Sbeta]
CoO[S]
Cr[L]
Cr[S]
Cu[G]
Cu[L]
Cu[S]
Cu2O[S]
Cu2S[Salpha]
CuO[S]
CuS[S]
CuSO4[S]
F2[G]
Fe[G]
Fe[L]
Fe[Salpha]
Fe[Sbeta]
Fe[Sgamma]
Fe2O3[Salpha]
Fe3O4[Salpha]
FeO[S]
FeS[Salpha]
H2[G]
H2O[G]
H2O[L]
H2S[G]
HBr[G]
HCl[G]
HI[G]
I2[G]
K2CO3[S]
Mg[G]
Mg[L]
Mg[S]
MgCO3[S]
MgO[S]
N2[G]
NH3[G]
Na2CO3[S]
Ni[L]
Ni[Salpha]
Ni[Sbeta]
Ni3S2[Salpha]
NiO[Salpha]
NiS[Salpha]
O2[G]
Pb[G]
Pb[L]
Pb[S]
PbO[L]
PbO[Sred]
PbO[Syellow]
S[Smono]
S[Sortho]
S2[G]
SO2[G]
SO3[G]
Sb[L]
Sb[S]
Si[L]
Si[S]
SiO2[S]
Sn[L]
Sn[Sgray]
Sn[Swhite]
SnO2[S]
Ti[Salpha]
Ti[Sbeta]
TiO2[Srutile]
U[Salpha]
UO2[S]
V[S]
W[S]
Zn[G]
Zn[L]
Zn[S]
ZnO[S]
ZnS[S]
Zr[Salpha]
ZrO2[S1]

The result lists all the compounds with the phases for which data are available. Taking the compound SiO2 as an example, data are available for eight solid phases (S1 to S8), for the liquid phase and for the gas phase.

If you have decided to create you own data folder, you can force auxi to use the data in that folder. Here is the code for this:


In [23]:
thermo.load_data_auxi('data')
thermo.list_compounds()


Compounds currently loaded:
CO[G1]
CO[G2]
CO2[G1]
CO2[G2]
Fe[G]
Fe[L]
Fe[S (gamma)]
Fe[S1 (alp – delt)]
Fe[S2 (alp – delt)]
Fe[S3 (alp – delt)]
Fe[S4 (alp – delt)]
Fe2O3[S1]
Fe2O3[S2]
Fe2O3[S3]

Calculating Heat Capacity

The auxi.tools.chemistry.thermochemistry.Cp function in the auxi.tools.chemistry.thermochemistry module can be used to calculate the heat capacity at constant pressure for a compound. This can be done as follows:


In [22]:
thermo.load_data_auxi()

Cp_H2O = thermo.Cp("H2O[L]", 70.0)
print("The Cp of 1 kg of water at 70 °C is", Cp_H2O, "kWh/K.")

Cp_H2O = thermo.Cp("H2O[G]", 70.0)
print("The Cp of 1 kg of water vapour at 70 °C is", Cp_H2O, "kWh/K.")

m_ZrO2 = 2.34
Cp_ZrO2 = thermo.Cp("ZrO2[S1]", 893.5, m_ZrO2)
print("The Cp of 2.34 kg of ZrO2[S1] at 893.5 °C is", Cp_ZrO2, "kWh/K.")


The Cp of 1 kg of water at 70 °C is 0.0011631792567198512 kWh/K.
The Cp of 1 kg of water vapour at 70 °C is 0.0005236292017203729 kWh/K.
The Cp of 2.34 kg of ZrO2[S1] at 893.5 °C is 0.00040815389961453013 kWh/K.

The first parameter to the function must specify both the compound's formula and phase. If the phase is not specified it is impossible to calculate a result. The heat capacity of water is clearly significantly different from that of water vapour.

The last parameter of the auxi.tools.chemistry.thermochemistry.Cp is mass and it is optional. If no value is specified, it is taken to be 1 kg. This was the case for the first two calculations above. A mass of 2.34 kg was specified in the last Cp calculation.

Calculating Enthalpy

The auxi.tools.chemistry.thermochemistry.H function in auxi.tools.chemistry.thermochemistry is used to calculate the enthalpy of a compound. This can be done as follows:


In [7]:
H_H2O = thermo.H("H2O[L]", 70.0)
print("The enthalpy of 1 kg of water at 70 °C is", H_H2O, "kWh.")

H_H2O = thermo.H("H2O[G]", 70.0)
print("The enthalpy of 1 kg of water vapour at 70 °C is", H_H2O, "kWh.")

m_ZrO2 = 2.34
H_ZrO2 = thermo.H("ZrO2[S1]", 893.5, m_ZrO2)
print("The enthalpy of 2.34 kg of ZrO2[S1] at 893.5 °C is", H_ZrO2, "kWh.")


The enthalpy of 1 kg of water at 70 °C is -4.354872487256496 kWh.
The enthalpy of 1 kg of water vapour at 70 °C is -3.7051065308333224 kWh.
The enthalpy of 2.34 kg of ZrO2[S1] at 893.5 °C is -5.481055002835159 kWh.

The parameters to the auxi.tools.chemistry.thermochemistry.H function works the same as that of the auxi.tools.chemistry.thermochemistry.Cp function. Both formula and phase are required in the first parameter, the second is temperature in °C and the third is mass, which is optional with a default value of 1 kg.

Calculating Entropy

The auxi.tools.chemistry.thermochemistry.S function in auxi.tools.chemistry.thermochemistry is used to calculate the entropy of a compound. This can be done as follows:


In [8]:
S_H2O = thermo.S("H2O[L]", 70.0)
print("The entropy of 1 kg of water at 70 °C is", S_H2O, "kWh/K.")

S_H2O = thermo.S("H2O[G]", 70.0)
print("The entropy of 1 kg of water vapour at 70 °C is", S_H2O, "kWh/K.")

m_ZrO2 = 2.34
S_ZrO2 = thermo.S("ZrO2[S1]", 893.5, m_ZrO2)
print("The entropy of 2.34 kg of ZrO2[S1] at 893.5 °C is", S_ZrO2, "kWh/K.")


The entropy of 1 kg of water at 70 °C is 0.0012420689488107494 kWh/K.
The entropy of 1 kg of water vapour at 70 °C is 0.002983105071775651 kWh/K.
The entropy of 2.34 kg of ZrO2[S1] at 893.5 °C is 0.0007640561418848722 kWh/K.

The parameters to the :py:func:auxi.tools.chemistry.thermochemistry.S function works the same as that of the auxi.tools.chemistry.thermochemistry.Cp function. Both formula and phase are required in the first parameter, the second is temperature in °C and the third is mass, which is optional with a default value of 1 kg.

Calculating Gibbs Free Energy

The auxi.tools.chemistry.thermochemistry.G function in auxi.tools.chemistry.thermochemistry is used to calculate the Gibbs free energy of a compound. This can be done as follows:


In [9]:
G_H2O = thermo.G("H2O[L]", 70.0)
print("The Gibbs free energy of 1 kg of water at 70 °C is", G_H2O,
    "kWh.")

G_H2O = thermo.G("H2O[G]", 70.0)
print("The Gibbs free energy of 1 kg of water vapour at 70 °C is", G_H2O,
    "kWh.")

m_ZrO2 = 2.34
G_ZrO2 = thermo.G("ZrO2[S1]", 893.5, m_ZrO2)
print("The Gibbs free energy of 2.34 kg of ZrO2[S1] at 893.5 °C is", G_ZrO2,
    "kWh.")


The Gibbs free energy of 1 kg of water at 70 °C is -4.781088447040905 kWh.
The Gibbs free energy of 1 kg of water vapour at 70 °C is -4.728759036213137 kWh.
The Gibbs free energy of 2.34 kg of ZrO2[S1] at 893.5 °C is -6.372441100765146 kWh.

The parameters to the auxi.tools.chemistry.thermochemistry.G function works the same as that of the auxi.tools.chemistry.thermochemistry.Cp function. Both formula and phase are required in the first parameter, the second is temperature in °C and the third is mass, which is optional with a default value of 1 kg.