Functions Module¶
pyEQL functions that take Solution objects as inputs or return Solution objects
copyright: | 2013-2016 by Ryan S. Kingsbury |
---|---|
license: | LGPL, see LICENSE for more details. |
-
pyEQL.functions.
autogenerate
(solution='')¶ This method provides a quick way to create Solution objects representing commonly-encountered solutions, such as seawater, rainwater, and wastewater.
Parameters: solution : str
String representing the desired solution Valid entries are ‘seawater’, ‘rainwater’, ‘wastewater’,and ‘urine’
Returns: Solution
A pyEQL Solution object.
Notes
The following sections explain the different solution options:
- ‘’ - empty solution, equivalent to pyEQL.Solution()
- ‘rainwater’ - pure water in equilibrium with atmospheric CO2 at pH 6
- ‘seawater’ - Standard Seawater. See Table 4 of the Reference for Composition [1]
- ‘wastewater’ - medium strength domestic wastewater. See Table 3-18 of [2]
- ‘urine’ - typical human urine. See Table 3-15 of [3]
References
[1] Millero, Frank J. “The composition of Standard Seawater and the definition of the Reference-Composition Salinity Scale.” Deep-sea Research. Part I 55(1), 2008, 50-72. [2] Metcalf & Eddy, Inc. et al. Wastewater Engineering: Treatment and Resource Recovery, 5th Ed. McGraw-Hill, 2013.
-
pyEQL.functions.
donnan_eql
(solution, fixed_charge)¶ Return a solution object in equilibrium with fixed_charge
Parameters: Solution : Solution object
The external solution to be brought into equilibrium with the fixed charges
fixed_charge : str quantity
String representing the concentration of fixed charges, including sign. May be specified in mol/L or mol/kg units. e.g. ‘1 mol/kg’
Returns: Solution
A solution that has established Donnan equilibrium with the external (input) Solution
See also
get_salt
Notes
The general equation representing the equilibrium between an external electrolyte solution and an ion-exchange medium containing fixed charges is:[4]
\[{a_- \over \bar a_-}^{1 \over z_-} {\bar a_+ \over a_+}^{1 \over z_+} = exp({\Delta \pi \bar V \over {RT z_+ \nu_+}})\]Where subscripts \(+\) and \(-\) indicate the cation and anion, respectively, the overbar indicates the membrane phase, \(a\) represents activity, \(z\) represents charge, \(\nu\) represents the stoichiometric coefficient, \(V\) represents the partial molar volume of the salt, and \(\Delta \pi\) is the difference in osmotic pressure between the membrane and the solution phase.
In addition, electroneutrality must prevail within the membrane phase:
\[\bar C_+ z_+ + \bar X + \bar C_- z_- = 0\]Where \(C\) represents concentration and \(X\) is the fixed charge concentration in the membrane or ion exchange phase.
This function solves these two equations simultaneously to arrive at the concentrations of the cation and anion in the membrane phase. It returns a solution equal to the input solution except that the concentrations of the predominant cation and anion have been adjusted according to this equilibrium.
NOTE that this treatment is only capable of equilibrating a single salt. This salt is identified by the get_salt() method.
References
[3] Strathmann, Heiner, ed. Membrane Science and Technology vol. 9, 2004. Chapter 2, p. 51. http://dx.doi.org/10.1016/S0927-5193(04)80033-0 Examples
TODO
-
pyEQL.functions.
entropy_mix
(Solution1, Solution2)¶ Return the ideal mixing entropy associated with mixing two solutions
Parameters: Solution1, Solution2 : Solution objects
The two solutions to be mixed.
Returns: Quantity
The ideal mixing entropy associated with complete mixing of the Solutions, in Joules.
Notes
The ideal entropy of mixing is calculated as follows:[5]
\[\Delta_{mix} S = \sum_i (n_c + n_d) R T \ln x_b - \sum_i n_c R T \ln x_c - \sum_i n_d R T \ln x_d\]Where \(n\) is the number of moles of substance, \(T\) is the temperature in kelvin, and subscripts \(b\), \(c\), and \(d\) refer to the concentrated, dilute, and blended Solutions, respectively.
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
[4] Koga, Yoshikata, 2007. Solution Thermodynamics and its Application to Aqueous Solutions: A differential approach. Elsevier, 2007, pp. 23-37.
-
pyEQL.functions.
gibbs_mix
(Solution1, Solution2)¶ Return the Gibbs energy change associated with mixing two solutions.
Parameters: Solution1, Solution2 : Solution objects
The two solutions to be mixed.
Returns: Quantity
The change in Gibbs energy associated with complete mixing of the Solutions, in Joules.
Notes
The Gibbs energy of mixing is calculated as follows: [#]_
\[\Delta_{mix} G = \sum_i (n_c + n_d) R T \ln a_b - \sum_i n_c R T \ln a_c - \sum_i n_d R T \ln a_d\]Where \(n\) is the number of moles of substance, \(T\) is the temperature in kelvin, and subscripts \(b\), \(c\), and \(d\) refer to the concentrated, dilute, and blended Solutions, respectively.
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
[5] Koga, Yoshikata, 2007. Solution Thermodynamics and its Application to Aqueous Solutions: A differential approach. Elsevier, 2007, pp. 23-37.
-
pyEQL.functions.
mix
(Solution1, Solution2)¶ Mix two solutions together
Returns a new Solution object that results from the mixing of Solution1 and Solution2
Parameters: Solution1, Solution2 : Solution objects
The two solutions to be mixed.
Returns: Solution
A Solution object representing the mixed solution.