Skip to content

polykin.thermo.acm¤

IdealSolution ¤

Ideal solution model.

This model is based on the following trivial molar excess Gibbs energy expression:

\[ g^{E} = 0 \]
PARAMETER DESCRIPTION
N

Number of components.

TYPE: int

name

Name.

TYPE: str DEFAULT: ''

Source code in src/polykin/thermo/acm/ideal.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class IdealSolution(SmallSpeciesActivityModel):
    r"""[Ideal solution](https://en.wikipedia.org/wiki/Ideal_solution) model.

    This model is based on the following trivial molar excess Gibbs energy
    expression:

    $$ g^{E} = 0 $$

    Parameters
    ----------
    N : int
        Number of components.
    name : str
        Name.
    """

    def __init__(self,
                 N: int,
                 name: str = ''
                 ) -> None:

        super().__init__(N, name)

    def gE(self, T: float, x: FloatVector) -> float:
        return 0.

    def gamma(self, T: float, x: FloatVector) -> FloatVector:
        return np.ones(self.N)

Dgmix ¤

Dgmix(T: float, x: FloatVector) -> float

Molar Gibbs energy of mixing, \(\Delta g_{mix}\).

\[ \Delta g_{mix} = \Delta h_{mix} -T \Delta s_{mix} \]
PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Molar Gibbs energy of mixing. Unit = J/mol.

Source code in src/polykin/thermo/acm/base.py
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def Dgmix(self,
          T: float,
          x: FloatVector
          ) -> float:
    r"""Molar Gibbs energy of mixing, $\Delta g_{mix}$.

    $$ \Delta g_{mix} = \Delta h_{mix} -T \Delta s_{mix} $$

    Parameters
    ----------
    T : float
        Temperature. Unit = K.
    x : FloatVector (N)
        Mole fractions of all components. Unit = mol/mol.

    Returns
    -------
    float
        Molar Gibbs energy of mixing. Unit = J/mol.
    """
    return self.gE(T, x) - T*self._Dsmix_ideal(T, x)

Dhmix ¤

Dhmix(T: float, x: FloatVector) -> float

Molar enthalpy of mixing, \(\Delta h_{mix}\).

\[ \Delta h_{mix} = h^{E} \]
PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Molar enthalpy of mixing. Unit = J/mol.

Source code in src/polykin/thermo/acm/base.py
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
def Dhmix(self,
          T: float,
          x: FloatVector
          ) -> float:
    r"""Molar enthalpy of mixing, $\Delta h_{mix}$.

    $$ \Delta h_{mix} = h^{E} $$

    Parameters
    ----------
    T : float
        Temperature. Unit = K.
    x : FloatVector (N)
        Mole fractions of all components. Unit = mol/mol.

    Returns
    -------
    float
        Molar enthalpy of mixing. Unit = J/mol.
    """
    return self.hE(T, x)

Dsmix ¤

Dsmix(T: float, x: FloatVector) -> float

Molar entropy of mixing, \(\Delta s_{mix}\).

\[ \Delta s_{mix} = s^{E} - R \sum_i {x_i \ln{x_i}} \]
PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Molar entropy of mixing. Unit = J/(mol·K).

Source code in src/polykin/thermo/acm/base.py
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
def Dsmix(self,
          T: float,
          x: FloatVector
          ) -> float:
    r"""Molar entropy of mixing, $\Delta s_{mix}$.

    $$ \Delta s_{mix} = s^{E} - R \sum_i {x_i \ln{x_i}} $$

    Parameters
    ----------
    T : float
        Temperature. Unit = K.
    x : FloatVector (N)
        Mole fractions of all components. Unit = mol/mol.

    Returns
    -------
    float
        Molar entropy of mixing. Unit = J/(mol·K).
    """
    return self.sE(T, x) + self._Dsmix_ideal(T, x)

N property ¤

N: int

Number of components.

activity ¤

activity(T: float, x: FloatVector) -> FloatVector

Activities, \(a_i\).

\[ a_i = x_i \gamma_i \]
PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
FloatVector(N)

Activities of all components.

Source code in src/polykin/thermo/acm/base.py
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
def activity(self,
             T: float,
             x: FloatVector
             ) -> FloatVector:
    r"""Activities, $a_i$.

    $$ a_i = x_i \gamma_i $$

    Parameters
    ----------
    T : float
        Temperature. Unit = K.
    x : FloatVector (N)
        Mole fractions of all components. Unit = mol/mol.

    Returns
    -------
    FloatVector (N)
        Activities of all components.
    """
    return x*self.gamma(T, x)

gE ¤

gE(T: float, x: FloatVector) -> float

Molar excess Gibbs energy, \(g^{E}\).

PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Molar excess Gibbs energy. Unit = J/mol.

Source code in src/polykin/thermo/acm/ideal.py
37
38
def gE(self, T: float, x: FloatVector) -> float:
    return 0.

gamma ¤

gamma(T: float, x: FloatVector) -> FloatVector

Activity coefficients based on mole fraction, \(\gamma_i\).

PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
FloatVector(N)

Activity coefficients of all components.

Source code in src/polykin/thermo/acm/ideal.py
40
41
def gamma(self, T: float, x: FloatVector) -> FloatVector:
    return np.ones(self.N)

hE ¤

hE(T: float, x: FloatVector) -> float

Molar excess enthalpy, \(h^{E}\).

\[ h^{E} = g^{E} + T s^{E} \]
PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Molar excess enthalpy. Unit = J/mol.

Source code in src/polykin/thermo/acm/base.py
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
def hE(self,
       T: float,
       x: FloatVector
       ) -> float:
    r"""Molar excess enthalpy, $h^{E}$.

    $$ h^{E} = g^{E} + T s^{E} $$

    Parameters
    ----------
    T : float
        Temperature. Unit = K.
    x : FloatVector (N)
        Mole fractions of all components. Unit = mol/mol.

    Returns
    -------
    float
        Molar excess enthalpy. Unit = J/mol.
    """
    return self.gE(T, x) + T*self.sE(T, x)

sE ¤

sE(T: float, x: FloatVector) -> float

Molar excess entropy, \(s^{E}\).

\[ s^{E} = -\left(\frac{\partial g^{E}}{\partial T}\right)_{P,x_i} \]
PARAMETER DESCRIPTION
T

Temperature. Unit = K.

TYPE: float

x

Mole fractions of all components. Unit = mol/mol.

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Molar excess entropy. Unit = J/(mol·K).

Source code in src/polykin/thermo/acm/base.py
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
def sE(self,
       T: float,
       x: FloatVector
       ) -> float:
    r"""Molar excess entropy, $s^{E}$.

    $$ s^{E} = -\left(\frac{\partial g^{E}}{\partial T}\right)_{P,x_i} $$

    Parameters
    ----------
    T : float
        Temperature. Unit = K.
    x : FloatVector (N)
        Mole fractions of all components. Unit = mol/mol.

    Returns
    -------
    float
        Molar excess entropy. Unit = J/(mol·K).
    """
    return -1*derivative_complex(lambda t: self.gE(t, x), T)[0]