Functions to calculate pH and alkalinity in an open, carbonate-buffered system at equilibrium (i.e. with an unlimited CO2 reservoir) with an optional additional weak acid/base buffer. This is for simplified aqueous geochemical systems commonly encountered in culturing applications. All default constants are based on freshwater and there is no implicit salinity correction included (stability constants can be set manually). For more complex systems, please use a full aquatic chemistry suite instead.
calculate_open_system_pH( pCO2, `H2CO3*` = solubility * pCO2, solubility = calculate_gas_solubility("CO2", temperature), temperature = qty(25, "C"), pKa1 = 6.3, pKa2 = 10.3, pKw = 14, buffer = qty(0, "M"), buffer_pKa, alkalinity = qty(0, "M") ) calculate_open_system_alkalinity( pH, pCO2, `H2CO3*` = solubility * pCO2, solubility = calculate_gas_solubility("CO2", temperature), temperature = qty(25, "C"), pKa1 = 6.3, pKa2 = 10.3, pKw = 14, buffer = qty(0, "M"), buffer_pKa )
the partial pressure of CO2 (a pressure quantity)
the concentration of H2CO3* (a molarity quantity), by default is calculated automatically from pCO2
the solubility of CO2, by default is determined based on the temperature of the system
the temperature of the system, used to calculate the solubility constant
the acid dissociation constant for H2CO3*
the acid dissociation constant for bicarbonate (HCO3-)
water dissociation constant
[optional] total concentration of the pH buffer (a molarity quantity). Assumes that this is a protonated weak acid with the provided
buffer_pKa. For weak base buffers, provide a negative molarity quantity instead and the appropriate
buffer_pKa. If the buffer is a salt (e.g. Na-Buffer or Buffer-Cl), make sure to add the appropriate molarity to the
alkalinity to account for the added ions (positive for hard cations, negative for hard anions). By default no additional buffer is added.
buffer acid dissociation constant, required if
buffer is provided
[optional] charge-weighed NET concentration of all conservative ions [units charge x a molarity quantity] (explicitly conservative alkalinity). Conservative ions are those that do NOT get affected by changes in pH in the pH range of interest (i.e. do not form any acids or bases or have pKas far outside the pH range of interest). E.g. mol/L Na that was added in the form of NaOH, NaHCO3 or as part of a Na-buffer salt; -1 x mol/L Cl that was added as HCl or -2 x mol/L SO4 that was added as H2SO4. Ions from salts that are comprised exclusively of conservative ions (e.g. NaCl, MgSO4) do not need to be included because they cancel out. By default the alkalinity of the system is 0 M.
the pH of the system
calculate_open_system_pH(): calculate the pH of an open system. Returns pH.
calculate_open_system_alkalinity(): calculates the alkalinity of an open system that is carbonate buffered and has an optional additional weak acid/base buffer. Returns the alkalinity as a molarity quantity. positive = excess cations, negative = excess anions.
calculate_open_system_pH(pCO2 = qty(100, "mbar")) #>  4.390743