Chemical equilibrium with fixed fugacity

Written by Allan Leal (ETH Zurich) on Jan 7th, 2022

This tutorial demonstrates the calculation of calcite (CaCO3) solubility in a saline aqueous solution for given fugacity of CO2.

The code block below produces a chemical system containing an aqueous phase (to model our saline aqueous solution) and a solid mineral phase (to model our calcite mineral).

import reaktoro as rkt

db = rkt.PhreeqcDatabase("phreeqc.dat")

solution = rkt.AqueousPhase(rkt.speciate("H O Na Cl C Ca"))
solution.setActivityModel(rkt.ActivityModelHKF())

calcite = rkt.MineralPhase("Calcite")

system = rkt.ChemicalSystem(db, solution, calcite)

In our desired chemical equilibrium calculation, the following properties are constrained at equilibrium:

  • temperature;

  • pressure; and

  • fugacity of CO2;

The next step is to create an object of class EquilibriumSpecs containing the above constraint specifications for the chemical equilibrium calculation we want to perform.

specs = rkt.EquilibriumSpecs(system)
specs.temperature()
specs.pressure()
specs.fugacity("CO2(g)")

Note

Because the fugacity of CO2 is constrained, the chemical equilibrium problem will presume that the system is open to CO2. This means that during the calculation, enough CO2 is allowed to leave or enter the system so that the fugacity constraint is satisfied.

Once we have created this specifications object, we can now create our dedicated and optimized equilibrium solver to solve equilibrium problems with such constraints, which is done next:

solver = rkt.EquilibriumSolver(specs)

Let’s now create an initial chemical state for our chemical system, one that represents a 1 molal NaCl aqueous solution mixed with 10 g of calcite mineral. We do this next by creating an object of class ChemicalState:

state = rkt.ChemicalState(system)
state.temperature(50.0, "celsius")
state.pressure(10.0, "bar")
state.set("H2O", 1.0, "kg")
state.set("Na+", 1.0, "mol")
state.set("Cl-", 1.0, "mol")
state.set("Calcite", 10, "g")

Note

This initial chemical state is not yet in chemical equilibrium! The state object created above will be equilibrated later using solver.

Let’s now specify the temperature, pressure, and fugacity conditions (their actual values) we want to impose at equilibrium. We do this by using an object of class EquilibriumConditions:

fCO2g = 0.1  # 0.1 bar

conditions = rkt.EquilibriumConditions(specs)
conditions.temperature(50.0, "celsius")
conditions.pressure(10.0, "bar")
conditions.fugacity("CO2(g)", fCO2g, "bar")

We have everything we need now to perform the chemical equilibrium calculation:

  • an equilibrium solver (the solver object of class EquilibriumSolver);

  • a chemical state to equilibrate (the state object of class ChemicalState); and

  • the conditions we are imposing for this equilibrium state (the conditions object of class EquilibriumConditions).

The code below will perform the equilibrium calculation and when it is finished, our state object will be in a chemical equilibrium state:

result = solver.solve(state, conditions)

It’s always advisable to verify if the calculation succeeded:

print("Successful computation!" if result.optima.succeeded else "Computation has failed!")
Successful computation!

Let’s check the computed chemical equilibrium state:

print(state)
+-----------------+--------------+------+
| Property        |        Value | Unit |
+-----------------+--------------+------+
| Temperature     |       323.15 |    K |
| Pressure        |        1e+06 |   Pa |
| Charge:         | -1.12104e-16 |  mol |
| Element Amount: |              |      |
| :: H            |      111.012 |  mol |
| :: C            |     0.106923 |  mol |
| :: O            |        55.82 |  mol |
| :: Na           |            1 |  mol |
| :: Cl           |            1 |  mol |
| :: Ca           |     0.099909 |  mol |
| Species Amount: |              |      |
| :: CO3-2        |    1.561e-05 |  mol |
| :: H+           |  2.52434e-07 |  mol |
| :: H2O          |      55.5007 |  mol |
| :: CO2          |   0.00152145 |  mol |
| :: (CO2)2       |        1e-16 |  mol |
| :: HCO3-        |   0.00929598 |  mol |
| :: CH4          |        1e-16 |  mol |
| :: Ca+2         |   0.00552591 |  mol |
| :: CaCO3        |  5.70421e-06 |  mol |
| :: CaHCO3+      |  0.000132019 |  mol |
| :: CaOH+        |  1.35322e-09 |  mol |
| :: Cl-          |            1 |  mol |
| :: H2           |        1e-16 |  mol |
| :: Na+          |     0.998293 |  mol |
| :: NaCO3-       |  0.000149376 |  mol |
| :: NaHCO3       |   0.00155768 |  mol |
| :: OH-          |  4.72771e-07 |  mol |
| :: NaOH         |        1e-16 |  mol |
| :: O2           |        1e-16 |  mol |
| :: Calcite      |    0.0942453 |  mol |
+-----------------+--------------+------+

And this is it. The above table presents the computed chemical state at equilibrium for the entire chemical system (aqueous solution and mineral calcite). Note that calcite was not fully dissolved with the specified conditions, and the solution is thus saturated with it. If this was not the case, we should then have increased the initial amount of calcite (e.g., 100 g instead of 10 g), since we are interested in computing the solubility of calcite.

Let’s now have a more in-depth look at the chemical state of the system by creating an object of class ChemicalProps and printing it:

props = rkt.ChemicalProps(state)
print(props)
+----------------------------------------+--------------+-----------+
| Property                               |        Value |      Unit |
+----------------------------------------+--------------+-----------+
| Temperature                            |       323.15 |         K |
| Pressure                               |        1e+06 |        Pa |
| Volume                                 |   0.00103295 |        m3 |
| Gibbs Energy                           |     -5891.62 |         J |
| Enthalpy                               |      1596.71 |         J |
| Entropy                                |      23.1729 |       J/K |
| Internal Energy                        |      563.759 |         J |
| Helmholtz Energy                       |     -6924.57 |         J |
| Charge                                 | -1.12104e-16 |       mol |
| Element Amount:                        |              |           |
| :: H                                   |      111.012 |       mol |
| :: C                                   |     0.106923 |       mol |
| :: O                                   |        55.82 |       mol |
| :: Na                                  |            1 |       mol |
| :: Cl                                  |            1 |       mol |
| :: Ca                                  |     0.099909 |       mol |
| Species Amount:                        |              |           |
| :: CO3-2                               |    1.561e-05 |       mol |
| :: H+                                  |  2.52434e-07 |       mol |
| :: H2O                                 |      55.5007 |       mol |
| :: CO2                                 |   0.00152145 |       mol |
| :: (CO2)2                              |        1e-16 |       mol |
| :: HCO3-                               |   0.00929598 |       mol |
| :: CH4                                 |        1e-16 |       mol |
| :: Ca+2                                |   0.00552591 |       mol |
| :: CaCO3                               |  5.70421e-06 |       mol |
| :: CaHCO3+                             |  0.000132019 |       mol |
| :: CaOH+                               |  1.35322e-09 |       mol |
| :: Cl-                                 |            1 |       mol |
| :: H2                                  |        1e-16 |       mol |
| :: Na+                                 |     0.998293 |       mol |
| :: NaCO3-                              |  0.000149376 |       mol |
| :: NaHCO3                              |   0.00155768 |       mol |
| :: OH-                                 |  4.72771e-07 |       mol |
| :: NaOH                                |        1e-16 |       mol |
| :: O2                                  |        1e-16 |       mol |
| :: Calcite                             |    0.0942453 |       mol |
| Mole Fraction:                         |              |           |
| :: CO3-2                               |  2.71397e-07 |   mol/mol |
| :: H+                                  |  4.38885e-09 |   mol/mol |
| :: H2O                                 |     0.964941 |   mol/mol |
| :: CO2                                 |  2.64521e-05 |   mol/mol |
| :: (CO2)2                              |  1.73861e-18 |   mol/mol |
| :: HCO3-                               |  0.000161621 |   mol/mol |
| :: CH4                                 |  1.73861e-18 |   mol/mol |
| :: Ca+2                                |   9.6074e-05 |   mol/mol |
| :: CaCO3                               |  9.91739e-08 |   mol/mol |
| :: CaHCO3+                             |   2.2953e-06 |   mol/mol |
| :: CaOH+                               |  2.35273e-11 |   mol/mol |
| :: Cl-                                 |    0.0173861 |   mol/mol |
| :: H2                                  |  1.73861e-18 |   mol/mol |
| :: Na+                                 |    0.0173564 |   mol/mol |
| :: NaCO3-                              |  2.59706e-06 |   mol/mol |
| :: NaHCO3                              |  2.70819e-05 |   mol/mol |
| :: OH-                                 |  8.21965e-09 |   mol/mol |
| :: NaOH                                |  1.73861e-18 |   mol/mol |
| :: O2                                  |  1.73861e-18 |   mol/mol |
| :: Calcite                             |            1 |   mol/mol |
| Activity Coefficient:                  |              |           |
| :: CO3-2                               |     0.163778 |         - |
| :: H+                                  |     0.634791 |         - |
| :: H2O                                 |      1.00115 |         - |
| :: CO2                                 |      1.26379 |         - |
| :: (CO2)2                              |      1.26379 |         - |
| :: HCO3-                               |      0.65177 |         - |
| :: CH4                                 |      1.26379 |         - |
| :: Ca+2                                |     0.156981 |         - |
| :: CaCO3                               |      1.26379 |         - |
| :: CaHCO3+                             |     0.641259 |         - |
| :: CaOH+                               |     0.641259 |         - |
| :: Cl-                                 |     0.665062 |         - |
| :: H2                                  |      1.26379 |         - |
| :: Na+                                 |     0.654279 |         - |
| :: NaCO3-                              |     0.665062 |         - |
| :: NaHCO3                              |      1.26379 |         - |
| :: OH-                                 |     0.702957 |         - |
| :: NaOH                                |      1.26379 |         - |
| :: O2                                  |      1.26379 |         - |
| :: Calcite                             |            1 |         - |
| Activity:                              |              |           |
| :: CO3-2                               |  2.55692e-06 |         - |
| :: H+                                  |  1.60265e-07 |         - |
| :: H2O                                 |     0.966051 |         - |
| :: CO2                                 |   0.00192306 |         - |
| :: (CO2)2                              |  1.26396e-16 |         - |
| :: HCO3-                               |   0.00605968 |         - |
| :: CH4                                 |  1.26396e-16 |         - |
| :: Ca+2                                |  0.000867585 |         - |
| :: CaCO3                               |  7.20992e-06 |         - |
| :: CaHCO3+                             |  8.46705e-05 |         - |
| :: CaOH+                               |  8.67888e-10 |         - |
| :: Cl-                                 |     0.665155 |         - |
| :: H2                                  |  1.26396e-16 |         - |
| :: Na+                                 |     0.653253 |         - |
| :: NaCO3-                              |  9.93579e-05 |         - |
| :: NaHCO3                              |   0.00196885 |         - |
| :: OH-                                 |  3.32384e-07 |         - |
| :: NaOH                                |  1.26396e-16 |         - |
| :: O2                                  |  1.26396e-16 |         - |
| :: Calcite                             |            1 |         - |
| lg(Activity):                          |              |           |
| :: CO3-2                               |     -5.59228 |         - |
| :: H+                                  |     -6.79516 |         - |
| :: H2O                                 |   -0.0149999 |         - |
| :: CO2                                 |     -2.71601 |         - |
| :: (CO2)2                              |     -15.8983 |         - |
| :: HCO3-                               |     -2.21755 |         - |
| :: CH4                                 |     -15.8983 |         - |
| :: Ca+2                                |     -3.06169 |         - |
| :: CaCO3                               |     -5.14207 |         - |
| :: CaHCO3+                             |     -4.07227 |         - |
| :: CaOH+                               |     -9.06154 |         - |
| :: Cl-                                 |    -0.177077 |         - |
| :: H2                                  |     -15.8983 |         - |
| :: Na+                                 |    -0.184918 |         - |
| :: NaCO3-                              |      -4.0028 |         - |
| :: NaHCO3                              |     -2.70579 |         - |
| :: OH-                                 |     -6.47836 |         - |
| :: NaOH                                |     -15.8983 |         - |
| :: O2                                  |     -15.8983 |         - |
| :: Calcite                             |            0 |         - |
| ln(Activity):                          |              |           |
| :: CO3-2                               |     -12.8767 |         - |
| :: H+                                  |     -15.6464 |         - |
| :: H2O                                 |   -0.0345386 |         - |
| :: CO2                                 |     -6.25384 |         - |
| :: (CO2)2                              |     -36.6071 |         - |
| :: HCO3-                               |      -5.1061 |         - |
| :: CH4                                 |     -36.6071 |         - |
| :: Ca+2                                |      -7.0498 |         - |
| :: CaCO3                               |     -11.8401 |         - |
| :: CaHCO3+                             |     -9.37674 |         - |
| :: CaOH+                               |      -20.865 |         - |
| :: Cl-                                 |    -0.407735 |         - |
| :: H2                                  |     -36.6071 |         - |
| :: Na+                                 |     -0.42579 |         - |
| :: NaCO3-                              |     -9.21678 |         - |
| :: NaHCO3                              |     -6.23031 |         - |
| :: OH-                                 |      -14.917 |         - |
| :: NaOH                                |     -36.6071 |         - |
| :: O2                                  |     -36.6071 |         - |
| :: Calcite                             |            0 |         - |
| Chemical Potential:                    |              |           |
| :: CO3-2                               |     -34597.4 |     J/mol |
| :: H+                                  |     -42039.1 |     J/mol |
| :: H2O                                 |     -92.7991 |     J/mol |
| :: CO2                                 |      -118583 |     J/mol |
| :: (CO2)2                              |       -89464 |     J/mol |
| :: HCO3-                               |     -76636.5 |     J/mol |
| :: CH4                                 |      -330946 |     J/mol |
| :: Ca+2                                |     -18941.5 |     J/mol |
| :: CaCO3                               |     -53538.9 |     J/mol |
| :: CaHCO3+                             |       -95578 |     J/mol |
| :: CaOH+                               |      23004.8 |     J/mol |
| :: Cl-                                 |     -1095.51 |     J/mol |
| :: H2                                  |       -78226 |     J/mol |
| :: Na+                                 |     -1144.02 |     J/mol |
| :: NaCO3-                              |     -35741.4 |     J/mol |
| :: NaHCO3                              |     -77780.5 |     J/mol |
| :: OH-                                 |      41946.3 |     J/mol |
| :: NaOH                                |      45539.1 |     J/mol |
| :: O2                                  |       386896 |     J/mol |
| :: Calcite                             |     -53538.9 |     J/mol |
| Standard Volume:                       |              |           |
| :: CO3-2                               | -5.36362e-06 |    m3/mol |
| :: H+                                  |            0 |    m3/mol |
| :: H2O                                 |  1.82272e-05 |    m3/mol |
| :: CO2                                 |  3.56505e-05 |    m3/mol |
| :: (CO2)2                              |  7.13011e-05 |    m3/mol |
| :: HCO3-                               |  2.56745e-05 |    m3/mol |
| :: CH4                                 |  3.73357e-05 |    m3/mol |
| :: Ca+2                                | -1.82893e-05 |    m3/mol |
| :: CaCO3                               | -1.44742e-05 |    m3/mol |
| :: CaHCO3+                             |    1.028e-05 |    m3/mol |
| :: CaOH+                               |            0 |    m3/mol |
| :: Cl-                                 |  1.81994e-05 |    m3/mol |
| :: H2                                  |  2.85829e-05 |    m3/mol |
| :: Na+                                 | -5.44111e-07 |    m3/mol |
| :: NaCO3-                              |  3.60258e-08 |    m3/mol |
| :: NaHCO3                              |  1.80331e-06 |    m3/mol |
| :: OH-                                 |  -3.8463e-06 |    m3/mol |
| :: NaOH                                |            0 |    m3/mol |
| :: O2                                  |  3.19036e-05 |    m3/mol |
| :: Calcite                             |     3.69e-05 |    m3/mol |
| Standard Gibbs Energy (formation):     |              |           |
| :: CO3-2                               |            0 |     J/mol |
| :: H+                                  |            0 |     J/mol |
| :: H2O                                 |            0 |     J/mol |
| :: CO2                                 |      -101780 |     J/mol |
| :: (CO2)2                              |      8892.65 |     J/mol |
| :: HCO3-                               |     -62917.3 |     J/mol |
| :: CH4                                 |      -232589 |     J/mol |
| :: Ca+2                                |            0 |     J/mol |
| :: CaCO3                               |     -21726.8 |     J/mol |
| :: CaHCO3+                             |     -70384.4 |     J/mol |
| :: CaOH+                               |      79065.2 |     J/mol |
| :: Cl-                                 |            0 |     J/mol |
| :: H2                                  |      20130.7 |     J/mol |
| :: Na+                                 |            0 |     J/mol |
| :: NaCO3-                              |     -10977.6 |     J/mol |
| :: NaHCO3                              |     -61040.8 |     J/mol |
| :: OH-                                 |      82025.5 |     J/mol |
| :: NaOH                                |       143896 |     J/mol |
| :: O2                                  |       485252 |     J/mol |
| :: Calcite                             |     -53538.9 |     J/mol |
| Standard Enthalpy (formation):         |              |           |
| :: CO3-2                               |            0 |     J/mol |
| :: H+                                  |            0 |     J/mol |
| :: H2O                                 |            0 |     J/mol |
| :: CO2                                 |     -8283.02 |     J/mol |
| :: (CO2)2                              |      21408.9 |     J/mol |
| :: HCO3-                               |     -7690.68 |     J/mol |
| :: CH4                                 |      -255300 |     J/mol |
| :: Ca+2                                |            0 |     J/mol |
| :: CaCO3                               |        26787 |     J/mol |
| :: CaHCO3+                             |     -2886.64 |     J/mol |
| :: CaOH+                               |    0.0558337 |     J/mol |
| :: Cl-                                 |            0 |     J/mol |
| :: H2                                  |     -7333.97 |     J/mol |
| :: Na+                                 |            0 |     J/mol |
| :: NaCO3-                              |      37284.8 |     J/mol |
| :: NaHCO3                              |     -11895.6 |     J/mol |
| :: OH-                                 |      51686.8 |     J/mol |
| :: NaOH                                |      51690.8 |     J/mol |
| :: O2                                  |       563957 |     J/mol |
| :: Calcite                             |        17974 |     J/mol |
| Standard Entropy (formation):          |              |           |
| :: CO3-2                               |            0 | J/(mol*K) |
| :: H+                                  |            0 | J/(mol*K) |
| :: H2O                                 |            0 | J/(mol*K) |
| :: CO2                                 |       289.33 | J/(mol*K) |
| :: (CO2)2                              |      38.7319 | J/(mol*K) |
| :: HCO3-                               |      170.901 | J/(mol*K) |
| :: CH4                                 |     -70.2785 | J/(mol*K) |
| :: Ca+2                                |            0 | J/(mol*K) |
| :: CaCO3                               |      150.128 | J/(mol*K) |
| :: CaHCO3+                             |      208.874 | J/(mol*K) |
| :: CaOH+                               |      -244.67 | J/(mol*K) |
| :: Cl-                                 |            0 | J/(mol*K) |
| :: H2                                  |     -84.9904 | J/(mol*K) |
| :: Na+                                 |            0 | J/(mol*K) |
| :: NaCO3-                              |       149.35 | J/(mol*K) |
| :: NaHCO3                              |      152.082 | J/(mol*K) |
| :: OH-                                 |     -93.8843 | J/(mol*K) |
| :: NaOH                                |     -285.332 | J/(mol*K) |
| :: O2                                  |      243.555 | J/(mol*K) |
| :: Calcite                             |      221.299 | J/(mol*K) |
| Standard Internal Energy (formation):  |              |           |
| :: CO3-2                               |      5.36362 |     J/mol |
| :: H+                                  |            0 |     J/mol |
| :: H2O                                 |     -18.2272 |     J/mol |
| :: CO2                                 |     -8318.67 |     J/mol |
| :: (CO2)2                              |      21337.6 |     J/mol |
| :: HCO3-                               |     -7716.35 |     J/mol |
| :: CH4                                 |      -255337 |     J/mol |
| :: Ca+2                                |      18.2893 |     J/mol |
| :: CaCO3                               |      26801.4 |     J/mol |
| :: CaHCO3+                             |     -2896.92 |     J/mol |
| :: CaOH+                               |    0.0558337 |     J/mol |
| :: Cl-                                 |     -18.1994 |     J/mol |
| :: H2                                  |     -7362.55 |     J/mol |
| :: Na+                                 |     0.544111 |     J/mol |
| :: NaCO3-                              |      37284.7 |     J/mol |
| :: NaHCO3                              |     -11897.4 |     J/mol |
| :: OH-                                 |      51690.7 |     J/mol |
| :: NaOH                                |      51690.8 |     J/mol |
| :: O2                                  |       563925 |     J/mol |
| :: Calcite                             |      17937.1 |     J/mol |
| Standard Helmholtz Energy (formation): |              |           |
| :: CO3-2                               |      5.36362 |     J/mol |
| :: H+                                  |            0 |     J/mol |
| :: H2O                                 |     -18.2272 |     J/mol |
| :: CO2                                 |      -101816 |     J/mol |
| :: (CO2)2                              |      8821.35 |     J/mol |
| :: HCO3-                               |       -62943 |     J/mol |
| :: CH4                                 |      -232627 |     J/mol |
| :: Ca+2                                |      18.2893 |     J/mol |
| :: CaCO3                               |     -21712.3 |     J/mol |
| :: CaHCO3+                             |     -70394.7 |     J/mol |
| :: CaOH+                               |      79065.2 |     J/mol |
| :: Cl-                                 |     -18.1994 |     J/mol |
| :: H2                                  |      20102.1 |     J/mol |
| :: Na+                                 |     0.544111 |     J/mol |
| :: NaCO3-                              |     -10977.6 |     J/mol |
| :: NaHCO3                              |     -61042.6 |     J/mol |
| :: OH-                                 |      82029.4 |     J/mol |
| :: NaOH                                |       143896 |     J/mol |
| :: O2                                  |       485221 |     J/mol |
| :: Calcite                             |     -53575.8 |     J/mol |
| Standard Heat Capacity (constant P):   |              |           |
| :: CO3-2                               |            0 | J/(mol*K) |
| :: H+                                  |            0 | J/(mol*K) |
| :: H2O                                 |            0 | J/(mol*K) |
| :: CO2                                 |            0 | J/(mol*K) |
| :: (CO2)2                              |            0 | J/(mol*K) |
| :: HCO3-                               |            0 | J/(mol*K) |
| :: CH4                                 |            0 | J/(mol*K) |
| :: Ca+2                                |            0 | J/(mol*K) |
| :: CaCO3                               |            0 | J/(mol*K) |
| :: CaHCO3+                             |            0 | J/(mol*K) |
| :: CaOH+                               |            0 | J/(mol*K) |
| :: Cl-                                 |            0 | J/(mol*K) |
| :: H2                                  |            0 | J/(mol*K) |
| :: Na+                                 |            0 | J/(mol*K) |
| :: NaCO3-                              |            0 | J/(mol*K) |
| :: NaHCO3                              |            0 | J/(mol*K) |
| :: OH-                                 |            0 | J/(mol*K) |
| :: NaOH                                |            0 | J/(mol*K) |
| :: O2                                  |            0 | J/(mol*K) |
| :: Calcite                             |            0 | J/(mol*K) |
| Standard Heat Capacity (constant V):   |              |           |
| :: CO3-2                               |            0 | J/(mol*K) |
| :: H+                                  |            0 | J/(mol*K) |
| :: H2O                                 |            0 | J/(mol*K) |
| :: CO2                                 |            0 | J/(mol*K) |
| :: (CO2)2                              |            0 | J/(mol*K) |
| :: HCO3-                               |            0 | J/(mol*K) |
| :: CH4                                 |            0 | J/(mol*K) |
| :: Ca+2                                |            0 | J/(mol*K) |
| :: CaCO3                               |            0 | J/(mol*K) |
| :: CaHCO3+                             |            0 | J/(mol*K) |
| :: CaOH+                               |            0 | J/(mol*K) |
| :: Cl-                                 |            0 | J/(mol*K) |
| :: H2                                  |            0 | J/(mol*K) |
| :: Na+                                 |            0 | J/(mol*K) |
| :: NaCO3-                              |            0 | J/(mol*K) |
| :: NaHCO3                              |            0 | J/(mol*K) |
| :: OH-                                 |            0 | J/(mol*K) |
| :: NaOH                                |            0 | J/(mol*K) |
| :: O2                                  |            0 | J/(mol*K) |
| :: Calcite                             |            0 | J/(mol*K) |
+----------------------------------------+--------------+-----------+

This table is long but gives you a complete picture of all the system’s important chemical and thermodynamic properties at the computed chemical equilibrium state. This table shows, for example, the activities of the species, their chemical potentials, and standard thermodynamic properties.

For properties more pertinent to aqueous solutions, we can create an object of class AqueousProps:

aprops = rkt.AqueousProps(state)
print(aprops)
+--------------------------+-------------+-------+
| Property                 |       Value |  Unit |
+--------------------------+-------------+-------+
| Temperature              |      323.15 |     K |
| Pressure                 |       1e+06 |    Pa |
| Ionic Strength (Effect.) |     1.01516 | molal |
| Ionic Strength (Stoich.) |     1.01674 | molal |
| pH                       |     6.79516 |       |
| pE                       |     2.50064 |       |
| Eh                       |    0.160341 |     V |
| Element Molality:        |             |       |
| :: C                     |   0.0126796 | molal |
| :: Na                    |     1.00014 | molal |
| :: Cl                    |     1.00014 | molal |
| :: Ca                    |  0.00566443 | molal |
| Species Molality:        |             |       |
| :: CO3-2                 | 1.56122e-05 | molal |
| :: H+                    | 2.52469e-07 | molal |
| :: CO2                   |  0.00152166 | molal |
| :: (CO2)2                | 1.00014e-16 | molal |
| :: HCO3-                 |  0.00929727 | molal |
| :: CH4                   | 1.00014e-16 | molal |
| :: Ca+2                  |  0.00552668 | molal |
| :: CaCO3                 | 5.70501e-06 | molal |
| :: CaHCO3+               | 0.000132038 | molal |
| :: CaOH+                 | 1.35341e-09 | molal |
| :: Cl-                   |     1.00014 | molal |
| :: H2                    | 1.00014e-16 | molal |
| :: Na+                   |    0.998432 | molal |
| :: NaCO3-                | 0.000149396 | molal |
| :: NaHCO3                |  0.00155789 | molal |
| :: OH-                   | 4.72837e-07 | molal |
| :: NaOH                  | 1.00014e-16 | molal |
| :: O2                    | 1.00014e-16 | molal |
+--------------------------+-------------+-------+

Let’s now find out if our computed chemical equilibrium state satisfies the imposed fugacity constraint. If this is the case, the following must be observed:

\[\mu_{\mathrm{CO_{2}(aq)}}=\mu_{\mathrm{CO_{2}(g)}},\]

where

\[\mu_{\mathrm{CO_{2}(g)}}\equiv\mu_{\mathrm{CO_{2}(g)}}^{\circ}+RT\log f_{\mathrm{CO_{2}(g)}}.\]

For the quantities above, note that:

  • \(\mu_{\mathrm{CO_{2}(aq)}}\), the chemical potential of aqueous species CO2, can be obtained from the ChemicalProps object;

  • \(\mu_{\mathrm{CO_{2}(g)}}^{\circ}\), the standard chemical potential of the gaseous species CO2(g), cannot be obtained from the ChemicalProps object because CO2(g) is not considered in the chemical system. For this property, we can compute it at specified temperature and pressure conditions as shown next;

  • \(f_{\mathrm{CO_{2}(g)}}\) this is the imposed fugacity value for CO2(g).

The code below verifies the above identity:

from math import log

R = rkt.universalGasConstant
T = props.temperature()
P = props.pressure()

uCO2aq = props.speciesChemicalPotential("CO2")
u0CO2g = db.species().get("CO2(g)").props(T, P).G0
uCO2g  = u0CO2g + R*T*log(fCO2g)

print(f"μCO2(aq) = {uCO2aq} J/mol")
print(f"μCO2(g)  = {uCO2g} J/mol")
μCO2(aq) = -118583 J/mol
μCO2(g)  = -118583 J/mol

Note that both chemical potential values above are identical, meaning that the fugacity constraint was satisfied.

With this, we conclude this tutorial, which demonstrates how Reaktoro can be used to solve chemical equilibrium problems with constrained gas fugacity, followed by a presentation of how to verify if the computed equilibrium state reflects the desired fugacity value.