ENKI

Quartz - Berman

from thermoengine import phases
from thermoengine import model

Get access to a thermodynamic database (by default, the Berman (1988) database).

modelDB = model.Database()

Create a Python reference to the Quartz stoichiometric phase class in the Berman (1988) database.

Quartz = modelDB.get_phase('Qz')

Obtain information about this phase.

print (Quartz.props['phase_name'])
print (Quartz.props['formula'][0])
print (Quartz.props['molwt'][0])
Quartz
SiO2
60.0843

All pure component (stoichiometric) phases implement the following functions:

get_gibbs_energy(T, P)
get_enthalpy(T, P)
get_entropy(T, P)
get_heat_capacity(T, P)
get_dCp_dT(T, P)
get_volume(T, P)
get_dV_dT(T, P)
get_dV_dP(T, P)
get_d2V_dT2(T, P)
get_d2V_dTdP(T, P)
get_d2V_dP2(T, P)

where T (temperature) is in K, and P (pressure) is in bars. ### These functions return a one-dimensional array:

print ("{0:>10s}{1:15.2f}{2:<20s}".format("G", Quartz.gibbs_energy(1000.0, 1000.0), 'J/mol'))
print ("{0:>10s}{1:15.2f}{2:<20s}".format("H", Quartz.enthalpy(1000.0, 1000.0), 'J/mol'))
print ("{0:>10s}{1:15.2f}{2:<20s}".format("S", Quartz.entropy(1000.0, 1000.0), 'J/K-mol'))
print ("{0:>10s}{1:15.3f}{2:<20s}".format("Cp", Quartz.heat_capacity(1000.0, 1000.0), 'J/K-mol'))
print ("{0:>10s}{1:15.6e}{2:<20s}".format("dCp/dT", Quartz.heat_capacity(1000.0, 1000.0, deriv={'dT':1}), 'J/-K^2-mol'))
print ("{0:>10s}{1:15.3f}{2:<20s}".format("V", Quartz.volume(1000.0, 1000.0, deriv={'dT':1}), 'J/bar-mol'))
print ("{0:>10s}{1:15.6e}{2:<20s}".format("dV/dT", Quartz.volume(1000.0, 1000.0, deriv={'dT':1}), 'J/bar-K-mol'))
print ("{0:>10s}{1:15.6e}{2:<20s}".format("dv/dP", Quartz.volume(1000.0, 1000.0, deriv={'dP':1}), 'J/bar^2-mol'))
print ("{0:>10s}{1:15.6e}{2:<20s}".format("d2V/dT2", Quartz.volume(1000.0, 1000.0, deriv={'dT':2}), 'J/bar-K^2-mol'))
print ("{0:>10s}{1:15.6e}{2:<20s}".format("d2V/dTdP", Quartz.volume(1000.0, 1000.0, deriv={'dT':1, 'dP':1}), 'J/bar^2-K-mol'))
print ("{0:>10s}{1:15.6e}{2:<20s}".format("d2V/dP2", Quartz.volume(1000.0, 1000.0, deriv={'dP':2}), 'J/bar^3-mol'))
       G     -980365.07J/mol
       H     -864126.03J/mol
       S         116.24J/K-mol
      Cp         69.356J/K-mol
  dCp/dT   9.418167e-03J/-K^2-mol
       V          0.000J/bar-mol
   dV/dT   0.000000e+00J/bar-K-mol
   dv/dP  -2.930704e-06J/bar^2-mol
 d2V/dT2   0.000000e+00J/bar-K^2-mol
d2V/dTdP   0.000000e+00J/bar^2-K-mol
 d2V/dP2   3.359238e-12J/bar^3-mol

Illustrate the Parameter Calibration Protocol.

try:
    param_props = Quartz.param_props
    supports_calib = param_props['supports_calib']
    print ('This phase supports the Calibration protocol')
    nparam = param_props['param_num']
    print ('... there are', nparam, 'parameters')
    names = param_props['param_names']
    units = param_props['param_units']
    values = param_props['param0']
    t = 1000.0
    p = 1000.0
    for i in range (0, nparam):
        print ("Parameter {0:<15s} has value {1:15.6e}  {2:<20s}".format(names[i], values[i], units[i]))
except AttributeError:
    print ('This phase does not implement the parameter calibration protocol')
This phase supports the Calibration protocol
... there are 27 parameters
Parameter delta H alpha   has value   -9.107000e+05  joules
Parameter S alpha         has value    4.146000e+01  joules/K
Parameter Cp k0 alpha     has value    8.001000e+01  joules/K
Parameter Cp k1 alpha     has value   -2.403000e+02  joules/K
Parameter Cp k2 alpha     has value   -3.546700e+06  joules/K
Parameter Cp k3 alpha     has value    4.915700e+08  joules/K
Parameter Cp l1 alpha     has value    0.000000e+00  joules/K
Parameter Cp l2 alpha     has value    0.000000e+00  joules/K
Parameter Cp Tt alpha     has value    0.000000e+00  K
Parameter Cp Ht alpha     has value    0.000000e+00  joules
Parameter V alpha         has value    2.269000e+00  joules/bar
Parameter EOS v1 alpha    has value   -2.434000e-06  bar^-1
Parameter EOS v2 alpha    has value    1.013700e-11  bar^-2
Parameter EOS v3 alpha    has value    2.389500e-05  K^-1
Parameter EOS v4 alpha    has value    0.000000e+00  K^-2
Parameter delta H beta    has value   -9.086270e+05  joules
Parameter S beta          has value    4.420700e+01  joules/K
Parameter Cp k0 beta      has value    8.001000e+01  joules/K
Parameter Cp k1 beta      has value   -2.403000e+02  joules/K
Parameter Cp k2 beta      has value   -3.546700e+06  joules/K
Parameter Cp k3 beta      has value    4.915700e+08  joules/K
Parameter V beta          has value    2.370000e+00  joules/bar
Parameter EOS v1 beta     has value   -1.238000e-06  bar^-1
Parameter EOS v2 beta     has value    7.087000e-13  bar^-2
Parameter EOS v3 beta     has value    0.000000e+00  K^-1
Parameter EOS v4 beta     has value    0.000000e+00  K^-2
Parameter dTtdp           has value    2.370000e-02  K/bar

Illustrate plotting the heat capacity.

Pressure is fixed at 1000 bars.
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
T_array = np.linspace(250.0, 1200.0, 100, endpoint=True)
Cp_array = Quartz.heat_capacity(T_array, 1000.0)
plt.plot(T_array, Cp_array)
plt.ylabel('Cp J/K-m')
plt.xlabel('T K')
plt.show()
_images/Quartz-Berman_15_0.png