FLASH_WILSON

This function runs a composition-independent Wilson flash using overall composition, critical constants, and acentric factors.

It solves for one of T, P, or vapor fraction VF from the other two, and reports phase split and compositions.

Wilson K-values are estimated as:

K_i = \frac{P_c}{P}\exp\left(5.37(1+\omega)\left[1-\frac{T_c}{T}\right]\right)

Excel Usage

=FLASH_WILSON(zs, critical_temperatures, critical_pressures, omegas, temperature, pressure, vapor_fraction)
  • zs (list[list], required): Overall mole fractions as a selected range (-).
  • critical_temperatures (list[list], required): Critical temperatures for each component (K).
  • critical_pressures (list[list], required): Critical pressures for each component (Pa).
  • omegas (list[list], required): Acentric factors for each component (-).
  • temperature (float, optional, default: null): Temperature (K).
  • pressure (float, optional, default: null): Pressure (Pa).
  • vapor_fraction (float, optional, default: null): Vapor fraction (-).

Returns (list[list]): 2D array with temperature, pressure, vapor fraction, and phase compositions.

Example 1: Binary Wilson flash with known temperature and pressure

Inputs:

zs critical_temperatures critical_pressures omegas temperature pressure
0.4 0.6 305.322 540.13 4872200 2736000 0.099 0.349 300 100000

Excel formula:

=FLASH_WILSON({0.4,0.6}, {305.322,540.13}, {4872200,2736000}, {0.099,0.349}, 300, 100000)

Expected output:

Property Value
T 300
P 100000
VF 0.422195
xs [0.020938815080034565, 0.9790611849199654]
ys [0.9187741856225791, 0.08122581437742094]
Example 2: Binary Wilson flash with temperature and vapor fraction

Inputs:

zs critical_temperatures critical_pressures omegas temperature vapor_fraction
0.4 0.6 305.322 540.13 4872200 2736000 0.099 0.349 320 0.5

Excel formula:

=FLASH_WILSON({0.4,0.6}, {305.322,540.13}, {4872200,2736000}, {0.099,0.349}, 320, 0.5)

Expected output:

Property Value
T 320
P 87933.8
VF 0.5
xs [0.010864719626849963, 0.9891352803731501]
ys [0.7891352803731501, 0.21086471962684986]
Example 3: Ternary Wilson flash with known temperature and pressure

Inputs:

zs critical_temperatures critical_pressures omegas temperature pressure
0.3 0.4 0.3 190.6 305.3 369.8 4604000 4880000 4248000 0.011 0.098 0.152 280 1500000

Excel formula:

=FLASH_WILSON({0.3,0.4,0.3}, {190.6,305.3,369.8}, {4604000,4880000,4248000}, {0.011,0.098,0.152}, 280, 1500000)

Expected output:

Property Value
T 280
P 1500000
VF 1.00268
xs [0.017225221905851927, 0.20919727163712515, 0.773577506457023]
ys [0.29924408411499936, 0.39948994456208914, 0.3012659713229115]
Example 4: Ternary Wilson flash with pressure and vapor fraction

Inputs:

zs critical_temperatures critical_pressures omegas pressure vapor_fraction
0.25 0.5 0.25 190.6 305.3 369.8 4604000 4880000 4248000 0.011 0.098 0.152 1000000 0.2

Excel formula:

=FLASH_WILSON({0.25,0.5,0.25}, {190.6,305.3,369.8}, {4604000,4880000,4248000}, {0.011,0.098,0.152}, 1000000, 0.2)

Expected output:

Property Value
T 208.294
P 1000000
VF 0.2
xs [0.11060305364385199, 0.5796134818309818, 0.3097834645250185]
ys [0.8075877854245921, 0.18154607267607278, 0.010866141899926275]

Python Code

Show Code
from chemicals.flash_basic import flash_wilson as chemicals_flash_wilson

def flash_wilson(zs, critical_temperatures, critical_pressures, omegas, temperature=None, pressure=None, vapor_fraction=None):
    """
    Perform a Wilson-model flash calculation and return state and phase compositions.

    See: https://chemicals.readthedocs.io/chemicals.flash_basic.html#chemicals.flash_basic.flash_wilson

    This example function is provided as-is without any representation of accuracy.

    Args:
        zs (list[list]): Overall mole fractions as a selected range (-).
        critical_temperatures (list[list]): Critical temperatures for each component (K).
        critical_pressures (list[list]): Critical pressures for each component (Pa).
        omegas (list[list]): Acentric factors for each component (-).
        temperature (float, optional): Temperature (K). Default is None.
        pressure (float, optional): Pressure (Pa). Default is None.
        vapor_fraction (float, optional): Vapor fraction (-). Default is None.

    Returns:
        list[list]: 2D array with temperature, pressure, vapor fraction, and phase compositions.
    """
    try:
        def to_list(x):
            if isinstance(x, list):
                out = []
                for row in x:
                    if isinstance(row, list):
                        for val in row:
                            if val is not None and val != "":
                                out.append(float(val))
                    elif row is not None and row != "":
                        out.append(float(row))
                return out
            if x is None or x == "":
                return []
            return [float(x)]

        z_vals = to_list(zs)
        tc_vals = to_list(critical_temperatures)
        pc_vals = to_list(critical_pressures)
        omega_vals = to_list(omegas)

        n = len(z_vals)
        if n == 0 or len(tc_vals) != n or len(pc_vals) != n or len(omega_vals) != n:
            return "Error: zs, critical_temperatures, critical_pressures, and omegas must be non-empty and have the same length"

        T, P, VF, xs, ys = chemicals_flash_wilson(zs=z_vals, Tcs=tc_vals, Pcs=pc_vals, omegas=omega_vals, T=temperature, P=pressure, VF=vapor_fraction)
        return [["Property", "Value"], ["T", T], ["P", P], ["VF", VF], ["xs", str(xs)], ["ys", str(ys)]]
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Overall mole fractions as a selected range (-).
Critical temperatures for each component (K).
Critical pressures for each component (Pa).
Acentric factors for each component (-).
Temperature (K).
Pressure (Pa).
Vapor fraction (-).