Cubic EoS

Cubic EoS implementations module.

class CubicEoS(critical_temperatures, critical_pressures, acentric_factors)[source]

Bases: ArModel

Cubic equation of state base class.

Parameters:
  • critical_temperatures (array_like) – Critical temperatures vector [K]

  • critical_pressures (array_like) – Critical pressures vector [bar]

  • acentric_factors (array_like) – Acentric factors vector

nc

Number of components

Type:

int

tc

Critical temperatures vector [K]

Type:

array_like

pc

Critical pressures vector [bar]

Type:

array_like

w

Acentric factors vector

Type:

array_like

set_mixrule(mixrule: CubicMixRule) None[source]

Set the mixing rule for the EoS.

Parameters:

mixrule (CubicMixRule) – Mixing rule object

class PengRobinson76(critical_temperatures, critical_pressures, acentric_factors, mixrule: CubicMixRule | None = None)[source]

Bases: CubicEoS

Peng-Robinson 1976 cubic equation of state.

Parameters:
  • critical_temperatures (array_like) – Critical temperatures vector [K]

  • critical_pressures (array_like) – Critical pressures vector [bar]

  • acentric_factors (array_like) – Acentric factors vector

  • mixrule (CubicMixRule, optional) – Mixing rule object. If no provided the quadratric mixing rule (QMR) with zero for kij and lij parameters is set, by default None

nc

Number of components

Type:

int

critical_temperatures

Critical temperatures vector [K]

Type:

array_like

critical_pressures

Critical pressures vector [bar]

Type:

array_like

acentric_factors

Acentric factors vector

Type:

array_like

id

EoS identifier

Type:

int

mixrule

Mixing rule object

Type:

CubicMixRule

Example

from yaeos import PengRobinson76

tc = [190.56, 305.32]   # Critical temperatures [K]
pc = [45.99, 48.72]     # Critical pressures [bar]
w = [0.0115, 0.0985]    # Acentric factors

pr76 = PengRobinson76(tc, pc, w)
name = 'PengRobinson76'
class PengRobinson78(critical_temperatures, critical_pressures, acentric_factors, mixrule: CubicMixRule | None = None)[source]

Bases: CubicEoS

Peng-Robinson 1978 cubic equation of state.

Parameters:
  • critical_temperatures (array_like) – Critical temperatures vector [K]

  • critical_pressures (array_like) – Critical pressures vector [bar]

  • acentric_factors (array_like) – Acentric factors vector

  • mixrule (CubicMixRule, optional) – Mixing rule object. If no provided the quadratric mixing rule (QMR) with zero for kij and lij parameters is set, by default None

nc

Number of components

Type:

int

critical_temperatures

Critical temperatures vector [K]

Type:

array_like

critical_pressures

Critical pressures vector [bar]

Type:

array_like

acentric_factors

Acentric factors vector

Type:

array_like

id

EoS identifier

Type:

int

mixrule

Mixing rule object

Type:

CubicMixRule

Example

from yaeos import PengRobinson78

tc = [190.56, 305.32]   # Critical temperatures [K]
pc = [45.99, 48.72]     # Critical pressures [bar]
w = [0.0115, 0.0985]    # Acentric factors

pr78 = PengRobinson78(tc, pc, w)
name = 'PengRobinson78'
class SoaveRedlichKwong(critical_temperatures, critical_pressures, acentric_factors, mixrule: CubicMixRule | None = None)[source]

Bases: CubicEoS

Soave-Redlich-Kwong cubic equation of state.

Parameters:
  • critical_temperatures (array_like) – Critical temperatures vector [K]

  • critical_pressures (array_like) – Critical pressures vector [bar]

  • acentric_factors (array_like) – Acentric factors vector

  • mixrule (CubicMixRule, optional) – Mixing rule object. If no provided the quadratric mixing rule (QMR) with zero for kij and lij parameters is set, by default None

nc

Number of components

Type:

int

critical_temperatures

Critical temperatures vector [K]

Type:

array_like

critical_pressures

Critical pressures vector [bar]

Type:

array_like

acentric_factors

Acentric factors vector

Type:

array_like

id

EoS identifier

Type:

int

mixrule

Mixing rule object

Type:

CubicMixRule

Example

from yaeos import SoaveRedlichKwong

tc = [190.56, 305.32]   # Critical temperatures [K]
pc = [45.99, 48.72]     # Critical pressures [bar]
w = [0.0115, 0.0985]    # Acentric factors

srk = SoaveRedlichKwong(tc, pc, w)
name = 'SoaveReldichKwong'
class RKPR(critical_temperatures, critical_pressures, acentric_factors, critical_z, k=None, delta_1=None, mixrule: CubicMixRule | None = None)[source]

Bases: CubicEoS

RKPR cubic equation of state.

Parameters:
  • critical_temperatures (array_like) – Critical temperatures vector [K]

  • critical_pressures (array_like) – Critical pressures vector [bar]

  • acentric_factors (array_like) – Acentric factors vector

  • critical_z (array_like) – Critical compressibility factor vector

  • k (array_like, optional) – k parameter, by default None

  • delta_1 (array_like, optional) – delta_1 parameter, by default None

  • mixrule (CubicMixRule, optional) – Mixing rule object. If no provided the quadratric mixing rule (QMR) with zero for kij and lij parameters is set, by default None

nc

Number of components

Type:

int

critical_temperatures

Critical temperatures vector [K]

Type:

array_like

critical_pressures

Critical pressures vector [bar]

Type:

array_like

acentric_factors

Acentric factors vector

Type:

array_like

zc

Critical compressibility factor vector

Type:

array_like

id

EoS identifier

Type:

int

mixrule

Mixing rule object

Type:

CubicMixRule

Example

from yaeos import RKPR

tc = [190.56, 305.32]   # Critical temperatures [K]
pc = [45.99, 48.72]     # Critical pressures [bar]
w = [0.0115, 0.0985]    # Acentric factors
zc = [0.27, 0.28]       # Critical compressibility factor

rkpr = RKPR(tc, pc, w, zc)
name = 'RKPR'
class PSRK(critical_temperatures, critical_pressures, acentric_factors, molecules, c1=None, c2=None, c3=None)[source]

Bases: CubicEoS

Predictive-Soave-Redlich-Kwong cubic equation of state.

Parameters:
  • critical_temperatures (array_like) – Critical temperatures vector [K]

  • critical_pressures (array_like) – Critical pressures vector [bar]

  • acentric_factors (array_like) – Acentric factors vector

  • molecules (list of dict) – List of dicts with the groups and their amounts for each molecule

  • c1 (array_like) – Mathias-Copeman parameters c1

  • c2 (array_like) – Mathias-Copeman parameters c3

  • c3 (array_like) – Mathias-Copeman parameters c3

nc

Number of components

Type:

int

critical_temperatures

Critical temperatures vector [K]

Type:

array_like

critical_pressures

Critical pressures vector [bar]

Type:

array_like

acentric_factors

Acentric factors vector

Type:

array_like

id

EoS identifier

Type:

int

Example

from yaeos import PSRK

# methanol/n-hexane mixture
tc = [512.5, 507.6]   # Critical temperatures [K]
pc = [80.84, 30.25]     # Critical pressures [bar]
w = [0.565831, 0.301261]    # Acentric factors

# Methanol: 1 CH3OH subgroup
# n-hexane: 2 CH3, 4 CH2 subgroups
molecules = [{15:1}, {1:2, 2:4}]

# Mathias-copeman constants
c1 = [1.31458917, 0.93830213]
c2 = [0.0, 0.0]
c3 = [0.0, 0.0]

psrk = PSRK(tc, pc, w, molecules=molecules, c1=c1, c2=c2, c3=c3)
# The dictionary of molecules can be created using the `ugropy` library

import ugropy as ug

molecules = ["methanol", "ethanol"]

groups = [ug.get_groups(ug.psrk, molecule) for molecule in molecules]
molecules = [
    ug.writers.to_thermo(grp.subgroups, ug.psrk) for grp in groups
]

print(molecules)

>>> [{15: 1}, {1: 1, 2: 1, 14: 1}]