Mixing Functions¶
pyEQL
contains several mixing and equilibration functions that take Solution
as arguments.
pyEQL functions that take Solution objects as inputs or return Solution objects.
- copyright:
2013-2024 by Ryan S. Kingsbury
- license:
LGPL, see LICENSE for more details.
- pyEQL.functions.gibbs_mix(solution1: Solution, solution2: Solution, activity_correction: bool = True)[source]¶
Return the Gibbs energy change associated with mixing two solutions.
- Parameters:
solution1 – a solution to be mixed.
solution2 – a solution to be mixed.
activity_correction – bool, optional If True, activities will be used to calculate the true energy of mixing. If False, mole fraction will be used, resulting in a calculation of the ideal energy of mixing (i.e., \(\Delta_{mix} S \times T\) )
- Returns:
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_{true} = \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}\]or
\[\Delta_{mix} G_{ideal} = \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, \(a\) is the activity of solute \(i\), \(x\) is the mole fraction of solute \(i\), 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
- Koga, Yoshikata, 2007. Solution Thermodynamics and its Application to Aqueous Solutions:
A differential approach. Elsevier, 2007, pp. 23-37.
- pyEQL.functions.entropy_mix(solution1: Solution, solution2: Solution)[source]¶
Return the ideal mixing entropy associated with mixing two solutions.
- Parameters:
solution1 – The two solutions to be mixed.
solution2 – The two solutions to be mixed.
- Returns:
The ideal mixing entropy associated with complete mixing of the Solutions, in Joules per Kelvin.
Notes
The ideal entropy of mixing is calculated as follows
\[\Delta_{mix} S = \sum_i {(n_c + n_d) R \ln x_b} - \sum_i {n_c R \ln x_c} - \sum_i {n_d R \ln x_d}\]Where \(n\) is the number of moles of substance, \(T\) is the temperature in kelvin, \(x\) is the mole fraction of solute \(i\), 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
- Koga, Yoshikata, 2007. *Solution Thermodynamics and its Application to Aqueous Solutions:
A differential approach.* Elsevier, 2007, pp. 23-37.
- pyEQL.functions.donnan_eql(solution: Solution, fixed_charge: str)[source]¶
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:
A Solution that has established Donnan equilibrium with the external (input) Solution
Notes
The general equation representing the equilibrium between an external electrolyte solution and an ion-exchange medium containing fixed charges is
\[\big(\frac{a_{-}}{\bar a_{-}} \big)^{(\frac{1}{z_{-}})} \big(\frac{\bar a_{+}}{a_{+}}\big)^{(\frac{1}{z_{+}})} =\exp \big(\frac{\Delta \pi \bar V}{RT z_{+} \nu_{+}}\big)\]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
- Strathmann, Heiner, ed. Membrane Science and Technology vol. 9, 2004. Chapter 2, p. 51.
See also
get_salt()