# Chemical equilibrium with fixed fugacity#

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

Attention

Always make sure you are using the latest version of Reaktoro. Otherwise, some new features documented on this website will not work on your machine and you may receive unintuitive errors. Follow these update instructions to get the latest version of Reaktoro!

This tutorial demonstrates the calculation of calcite (CaCO3) solubility in a saline aqueous solution for a 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 calcite mineral).

import reaktoro as rkt

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

solution = rkt.AqueousPhase(rkt.speciate("H O Na Cl C Ca"))
solution.set(rkt.ActivityModelPhreeqc(db))

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:

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.succeeded() else "Computation has failed!")

Successful computation!


Letâ€™s check the computed chemical equilibrium state:

print(state)

+---------------------+-------------+------+
| Property            |       Value | Unit |
+---------------------+-------------+------+
| Temperature         |    323.1500 |    K |
| Pressure            |     10.0000 |  bar |
| Charge:             | -6.9129e-17 |  mol |
| Element Amount:     |             |      |
| :: H                |  1.1101e+02 |  mol |
| :: C                |  1.0610e-01 |  mol |
| :: O                |  5.5818e+01 |  mol |
| :: Na               |  1.0000e+00 |  mol |
| :: Cl               |  1.0000e+00 |  mol |
| :: Ca               |  9.9909e-02 |  mol |
| Species Amount:     |             |      |
| :: CO3-2            |  1.0214e-05 |  mol |
| :: H+               |  2.6362e-07 |  mol |
| :: H2O              |  5.5502e+01 |  mol |
| :: CO2              |  1.5230e-03 |  mol |
| :: (CO2)2           |  1.0995e-07 |  mol |
| :: HCO3-            |  7.7911e-03 |  mol |
| :: CH4              |  1.0000e-16 |  mol |
| :: Ca+2             |  4.6432e-03 |  mol |
| :: CaCO3            |  4.8235e-06 |  mol |
| :: CaHCO3+          |  1.3042e-04 |  mol |
| :: CaOH+            |  1.1299e-09 |  mol |
| :: Cl-              |  1.0000e+00 |  mol |
| :: H2               |  1.0000e-16 |  mol |
| :: Na+              |  9.9849e-01 |  mol |
| :: NaCO3-           |  9.5148e-05 |  mol |
| :: NaHCO3           |  1.4147e-03 |  mol |
| :: OH-              |  4.8627e-07 |  mol |
| :: NaOH             |  1.0000e-16 |  mol |
| :: O2               |  1.0000e-16 |  mol |
| :: Calcite :: CaCO3 |  9.5131e-02 |  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.1500 |         K |
| Pressure                               |      10.0000 |       bar |
| Volume                                 |   1.0330e-03 |        m3 |
| Gibbs Energy                           |   -5878.1712 |         J |
| Enthalpy                               |    2401.0137 |         J |
| Entropy                                |      25.6203 |       J/K |
| Internal Energy                        |    1368.0387 |         J |
| Helmholtz Energy                       |   -6911.1463 |         J |
| Charge                                 |  -6.9129e-17 |       mol |
| Element Amount:                        |              |           |
| :: H                                   |   1.1101e+02 |       mol |
| :: C                                   |   1.0610e-01 |       mol |
| :: O                                   |   5.5818e+01 |       mol |
| :: Na                                  |   1.0000e+00 |       mol |
| :: Cl                                  |   1.0000e+00 |       mol |
| :: Ca                                  |   9.9909e-02 |       mol |
| Species Amount:                        |              |           |
| :: CO3-2                               |   1.0214e-05 |       mol |
| :: H+                                  |   2.6362e-07 |       mol |
| :: H2O                                 |   5.5502e+01 |       mol |
| :: CO2                                 |   1.5230e-03 |       mol |
| :: (CO2)2                              |   1.0995e-07 |       mol |
| :: HCO3-                               |   7.7911e-03 |       mol |
| :: CH4                                 |   1.0000e-16 |       mol |
| :: Ca+2                                |   4.6432e-03 |       mol |
| :: CaCO3                               |   4.8235e-06 |       mol |
| :: CaHCO3+                             |   1.3042e-04 |       mol |
| :: CaOH+                               |   1.1299e-09 |       mol |
| :: Cl-                                 |   1.0000e+00 |       mol |
| :: H2                                  |   1.0000e-16 |       mol |
| :: Na+                                 |   9.9849e-01 |       mol |
| :: NaCO3-                              |   9.5148e-05 |       mol |
| :: NaHCO3                              |   1.4147e-03 |       mol |
| :: OH-                                 |   4.8627e-07 |       mol |
| :: NaOH                                |   1.0000e-16 |       mol |
| :: O2                                  |   1.0000e-16 |       mol |
| :: Calcite :: CaCO3                    |   9.5131e-02 |       mol |
| Mole Fraction:                         |              |           |
| :: CO3-2                               |   1.7759e-07 |   mol/mol |
| :: H+                                  |   4.5835e-09 |   mol/mol |
| :: H2O                                 |   9.6498e-01 |   mol/mol |
| :: CO2                                 |   2.6479e-05 |   mol/mol |
| :: (CO2)2                              |   1.9117e-09 |   mol/mol |
| :: HCO3-                               |   1.3546e-04 |   mol/mol |
| :: CH4                                 |   1.7387e-18 |   mol/mol |
| :: Ca+2                                |   8.0729e-05 |   mol/mol |
| :: CaCO3                               |   8.3865e-08 |   mol/mol |
| :: CaHCO3+                             |   2.2675e-06 |   mol/mol |
| :: CaOH+                               |   1.9645e-11 |   mol/mol |
| :: Cl-                                 |   1.7387e-02 |   mol/mol |
| :: H2                                  |   1.7387e-18 |   mol/mol |
| :: Na+                                 |   1.7360e-02 |   mol/mol |
| :: NaCO3-                              |   1.6543e-06 |   mol/mol |
| :: NaHCO3                              |   2.4596e-05 |   mol/mol |
| :: OH-                                 |   8.4546e-09 |   mol/mol |
| :: NaOH                                |   1.7387e-18 |   mol/mol |
| :: O2                                  |   1.7387e-18 |   mol/mol |
| :: Calcite :: CaCO3                    |   1.0000e+00 |   mol/mol |
| Activity Coefficient:                  |              |           |
| :: CO3-2                               |       0.1714 |         - |
| :: H+                                  |       0.7345 |         - |
| :: H2O                                 |       1.0008 |         - |
| :: CO2                                 |       1.2626 |         - |
| :: (CO2)2                              |       1.2626 |         - |
| :: HCO3-                               |       0.6434 |         - |
| :: CH4                                 |       1.2626 |         - |
| :: Ca+2                                |       0.2305 |         - |
| :: CaCO3                               |       1.2626 |         - |
| :: CaHCO3+                             |       0.6626 |         - |
| :: CaOH+                               |       0.7840 |         - |
| :: Cl-                                 |       0.5950 |         - |
| :: H2                                  |       1.2626 |         - |
| :: Na+                                 |       0.7174 |         - |
| :: NaCO3-                              |       0.7840 |         - |
| :: NaHCO3                              |       1.2626 |         - |
| :: OH-                                 |       0.5655 |         - |
| :: NaOH                                |       1.2626 |         - |
| :: O2                                  |       1.2626 |         - |
| :: Calcite :: CaCO3                    |       1.0000 |         - |
| Activity:                              |              |           |
| :: CO3-2                               |   1.7507e-06 |         - |
| :: H+                                  |   1.9365e-07 |         - |
| :: H2O                                 |   9.6576e-01 |         - |
| :: CO2                                 |   1.9231e-03 |         - |
| :: (CO2)2                              |   1.3884e-07 |         - |
| :: HCO3-                               |   5.0134e-03 |         - |
| :: CH4                                 |   1.2627e-16 |         - |
| :: Ca+2                                |   1.0704e-03 |         - |
| :: CaCO3                               |   6.0907e-06 |         - |
| :: CaHCO3+                             |   8.6428e-05 |         - |
| :: CaOH+                               |   8.8591e-10 |         - |
| :: Cl-                                 |   5.9501e-01 |         - |
| :: H2                                  |   1.2627e-16 |         - |
| :: Na+                                 |   7.1638e-01 |         - |
| :: NaCO3-                              |   7.4604e-05 |         - |
| :: NaHCO3                              |   1.7863e-03 |         - |
| :: OH-                                 |   2.7499e-07 |         - |
| :: NaOH                                |   1.2627e-16 |         - |
| :: O2                                  |   1.2627e-16 |         - |
| :: Calcite :: CaCO3                    |   1.0000e+00 |         - |
| lg(Activity):                          |              |           |
| :: CO3-2                               |      -5.7568 |         - |
| :: H+                                  |      -6.7130 |         - |
| :: H2O                                 |      -0.0151 |         - |
| :: CO2                                 |      -2.7160 |         - |
| :: (CO2)2                              |      -6.8575 |         - |
| :: HCO3-                               |      -2.2999 |         - |
| :: CH4                                 |     -15.8987 |         - |
| :: Ca+2                                |      -2.9704 |         - |
| :: CaCO3                               |      -5.2153 |         - |
| :: CaHCO3+                             |      -4.0633 |         - |
| :: CaOH+                               |      -9.0526 |         - |
| :: Cl-                                 |      -0.2255 |         - |
| :: H2                                  |     -15.8987 |         - |
| :: Na+                                 |      -0.1449 |         - |
| :: NaCO3-                              |      -4.1272 |         - |
| :: NaHCO3                              |      -2.7480 |         - |
| :: OH-                                 |      -6.5607 |         - |
| :: NaOH                                |     -15.8987 |         - |
| :: O2                                  |     -15.8987 |         - |
| :: Calcite :: CaCO3                    |       0.0000 |         - |
| ln(Activity):                          |              |           |
| :: CO3-2                               |     -13.2555 |         - |
| :: H+                                  |     -15.4572 |         - |
| :: H2O                                 |      -0.0348 |         - |
| :: CO2                                 |      -6.2538 |         - |
| :: (CO2)2                              |     -15.7900 |         - |
| :: HCO3-                               |      -5.2956 |         - |
| :: CH4                                 |     -36.6081 |         - |
| :: Ca+2                                |      -6.8397 |         - |
| :: CaCO3                               |     -12.0087 |         - |
| :: CaHCO3+                             |      -9.3562 |         - |
| :: CaOH+                               |     -20.8444 |         - |
| :: Cl-                                 |      -0.5192 |         - |
| :: H2                                  |     -36.6081 |         - |
| :: Na+                                 |      -0.3335 |         - |
| :: NaCO3-                              |      -9.5033 |         - |
| :: NaHCO3                              |      -6.3276 |         - |
| :: OH-                                 |     -15.1065 |         - |
| :: NaOH                                |     -36.6081 |         - |
| :: O2                                  |     -36.6081 |         - |
| :: Calcite :: CaCO3                    |       0.0000 |         - |
| Chemical Potential:                    |              |           |
| :: CO3-2                               |  -3.5615e+04 |     J/mol |
| :: H+                                  |  -4.1531e+04 |     J/mol |
| :: H2O                                 |  -9.3616e+01 |     J/mol |
| :: CO2                                 |  -1.1858e+05 |     J/mol |
| :: (CO2)2                              |  -2.3717e+05 |     J/mol |
| :: HCO3-                               |  -7.7146e+04 |     J/mol |
| :: CH4                                 |  -3.3095e+05 |     J/mol |
| :: Ca+2                                |  -1.8377e+04 |     J/mol |
| :: CaCO3                               |  -5.3992e+04 |     J/mol |
| :: CaHCO3+                             |  -9.5523e+04 |     J/mol |
| :: CaOH+                               |   2.3060e+04 |     J/mol |
| :: Cl-                                 |  -1.3949e+03 |     J/mol |
| :: H2                                  |  -7.8229e+04 |     J/mol |
| :: Na+                                 |  -8.9617e+02 |     J/mol |
| :: NaCO3-                              |  -3.6511e+04 |     J/mol |
| :: NaHCO3                              |  -7.8042e+04 |     J/mol |
| :: OH-                                 |   4.1437e+04 |     J/mol |
| :: NaOH                                |   4.5536e+04 |     J/mol |
| :: O2                                  |   3.8689e+05 |     J/mol |
| :: Calcite :: CaCO3                    |  -5.3992e+04 |     J/mol |
| Standard Volume:                       |              |           |
| :: CO3-2                               |  -5.3636e-06 |    m3/mol |
| :: H+                                  |   0.0000e+00 |    m3/mol |
| :: H2O                                 |   1.8227e-05 |    m3/mol |
| :: CO2                                 |   3.5651e-05 |    m3/mol |
| :: (CO2)2                              |   7.1301e-05 |    m3/mol |
| :: HCO3-                               |   2.5675e-05 |    m3/mol |
| :: CH4                                 |   3.7336e-05 |    m3/mol |
| :: Ca+2                                |  -1.8289e-05 |    m3/mol |
| :: CaCO3                               |  -1.4474e-05 |    m3/mol |
| :: CaHCO3+                             |   1.0280e-05 |    m3/mol |
| :: CaOH+                               |   0.0000e+00 |    m3/mol |
| :: Cl-                                 |   1.8199e-05 |    m3/mol |
| :: H2                                  |   2.8583e-05 |    m3/mol |
| :: Na+                                 |  -5.4411e-07 |    m3/mol |
| :: NaCO3-                              |   3.6026e-08 |    m3/mol |
| :: NaHCO3                              |   1.8033e-06 |    m3/mol |
| :: OH-                                 |  -3.8463e-06 |    m3/mol |
| :: NaOH                                |   0.0000e+00 |    m3/mol |
| :: O2                                  |   3.1904e-05 |    m3/mol |
| :: Calcite :: CaCO3                    |   3.6900e-05 |    m3/mol |
| Standard Gibbs Energy (formation):     |              |           |
| :: CO3-2                               |       0.0000 |     J/mol |
| :: H+                                  |       0.0000 |     J/mol |
| :: H2O                                 |       0.0000 |     J/mol |
| :: CO2                                 | -101779.9097 |     J/mol |
| :: (CO2)2                              | -194740.8830 |     J/mol |
| :: HCO3-                               |  -62917.3432 |     J/mol |
| :: CH4                                 | -232589.1677 |     J/mol |
| :: Ca+2                                |       0.0000 |     J/mol |
| :: CaCO3                               |  -21726.8213 |     J/mol |
| :: CaHCO3+                             |  -70384.4183 |     J/mol |
| :: CaOH+                               |   79065.1624 |     J/mol |
| :: Cl-                                 |       0.0000 |     J/mol |
| :: H2                                  |   20130.6753 |     J/mol |
| :: Na+                                 |       0.0000 |     J/mol |
| :: NaCO3-                              |  -10977.5725 |     J/mol |
| :: NaHCO3                              |  -61040.8196 |     J/mol |
| :: OH-                                 |   82025.5329 |     J/mol |
| :: NaOH                                |  143895.7590 |     J/mol |
| :: O2                                  |  485252.4620 |     J/mol |
| :: Calcite :: CaCO3                    |  -53992.1419 |     J/mol |
| Standard Enthalpy (formation):         |              |           |
| :: CO3-2                               |       0.0000 |     J/mol |
| :: H+                                  |       0.0000 |     J/mol |
| :: H2O                                 |       0.0000 |     J/mol |
| :: CO2                                 |   -8283.0231 |     J/mol |
| :: (CO2)2                              |    4769.1192 |     J/mol |
| :: HCO3-                               |   -7690.6772 |     J/mol |
| :: CH4                                 | -255299.6623 |     J/mol |
| :: Ca+2                                |       0.0000 |     J/mol |
| :: CaCO3                               |   26786.9523 |     J/mol |
| :: CaHCO3+                             |   -2886.6402 |     J/mol |
| :: CaOH+                               |       0.0558 |     J/mol |
| :: Cl-                                 |       0.0000 |     J/mol |
| :: H2                                  |   -7333.9693 |     J/mol |
| :: Na+                                 |       0.0000 |     J/mol |
| :: NaCO3-                              |   37284.7815 |     J/mol |
| :: NaHCO3                              |  -11895.6407 |     J/mol |
| :: OH-                                 |   51686.8330 |     J/mol |
| :: NaOH                                |   51690.7786 |     J/mol |
| :: O2                                  |  563957.2704 |     J/mol |
| :: Calcite :: CaCO3                    |   26143.5384 |     J/mol |
| Standard Entropy (formation):          |              |           |
| :: CO3-2                               |       0.0000 | J/(mol*K) |
| :: H+                                  |       0.0000 | J/(mol*K) |
| :: H2O                                 |       0.0000 | J/(mol*K) |
| :: CO2                                 |     289.3297 | J/(mol*K) |
| :: (CO2)2                              |     617.3913 | J/(mol*K) |
| :: HCO3-                               |     170.9010 | J/(mol*K) |
| :: CH4                                 |     -70.2785 | J/(mol*K) |
| :: Ca+2                                |       0.0000 | J/(mol*K) |
| :: CaCO3                               |     150.1277 | J/(mol*K) |
| :: CaHCO3+                             |     208.8744 | J/(mol*K) |
| :: CaOH+                               |    -244.6700 | J/(mol*K) |
| :: Cl-                                 |       0.0000 | J/(mol*K) |
| :: H2                                  |     -84.9904 | J/(mol*K) |
| :: Na+                                 |       0.0000 | J/(mol*K) |
| :: NaCO3-                              |     149.3497 | J/(mol*K) |
| :: NaHCO3                              |     152.0816 | J/(mol*K) |
| :: OH-                                 |     -93.8843 | J/(mol*K) |
| :: NaOH                                |    -285.3318 | J/(mol*K) |
| :: O2                                  |     243.5550 | J/(mol*K) |
| :: Calcite :: CaCO3                    |     247.9829 | J/(mol*K) |
| Standard Internal Energy (formation):  |              |           |
| :: CO3-2                               |       5.3636 |     J/mol |
| :: H+                                  |       0.0000 |     J/mol |
| :: H2O                                 |     -18.2272 |     J/mol |
| :: CO2                                 |   -8318.6737 |     J/mol |
| :: (CO2)2                              |    4697.8181 |     J/mol |
| :: HCO3-                               |   -7716.3518 |     J/mol |
| :: CH4                                 | -255336.9980 |     J/mol |
| :: Ca+2                                |      18.2893 |     J/mol |
| :: CaCO3                               |   26801.4266 |     J/mol |
| :: CaHCO3+                             |   -2896.9202 |     J/mol |
| :: CaOH+                               |       0.0558 |     J/mol |
| :: Cl-                                 |     -18.1994 |     J/mol |
| :: H2                                  |   -7362.5522 |     J/mol |
| :: Na+                                 |       0.5441 |     J/mol |
| :: NaCO3-                              |   37284.7455 |     J/mol |
| :: NaHCO3                              |  -11897.4440 |     J/mol |
| :: OH-                                 |   51690.6793 |     J/mol |
| :: NaOH                                |   51690.7786 |     J/mol |
| :: O2                                  |  563925.3668 |     J/mol |
| :: Calcite :: CaCO3                    |   26106.6384 |     J/mol |
| Standard Helmholtz Energy (formation): |              |           |
| :: CO3-2                               |       5.3636 |     J/mol |
| :: H+                                  |       0.0000 |     J/mol |
| :: H2O                                 |     -18.2272 |     J/mol |
| :: CO2                                 | -101815.5602 |     J/mol |
| :: (CO2)2                              | -194812.1840 |     J/mol |
| :: HCO3-                               |  -62943.0177 |     J/mol |
| :: CH4                                 | -232626.5034 |     J/mol |
| :: Ca+2                                |      18.2893 |     J/mol |
| :: CaCO3                               |  -21712.3471 |     J/mol |
| :: CaHCO3+                             |  -70394.6983 |     J/mol |
| :: CaOH+                               |   79065.1624 |     J/mol |
| :: Cl-                                 |     -18.1994 |     J/mol |
| :: H2                                  |   20102.0924 |     J/mol |
| :: Na+                                 |       0.5441 |     J/mol |
| :: NaCO3-                              |  -10977.6085 |     J/mol |
| :: NaHCO3                              |  -61042.6229 |     J/mol |
| :: OH-                                 |   82029.3792 |     J/mol |
| :: NaOH                                |  143895.7590 |     J/mol |
| :: O2                                  |  485220.5584 |     J/mol |
| :: Calcite :: CaCO3                    |  -54029.0419 |     J/mol |
| Standard Heat Capacity (constant P):   |              |           |
| :: CO3-2                               |       0.0000 | J/(mol*K) |
| :: H+                                  |       0.0000 | J/(mol*K) |
| :: H2O                                 |       0.0000 | J/(mol*K) |
| :: CO2                                 |     602.5539 | J/(mol*K) |
| :: (CO2)2                              |    1077.6633 | J/(mol*K) |
| :: HCO3-                               |     285.5330 | J/(mol*K) |
| :: CH4                                 |       0.0000 | J/(mol*K) |
| :: Ca+2                                |       0.0000 | J/(mol*K) |
| :: CaCO3                               |     334.2675 | J/(mol*K) |
| :: CaHCO3+                             |     176.8105 | J/(mol*K) |
| :: CaOH+                               |       0.0000 | J/(mol*K) |
| :: Cl-                                 |       0.0000 | J/(mol*K) |
| :: H2                                  |       0.0000 | J/(mol*K) |
| :: Na+                                 |       0.0000 | J/(mol*K) |
| :: NaCO3-                              |       0.0000 | J/(mol*K) |
| :: NaHCO3                              |     285.5330 | J/(mol*K) |
| :: OH-                                 |    -184.2105 | J/(mol*K) |
| :: NaOH                                |    -184.2105 | J/(mol*K) |
| :: O2                                  |       0.0000 | J/(mol*K) |
| :: Calcite :: CaCO3                    |     575.7029 | J/(mol*K) |
| Standard Heat Capacity (constant V):   |              |           |
| :: CO3-2                               |       0.0000 | J/(mol*K) |
| :: H+                                  |       0.0000 | J/(mol*K) |
| :: H2O                                 |       0.0000 | J/(mol*K) |
| :: CO2                                 |     602.5539 | J/(mol*K) |
| :: (CO2)2                              |    1077.6633 | J/(mol*K) |
| :: HCO3-                               |     285.5330 | J/(mol*K) |
| :: CH4                                 |       0.0000 | J/(mol*K) |
| :: Ca+2                                |       0.0000 | J/(mol*K) |
| :: CaCO3                               |     334.2675 | J/(mol*K) |
| :: CaHCO3+                             |     176.8105 | J/(mol*K) |
| :: CaOH+                               |       0.0000 | J/(mol*K) |
| :: Cl-                                 |       0.0000 | J/(mol*K) |
| :: H2                                  |       0.0000 | J/(mol*K) |
| :: Na+                                 |       0.0000 | J/(mol*K) |
| :: NaCO3-                              |       0.0000 | J/(mol*K) |
| :: NaHCO3                              |     285.5330 | J/(mol*K) |
| :: OH-                                 |    -184.2105 | J/(mol*K) |
| :: NaOH                                |    -184.2105 | J/(mol*K) |
| :: O2                                  |       0.0000 | J/(mol*K) |
| :: Calcite :: CaCO3                    |     575.7029 | 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.1500 |     K |
| Pressure                        |     10.0000 |   bar |
| Ionic Strength (Effective)      |      1.0126 | molal |
| Ionic Strength (Stoichiometric) |      1.0141 | molal |
| pH                              |      6.7130 |       |
| pE                              |     -2.4184 |       |
| Eh                              |     -0.1551 |     V |
| Charge Molality                 | -6.9134e-17 | molal |
| Element Molality:               |             |       |
| :: C                            |  1.0971e-02 | molal |
| :: Na                           |  1.0001e+00 | molal |
| :: Cl                           |  1.0001e+00 | molal |
| :: Ca                           |  4.7788e-03 | molal |
| Species Molality:               |             |       |
| :: CO3-2                        |  1.0215e-05 | molal |
| :: H+                           |  2.6364e-07 | molal |
| :: CO2                          |  1.5231e-03 | molal |
| :: (CO2)2                       |  1.0996e-07 | molal |
| :: HCO3-                        |  7.7918e-03 | molal |
| :: CH4                          |  1.0001e-16 | molal |
| :: Ca+2                         |  4.6436e-03 | molal |
| :: CaCO3                        |  4.8240e-06 | molal |
| :: CaHCO3+                      |  1.3043e-04 | molal |
| :: CaOH+                        |  1.1300e-09 | molal |
| :: Cl-                          |  1.0001e+00 | molal |
| :: H2                           |  1.0001e-16 | molal |
| :: Na+                          |  9.9857e-01 | molal |
| :: NaCO3-                       |  9.5156e-05 | molal |
| :: NaHCO3                       |  1.4148e-03 | molal |
| :: OH-                          |  4.8631e-07 | molal |
| :: NaOH                         |  1.0001e-16 | molal |
| :: O2                           |  1.0001e-16 | molal |
| Saturation Indices:             |             |       |
| :: CH4(g)                       |    -13.9339 |     - |
| :: CO2(g)                       |     -2.0000 |     - |
| :: H2(g)                        |     -9.7026 |     - |
| :: H2O(g)                       |     -1.9283 |     - |
| :: O2(g)                        |    -59.2529 |     - |
| :: Aragonite :: CaCO3           |     -0.2000 |     - |
| :: Calcite :: CaCO3             |     -0.0000 |     - |
| :: Halite :: NaCl               |     -1.9603 |     - |
| Saturation Ratios:              |             |       |
| :: CH4(g)                       |  1.1643e-14 |     - |
| :: CO2(g)                       |  1.0000e-02 |     - |
| :: H2(g)                        |  1.9834e-10 |     - |
| :: H2O(g)                       |  1.1794e-02 |     - |
| :: O2(g)                        |  5.5860e-60 |     - |
| :: Aragonite :: CaCO3           |  6.3093e-01 |     - |
| :: Calcite :: CaCO3             |  1.0000e+00 |     - |
| :: Halite :: NaCl               |  1.0958e-02 |     - |
+---------------------------------+-------------+-------+


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) = -118582.83472819923 J/mol
Î¼CO2(g)  = -118582.8347311335 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.