Skip to content

polykin.thermo.acm¤

NRTL_gamma ¤

NRTL_gamma(
    x: FloatVector,
    tau: FloatSquareMatrix,
    alpha: FloatSquareMatrix,
) -> FloatVector

Calculate the activity coefficients of a multicomponent mixture according to the NRTL model.

\[ \ln{\gamma_i} = \frac{\displaystyle\sum_{k}{x_{k}\tau_{ki}G_{ki}}} {\displaystyle\sum_{k}{x_{k}G_{ki}}} +\sum_{j}{\frac{x_{j}G_{ij}}{\displaystyle\sum_{k}{x_{k}G_{kj}}}} {\left ({\tau_{ij}-\frac{\displaystyle\sum_{k}{x_{k}\tau_{kj}G_{kj}}} {\displaystyle\sum_{k}{x_{k}G_{kj}}}}\right )} \]

where \(x_i\) are the mole fractions, \(\tau_{ij}\) are the interaction parameters, \(\alpha_{ij}\) are the non-randomness parameters, and \(G_{ij}=\exp(-\alpha_{ij} \tau_{ij})\).

References

  • Renon, H. and Prausnitz, J.M. (1968), Local compositions in thermodynamic excess functions for liquid mixtures. AIChE J., 14: 135-144.
PARAMETER DESCRIPTION
x

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

TYPE: FloatVector(N)

tau

Interaction parameters, \(\tau_{ij}\). It is expected (but not checked) that \(\tau_{ii}=0\).

TYPE: FloatSquareMatrix(N, N)

alpha

Non-randomness parameters, \(\alpha_{ij}\). It is expected (but not checked) that \(\alpha_{ij}=\alpha_{ji}\).

TYPE: FloatSquareMatrix(N, N)

RETURNS DESCRIPTION
FloatVector(N)

Activity coefficients of all components.

See also
  • NRTL: related class.
Source code in src/polykin/thermo/acm/nrtl.py
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
def NRTL_gamma(x: FloatVector,
               tau: FloatSquareMatrix,
               alpha: FloatSquareMatrix
               ) -> FloatVector:
    r"""Calculate the activity coefficients of a multicomponent mixture
    according to the NRTL model.

    $$ \ln{\gamma_i} = \frac{\displaystyle\sum_{k}{x_{k}\tau_{ki}G_{ki}}}
    {\displaystyle\sum_{k}{x_{k}G_{ki}}}
    +\sum_{j}{\frac{x_{j}G_{ij}}{\displaystyle\sum_{k}{x_{k}G_{kj}}}}
    {\left ({\tau_{ij}-\frac{\displaystyle\sum_{k}{x_{k}\tau_{kj}G_{kj}}}
    {\displaystyle\sum_{k}{x_{k}G_{kj}}}}\right )} $$

    where $x_i$ are the mole fractions, $\tau_{ij}$ are the interaction
    parameters, $\alpha_{ij}$ are the non-randomness parameters, and 
    $G_{ij}=\exp(-\alpha_{ij} \tau_{ij})$.

    **References**

    *   Renon, H. and Prausnitz, J.M. (1968), Local compositions in
        thermodynamic excess functions for liquid mixtures. AIChE J.,
        14: 135-144.

    Parameters
    ----------
    x : FloatVector (N)
        Mole fractions of all components. Unit = mol/mol.
    tau : FloatSquareMatrix (N,N)
        Interaction parameters, $\tau_{ij}$. It is expected (but not checked)
        that $\tau_{ii}=0$.
    alpha : FloatSquareMatrix (N,N)
        Non-randomness parameters, $\alpha_{ij}$. It is expected (but not
        checked) that $\alpha_{ij}=\alpha_{ji}$.

    Returns
    -------
    FloatVector (N)
        Activity coefficients of all components.

    See also
    --------
    * [`NRTL`](NRTL.md): related class.

    """

    G = exp(-alpha*tau)

    # N = x.size
    # A = np.empty(N)
    # B = np.empty(N)
    # for i in range(N):
    #     A[i] = np.sum(x*tau[:, i]*G[:, i])
    #     B[i] = np.sum(x*G[:, i])
    # C = np.zeros(N)
    # for j in range(N):
    #     C += x[j]*G[:, j]/B[j]*(tau[:, j] - A[j]/B[j])

    A = dot(x, tau*G)
    B = dot(x, G)
    C = dot(tau*G, x/B) - dot(G, x*A/B**2)

    return exp(A/B + C)