|
15 | 15 | import math
|
16 | 16 |
|
17 | 17 | from iapws import IAPWS95
|
| 18 | +from pint import Quantity |
18 | 19 |
|
19 |
| -# the pint unit registry |
20 | 20 | from pyEQL import ureg
|
21 | 21 | from pyEQL.logging_system import logger
|
22 | 22 |
|
23 | 23 |
|
24 |
| -def _debye_parameter_B(temperature="25 degC"): |
| 24 | +def _debye_parameter_B(temperature: str = "25 degC") -> Quantity: |
25 | 25 | """
|
26 | 26 | Return the constant B used in the extended Debye-Huckel equation.
|
27 | 27 |
|
28 |
| - Parameters |
29 |
| - ---------- |
30 |
| - temperature : str Quantity, optional |
31 |
| - String representing the temperature of the solution. Defaults to '25 degC' if not specified. |
| 28 | + Args: |
| 29 | + temperature: The temperature of the solution at which to calculate the constant. |
| 30 | + Defaults to '25 degC'. |
32 | 31 |
|
33 |
| - Notes |
34 |
| - ----- |
35 |
| - The parameter B is equal to: |
| 32 | + Returns: |
| 33 | + The parameter B for use in extended Debye-Huckel equation (base e). For base 10, |
| 34 | + divide the resulting value by 2.303. Note that A is often given in base 10 terms |
| 35 | + in older textbooks and reference material (0.3281 at 25 degC). |
36 | 36 |
|
37 |
| - .. math:: B = ( {8 \\pi N_A e^2 \\over 1000 \\epsilon k T} ) ^ {1 \\over 2} |
| 37 | + Notes: |
| 38 | + The parameter B is equal to: |
38 | 39 |
|
39 |
| - References |
40 |
| - ---------- |
41 |
| - Bockris and Reddy. /Modern Electrochemistry/, vol 1. Plenum/Rosetta, 1977, p.210. |
| 40 | + .. math:: B = ( \\frac{{2 N_A \\rho_w e^2}{\\epsilon_o \\epsilon_r k T}) ^ {1 \\over 2} |
42 | 41 |
|
43 |
| - Examples: |
44 |
| - -------- |
45 |
| - >>> _debye_parameter_B() #doctest: +ELLIPSIS |
46 |
| - 0.3291... |
| 42 | + References: |
| 43 | + Bockris and Reddy. /Modern Electrochemistry/, vol 1. Plenum/Rosetta, 1977, p.210. |
| 44 | +
|
| 45 | + Archer, Donald G. and Wang, Peiming. "The Dielectric Constant of Water \ |
| 46 | + and Debye-Huckel Limiting Law Slopes." /J. Phys. Chem. Ref. Data/ 19(2), 1990. |
47 | 47 |
|
| 48 | + https://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Physical_Chemistry_(LibreTexts)/25%3A_Solutions_II_-_Nonvolatile_Solutes/25.06%3A_The_Debye-Huckel_Theory |
| 49 | +
|
| 50 | + https://en.wikipedia.org/wiki/Debye%E2%80%93H%C3%BCckel_equation |
48 | 51 | """
|
49 | 52 | water_substance = IAPWS95(
|
50 |
| - T=ureg.Quantity(temperature).magnitude, |
| 53 | + T=ureg.Quantity(temperature).to("K").magnitude, |
51 | 54 | P=ureg.Quantity("1 atm").to("MPa").magnitude,
|
52 | 55 | )
|
53 | 56 |
|
54 | 57 | param_B = (
|
55 |
| - 8 |
56 |
| - * math.pi |
| 58 | + 2 |
57 | 59 | * ureg.N_A
|
| 60 | + * ureg.Quantity(water_substance.rho, "g/L") |
58 | 61 | * ureg.elementary_charge**2
|
59 |
| - / ( |
60 |
| - water_substance.mu |
61 |
| - * ureg.Quantity("1 g/L") # in g/L |
62 |
| - * ureg.epsilon_0 |
63 |
| - * water_substance.epsilon |
64 |
| - * ureg.boltzmann_constant |
65 |
| - * ureg.Quantity(temperature) |
66 |
| - ) |
| 62 | + / (ureg.epsilon_0 * water_substance.epsilon * ureg.boltzmann_constant * ureg.Quantity(temperature)) |
67 | 63 | ) ** 0.5
|
68 | 64 | return param_B.to_base_units()
|
69 | 65 |
|
70 | 66 |
|
71 |
| -def _debye_parameter_activity(temperature="25 degC"): |
| 67 | +def _debye_parameter_activity(temperature: str = "25 degC") -> "Quantity": |
72 | 68 | """
|
73 |
| - Return the constant A for use in the Debye-Huckel limiting law (base 10). |
| 69 | + Return the constant A for use in the Debye-Huckel limiting law (base e). |
74 | 70 |
|
75 |
| - Parameters |
76 |
| - ---------- |
77 |
| - temperature : str Quantity, optional |
78 |
| - String representing the temperature of the solution. Defaults to '25 degC' if not specified. |
| 71 | + Args: |
| 72 | + temperature: The temperature of the solution at which to calculate the constant. |
| 73 | + Defaults to '25 degC'. |
79 | 74 |
|
80 |
| - Returns |
81 |
| - ------- |
82 |
| - Quantity The parameter A for use in the Debye-Huckel limiting law (base e) |
| 75 | + Returns: |
| 76 | + The parameter A for use in the Debye-Huckel limiting law (base e). For base 10, |
| 77 | + divide the resulting value by 2.303. Note that A is often given in base 10 terms |
| 78 | + in older textbooks and reference material (0.509 at 25 degC). |
83 | 79 |
|
84 |
| - Notes |
85 |
| - ----- |
86 |
| - The parameter A is equal to: |
| 80 | + Notes: |
| 81 | + The parameter A is equal to: |
87 | 82 |
|
88 |
| - .. math:: |
89 |
| - A^{\\gamma} = {e^3 ( 2 \\pi N_A {\\rho})^{0.5} \\over (4 \\pi \\epsilon_o \\epsilon_r k T)^{1.5}} |
| 83 | + .. math:: |
| 84 | + A^{\\gamma} = {e^3 ( 2 \\pi N_A {\\rho})^{0.5} \\over (4 \\pi \\epsilon_o \\epsilon_r k T)^{1.5}} |
90 | 85 |
|
91 |
| - Note that this equation returns the parameter value that can be used to calculate |
92 |
| - the natural logarithm of the activity coefficient. For base 10, divide the |
93 |
| - value returned by 2.303. The value is often given in base 10 terms (0.509 at |
94 |
| - 25 degC) in older textbooks. |
| 86 | + Note that this equation returns the parameter value that can be used to calculate |
| 87 | + the natural logarithm of the activity coefficient. For base 10, divide the |
| 88 | + value returned by 2.303. |
95 | 89 |
|
96 |
| - References |
97 |
| - ---------- |
98 |
| - Archer, Donald G. and Wang, Peiming. "The Dielectric Constant of Water \ |
99 |
| - and Debye-Huckel Limiting Law Slopes." /J. Phys. Chem. Ref. Data/ 19(2), 1990. |
| 90 | + References: |
| 91 | + Archer, Donald G. and Wang, Peiming. "The Dielectric Constant of Water \ |
| 92 | + and Debye-Huckel Limiting Law Slopes." /J. Phys. Chem. Ref. Data/ 19(2), 1990. |
100 | 93 |
|
101 |
| - Examples: |
102 |
| - -------- |
103 |
| - >>> _debye_parameter_activity() #doctest: +ELLIPSIS |
104 |
| - 1.17499... |
| 94 | + https://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Physical_Chemistry_(LibreTexts)/25%3A_Solutions_II_-_Nonvolatile_Solutes/25.06%3A_The_Debye-Huckel_Theory |
| 95 | +
|
| 96 | + https://en.wikipedia.org/wiki/Debye%E2%80%93H%C3%BCckel_equation |
105 | 97 |
|
106 | 98 | See Also:
|
107 | 99 | :py:func:`_debye_parameter_osmotic`
|
108 | 100 |
|
109 | 101 | """
|
110 | 102 | water_substance = IAPWS95(
|
111 |
| - T=ureg.Quantity(temperature).magnitude, |
| 103 | + T=ureg.Quantity(temperature).to("K").magnitude, |
112 | 104 | P=ureg.Quantity("1 atm").to("MPa").magnitude,
|
113 | 105 | )
|
114 | 106 |
|
115 | 107 | debyeparam = (
|
116 | 108 | ureg.elementary_charge**3
|
117 |
| - * (2 * math.pi * ureg.N_A * water_substance.rho * ureg.Quantity("1 g/L")) ** 0.5 |
| 109 | + * (2 * math.pi * ureg.N_A * ureg.Quantity(water_substance.rho, "g/L")) ** 0.5 |
118 | 110 | / (
|
119 | 111 | 4
|
120 | 112 | * math.pi
|
|
0 commit comments