Jump to content
Geochemist's Workbench Support Forum

pH calculation with less constraints on carbonate system


Recommended Posts

Hello all,

I’m interested in figuring out how to use GWB to calculate the pH of a water in equilibrium with a simple mineral assemblage and PCO2 at a fixed value.  Outside of GWB, one can calculate pH by using 1 or 2 simple assumptions but I’m not sure GWB allows for that. It seems like GWB needs a minimum of two constraints on the carbonate system, such as a designated amount of CO2 and information about carbonate minerals or initial CO2 and an initial pH. However, some of my assemblages do not have carbonate minerals, so I only have information on CO2 and I want GWB to calculate a pH without having to set a specific pH myself.  

Initially I was swapping CO2 with HCO3- and designating a neutral pH of 7. I'm also using Pitzer thermo data. I’ve attached a simple SpecE8 example water chemistry in equilibrium with 3 sulfate minerals and an amount of sulfate that should balance the system fairly well. In this example I swap HCO3- with CO2(g) and tried to make H+ the charge balance species but I get the error

       -- Error: Can't set pH of charge balance species H+

I’ve also attached the same chemistry run in React, without a reaction pathway, but swapped CO2 with H+ and then set the charge balance on HCO3-. I get the error

Ionic strength out of range.

Largest residual(s):

                       Resid     Resid/Totmol   Cbasis


 HCO3-                   5.279        16.94    1.758e-11

Can anyone tell me if there is a way to have GWB calculate a pH with less constraints on the carbonate system, or how to fix my GWB input so it will calculate it appropriately?

Also, could you please explain what GWB is attempted to tell me with this error messaging using residual, residual per total mol and cbasis? Residual is typically the difference between observed value and the mean value the model predicts but I’m uncertain I’m interpreting this correctly in GWB. I haven’t found an explanation of this error message in any of the reference manuals or guides.


Thank you,



MinEq_Ex1.sp8 MinEq_Ex2.rea

Link to comment
Share on other sites

Hi Sara,

I think there are a couple of things to consider when setting up your script. In general, you would need to have two constraints on carbonates to make a calculation for pH. If you don't have that information, you can make assumptions about the constraints on pH, like you have done in your React file, setting the H+ ion in equilibrium with CO2(g) and charge balancing on bicarbonate. 

However, are you certain that your fluid is in equilibrium with the three sulfate minerals (gypsum, epsomite, and polyhalite) at the same time? You might observe these three minerals in the field but the fluid might not be in equilibrium with the minerals at the same time. The error message you received regarding large residuals mean that the program is having difficulties solving the full solution to your system because the initial guesses are likely leading to large residual values. You can find the details regarding residuals in chapter 4 of the Geochemical and Biogeochemical Modeling Text. If you have a fluid analysis with concentration values for potassium, calcium, and  magnesium, I would suggest using those values instead of swapping the minerals in to set them at equilibrium. 

Lastly, I would try to refrain from using charge balancing to calculate the H+ concentration. The electroneutrality condition is almost always used to set the bulk concentration of the species in abundant concentration for which the greatest analytic uncertainty exists. Since H+ is typically present in small quantities, your calculation may just reflect the rounding error in the lab's precision for the fluid analysis.

Hope this helps,
Jia Wang

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...