Skip to content

polykin.thermo.eos¤

GasEoS ¤

Abstract base class for gas equations of state.

A gas EoS is defined in terms of a compressibility factor function having pressure and temperature as independent variables:

\[ Z = Z(T,P) \]

All other thermodynamic properties are derived from \(Z\).

To implement a specific gas EoS, subclasses must:

  • Implement the Z method.
  • Preferably override the gR, P, and phi methods for efficiency.
Source code in src/polykin/thermo/eos/base.py
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
class GasEoS(EoS):
    r"""Abstract base class for gas equations of state.

    A gas EoS is defined in terms of a compressibility factor function having
    pressure and temperature as independent variables:

    $$ Z = Z(T,P) $$

    All other thermodynamic properties are derived from $Z$.

    To implement a specific gas EoS, subclasses must:

    * Implement the `Z` method.
    * Preferably override the `gR`, `P`, and `phi` methods for efficiency.
    """

    @abstractmethod
    def Z(self, T: Number, P: Number, y: FloatVector) -> float:
        r"""Calculate the compressibility factor of the fluid.

        $$ Z = \frac{P v}{R T} $$

        Parameters
        ----------
        T : Number
            Temperature [K].
        P : Number
            Pressure [Pa].
        y : FloatVector (N)
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Compressibility factor.
        """

    def gR(self, T: Number, P: float, y: FloatVector) -> float:
        r"""Calculate the molar residual Gibbs energy of the fluid.

        $$ g^R = R T \int_0^P (Z-1)\frac{d P}{P} $$

        Parameters
        ----------
        T : Number
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Molar residual Gibbs energy [J/mol].
        """
        res = integrate.quad(lambda P_: (self.Z(T, P_, y) - 1) / P_, eps, P)

        return R * T * res[0]

    def P(self, T: float, v: float, y: FloatVector) -> float:
        r"""Calculate the pressure of the fluid.

        $$ P = \frac{Z(T,P,y) R T}{v} $$

        Parameters
        ----------
        T : float
            Temperature [K].
        v : float
            Molar volume [m³/mol].
        y : FloatVector (N)
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Pressure [Pa].
        """
        sol = root_newton(
            lambda P_: P_ * v / (R * T) - self.Z(T, P_, y),
            x0=R * T / v,
        )

        if not sol.success:
            raise RootSolverError(
                f"Could not solve for pressure in `GasEoS.P` method.\n{sol.message}"
            )

        return sol.x

    def phi(self, T: float, P: float, y: FloatVector) -> FloatVector:
        r"""Calculate the fugacity coefficients of all components.

        $$ \ln \hat{\phi}_i = \frac{1}{RT}
           \left( \frac{\partial (n g^R)}{\partial n_i} \right)_{T,P,n_j} $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector (N)
            Mole fractions of all components [mol/mol].

        Returns
        -------
        FloatVector (N)
            Fugacity coefficients of all components.
        """

        def GR(n: np.ndarray):
            """Total residual Gibbs energy."""
            nT = n.sum()
            return nT * self.gR(T, P, n / nT)

        dGRdn = jacobian_forward(GR, y)

        return exp(dGRdn / (R * T))

    def f(self, T: float, P: float, y: FloatVector) -> FloatVector:
        r"""Calculate the fugacity of all components.

        $$ \hat{f}_i = \hat{\phi}_i y_i P $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector (N)
            Mole fractions of all components [mol/mol].

        Returns
        -------
        FloatVector (N)
            Fugacities of all components [Pa].
        """
        return self.phi(T, P, y) * y * P

    def v(self, T: float, P: float, y: FloatVector) -> float:
        r"""Calculate the molar volume the fluid.

        $$ v = Z \frac{R T}{P} $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector (N)
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Molar volume of the fluid [m³/mol].
        """
        return self.Z(T, P, y) * R * T / P

    def beta(self, T: float, P: float, y: FloatVector) -> float:
        r"""Calculate the thermal expansion coefficient.

        $$ \beta \equiv
         \frac{1}{v} \left( \frac{\partial v}{\partial T} \right)_{P,y_i}
         = \frac{1}{T}
         + \frac{1}{Z} \left( \frac{\partial Z}{\partial T} \right)_{P,y_i} $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector (N)
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Thermal expansion coefficient, $\beta$ [K⁻¹].
        """
        dZdT, Z = derivative_centered(lambda T_: self.Z(T_, P, y), T)

        return 1 / T + dZdT / Z

    def kappa(self, T: float, P: float, y: FloatVector) -> float:
        r"""Calculate the isothermal compressibility coefficient.

        $$ \kappa \equiv
        - \frac{1}{v} \left( \frac{\partial v}{\partial P} \right)_{T,y_i}
        = \frac{1}{P}
        - \frac{1}{Z} \left( \frac{\partial Z}{\partial P} \right)_{T,y_i} $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector (N)
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Isothermal compressibility coefficient, $\kappa$ [Pa⁻¹].
        """
        dZdP, Z = derivative_complex(lambda P_: self.Z(T, P_, y), P)

        return 1 / P - dZdP / Z

    def aR(self, T: float, P: float, y: FloatVector) -> float:
        r"""Calculate the molar residual Helmholtz energy of the fluid.

        $$ a^R = g^R - R T (Z - 1) $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Molar residual Helmholtz energy [J/mol].
        """
        return self.gR(T, P, y) - R * T * (self.Z(T, P, y) - 1.0)

    def hR(self, T: float, P: float, y: FloatVector) -> float:
        r"""Calculate the molar residual enthalpy of the fluid.

        $$ h^R = g^R + T s^R $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Molar residual enthalpy [J/mol].
        """
        return self.gR(T, P, y) + T * self.sR(T, P, y)

    def sR(self, T: float, P: float, y: FloatVector) -> float:
        r"""Calculate the molar residual entropy of the fluid.

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

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Molar residual entropy [J/(mol·K)].
        """
        return -1 * derivative_centered(lambda T_: self.gR(T_, P, y), T)[0]

    def vR(self, T: float, P: float, y: FloatVector) -> float:
        r"""Calculate the molar residual volume of the fluid.

        $$ v^R = \left(Z - 1 \right) \frac{R T}{P} $$

        Parameters
        ----------
        T : float
            Temperature [K].
        P : float
            Pressure [Pa].
        y : FloatVector
            Mole fractions of all components [mol/mol].

        Returns
        -------
        float
            Molar residual volume [m³/mol].
        """
        return R * T / P * (self.Z(T, P, y) - 1.0)

DA ¤

DA(T: float, V: float, n: FloatVector, v0: float) -> float

Calculate the departure of Helmholtz energy.

\[ A(T,V,n) - A^{\circ}(T,V,n)\]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

V

Volume [m³].

TYPE: float

n

Mole amounts of all components [mol].

TYPE: FloatVector(N)

v0

Molar volume in reference state [m³/mol].

TYPE: float

RETURNS DESCRIPTION
float

Helmholtz energy departure, \(A - A^{\circ}\) [J].

Source code in src/polykin/thermo/eos/base.py
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
def DA(
    self,
    T: float,
    V: float,
    n: FloatVector,
    v0: float,
) -> float:
    r"""Calculate the departure of Helmholtz energy.

    $$ A(T,V,n) - A^{\circ}(T,V,n)$$

    Parameters
    ----------
    T : float
        Temperature [K].
    V : float
        Volume [m³].
    n : FloatVector (N)
        Mole amounts of all components [mol].
    v0 : float
        Molar volume in reference state [m³/mol].

    Returns
    -------
    float
        Helmholtz energy departure, $A - A^{\circ}$ [J].
    """

N property ¤

N: int

Number of components.

P ¤

P(T: float, v: float, y: FloatVector) -> float

Calculate the pressure of the fluid.

\[ P = \frac{Z(T,P,y) R T}{v} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

v

Molar volume [m³/mol].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Pressure [Pa].

Source code in src/polykin/thermo/eos/base.py
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
def P(self, T: float, v: float, y: FloatVector) -> float:
    r"""Calculate the pressure of the fluid.

    $$ P = \frac{Z(T,P,y) R T}{v} $$

    Parameters
    ----------
    T : float
        Temperature [K].
    v : float
        Molar volume [m³/mol].
    y : FloatVector (N)
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Pressure [Pa].
    """
    sol = root_newton(
        lambda P_: P_ * v / (R * T) - self.Z(T, P_, y),
        x0=R * T / v,
    )

    if not sol.success:
        raise RootSolverError(
            f"Could not solve for pressure in `GasEoS.P` method.\n{sol.message}"
        )

    return sol.x

Z abstractmethod ¤

Z(T: Number, P: Number, y: FloatVector) -> float

Calculate the compressibility factor of the fluid.

\[ Z = \frac{P v}{R T} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: Number

P

Pressure [Pa].

TYPE: Number

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Compressibility factor.

Source code in src/polykin/thermo/eos/base.py
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@abstractmethod
def Z(self, T: Number, P: Number, y: FloatVector) -> float:
    r"""Calculate the compressibility factor of the fluid.

    $$ Z = \frac{P v}{R T} $$

    Parameters
    ----------
    T : Number
        Temperature [K].
    P : Number
        Pressure [Pa].
    y : FloatVector (N)
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Compressibility factor.
    """

aR ¤

aR(T: float, P: float, y: FloatVector) -> float

Calculate the molar residual Helmholtz energy of the fluid.

\[ a^R = g^R - R T (Z - 1) \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector

RETURNS DESCRIPTION
float

Molar residual Helmholtz energy [J/mol].

Source code in src/polykin/thermo/eos/base.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
def aR(self, T: float, P: float, y: FloatVector) -> float:
    r"""Calculate the molar residual Helmholtz energy of the fluid.

    $$ a^R = g^R - R T (Z - 1) $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Molar residual Helmholtz energy [J/mol].
    """
    return self.gR(T, P, y) - R * T * (self.Z(T, P, y) - 1.0)

beta ¤

beta(T: float, P: float, y: FloatVector) -> float

Calculate the thermal expansion coefficient.

\[ \beta \equiv \frac{1}{v} \left( \frac{\partial v}{\partial T} \right)_{P,y_i} = \frac{1}{T} + \frac{1}{Z} \left( \frac{\partial Z}{\partial T} \right)_{P,y_i} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Thermal expansion coefficient, \(\beta\) [K⁻¹].

Source code in src/polykin/thermo/eos/base.py
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
def beta(self, T: float, P: float, y: FloatVector) -> float:
    r"""Calculate the thermal expansion coefficient.

    $$ \beta \equiv
     \frac{1}{v} \left( \frac{\partial v}{\partial T} \right)_{P,y_i}
     = \frac{1}{T}
     + \frac{1}{Z} \left( \frac{\partial Z}{\partial T} \right)_{P,y_i} $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector (N)
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Thermal expansion coefficient, $\beta$ [K⁻¹].
    """
    dZdT, Z = derivative_centered(lambda T_: self.Z(T_, P, y), T)

    return 1 / T + dZdT / Z

f ¤

f(T: float, P: float, y: FloatVector) -> FloatVector

Calculate the fugacity of all components.

\[ \hat{f}_i = \hat{\phi}_i y_i P \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector(N)

RETURNS DESCRIPTION
FloatVector(N)

Fugacities of all components [Pa].

Source code in src/polykin/thermo/eos/base.py
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
def f(self, T: float, P: float, y: FloatVector) -> FloatVector:
    r"""Calculate the fugacity of all components.

    $$ \hat{f}_i = \hat{\phi}_i y_i P $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector (N)
        Mole fractions of all components [mol/mol].

    Returns
    -------
    FloatVector (N)
        Fugacities of all components [Pa].
    """
    return self.phi(T, P, y) * y * P

gR ¤

gR(T: Number, P: float, y: FloatVector) -> float

Calculate the molar residual Gibbs energy of the fluid.

\[ g^R = R T \int_0^P (Z-1)\frac{d P}{P} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: Number

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector

RETURNS DESCRIPTION
float

Molar residual Gibbs energy [J/mol].

Source code in src/polykin/thermo/eos/base.py
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
def gR(self, T: Number, P: float, y: FloatVector) -> float:
    r"""Calculate the molar residual Gibbs energy of the fluid.

    $$ g^R = R T \int_0^P (Z-1)\frac{d P}{P} $$

    Parameters
    ----------
    T : Number
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Molar residual Gibbs energy [J/mol].
    """
    res = integrate.quad(lambda P_: (self.Z(T, P_, y) - 1) / P_, eps, P)

    return R * T * res[0]

hR ¤

hR(T: float, P: float, y: FloatVector) -> float

Calculate the molar residual enthalpy of the fluid.

\[ h^R = g^R + T s^R \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector

RETURNS DESCRIPTION
float

Molar residual enthalpy [J/mol].

Source code in src/polykin/thermo/eos/base.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
def hR(self, T: float, P: float, y: FloatVector) -> float:
    r"""Calculate the molar residual enthalpy of the fluid.

    $$ h^R = g^R + T s^R $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Molar residual enthalpy [J/mol].
    """
    return self.gR(T, P, y) + T * self.sR(T, P, y)

kappa ¤

kappa(T: float, P: float, y: FloatVector) -> float

Calculate the isothermal compressibility coefficient.

\[ \kappa \equiv - \frac{1}{v} \left( \frac{\partial v}{\partial P} \right)_{T,y_i} = \frac{1}{P} - \frac{1}{Z} \left( \frac{\partial Z}{\partial P} \right)_{T,y_i} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Isothermal compressibility coefficient, \(\kappa\) [Pa⁻¹].

Source code in src/polykin/thermo/eos/base.py
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
def kappa(self, T: float, P: float, y: FloatVector) -> float:
    r"""Calculate the isothermal compressibility coefficient.

    $$ \kappa \equiv
    - \frac{1}{v} \left( \frac{\partial v}{\partial P} \right)_{T,y_i}
    = \frac{1}{P}
    - \frac{1}{Z} \left( \frac{\partial Z}{\partial P} \right)_{T,y_i} $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector (N)
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Isothermal compressibility coefficient, $\kappa$ [Pa⁻¹].
    """
    dZdP, Z = derivative_complex(lambda P_: self.Z(T, P_, y), P)

    return 1 / P - dZdP / Z

phi ¤

phi(T: float, P: float, y: FloatVector) -> FloatVector

Calculate the fugacity coefficients of all components.

\[ \ln \hat{\phi}_i = \frac{1}{RT} \left( \frac{\partial (n g^R)}{\partial n_i} \right)_{T,P,n_j} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector(N)

RETURNS DESCRIPTION
FloatVector(N)

Fugacity coefficients of all components.

Source code in src/polykin/thermo/eos/base.py
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
def phi(self, T: float, P: float, y: FloatVector) -> FloatVector:
    r"""Calculate the fugacity coefficients of all components.

    $$ \ln \hat{\phi}_i = \frac{1}{RT}
       \left( \frac{\partial (n g^R)}{\partial n_i} \right)_{T,P,n_j} $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector (N)
        Mole fractions of all components [mol/mol].

    Returns
    -------
    FloatVector (N)
        Fugacity coefficients of all components.
    """

    def GR(n: np.ndarray):
        """Total residual Gibbs energy."""
        nT = n.sum()
        return nT * self.gR(T, P, n / nT)

    dGRdn = jacobian_forward(GR, y)

    return exp(dGRdn / (R * T))

sR ¤

sR(T: float, P: float, y: FloatVector) -> float

Calculate the molar residual entropy of the fluid.

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

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector

RETURNS DESCRIPTION
float

Molar residual entropy [J/(mol·K)].

Source code in src/polykin/thermo/eos/base.py
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
def sR(self, T: float, P: float, y: FloatVector) -> float:
    r"""Calculate the molar residual entropy of the fluid.

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

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Molar residual entropy [J/(mol·K)].
    """
    return -1 * derivative_centered(lambda T_: self.gR(T_, P, y), T)[0]

v ¤

v(T: float, P: float, y: FloatVector) -> float

Calculate the molar volume the fluid.

\[ v = Z \frac{R T}{P} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector(N)

RETURNS DESCRIPTION
float

Molar volume of the fluid [m³/mol].

Source code in src/polykin/thermo/eos/base.py
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
def v(self, T: float, P: float, y: FloatVector) -> float:
    r"""Calculate the molar volume the fluid.

    $$ v = Z \frac{R T}{P} $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector (N)
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Molar volume of the fluid [m³/mol].
    """
    return self.Z(T, P, y) * R * T / P

vR ¤

vR(T: float, P: float, y: FloatVector) -> float

Calculate the molar residual volume of the fluid.

\[ v^R = \left(Z - 1 \right) \frac{R T}{P} \]
PARAMETER DESCRIPTION
T

Temperature [K].

TYPE: float

P

Pressure [Pa].

TYPE: float

y

Mole fractions of all components [mol/mol].

TYPE: FloatVector

RETURNS DESCRIPTION
float

Molar residual volume [m³/mol].

Source code in src/polykin/thermo/eos/base.py
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
def vR(self, T: float, P: float, y: FloatVector) -> float:
    r"""Calculate the molar residual volume of the fluid.

    $$ v^R = \left(Z - 1 \right) \frac{R T}{P} $$

    Parameters
    ----------
    T : float
        Temperature [K].
    P : float
        Pressure [Pa].
    y : FloatVector
        Mole fractions of all components [mol/mol].

    Returns
    -------
    float
        Molar residual volume [m³/mol].
    """
    return R * T / P * (self.Z(T, P, y) - 1.0)