# PhreeqcUsers Discussion Forum

## Conceptual Models => Equilibrium assumptions => Topic started by: amargert on June 27, 2019, 01:54:27 PM

Title: Element based input definition and water mass balance
Post by: amargert on June 27, 2019, 01:54:27 PM
Hello everyone!
I am a graduate student and working now on the project that involves modeling of chemical reactions. Below I will try to explain my question.

There are three components in the system: H2O, CO2 and CaCO3. I want to obtain species distribution and phase compositions. Two different models are created. First one:

SOLUTION 1
temp       50
pressure  98.6923
pH           7 charge
pe           4
redox      pe
units       mol/kgw
-water     1 # kg
EQUILIBRIUM_PHASES 1
Calcite     10    0.56991
CO2(g)    10    1.105295
GAS_PHASE 1
-fixed_pressure
-pressure 98.6923
CO2(g)    0.0
H2O(g)    0.0

The idea behind it is that CO2 and CaCO3 concentrations are defined as "equilibrium phases" and their target saturation indices are set to 10 to ensure that the phase is completely dissolved in water. Then, "gas phase" section is defined to see how much of the gaseous CO2 and H2O is liberated. The output of this model gives the following information:

----------------Fixed-pressure gas phase 1 dissolved completely----------------

Total H  = 1.110124e+02
Total O  = 5.942654e+01

Species     Molality
C(4)          1.692e+00
Ca             5.758e-01

Phase         SI
Calcite        2.81
CO2(g)       1.57

Such output makes sense, since Total H and Total O match the manual calculations (Total_H = 1 kgw / 0.018016, and Total_O = Total_H / 2 + n(CO2) * 2 + n(CaCO3) * 3). Although, Ca and C(4) molalities are a little different (higher) from what I expected, this deviation is probably negligible.
Second realization of the model is the following:

SOLUTION 1
temp       50
pressure  98.6923
pH           7 charge
pe           4
redox      pe
units       mol/kgw
C            1.6752
Ca          0.56991
-water    1 # kg
GAS_PHASE 1
-fixed_pressure
-pressure 98.6923
CO2(g)    0.0
H2O(g)    0.0

It differs from the first one in the "solution" section. Here the idea is to only provide the concentration of species. Molality of C is calculated as n(CO2) + n(CaCO3) from the previous example, and molality of Ca is the same as n(CaCO3). No other species are added. Part of the output is given below:

----------------Fixed-pressure gas phase 1 dissolved completely----------------

Total H  = 1.121427e+02
Total O  = 5.999167e+01

Species     Molality
C(4)         1.675e+00
Ca            5.699e-01

Phase        SI
Calcite       2.81
CO2(g)      1.57

This results puzzled me. First, Total H is higher than expected. Since no additional H+, H2 or hydrogen containing components were added, I would expect to observe that Total_H = 1 kgw / 0.018016 = 111.01244 mole, but output is different. Second thing that confused me is Total_O. Again, instead of expected value of Total_O = Total_H / 2 = 55.50622‬, the observed value of 5.999167e+01 seems to be closer to the first model result. However, SI indices are completely the same for both realizations. So I make a conclusion that by introducing C and Ca as species to the solution they come with some H and O. Looking for answer I studied the manual but didn't find any explanation. I am not a chemist and most probably miss something. Maybe it is caused by the "charge" setting or other chemical or thermodynamic closing assumptions applied in the PHREEQC. If somebody can help me with this or point on my mistakes it would be much appreciated.

Thank you,
Andrei
Title: Re: Element based input definition and water mass balance
Post by: dlparkhurst on June 27, 2019, 03:53:26 PM
The two calculations are slightly different. In the first, you start with a kilogram of water and add the given number of moles of CO2 and Calcite. Creation of HCO3- and CO2(aq) consume a bit of water through hydrolysis resulting in a mass of water of 0.9898 and slightly higher molalities (mol/kgw) than you expected.

In the second, you define the molalities (not moles) to be exactly  C  1.6752 and  Ca  0.56991 with 1 kilogram of water. Here, the hydrolysis reactions are accounted for, but the solution is scaled to have exactly 1 kilogram of water. So, one way to think of it is that the first case has 1 kg water before hydrolysis and the second has one kilogram of water after hydrolysis.

BTW, a clearer way to do the first calculation is to use REACTION instead of EQUILIBRIUM_PHASES.

Title: Re: Element based input definition and water mass balance
Post by: amargert on June 27, 2019, 04:39:27 PM
Dear David Parkhurst,

Thank you for your reply! This indeed makes things much more clear.
Title: Re: Element based input definition and water mass balance
Post by: amargert on July 01, 2019, 02:38:28 PM
Dear David,

I was further exploring the ways to define a solution. As you've recommended, I now use REACTION to dissolve CaCO3 and CO2.

-------------------------------------------------------------------------------
SOLUTION 1
temp       50.00
pressure  99.67922
pH          7 charge
-water    1 # kg
REACTION 1
Calcite    0.45218916
CO2(g)   0.56523646
1
GAS_PHASE 1
-fixed_pressure
-pressure 99.67922
CO2(g)    0.0
H2O(g)    0.0
H2(g)      0.0
O2(g)      0.0
CH4(g)    0.0
END
-------------------------------------------------------------------------------

The results are compared to the model below:

-------------------------------------------------------------------------------
SOLUTION 1
temp        50.00
pressure  99.67922
pH           7 charge
-water     1 # kg
REACTION 1
Ca           0.45218916
C             1.01742562
O            2.48704041
1
GAS_PHASE 1
-fixed_pressure
-pressure 99.67922
CO2(g)    0.0
H2O(g)    0.0
H2(g)      0.0
O2(g)      0.0
CH4(g)    0.0
END
-------------------------------------------------------------------------------

Up to my understanding they should be equivalent. Indeed, almost all numbers are the same. Moreover, Reaction section in the output shows the same elements for both models:

-------------------------------------------------------------------------------
Reaction 1.
1.000e+00 moles of the following reaction have been added:

Relative
Reactant            moles
CO2(g)             0.56524
Calcite              0.45219

Relative
Element             moles
C                    1.01743
Ca                   0.45219
O                    2.48704
-------------------------------------------------------------------------------
Reaction 1.
1.000e+00 moles of the following reaction have been added:

Relative
Reactant            moles
C                    1.01743
Ca                   0.45219
O                    2.48704

Relative
Element             moles
C                    1.01743
Ca                   0.45219
O                    2.48704
-------------------------------------------------------------------------------

However, some species distributions are different. Here are only the ones that doesn't match:

-first model
----------------------------Distribution of species----------------------------
Log        Log        Log          mole       V
Species          Molality    Activity  Molality  Activity     Gamma   cm³/mol

C(-4)         3.940e-23
CH4             3.940e-23   4.656e-23   -22.405   -22.332     0.073     37.39
H(0)          1.908e-14
H2              9.542e-15   1.128e-14   -14.020   -13.948     0.073     28.54
O(0)          0.000e+00
O2              0.000e+00   0.000e+00   -57.215   -57.143     0.073     31.70
-------------------------------------------------------------------------------

-second model
----------------------------Distribution of species----------------------------
Log       Log         Log          mole        V
Species          Molality    Activity  Molality  Activity     Gamma   cm³/mol

C(-4)         0.000e+00
CH4             0.000e+00   0.000e+00  -120.525  -120.453     0.073     37.39
H(0)          5.630e-39
H2              2.815e-39   3.326e-39   -38.551   -38.478     0.073     28.54
O(0)          1.400e-08
O2              7.002e-09   8.275e-09    -8.155    -8.082     0.073     31.70
-------------------------------------------------------------------------------

In order to double check this observation another pair of models were created. They are similar to the ones given above, but for the REACTION section. When the concentrations are higher mismatch doesn't occur. All simulations are run with the phreeqc.dat database.

------------------------------------------------
REACTION 1        |   REACTION 1
Calcite     4        |       Ca    4
CO2(g)    4        |        C     8
1                        |        O     20
|        1
------------------------------------------------

I am not completely sure how to properly interpret those results. Can it be that such results are caused by some numerical error due to low reactant concentrations? Or maybe it is just because I didn't specify something important in the input?

Thank you,
Andrei
Title: Re: Element based input definition and water mass balance
Post by: dlparkhurst on July 01, 2019, 02:54:16 PM
I think you are simply flirting with numerical precision. PHREEQC normally solves the nonlinear equations to a precision of 1e-8. The differences in species concentrations are on that order or less.

You can decrease the tolerance with

KNOBS
-convergence 1e-12

However, you are still defining your solution with about eight digits, so you may not get more accuracy than that. Note too that your final run with 4 moles is an even power of 2, so that the conversion to binary is exact.
Title: Re: Element based input definition and water mass balance
Post by: amargert on July 01, 2019, 04:08:18 PM
I see where the problem is. Thank you very much for recommendations!