Internal module reference

These internal modules are used by Solution but typically are not directly accessed by the user.

Salt analysis module

pyEQL salt matching library.

This file contains functions that allow a pyEQL Solution object composed of individual species (usually ions) to be mapped to a solution of one or more salts. This mapping is necessary because some parameters (such as activity coefficient data) can only be determined for salts (e.g. NaCl) and not individual species (e.g. Na+)

copyright:

2013-2023 by Ryan S. Kingsbury

license:

LGPL, see LICENSE for more details.

class pyEQL.salt_ion_match.Salt(cation, anion)[source]

Class to represent a salt.

get_effective_molality(ionic_strength)[source]

Calculate the effective molality according to [mistry].

\[2 I \over (\nu_+ z_+^2 + \nu_- z_- ^2)\]
Parameters:

ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

Returns:

Quantity

Return type:

the effective molality of the salt in the parent solution

References

[mistry]

Mistry, K. H.; Hunter, H. a.; Lienhard V, J. H. Effect of composition and nonideal solution behavior on desalination calculations for mixed electrolyte solutions with comparison to seawater. Desalination 2013, 318, 34-47.

pyEQL.salt_ion_match._sort_components(Solution, type='all')[source]

Sort the components of a solution in descending order (by mol).

Parameters:
  • Solution (Solution object) –

  • type (The type of component to be sorted. Defaults to 'all' for all) – solutes. Other valid arguments are ‘cations’ and ‘anions’ which return sorted lists of cations and anions, respectively.

Returns:

  • A list whose keys are the component names (formulas) and whose

  • values are the component objects themselves

pyEQL.salt_ion_match.generate_salt_list(sol, unit='mol/kg')[source]

Generate a list of salts that represents the ionic composition of a solution.

Returns:

A dictionary of Salt objects, where Salt objects are the keys and the amounts are the values.

Return type:

dict

pyEQL.salt_ion_match.identify_salt(sol)[source]

Analyze the components of a solution and identify the salt that most closely approximates it. (e.g., if a solution contains 0.5 mol/kg of Na+ and Cl-, plus traces of H+ and OH-, the matched salt is 0.5 mol/kg NaCl).

Create a Salt object for this salt.

Return type:

A Salt object.

Activity Correction module

pyEQL activity correction library.

This file contains functions for computing molal-scale activity coefficients of ions and salts in aqueous solution.

Individual functions for activity coefficients are defined here so that they can be used independently of a pyEQL solution object. Normally, these functions are called from within the get_activity_coefficient method of the Solution class.

copyright:

2013-2023 by Ryan S. Kingsbury

license:

LGPL, see LICENSE for more details.

pyEQL.activity_correction._debye_parameter_B(temperature='25 degC')[source]

Return the constant B used in the extended Debye-Huckel equation.

Parameters:

temperature (str Quantity, optional) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

Notes

The parameter B is equal to:

\[B = ( {8 \pi N_A e^2 \over 1000 \epsilon k T} ) ^ {1 \over 2}\]

References

Bockris and Reddy. /Modern Electrochemistry/, vol 1. Plenum/Rosetta, 1977, p.210.

Examples:

>>> _debye_parameter_B() 
0.3291...
pyEQL.activity_correction._debye_parameter_activity(temperature='25 degC')[source]

Return the constant A for use in the Debye-Huckel limiting law (base 10).

Parameters:

temperature (str Quantity, optional) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

Return type:

Quantity The parameter A for use in the Debye-Huckel limiting law (base e)

Notes

The parameter A is equal to:

\[A^{\gamma} = {e^3 ( 2 \pi N_A {\rho})^{0.5} \over (4 \pi \epsilon_o \epsilon_r k T)^{1.5}}\]

Note that this equation returns the parameter value that can be used to calculate the natural logarithm of the activity coefficient. For base 10, divide the value returned by 2.303. The value is often given in base 10 terms (0.509 at 25 degC) in older textbooks.

References

Archer, Donald G. and Wang, Peiming. “The Dielectric Constant of Water and Debye-Huckel Limiting Law Slopes.” /J. Phys. Chem. Ref. Data/ 19(2), 1990.

Examples:

>>> _debye_parameter_activity() 
1.17499...
pyEQL.activity_correction._debye_parameter_osmotic(temperature='25 degC')[source]

Return the constant A_phi for use in calculating the osmotic coefficient according to Debye-Huckel theory.

Parameters:

temperature (str Quantity, optional) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

Notes

Not to be confused with the Debye-Huckel constant used for activity coefficients in the limiting law. Takes the value 0.392 at 25 C. This constant is calculated according to: [kim] [arch]

\[A^{\phi} = {1 \over 3} A^{\gamma}\]

References

[kim]

Kim, Hee-Talk and Frederick, William Jr, 1988. “Evaluation of Pitzer Ion Interaction Parameters of Aqueous Electrolytes at 25 C. 1. Single Salt Parameters,” J. Chemical Engineering Data 33, pp.177-184.

[arch]

Archer, Donald G. and Wang, Peiming. “The Dielectric Constant of Water and Debye-Huckel Limiting Law Slopes.” /J. Phys. Chem. Ref. Data/ 19(2), 1990.

Examples:

>>> _debye_parameter_osmotic() 
0.3916...
pyEQL.activity_correction._debye_parameter_volume(temperature='25 degC')[source]

Return the constant A_V, the Debye-Huckel limiting slope for apparent molar volume.

Parameters:

temperature (str Quantity, optional) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

Notes

Takes the value 1.8305 cm ** 3 * kg ** 0.5 / mol ** 1.5 at 25 C. This constant is calculated according to: [1]_

\[A_V = -2 A_{\phi} R T [ {3 \over \epsilon} {{\partial \epsilon \over \partial p} } - {{1 \over \rho}{\partial \rho \over \partial p} }]\]

NOTE: at this time, the term in brackets (containing the partial derivatives) is approximate. These approximations give the correct value of the slope at 25 degC and produce estimates with less than 10% error between 0 and 60 degC.

The derivative of epsilon with respect to pressure is assumed constant (for atmospheric pressure) at -0.01275 1/MPa. Note that the negative sign does not make sense in light of real data, but is required to give the correct result.

The second term is equivalent to the inverse of the bulk modulus of water, which is taken to be 2.2 GPa. [2]_

References

See Also:

_debye_parameter_osmotic

pyEQL.activity_correction._pitzer_B_MX(ionic_strength, alpha1, alpha2, beta0, beta1, beta2)[source]

Return the B_MX coefficient for the Pitzer ion interaction model.

\[B_MX = \beta_0 + \beta_1 f1(\alpha_1 I ^ {0.5}) + \beta_2 f2(\alpha_2 I ^ {0.5})\]
Parameters:
  • ionic_strength (number) – The ionic strength of the parent solution, mol/kg

  • alpha1 (number) – Coefficients for the Pitzer model, kg ** 0.5 / mol ** 0.5

  • alpha2 (number) – Coefficients for the Pitzer model, kg ** 0.5 / mol ** 0.5

  • beta0 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta1 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta2 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

Returns:

The B_MX parameter for the Pitzer ion interaction model.

Return type:

float

References

Scharge, T., Munoz, A.G., and Moog, H.C. (2012). Activity Coefficients of Fission Products in Highly Salinary Solutions of Na+, K+, Mg2+, Ca2+, Cl-, and SO42- : Cs+. /Journal of Chemical& Engineering Data (57), p. 1637-1647.

Kim, H., & Jr, W. F. (1988). Evaluation of Pitzer ion interaction parameters of aqueous electrolytes at 25 degree C. 1. Single salt parameters. Journal of Chemical and Engineering Data, (2), 177-184.

See Also:

_pitzer_f1

pyEQL.activity_correction._pitzer_B_phi(ionic_strength, alpha1, alpha2, beta0, beta1, beta2)[source]

Return the B^Phi coefficient for the Pitzer ion interaction model.

\[B^\Phi = \beta_0 + \beta1 \exp(-\alpha_1 I ^{0.5}) + \beta_2 \exp(-\alpha_2 I ^ {0.5})\]

or

\[B^\Phi = B^\gamma - B_{MX}\]
Parameters:
  • ionic_strength (number) – The ionic strength of the parent solution, mol/kg

  • alpha1 (number) – Coefficients for the Pitzer model, kg ** 0.5 / mol ** 0.5

  • alpha2 (number) – Coefficients for the Pitzer model, kg ** 0.5 / mol ** 0.5

  • beta0 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta1 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta2 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

Returns:

The B^Phi parameter for the Pitzer ion interaction model.

Return type:

float

References

Scharge, T., Munoz, A.G., and Moog, H.C. (2012). Activity Coefficients of Fission Products in Highly Salinary Solutions of Na+, K+, Mg2+, Ca2+, Cl-, and SO42- : Cs+. /Journal of Chemical& Engineering Data (57), p. 1637-1647.

Kim, H., & Jr, W. F. (1988). Evaluation of Pitzer ion interaction parameters of aqueous electrolytes at 25 degree C. 1. Single salt parameters. Journal of Chemical and Engineering Data, (2), 177-184.

Beyer, R., & Steiger, M. (2010). Vapor Pressure Measurements of NaHCOO + H 2 O and KHCOO + H 2 O from 278 to 308 K and Representation with an Ion Interaction (Pitzer) Model. Journal of Chemical & Engineering Data, 55(2), 830-838. doi:10.1021/je900487a

pyEQL.activity_correction._pitzer_f1(x)[source]

The function of ionic strength used to calculate eta_MX in the Pitzer ion interaction model.

\[f(x) = 2 [ 1- (1+x) \exp(-x)] / x ^ 2\]

References

Scharge, T., Munoz, A.G., and Moog, H.C. (2012). Activity Coefficients of Fission Products in Highly Salinary Solutions of Na+, K+, Mg2+, Ca2+, Cl-, and SO42- : Cs+. /Journal of Chemical& Engineering Data (57), p. 1637-1647.

Kim, H., & Jr, W. F. (1988). Evaluation of Pitzer ion interaction parameters of aqueous electrolytes at 25 degree C. 1. Single salt parameters. Journal of Chemical and Engineering Data, (2), 177-184.

pyEQL.activity_correction._pitzer_f2(x)[source]

The function of ionic strength used to calculate beta_gamma in the Pitzer ion interaction model.

\[f(x) = -{2 \over x ^ 2} [ 1 - ({1+x+ x^2 \over 2}) \exp(-x)]\]

References

Scharge, T., Munoz, A.G., and Moog, H.C. (2012). Activity Coefficients of Fission Products in Highly Salinary Solutions of Na+, K+, Mg2+, Ca2+, Cl-, and SO42- : Cs+. /Journal of Chemical& Engineering Data (57), p. 1637-1647.

Kim, H., & Jr, W. F. (1988). Evaluation of Pitzer ion interaction parameters of aqueous electrolytes at 25 degree C. 1. Single salt parameters. Journal of Chemical and Engineering Data, (2), 177-184.

pyEQL.activity_correction._pitzer_log_gamma(ionic_strength, molality, B_MX, B_phi, C_phi, z_cation, z_anion, nu_cation, nu_anion, temperature='25 degC', b=<Quantity(1.2, 'kilogram ** 0.5 / mole ** 0.5')>)[source]

Return the natural logarithm of the binary activity coefficient calculated by the Pitzer ion interaction model.

\[\ln \gamma_{MX} = -{|z_+ z_-| A^{Phi} ( I ^ {0.5} \over (1 + b I ^ {0.5})} + {2 \over b }\ln (1 + b I ^ {0.5}) )+ + {m (2 \nu_+ \nu_-) \over (\nu_+ + \nu_-)} (B_{MX} + B_{MX}^\Phi) + {m^2(3 (\nu_+ \nu_-)^{1.5} \over (\nu_+ + \nu_-))} C_{MX}^\Phi\]
Parameters:
  • ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

  • molality (Quantity) – The concentration of the salt, mol/kg

  • B_MX (Quantity) – Calculated parameters for the Pitzer ion interaction model.

  • B_phi (Quantity) – Calculated parameters for the Pitzer ion interaction model.

  • C_phi (Quantity) – Calculated parameters for the Pitzer ion interaction model.

  • z_cation (int) – The formal charge on the cation and anion, respectively

  • z_anion (int) – The formal charge on the cation and anion, respectively

  • nu_cation (int) – The stoichiometric coefficient of the cation and anion in the salt

  • nu_anion (int) – The stoichiometric coefficient of the cation and anion in the salt

  • temperature (str Quantity) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

  • b (number, optional) – Coefficient. Usually set equal to 1.2 kg ** 0.5 / mol ** 0.5 and considered independent of temperature and pressure

Returns:

The natural logarithm of the binary activity coefficient calculated by the Pitzer ion interaction model.

Return type:

float

References

Kim, H., & Jr, W. F. (1988). Evaluation of Pitzer ion interaction parameters of aqueous electrolytes at 25 degree C. 1. Single salt parameters. Journal of Chemical and Engineering Data, (2), 177-184.

May, P. M., Rowland, D., Hefter, G., & Königsberger, E. (2011). A Generic and Updatable Pitzer Characterization of Aqueous Binary Electrolyte Solutions at 1 bar and 25 °C. Journal of Chemical & Engineering Data, 56(12), 5066-5077. doi:10.1021/je2009329

pyEQL.activity_correction.get_activity_coefficient_davies(ionic_strength, formal_charge=1, temperature='25 degC')[source]

Return the activity coefficient of solute in the parent solution according to the Davies equation.

Parameters:
  • formal_charge (int, optional) – The charge on the solute, including sign. Defaults to +1 if not specified.

  • ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

  • temperature (str Quantity, optional) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

Returns:

  • Quantity – The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless.

  • See Also

  • ——–

  • _debye_parameter_activity

Notes

Activity coefficient is calculated according to:

\[\ln \gamma = A^{\gamma} z_i^2 ({\sqrt I \over (1 + \sqrt I)} + 0.2 I)\]

Valid for 0.1 < I < 0.5

References

Stumm, Werner and Morgan, James J. Aquatic Chemistry, 3rd ed,

pp 103. Wiley Interscience, 1996.

pyEQL.activity_correction.get_activity_coefficient_debyehuckel(ionic_strength, formal_charge=1, temperature='25 degC')[source]

Return the activity coefficient of solute in the parent solution according to the Debye-Huckel limiting law.

Parameters:
  • formal_charge (int, optional) – The charge on the solute, including sign. Defaults to +1 if not specified.

  • ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

  • temperature (str Quantity, optional) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

Returns:

  • Quantity – The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless.

  • See Also

  • ——–

  • _debye_parameter_activity

Notes

Activity coefficient is calculated according to:

\[\ln \gamma = A^{\gamma} z_i^2 \sqrt I\]

Valid only for I < 0.005

References

Stumm, Werner and Morgan, James J. Aquatic Chemistry, 3rd ed,

pp 103. Wiley Interscience, 1996.

pyEQL.activity_correction.get_activity_coefficient_guntelberg(ionic_strength, formal_charge=1, temperature='25 degC')[source]

Return the activity coefficient of solute in the parent solution according to the Guntelberg approximation.

Parameters:
  • formal_charge (int, optional) – The charge on the solute, including sign. Defaults to +1 if not specified.

  • ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

  • temperature (str Quantity, optional) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

Returns:

  • Quantity – The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless.

  • See Also

  • ——–

  • _debye_parameter_activity

Notes

Activity coefficient is calculated according to:

\[\ln \gamma = A^{\gamma} z_i^2 {\sqrt I \over (1 + \sqrt I)}\]

Valid for I < 0.1

References

Stumm, Werner and Morgan, James J. Aquatic Chemistry, 3rd ed,

pp 103. Wiley Interscience, 1996.

pyEQL.activity_correction.get_activity_coefficient_pitzer(ionic_strength, molality, alpha1, alpha2, beta0, beta1, beta2, C_phi, z_cation, z_anion, nu_cation, nu_anion, temperature='25 degC', b=1.2)[source]

Return the activity coefficient of solute in the parent solution according to the Pitzer model.

Parameters:
  • ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

  • molality (Quantity) – The molal concentration of the parent salt, mol/kg

  • alpha1 (number) – Coefficients for the Pitzer model. This function assigns the coefficients proper units of kg ** 0.5 / mol ** 0.5 after they are entered.

  • alpha2 (number) – Coefficients for the Pitzer model. This function assigns the coefficients proper units of kg ** 0.5 / mol ** 0.5 after they are entered.

  • beta0 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta1 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta2 (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • C_phi (number) – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • z_cation (int) – The formal charge on the cation and anion, respectively

  • z_anion (int) – The formal charge on the cation and anion, respectively

  • nu_cation (int) – The stoichiometric coefficient of the cation and anion in the salt

  • nu_anion (int) – The stoichiometric coefficient of the cation and anion in the salt

  • temperature (str Quantity) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

  • b (number, optional) – Coefficient. Usually set equal to 1.2 and considered independent of temperature and pressure. If provided, this coefficient is assigned proper units of kg ** 0.5 / mol ** 0.5 after entry.

Returns:

  • Quantity – The mean molal (mol/kg) scale ionic activity coefficient of solute, dimensionless

  • Examples

  • ——–

  • >>> get_activity_coefficient_pitzer(0.5*unit.Quantity(‘mol/kg’),0.5*unit.Quantity(‘mol/kg’),1,0.5,-.0181191983,-.4625822071,.4682,.000246063,1,-1,1,1,b=1.2)

  • 0.61915…

  • >>> get_activity_coefficient_pitzer(5.6153*unit.Quantity(‘mol/kg’),5.6153*unit.Quantity(‘mol/kg’),3,0.5,0.0369993,0.354664,0.0997513,-0.00171868,1,-1,1,1,b=1.2)

  • 0.76331…

  • NOTE (the examples below are for comparison with experimental and modeling data presented in)

  • the May et al reference below.

  • 10 mol/kg ammonium nitrate. Estimated result (from graph) = 0.2725

  • >>> get_activity_coefficient_pitzer(10*unit.Quantity(‘mol/kg’),10*unit.Quantity(‘mol/kg’),2,0,-0.01709,0.09198,0,0.000419,1,-1,1,1,b=1.2)

  • 0.22595 …

  • 5 mol/kg ammonium nitrate. Estimated result (from graph) = 0.3011

  • >>> get_activity_coefficient_pitzer(5*unit.Quantity(‘mol/kg’),5*unit.Quantity(‘mol/kg’),2,0,-0.01709,0.09198,0,0.000419,1,-1,1,1,b=1.2)

  • 0.30249 …

  • 18 mol/kg ammonium nitrate. Estimated result (from graph) = 0.1653

  • >>> get_activity_coefficient_pitzer(18*unit.Quantity(‘mol/kg’),18*unit.Quantity(‘mol/kg’),2,0,-0.01709,0.09198,0,0.000419,1,-1,1,1,b=1.2)

  • 0.16241 …

References

Scharge, T., Munoz, A.G., and Moog, H.C. (2012). Activity Coefficients of Fission Products in Highly Salinary Solutions of Na+, K+, Mg2+, Ca2+, Cl-, and SO42- : Cs+. /Journal of Chemical& Engineering Data (57), p. 1637-1647.

Kim, H., & Jr, W. F. (1988). Evaluation of Pitzer ion interaction parameters of aqueous electrolytes at 25 degree C. 1. Single salt parameters. Journal of Chemical and Engineering Data, (2), 177-184.

May, P. M., Rowland, D., Hefter, G., & Königsberger, E. (2011). A Generic and Updatable Pitzer Characterization of Aqueous Binary Electrolyte Solutions at 1 bar and 25 °C. Journal of Chemical & Engineering Data, 56(12), 5066-5077. doi:10.1021/je2009329

Beyer, R., & Steiger, M. (2010). Vapor Pressure Measurements of NaHCOO + H 2 O and KHCOO + H 2 O from 278 to 308 K and Representation with an Ion Interaction (Pitzer) Model. Journal of Chemical & Engineering Data, 55(2), 830-838. doi:10.1021/je900487a

See Also:

_debye_parameter_activity _pitzer_B_MX _pitzer_B_gamma _pitzer_B_phi _pitzer_log_gamma

pyEQL.activity_correction.get_apparent_volume_pitzer(ionic_strength, molality, alpha1, alpha2, beta0, beta1, beta2, C_phi, V_o, z_cation, z_anion, nu_cation, nu_anion, temperature='25 degC', b=1.2)[source]

Return the apparent molar volume of solute in the parent solution according to the Pitzer model.

Parameters:
  • ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

  • molality (Quantity) – The molal concentration of the parent salt, mol/kg

  • alpha1 (number) – Coefficients for the Pitzer model. This function assigns the coefficients proper units of kg ** 0.5 / mol ** 0.5 after they are entered.

  • alpha2 (number) – Coefficients for the Pitzer model. This function assigns the coefficients proper units of kg ** 0.5 / mol ** 0.5 after they are entered.

  • beta0 (number) – Pitzer coefficients for the apparent molar volume. These ion-interaction parameters are specific to each salt system.

  • beta1 (number) – Pitzer coefficients for the apparent molar volume. These ion-interaction parameters are specific to each salt system.

  • beta2 (number) – Pitzer coefficients for the apparent molar volume. These ion-interaction parameters are specific to each salt system.

  • C_phi (number) – Pitzer coefficients for the apparent molar volume. These ion-interaction parameters are specific to each salt system.

  • V_o (number) – The V^o Pitzer coefficient for the apparent molar volume.

  • z_cation (int) – The formal charge on the cation and anion, respectively

  • z_anion (int) – The formal charge on the cation and anion, respectively

  • nu_cation (int) – The stoichiometric coefficient of the cation and anion in the salt

  • nu_anion (int) – The stoichiometric coefficient of the cation and anion in the salt

  • temperature (str Quantity) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

  • b (number, optional) – Coefficient. Usually set equal to 1.2 and considered independent of temperature and pressure. If provided, this coefficient is assigned proper units of kg ** 0.5 / mol ** 0.5 after entry.

Returns:

  • Quantity – The apparent molar volume of the solute, cm ** 3 / mol

  • Examples

  • ——–

  • NOTE (the example below is for comparison with experimental and modeling data presented in)

  • the Krumgalz et al reference below.

  • 0.25 mol/kg CuSO4. Expected result (from graph) = 0.5 cm * 3 / mol*

  • >>> get_apparent_volume_pitzer(1.0*unit.Quantity(‘mol/kg’),0.25*unit.Quantity(‘mol/kg’),1.4,12,0.001499,-0.008124,0.2203,-0.0002589,-6,2,-2,1,1,b=1.2)

  • 0.404…

  • 1.0 mol/kg CuSO4. Expected result (from graph) = 4 cm * 3 / mol*

  • >>> get_apparent_volume_pitzer(4.0*unit.Quantity(‘mol/kg’),1.0*unit.Quantity(‘mol/kg’),1.4,12,0.001499,-0.008124,0.2203,-0.0002589,-6,2,-2,1,1,b=1.2)

  • 4.424…

  • 10.0 mol/kg ammonium nitrate. Expected result (from graph) = 50.3 cm * 3 / mol*

  • >>> get_apparent_volume_pitzer(10.0*unit.Quantity(‘mol/kg’),10.0*unit.Quantity(‘mol/kg’),2,0,0.000001742,0.0002926,0,0.000000424,46.9,1,-1,1,1,b=1.2)

  • 50.286…

  • 20.0 mol/kg ammonium nitrate. Expected result (from graph) = 51.2 cm * 3 / mol*

  • >>> get_apparent_volume_pitzer(20.0*unit.Quantity(‘mol/kg’),20.0*unit.Quantity(‘mol/kg’),2,0,0.000001742,0.0002926,0,0.000000424,46.9,1,-1,1,1,b=1.2)

  • 51.145…

  • NOTE (the examples below are for comparison with experimental and modeling data presented in)

  • the Krumgalz et al reference below.

  • 0.8 mol/kg NaF. Expected result = 0.03

  • >>> get_apparent_volume_pitzer(0.8*unit.Quantity(‘mol/kg’),0.8*unit.Quantity(‘mol/kg’),2,0,0.000024693,0.00003169,0,-0.000004068,-2.426,1,-1,1,1,b=1.2)

  • 0.22595 …

References

May, P. M., Rowland, D., Hefter, G., & Königsberger, E. (2011). A Generic and Updatable Pitzer Characterization of Aqueous Binary Electrolyte Solutions at 1 bar and 25 °C. Journal of Chemical & Engineering Data, 56(12), 5066-5077. doi:10.1021/je2009329

Krumgalz, Boris S., Pogorelsky, Rita (1996). Volumetric Properties of Single Aqueous Electrolytes from Zero to Saturation Concentration at 298.15 K Represented by Pitzer’s Ion-Interaction Equations. Journal of Physical Chemical Reference Data, 25(2), 663-689.

See Also:

_debye_parameter_volume _pitzer_B_MX

pyEQL.activity_correction.get_osmotic_coefficient_pitzer(ionic_strength, molality, alpha1, alpha2, beta0, beta1, beta2, C_phi, z_cation, z_anion, nu_cation, nu_anion, temperature='25 degC', b=1.2)[source]

Return the osmotic coefficient of water in an electrolyte solution according to the Pitzer model.

Parameters:
  • ionic_strength (Quantity) – The ionic strength of the parent solution, mol/kg

  • molality (Quantity) – The molal concentration of the parent salt, mol/kg

  • alpha1 (number) – Coefficients for the Pitzer model. This function assigns the coefficients proper units of kg ** 0.5 / mol ** 0.5 after they are entered.

  • alpha2 (number) – Coefficients for the Pitzer model. This function assigns the coefficients proper units of kg ** 0.5 / mol ** 0.5 after they are entered.

  • beta0 – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta1 – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • beta2 – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • C_phi – Coefficients for the Pitzer model. These ion-interaction parameters are specific to each salt system.

  • z_cation (int) – The formal charge on the cation and anion, respectively

  • z_anion (int) – The formal charge on the cation and anion, respectively

  • nu_cation (int) – The stoichiometric coefficient of the cation and anion in the salt

  • nu_anion (int) – The stoichiometric coefficient of the cation and anion in the salt

  • temperature (str Quantity) – String representing the temperature of the solution. Defaults to ‘25 degC’ if not specified.

  • b (number, optional) – Coefficient. Usually set equal to 1.2 and considered independent of temperature and pressure. If provided, this coefficient is assigned proper units of kg ** 0.5 / mol ** 0.5 after entry.

Returns:

  • Quantity – The osmotic coefficient of water, dimensionless

  • Examples

  • ——–

  • Experimental value according to Beyer and Stieger reference is 1.3550

  • >>> get_osmotic_coefficient_pitzer(10.175*unit.Quantity(‘mol/kg’),10.175*unit.Quantity(‘mol/kg’),1,0.5,-.0181191983,-.4625822071,.4682,.000246063,1,-1,1,1,b=1.2)

  • 1.3552 …

  • Experimental value according to Beyer and Stieger reference is 1.084

  • >>> get_osmotic_coefficient_pitzer(5.6153*unit.Quantity(‘mol/kg’),5.6153*unit.Quantity(‘mol/kg’),3,0.5,0.0369993,0.354664,0.0997513,-0.00171868,1,-1,1,1,b=1.2)

  • 1.0850 …

  • NOTE (the examples below are for comparison with experimental and modeling data presented in)

  • the May et al reference below.

  • 10 mol/kg ammonium nitrate. Estimated result (from graph) = 0.62

  • >>> get_osmotic_coefficient_pitzer(10*unit.Quantity(‘mol/kg’),10*unit.Quantity(‘mol/kg’),2,0,-0.01709,0.09198,0,0.000419,1,-1,1,1,b=1.2)

  • 0.6143 …

  • 5 mol/kg ammonium nitrate. Estimated result (from graph) = 0.7

  • >>> get_osmotic_coefficient_pitzer(5*unit.Quantity(‘mol/kg’),5*unit.Quantity(‘mol/kg’),2,0,-0.01709,0.09198,0,0.000419,1,-1,1,1,b=1.2)

  • 0.6925 …

  • 18 mol/kg ammonium nitrate. Estimated result (from graph) = 0.555

  • >>> get_osmotic_coefficient_pitzer(18*unit.Quantity(‘mol/kg’),18*unit.Quantity(‘mol/kg’),2,0,-0.01709,0.09198,0,0.000419,1,-1,1,1,b=1.2)

  • 0.5556 …

References

Scharge, T., Munoz, A.G., and Moog, H.C. (2012). Activity Coefficients of Fission Products in Highly Salinary Solutions of Na+, K+, Mg2+, Ca2+, Cl-, and SO42- : Cs+. /Journal of Chemical& Engineering Data (57), p. 1637-1647.

Kim, H., & Jr, W. F. (1988). Evaluation of Pitzer ion interaction parameters of aqueous electrolytes at 25 degree C. 1. Single salt parameters. Journal of Chemical and Engineering Data, (2), 177-184.

May, P. M., Rowland, D., Hefter, G., & Königsberger, E. (2011). A Generic and Updatable Pitzer Characterization of Aqueous Binary Electrolyte Solutions at 1 bar and 25 °C. Journal of Chemical & Engineering Data, 56(12), 5066-5077. doi:10.1021/je2009329

Beyer, R., & Steiger, M. (2010). Vapor Pressure Measurements of NaHCOO + H 2 O and KHCOO + H 2 O from 278 to 308 K and Representation with an Ion Interaction (Pitzer) Model. Journal of Chemical & Engineering Data, 55(2), 830-838. doi:10.1021/je900487a

See Also:

_debye_parameter_activity _pitzer_B_MX _pitzer_B_gamma _pitzer_B_phi _pitzer_log_gamma

Speciation Engines module

pyEQL engines for computing aqueous equilibria (e.g., speciation, redox, etc.).

copyright:

2013-2023 by Ryan S. Kingsbury

license:

LGPL, see LICENSE for more details.

class pyEQL.engines.EOS[source]

Abstract base class for pyEQL equation of state classes.

abstract equilibrate(solution)[source]

Adjust the speciation and pH of a Solution object to achieve chemical equilibrium.

The Solution should be modified in-place, likely using add_moles / set_moles, etc.

Parameters:

solution – pyEQL Solution object

Returns

Nothing. The speciation of the Solution is modified in-place.

Raises:
  • ValueError if the calculation cannot be completed, e.g. due to insufficient number of

  • parameters or lack of convergence.

abstract get_activity_coefficient(solution, solute)[source]

Return the molal scale activity coefficient of solute, given a Solution object.

Parameters:
  • solution – pyEQL Solution object

  • solute – str identifying the solute of interest

Returns

Quantity: dimensionless quantity object

Raises:
  • ValueError if the calculation cannot be completed, e.g. due to insufficient number of

  • parameters.

abstract get_osmotic_coefficient(solution)[source]

Return the molal scale osmotic coefficient of a Solution.

Parameters:

solution – pyEQL Solution object

Returns

Quantity: dimensionless molal scale osmotic coefficient

Raises:
  • ValueError if the calculation cannot be completed, e.g. due to insufficient number of

  • parameters.

abstract get_solute_volume()[source]

Return the volume of only the solutes.

Parameters:

solution – pyEQL Solution object

Returns

Quantity: solute volume in L

Raises:
  • ValueError if the calculation cannot be completed, e.g. due to insufficient number of

  • parameters.

class pyEQL.engines.IdealEOS[source]

Ideal solution equation of state engine.

equilibrate(solution)[source]

Adjust the speciation of a Solution object to achieve chemical equilibrium.

get_activity_coefficient(solution, solute)[source]

Return the molal scale activity coefficient of solute, given a Solution object.

get_osmotic_coefficient(solution)[source]

Return the molal scale osmotic coefficient of solute, given a Solution object.

get_solute_volume(solution)[source]

Return the volume of the solutes.

class pyEQL.engines.NativeEOS[source]

pyEQL’s native EOS. Uses the Pitzer model when possible, falls back to other models (e.g. Debye-Huckel) based on ionic strength if sufficient parameters are not available.

equilibrate(solution)[source]

Adjust the speciation of a Solution object to achieve chemical equilibrium.

get_activity_coefficient(solution, solute)[source]

Whenever the appropriate parameters are available, the Pitzer model [may] is used. If no Pitzer parameters are available, then the appropriate equations are selected according to the following logic: [stumm].

I <= 0.0005: Debye-Huckel equation 0.005 < I <= 0.1: Guntelberg approximation 0.1 < I <= 0.5: Davies equation I > 0.5: Raises a warning and returns activity coefficient = 1

The ionic strength, activity coefficients, and activities are all calculated based on the molal (mol/kg) concentration scale. If a different scale is given as input, then the molal-scale activity coefficient \(\gamma_\pm\) is converted according to [rbs]

\[f_\pm = \gamma_\pm * (1 + M_w \sum_i \nu_i \m_i)\]
\[y_\pm = m \rho_w / C \gamma_\pm\]

where \(f_\pm\) is the rational activity coefficient, \(M_w\) is the molecular weight of water, the summation represents the total molality of all solute species, \(y_\pm\) is the molar activity coefficient, \(\rho_w\) is the density of pure water, \(m\) and \(C\) are the molal and molar concentrations of the chosen salt (not individual solute), respectively.

Parameters:
  • solute – String representing the name of the solute of interest

  • scale – The concentration scale for the returned activity coefficient. Valid options are “molal”, “molar”, and “rational” (i.e., mole fraction). By default, the molal scale activity coefficient is returned.

  • verbose – If True, pyEQL will print a message indicating the parent salt that is being used for activity calculations. This option is useful when modeling multicomponent solutions. False by default.

Returns

The mean ion activity coefficient of the solute in question on the selected scale.

See also

get_ionic_strength get_salt activity_correction.get_activity_coefficient_debyehuckel activity_correction.get_activity_coefficient_guntelberg activity_correction.get_activity_coefficient_davies activity_correction.get_activity_coefficient_pitzer

Notes

For multicomponent mixtures, pyEQL implements the “effective Pitzer model” presented by Mistry et al. [mistry]. In this model, the activity coefficient of a salt in a multicomponent mixture is calculated using an “effective molality,” which is the molality that would result in a single-salt mixture with the same total ionic strength as the multicomponent solution.

\[m_effective = 2 I \over (\nu_{+} z_{+}^2 + \nu{_}- z_{-} ^2)\]

References

[may]

May, P. M., Rowland, D., Hefter, G., & Königsberger, E. (2011). A Generic and Updatable Pitzer Characterization of Aqueous Binary Electrolyte Solutions at 1 bar and 25 °C. Journal of Chemical & Engineering Data, 56(12), 5066-5077. doi:10.1021/je2009329

[stumm]

Stumm, Werner and Morgan, James J. Aquatic Chemistry, 3rd ed, pp 165. Wiley Interscience, 1996.

[rbs]

Robinson, R. A.; Stokes, R. H. Electrolyte Solutions: Second Revised Edition; Butterworths: London, 1968, p.32.

[mistry]

Mistry, K. H.; Hunter, H. a.; Lienhard V, J. H. Effect of composition and nonideal solution behavior on desalination calculations for mixed electrolyte solutions with comparison to seawater. Desalination 2013, 318, 34-47.

get_osmotic_coefficient(solution)[source]

Return the molal scale osmotic coefficient of solute, given a Solution object.

Osmotic coefficient is calculated using the Pitzer model. [may] If appropriate parameters for the model are not available, then pyEQL raises a WARNING and returns an osmotic coefficient of 1.

If the ‘rational’ scale is given as input, then the molal-scale osmotic coefficient \(\phi\) is converted according to [rbs]

\[g = - \phi * M_{w} \sum_{i} \nu_{i} \m_{i}) / \ln x_{w}\]

where \(g\) is the rational osmotic coefficient, \(M_{w}\) is the molecular weight of water, the summation represents the total molality of all solute species, and \(x_{w}\) is the mole fraction of water.

Parameters:
  • scale

  • "molal" (The concentration scale for the returned osmotic coefficient. Valid options are) –

:param : :param “rational”: :type “rational”: i.e., mole fraction :param coefficient is returned.:

Returns
Quantity:

The osmotic coefficient

See also

get_water_activity get_ionic_strength get_salt

Notes

For multicomponent mixtures, pyEQL adopts the “effective Pitzer model” presented by Mistry et al. [mstry]. In this approach, the osmotic coefficient of each individual salt is calculated using the normal Pitzer model based on its respective concentration. Then, an effective osmotic coefficient is calculated as the concentration-weighted average of the individual osmotic coefficients.

For example, in a mixture of 0.5 M NaCl and 0.5 M KBr, one would calculate the osmotic coefficient for each salt using a concentration of 0.5 M and an ionic strength of 1 M. Then, one would average the two resulting osmotic coefficients to obtain an effective osmotic coefficient for the mixture.

(Note: in the paper referenced below, the effective osmotic coefficient is determined by weighting using the “effective molality” rather than the true molality. Subsequent checking and correspondence with the author confirmed that the weight factor should be the true molality, and that is what is implemented in pyEQL.)

References

[may]

May, P. M., Rowland, D., Hefter, G., & Königsberger, E. (2011). A Generic and Updatable Pitzer Characterization of Aqueous Binary Electrolyte Solutions at 1 bar and 25 °C. Journal of Chemical & Engineering Data, 56(12), 5066-5077. doi:10.1021/je2009329

[rbs]

Robinson, R. A.; Stokes, R. H. Electrolyte Solutions: Second Revised Edition; Butterworths: London, 1968, p.32.

[mstry]

Mistry, K. H.; Hunter, H. a.; Lienhard V, J. H. Effect of composition and nonideal solution behavior on desalination calculations for mixed electrolyte solutions with comparison to seawater. Desalination 2013, 318, 34-47.

Examples

>>> s1 = pyEQL.Solution([['Na+','0.2 mol/kg'],['Cl-','0.2 mol/kg']])
>>> s1.get_osmotic_coefficient()
<Quantity(0.923715281, 'dimensionless')>
>>> s1 = pyEQL.Solution([['Mg+2','0.3 mol/kg'],['Cl-','0.6 mol/kg']],temperature='30 degC')
>>> s1.get_osmotic_coefficient()
<Quantity(0.891409618, 'dimensionless')>
get_solute_volume(solution)[source]

Return the volume of the solutes.