The Solution Class¶
pyEQL Solution Class
copyright: | 2013-2016 by Ryan S. Kingsbury |
---|---|
license: | LGPL, see LICENSE for more details. |
-
class
pyEQL.solution.
Solution
(solutes=[], **kwargs)¶ Class representing the properties of a solution. Instances of this class contain information about the solutes, solvent, and bulk properties.
Parameters: solutes : list of lists, optional
See add_solute() documentation for formatting of this list. Defaults to empty (pure solvent) if omitted
volume : str, optional
Volume of the solvent, including the unit. Defaults to ‘1 L’ if omitted. Note that the total solution volume will be computed using partial molar volumes of the respective solutes as they are added to the solution.
temperature : str, optional
The solution temperature, including the unit. Defaults to ‘25 degC’ if omitted.
pressure : Quantity, optional
The ambient pressure of the solution, including the unit. Defaults to ‘1 atm’ if omitted.
pH : number, optional
Negative log of H+ activity. If omitted, the solution will be initialized to pH 7 (neutral) with appropriate quantities of H+ and OH- ions
Returns: Solution
A Solution object.
See also
Examples
>>> s1 = pyEQL.Solution([['Na+','1 mol/L'],['Cl-','1 mol/L']],temperature='20 degC',volume='500 mL') >>> print(s1) Components: ['H2O', 'Cl-', 'H+', 'OH-', 'Na+'] Volume: 0.5 l Density: 1.0383030844030992 kg/l
Methods
add_amount
(solute, amount)Add the amount of ‘solute’ to the parent solution. add_solute
(formula, amount[, parameters])Primary method for adding substances to a pyEQL solution add_solvent
(formula, amount)Same as add_solute but omits the need to pass solvent mass to pint copy
()Return a copy of the solution get_activity
(solute)Return the thermodynamic activity of the solute in solution on the molal scale. get_activity_coefficient
(solute)Return the activity coefficient of a solute in solution. get_alkalinity
()Return the alkalinity or acid neutralizing capacity of a solution get_amount
(solute, units)Return the amount of ‘solute’ in the parent solution get_bjerrum_length
()Return the Bjerrum length of a solution get_charge_balance
()Return the charge balance of the solution. get_chemical_potential_energy
([...])Return the total chemical potential energy of a solution (not including get_conductivity
()Compute the electrical conductivity of the solution. get_debye_length
()Return the Debye length of a solution get_density
()Return the density of the solution. get_dielectric_constant
()Returns the dielectric constant of the solution. get_hardness
()Return the hardness of a solution. get_ionic_strength
()Return the ionic strength of the solution. get_lattice_distance
(solute)Calculate the average distance between molecules get_mass
()Return the total mass of the solution. get_mobility
(solute)Calculate the ionic mobility of the solute get_molar_conductivity
(solute)Calculate the molar (equivalent) conductivity for a solute get_mole_fraction
(solute)Return the mole fraction of ‘solute’ in the solution get_moles_solvent
()Return the moles of solvent present in the solution get_osmotic_coefficient
()Return the osmotic coefficient of an aqueous solution. get_osmotic_pressure
()Return the osmotic pressure of the solution relative to pure water. get_pressure
()Return the hydrostatic pressure of the solution. get_property
(solute, name)Retrieve a thermodynamic property (such as diffusion coefficient) get_salt
()Determine the predominant salt in a solution of ions. get_solute
(i)Return the specified solute object. get_solvent
()Return the solvent object. get_solvent_mass
()Return the mass of the solvent. get_temperature
()Return the temperature of the solution. get_total_amount
(element, units)Return the total amount of ‘element’ (across all solutes) in the solution. get_total_moles_solute
()Return the total moles of all solute in the solution get_transport_number
(solute[, ...])Calculate the transport number of the solute in the solution get_viscosity_dynamic
()Return the dynamic (absolute) viscosity of the solution. get_viscosity_kinematic
()Return the kinematic viscosity of the solution. get_viscosity_relative
()Return the viscosity of the solution relative to that of water get_volume
()Return the volume of the solution. get_water_activity
()Return the water activity. list_activities
([decimals])List the activity of each species in a solution. list_concentrations
([unit, decimals])List the concentration of each species in a solution. list_solutes
()List all the solutes in the solution. p
(solute[, activity])Return the negative log of the activity of solute. set_amount
(solute, amount)Set the amount of ‘solute’ in the parent solution. set_pressure
(pressure)Set the hydrostatic pressure of the solution. set_temperature
(temperature)Set the solution temperature. set_volume
(volume)Change the total solution volume to volume, while preserving -
add_amount
(solute, amount)¶ Add the amount of ‘solute’ to the parent solution.
Parameters: solute : str
String representing the name of the solute of interest
amount : str quantity
String representing the concentration desired, e.g. ‘1 mol/kg’ If the units are given on a per-volume basis, the solution volume is not recalculated If the units are given on a mass, substance, per-mass, or per-substance basis, then the solution volume is recalculated based on the new composition
Returns: Nothing. The concentration of solute is modified.
See also
Solute.add_moles
-
add_solute
(formula, amount, parameters={})¶ Primary method for adding substances to a pyEQL solution
Parameters: formula : str
Chemical formula for the solute. Charged species must contain a + or - and (for polyvalent solutes) a number representing the net charge (e.g. ‘SO4-2’).
amount : str
The amount of substance in the specified unit system. The string should contain both a quantity and a pint-compatible representation of a unit. e.g. ‘5 mol/kg’ or ‘0.1 g/L’
parameters : dictionary, optional
Dictionary of custom parameters, such as diffusion coefficients, transport numbers, etc. Specify parameters as key:value pairs separated by commas within curly braces, e.g. {diffusion_coeff:5e-10,transport_number:0.8}. The ‘key’ is the name that will be used to access the parameter, the value is its value.
-
add_solvent
(formula, amount)¶ Same as add_solute but omits the need to pass solvent mass to pint
-
copy
()¶ Return a copy of the solution
TODO - clarify whether this is a deep or shallow copy
-
get_activity
(solute)¶ Return the thermodynamic activity of the solute in solution on the molal scale.
Parameters: solute : str
String representing the name of the solute of interest
temperature : Quantity, optional
The temperature of the solution. Defaults to 25 degrees C if omitted
Returns: The thermodynamic activity of the solute in question (dimensionless)
See also
Notes
The thermodynamic activity is independent of the concentration scale used. However, the concentration and the activity coefficient must use corresponding scales. [1] [2] The ionic strength, activity coefficients, and activities are all calculated based on the molal (mol/kg) concentration scale.
References
[1] http://adsorption.org/awm/utils/Activity.htm [2] http://en.wikipedia.org/wiki/Thermodynamic_activity#Activity_coefficient
-
get_activity_coefficient
(solute)¶ Return the activity coefficient of a solute in solution.
Whenever the appropriate parameters are available, the Pitzer model [3] is used. If no Pitzer parameters are available, then the appropriate equations are selected according to the following logic: [4]
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.
Parameters: solute : str
String representing the name of the solute of interest
Returns: The molal (mol/kg) scale mean ion activity coefficient of the solute in question
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 (i.e., solutions containing more than one cation and anion), the Pitzer parameters for the predominant salt (identified using the get_salt() method) are used in conjunction with the ionic strength calculated from the complete ionic composition to calculate the activity coefficients for ions in the predominant salt.
For other ions (not in the predominant salt), the regular logic will apply. If the ionic strength of a complex mixture is lower than 0.5 m, the corresponding equations will be used to estimate the activity coefficient based on ionic strenght. However, if the ionic strength is higher than 0.5m, this method will return an activity coefficient of 1 for any ions not in the predominant salt. pyEQL will raise a WARNING when this occurs.
In using the Pitzer model for ions in the predominant salt, pyEQL calculates the “effective concentration” of the predominant salt by averaging the equivalent salt concentration of each ion, accounting for stoichiometry. This approximation is necessary to allow the Pitzer model to be applied to situations in which the ionic concentrations are unequal, or in which there is a common ion between more than one salt (e.g., NaCl and MgCl2).
This behavior is best illustrated with an example. In the solution below, the predominant salt is MgCl2. Therefore, the activity coefficient of Mg+2 is calculatd with the Pitzer model. The effective concentration of MgCl2 would be the average of 0.2 m / 1 (for Mg+2) and 0.8 / 2 (for Cl-), or 0.3 m. However, the activity coefficient for Na+ is 1 becaue the ionic strength is too high to use other methods.
References
[3] 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 [4] Stumm, Werner and Morgan, James J. Aquatic Chemistry, 3rd ed, pp 165. Wiley Interscience, 1996. Examples
>>> s1 = pyEQL.Solution([['Na+','0.2 mol/kg'],['Mg+2','0.3 mol/kg'],['Cl-','0.8 mol/kg']]) >>> s1.get_salt().formula 'MgCl2' >>> soln.get_activity_coefficient('Mg+2') <Quantity(0.4711660119505297, 'dimensionless')> >>> soln.get_activity_coefficient('Na+') (pyEQL.solution) - WARNING - Ionic strength too high to estimate activity for species Na+. Specify parameters for Pitzer model. Returning unit activity coefficient <Quantity(1, 'dimensionless')>
-
get_alkalinity
()¶ Return the alkalinity or acid neutralizing capacity of a solution
Returns: Quantity :
The alkalinity of the solution in mg/L as CaCO3
Notes
The alkalinity is calculated according to: [5]
\[Alk = F \sum_i z_i C_B - \sum_i z_i C_A\]Where \(C_B\) and \(C_A\) are conservative cations and anions, respectively (i.e. ions that do not participate in acid-base reactions), and \(z_i\) is their charge. In this method, the set of conservative cations is all Group I and Group II cations, and the conservative anions are all the anions of strong acids.
References
[5] Stumm, Werner and Morgan, James J. Aquatic Chemistry, 3rd ed, pp 165. Wiley Interscience, 1996.
-
get_amount
(solute, units)¶ Return the amount of ‘solute’ in the parent solution
Parameters: solute : str
String representing the name of the solute of interest
units : str
Units desired for the output. Examples of valid units are ‘mol/L’,’mol/kg’,’mol’, ‘kg’, and ‘g/L’ Use ‘fraction’ to return the mole fraction.
Returns: The amount of the solute in question, in the specified units
See also
-
get_bjerrum_length
()¶ Return the Bjerrum length of a solution
Bjerrum length representes the distance at which electrostatic interactions between particles become comparable in magnitude to the thermal energy.:math:lambda_B is calculated as [6]
\[\lambda_B = {e^2 \over (4 \pi \epsilon_r \epsilon_o k_B T)}\]where \(e\) is the fundamental charge, \(epsilon_r\) and \(epsilon_r\) are the relative permittivity and vacuum permittivity, \(k_B\) is the Boltzmann constant, and \(T\) is the temperature.
Parameters: None
Returns: Quantity
The Bjerrum length, in nanometers.
See also
References
[6] https://en.wikipedia.org/wiki/Bjerrum_length Examples
>>> s1 = pyEQL.Solution() >>> s1.get_bjerrum_length() <Quantity(0.7152793009386953, 'nanometer')>
-
get_charge_balance
()¶ Return the charge balance of the solution.
Return the charge balance of the solution. The charge balance represents the net electric charge on the solution and SHOULD equal zero at all times, but due to numerical errors will usually have a small nonzero value.
Returns: float :
The charge balance of the solution, in equivalents.
Notes
The charge balance is calculated according to:
\[CB = F \sum_i n_i z_i\]Where \(n_i\) is the number of moles, \(z_i\) is the charge on species i, and \(F\) is the Faraday constant.
-
get_chemical_potential_energy
(activity_correction=True)¶ Return the total chemical potential energy of a solution (not including pressure or electric effects)
Parameters: activity_correction : bool, optional
If True, activities will be used to calculate the true chemical potential. If False, mole fraction will be used, resulting in a calculation of the ideal chemical potential.
Returns: Quantity
The actual or ideal chemical potential energy of the solution, in Joules.
Notes
The chemical potential energy (related to the Gibbs mixing energy) is calculated as follows: [7]
\[E = R T \sum_i n_i \ln a_i\]or
\[E = R T \sum_i n_i \ln x_i\]Where \(n\) is the number of moles of substance, \(T\) is the temperature in kelvin, \(R\) the ideal gas constant, \(x\) the mole fraction, and \(a\) the activity of each component.
Note that dissociated ions must be counted as separate components, so a simple salt dissolved in water is a three component solution (cation, anion, and water).
References
[7] Koga, Yoshikata, 2007. Solution Thermodynamics and its Application to Aqueous Solutions: A differential approach. Elsevier, 2007, pp. 23-37.
-
get_conductivity
()¶ Compute the electrical conductivity of the solution.
Parameters: None
Returns: Quantity
The electrical conductivity of the solution in Siemens / meter.
Notes
Conductivity is calculated by summing the molar conductivities of the respective solutes, but they are activity-corrected and adjusted using an empricial exponent. This approach is used in PHREEQC and Aqion models [8] [9]
\[EC = {F^2 \over R T} \sum_i D_i z_i ^ 2 \gamma_i ^ {\alpha} m_i\]Where:
\[\begin{split}\alpha = \begin{cases} {0.6 \over \sqrt{|z_i|}} & {I < 0.36|z_i|} \\ {\sqrt{I} \over |z_i|} & otherwise \end{cases}\end{split}\]Note: PHREEQC uses the molal rather than molar concentration according to http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc/phreeqc3-html/phreeqc3-43.htm
References
[8] http://www.aqion.de/site/77 [9] http://www.hydrochemistry.eu/exmpls/sc.html
-
get_debye_length
()¶ Return the Debye length of a solution
Debye length is calculated as [10]
\[\kappa^{-1} = \sqrt({\epsilon_r \epsilon_o k_B T \over (2 N_A e^2 I)})\]where \(I\) is the ionic strength, \(epsilon_r\) and \(epsilon_r\) are the relative permittivity and vacuum permittivity, \(k_B\) is the Boltzmann constant, and \(T\) is the temperature, \(e\) is the elementary charge, and \(N_A\) is Avogadro’s number.
Parameters: None
Returns: Quantity
The Debye length, in nanometers.
See also
References
[10] https://en.wikipedia.org/wiki/Debye_length#Debye_length_in_an_electrolyte
-
get_density
()¶ Return the density of the solution.
Density is calculated from the mass and volume each time this method is called.
Returns: Quantity: The density of the solution.
-
get_dielectric_constant
()¶ Returns the dielectric constant of the solution.
Parameters: None Returns: Quantity: the dielectric constant of the solution, dimensionless. Notes
Implements the following equation as given by [11]
\[\epsilon = \epsilon_solvent \over 1 + \sum_i \alpha_i x_i\]where \(\alpha_i\) is a coefficient specific to the solvent and ion, and \(x_i\) is the mole fraction of the ion in solution.
References
[11] [1] A. Zuber, L. Cardozo-Filho, V.F. Cabral, R.F. Checoni, M. Castier, An empirical equation for the dielectric constant in aqueous and nonaqueous electrolyte mixtures, Fluid Phase Equilib. 376 (2014) 116–123. doi:10.1016/j.fluid.2014.05.037.
-
get_hardness
()¶ Return the hardness of a solution.
Hardness is defined as the sum of the equivalent concentrations of multivalent cations as calcium carbonate.
NOTE: at present pyEQL cannot distinguish between mg/L as CaCO3 and mg/L units. Use with caution.
Parameters: None
Returns: Quantity
The hardness of the solution in mg/L as CaCO3
-
get_ionic_strength
()¶ Return the ionic strength of the solution.
Return the ionic strength of the solution, calculated as 1/2 * sum ( molality * charge ^2) over all the ions. Molal (mol/kg) scale concentrations are used for compatibility with the activity correction formulas.
Returns: Quantity :
The ionic strength of the parent solution, mol/kg.
See also
Notes
The ionic strength is calculated according to:
\[I = \sum_i m_i z_i^2\]Where \(m_i\) is the molal concentration and \(z_i\) is the charge on species i.
Examples
>>> s1 = pyEQL.Solution([['Na+','0.2 mol/kg'],['Cl-','0.2 mol/kg']]) >>> s1.get_ionic_strength() <Quantity(0.20000010029672785, 'mole / kilogram')>
>>> s1 = pyEQL.Solution([['Mg+2','0.3 mol/kg'],['Na+','0.1 mol/kg'],['Cl-','0.7 mol/kg']],temperature='30 degC') >>> s1.get_ionic_strength() <Quantity(1.0000001004383303, 'mole / kilogram')>
-
get_lattice_distance
(solute)¶ Calculate the average distance between molecules
Calculate the average distance between molecules of the given solute, assuming that the molecules are uniformly distributed throughout the solution.
Parameters: solute : str
String representing the name of the solute of interest
Returns: Quantity : The average distance between solute molecules
Notes
The lattice distance is related to the molar concentration as follows:
\[d = ( C_i N_A ) ^ {-{1\over3}}\]Examples
>>> soln = Solution([['Na+','0.5 mol/kg'],['Cl-','0.5 mol/kg']]) >>> soln.get_lattice_distance('Na+') 1.492964.... nanometer
-
get_mass
()¶ Return the total mass of the solution.
The mass is calculated each time this method is called. Parameters ———- None
Returns: Quantity: the mass of the solution, in kg
-
get_mobility
(solute)¶ Calculate the ionic mobility of the solute
Parameters: solute : str
String identifying the solute for which the mobility is to be calculated.
Returns: float : The ionic mobility. Zero if the solute is not charged.
Notes
This function uses the Einstein relation to convert a diffusion coefficient into an ionic mobility [12]
\[\mu_i = {F |z_i| D_i \over RT}\]References
[12] Smedley, Stuart I. The Interpretation of Ionic Conductivity in Liquids. Plenum Press, 1980.
-
get_molar_conductivity
(solute)¶ Calculate the molar (equivalent) conductivity for a solute
Parameters: solute : str
String identifying the solute for which the molar conductivity is to be calculated.
Returns: float
The molar or equivalent conductivity of the species in the solution. Zero if the solute is not charged.
Notes
Molar conductivity is calculated from the Nernst-Einstein relation [13]
\[\kappa_i = {z_i^2 D_i F^2 \over RT}\]Note that the diffusion coefficient is strongly variable with temperature.
References
[13] Smedley, Stuart. The Interpretation of Ionic Conductivity in Liquids, pp 1-9. Plenum Press, 1980. Examples
TODO
-
get_mole_fraction
(solute)¶ Return the mole fraction of ‘solute’ in the solution
Parameters: solute : str
String representing the name of the solute of interest
Returns: float
The mole fraction of ‘solute’ in the parent Solution object
See also
Notes
This function assumes water is the solvent with MW = 18
Examples
TODO
-
get_moles_solvent
()¶ Return the moles of solvent present in the solution
Parameters: None
Returns: Quantity
The moles of solvent in the solution.
-
get_osmotic_coefficient
()¶ Return the osmotic coefficient of an aqueous solution.
Osmotic coefficient is calculated using the Pitzer model.[#]_ If appropriate parameters for the model are not available, then pyEQL raises a WARNING and returns an osmotic coefficient of 1.
Returns: Quantity :
The osmotic coefficient
See also
Notes
For multicomponent mixtures (i.e., solutions containing more than one cation and anion), the Pitzer parameters for the predominant salt (identified using the get_salt() method) are used in conjunction with the ionic strength calculated from the complete ionic composition to calculate the osmotic coefficient.
In using the Pitzer model for ions in the predominant salt, pyEQL calculates the “effective concentration” of the predominant salt by averaging the equivalent salt concentration of each ion, accounting for stoichiometry. This approximation is necessary to allow the Pitzer model to be applied to situations in which the ionic concentrations are unequal, or in which there is a common ion between more than one salt (e.g., NaCl and MgCl2).
This behavior is best illustrated with an example. In the solution below, the predominant salt is MgCl2. Therefore, the activity coefficient of Mg+2 is calculatd with the Pitzer model. The effective concentration of MgCl2 would be the average of 0.2 m / 1 (for Mg+2) and 0.8 / 2 (for Cl-), or 0.3 m. However, the activity coefficient for Na+ is 1 becaue the ionic strength is too high to use other methods
In the third example below, the predominant salt is MgCl2. Therefore, the Pitzer parameters for MgCl2 are used to calculate the osmotic coefficient. The effective concentration of MgCl2 would be the average of 0.2 m / 1 (for Mg+2) and 0.8 / 2 (for Cl-), or 0.3 m. Compare the result to the second example, in which only MgCl2 is present and the salt concentration is also 0.3m. The slightly higher ionic strength due to the presence of the sodium ions changes the value of the osmotic coefficient.
References
[14] 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 Examples
>>> s1 = pyEQL.Solution([['Na+','0.2 mol/kg'],['Cl-','0.2 mol/kg']]) >>> s1.get_osmotic_coefficient() <Quantity(0.9235996615888572, 'dimensionless')>
>>> s1 = pyEQL.Solution([['Mg+2','0.3 mol/kg'],['Cl-','0.6 mol/kg']],temperature='30 degC') >>> s1.get_osmotic_coefficient() <Quantity(0.891154788474231, 'dimensionless')>
>>> s1 = pyEQL.Solution([['Na+','0.2 mol/kg'],['Mg+2','0.3 mol/kg'],['Cl-','0.8 mol/kg']]) >>> s1.get_salt().formula 'MgCl2' >>> s1.get_osmotic_coefficient() <Quantity(0.8974036010550355, 'dimensionless')>
-
get_osmotic_pressure
()¶ Return the osmotic pressure of the solution relative to pure water.
Parameters: None
Returns: Quantity
The osmotic pressure of the solution relative to pure water in Pa
See also
Notes
Osmotic pressure is calculated based on the water activity [14] [15] :
\[\Pi = {RT \over V_w} \ln a_w\]Where \(\Pi\) is the osmotic pressure, \(V_w\) is the partial molar volume of water (18.2 cm**3/mol), and \(a_w\) is the water activity.
References
[15] Sata, Toshikatsu. Ion Exchange Membranes: Preparation, Characterization, and Modification. Royal Society of Chemistry, 2004, p. 10. [16] http://en.wikipedia.org/wiki/Osmotic_pressure#Derivation_of_osmotic_pressure Examples
>>> s1=pyEQL.Solution() >>> s1.get_osmotic_pressure() 0.0
>>> s1 = pyEQL.Solution([['Na+','0.2 mol/kg'],['Cl-','0.2 mol/kg']]) >>> soln.get_osmotic_pressure() <Quantity(906516.7318131207, 'pascal')>
-
get_pressure
()¶ Return the hydrostatic pressure of the solution.
Returns: Quantity: The hydrostatic pressure of the solution, in atm.
-
get_property
(solute, name)¶ Retrieve a thermodynamic property (such as diffusion coefficient) for solute, and adjust it from the reference conditions to the conditions of the solution
Parameters: solute: str
String representing the chemical formula of the solute species
name: str
The name of the property needed, e.g. ‘diffusion coefficient’
Returns: Quantity: The desired parameter
-
get_salt
()¶ Determine the predominant salt in a solution of ions.
Many empirical equations for solution properties such as activity coefficient, partial molar volume, or viscosity are based on the concentration of single salts (e.g., NaCl). When multiple ions are present (e.g., a solution containing Na+, Cl-, and Mg+2), it is generally not possible to direclty model these quantities. pyEQL works around this problem by treating such solutions as single salt solutions.
The get_salt() method examines the ionic composition of a solution and returns an object that identifies the single most predominant salt in the solution, defined by the cation and anion with the highest mole fraction. The Salt object contains information about the stoichiometry of the salt to enable its effective concentration to be calculated (e.g., 1 M MgCl2 yields 1 M Mg+2 and 2 M Cl-).
Parameters: None
Returns: Salt
Salt object containing information about the parent salt.
See also
get_activity
,get_activity_coefficient
,get_water_activity
,get_osmotic_coefficient
,get_osmotic_pressure
,get_viscosity_kinematic
Examples
>>> s1 = Solution([['Na+','0.5 mol/kg'],['Cl-','0.5 mol/kg']]) >>> s1.get_salt() <pyEQL.salt_ion_match.Salt object at 0x7fe6d3542048> >>> s1.get_salt().formula 'NaCl' >>> s1.get_salt().nu_cation 1 >>> s1.get_salt().z_anion -1
>>> s2 = pyEQL.Solution([['Na+','0.1 mol/kg'],['Mg+2','0.2 mol/kg'],['Cl-','0.5 mol/kg']]) >>> s2.get_salt().formula 'MgCl2' >>> s2.get_salt().nu_anion 2 >>> s2.get_salt().z_cation 2
-
get_solute
(i)¶ Return the specified solute object.
-
get_solvent
()¶ Return the solvent object.
-
get_solvent_mass
()¶ Return the mass of the solvent.
This method is used whenever mol/kg (or similar) concentrations are requested by get_amount()
Parameters: None Returns: Quantity: the mass of the solvent, in kg See also
-
get_temperature
()¶ Return the temperature of the solution.
Parameters: None Returns: Quantity: The temperature of the solution, in Kelvin.
-
get_total_amount
(element, units)¶ Return the total amount of ‘element’ (across all solutes) in the solution.
Parameters: element : str
String representing the name of the element of interest
units : str
Units desired for the output. Examples of valid units are ‘mol/L’,’mol/kg’,’mol’, ‘kg’, and ‘g/L’
Returns: The total amount of the element in the solution, in the specified units
See also
Notes
There is currently no way to distinguish between different oxidation states of the same element (e.g. TOTFe(II) vs. TOTFe(III)). This is planned for a future release. (TODO)
-
get_total_moles_solute
()¶ Return the total moles of all solute in the solution
-
get_transport_number
(solute, activity_correction=False)¶ Calculate the transport number of the solute in the solution
Parameters: solute : str
String identifying the solute for which the transport number is to be calculated.
activity_correction: bool
If True, the transport number will be corrected for activity following the same method used for solution conductivity. Defaults to False if omitted.
Returns: float
The transport number of solute
Notes
Transport number is calculated according to [16] :
\[t_i = {D_i z_i^2 C_i \over \sum D_i z_i^2 C_i}\]Where \(C_i\) is the concentration in mol/L, \(D_i\) is the diffusion coefficient, and \(z_i\) is the charge, and the summation extends over all species in the solution.
If activity_correction is True, the contribution of each ion to the transport number is corrected with an activity factor. See the documentation for get_conductivity() for an explanation of this correction.
References
[17] Geise, G. M.; Cassady, H. J.; Paul, D. R.; Logan, E.; Hickner, M. A. “Specific ion effects on membrane potential and the permselectivity of ion exchange membranes.”” Phys. Chem. Chem. Phys. 2014, 16, 21673–21681.
-
get_viscosity_dynamic
()¶ Return the dynamic (absolute) viscosity of the solution.
Calculated from the kinematic viscosity
-
get_viscosity_kinematic
()¶ Return the kinematic viscosity of the solution.
See also
Notes
The calculation is based on a model derived from the Eyring equation and presented in [17]
\[\ln \nu = \ln {\nu_w MW_w \over \sum_i x_i MW_i } + 15 x_+^2 + x_+^3 \delta G^*_{123} + 3 x_+ \delta G^*_{23} (1-0.05x_+)\]Where:
\[\delta G^*_{123} = a_o + a_1 (T)^{0.75}\]\[\delta G^*_{23} = b_o + b_1 (T)^{0.5}\]In which :math: nu is the kinematic viscosity, MW is the molecular weight, x_+ is the mole fraction of cations, and T is the temperature in degrees C.
The a and b fitting parameters for a variety of common salts are included in the database.
References
[18] Vásquez-Castillo, G.; Iglesias-Silva, G. a.; Hall, K. R. An extension of the McAllister model to correlate kinematic viscosity of electrolyte solutions. Fluid Phase Equilib. 2013, 358, 44–49.
-
get_viscosity_relative
()¶ Return the viscosity of the solution relative to that of water
This is calculated using a simplified form of the Jones-Dole equation:
\[\eta_{rel} = 1 + \sum_i B_i m_i\]Where \(m\) is the molal concentration and \(B\) is an empirical parameter.
See <http://downloads.olisystems.com/ResourceCD/TransportProperties/Viscosity-Aqueous.pdf> <http://www.nrcresearchpress.com/doi/pdf/10.1139/v77-148> <http://apple.csgi.unifi.it/~fratini/chen/pdf/14.pdf>
-
get_volume
()¶ Return the volume of the solution.
Parameters: None Returns: Quantity: the volume of the solution, in L
-
get_water_activity
()¶ Return the water activity.
Returns: Quantity :
The thermodynamic activity of water in the solution.
See also
Notes
Water activity is related to the osmotic coefficient in a solution containing i solutes by: [18]
\[\ln a_w = - \Phi M_w \sum_i m_i\]Where \(M_w\) is the molar mass of water (0.018015 kg/mol) and \(m_i\) is the molal concentration of each species.
If appropriate Pitzer model parameters are not available, the water activity is assumed equal to the mole fraction of water.
References
[19] Blandamer, Mike J., Engberts, Jan B. F. N., Gleeson, Peter T., Reis, Joao Carlos R., 2005. “Activity of water in aqueous systems: A frequently neglected property.” Chemical Society Review 34, 440-458.
Examples
>>> s1 = pyEQL.Solution([['Na+','0.3 mol/kg'],['Cl-','0.3 mol/kg']]) >>> s1.get_water_activity() <Quantity(0.9900944932888518, 'dimensionless')>
-
list_activities
(decimals=4)¶ List the activity of each species in a solution.
Parameters: decimals: int
The number of decimal places to display. Defaults to 4.
Returns: dict
Dictionary containing a list of the species in solution paired with their activity
-
list_concentrations
(unit='mol/kg', decimals=4)¶ List the concentration of each species in a solution.
Parameters: unit: str
String representing the desired concentration unit.
decimals: int
The number of decimal places to display. Defaults to 4.
Returns: dict
Dictionary containing a list of the species in solution paired with their amount in the specified units
-
list_solutes
()¶ List all the solutes in the solution.
-
p
(solute, activity=True)¶ Return the negative log of the activity of solute.
Generally used for expressing concentration of hydrogen ions (pH)
Parameters: solute : str
String representing the formula of the solute
activity: bool, optional
If False, the function will use the molar concentration rather than the activity to calculate p. Defaults to True.
Returns: Quantity
The negative log10 of the activity (or molar concentration if activity = False) of the solute.
Examples
TODO
-
set_amount
(solute, amount)¶ Set the amount of ‘solute’ in the parent solution.
Parameters: solute : str
String representing the name of the solute of interest
amount : str Quantity
String representing the concentration desired, e.g. ‘1 mol/kg’ If the units are given on a per-volume basis, the solution volume is not recalculated and the molar concentrations of other components in the solution are not altered, while the molal concentrations are modified.
If the units are given on a mass, substance, per-mass, or per-substance basis, then the solution volume is recalculated based on the new composition and the molal concentrations of other components are not altered, while the molar concentrations are modified.
Returns: Nothing. The concentration of solute is modified.
See also
Solute.set_moles
-
set_pressure
(pressure)¶ Set the hydrostatic pressure of the solution.
Parameters: pressure : str
String representing the temperature, e.g. ‘25 degC’
-
set_temperature
(temperature)¶ Set the solution temperature.
Parameters: temperature : str
String representing the temperature, e.g. ‘25 degC’
-
set_volume
(volume)¶ Change the total solution volume to volume, while preserving all component concentrations
Parameters: volume : str quantity
Total volume of the solution, including the unit, e.g. ‘1 L’
Examples
>>> mysol = Solution([['Na+','2 mol/L'],['Cl-','0.01 mol/L']],volume='500 mL') >>> print(mysol.get_volume()) 0.5000883925072983 l >>> mysol.list_concentrations() {'H2O': '55.508435061791985 mol/kg', 'Cl-': '0.00992937605907076 mol/kg', 'Na+': '2.0059345573880325 mol/kg'} >>> mysol.set_volume('200 mL') >>> print(mysol.get_volume()) 0.2 l >>> mysol.list_concentrations() {'H2O': '55.50843506179199 mol/kg', 'Cl-': '0.00992937605907076 mol/kg', 'Na+': '2.0059345573880325 mol/kg'}
-