vle_flash
Vapour-liquid equilibrium of an ideal mixture (Raoult's law, Antoine vapour pressures given as inputs per component): bubble and dew pressure at a temperature, bubble and dew temperature at a pressure, isothermal flash by Rachford-Rice at both, relative volatility; P-x-y and T-x-y csv for a binary.
- Field
- Chemistry
- Version
- 0.1.0
- Runs as
- Compiled (Rust)
- Typical run
- 0.05 s
Compiled from source: run sh packs/install.sh once before admitting it.
Known answers it must pass
r0001pure component, log10 Antoine in kPa and K (A=4, B=600, C=0) at 100 kPa: closed form T = B/(A - log10 P) = 300 K exactly, bubble = dew (rel 1e-9: bisection to neighbouring floats)passed
bubble_temperature_K300 ± 3e-07300lockedunder 0.01 % of the tolerance useddew_temperature_K300 ± 3e-07300lockedunder 0.01 % of the tolerance usedboiling_range_K0 ± 1e-090lockedunder 0.01 % of the tolerance usedpure_boiling_temperature_K.0{"value": 300.0, "rel_tol": 1e-09}r0002pure component, log10 Antoine in mmHg and degC (A=7, B=1500, C=200) at 101.325 kPa = 760 mmHg (exact by definition): closed form T = B/(A - log10 760) - C + 273.15 = 437.299579924097 K (rel 1e-9)passed
bubble_temperature_K437.3 ± 4.4e-07437.3lockedunder 0.01 % of the tolerance useddew_temperature_K437.3 ± 4.4e-07437.3lockedunder 0.01 % of the tolerance usedboiling_range_K0 ± 1e-090lockedunder 0.01 % of the tolerance usedr0003binary at 300 K with Psat = 100 and 10 kPa by construction (10^(4-600/300), 10^(4-900/300)), z = [0.4, 0.6]: Raoult P_bubble = 46 kPa, y1 = 40/46 = 20/23; P_dew = 1/(0.4/100 + 0.6/10) = 15.625 kPa, x1 = 0.0625; alpha = 10 (closed forms, rel 1e-9)passed
psat_kPa.0{"value": 100.0, "rel_tol": 1e-09}psat_kPa.1{"value": 10.0, "rel_tol": 1e-09}bubble_pressure_kPa46 ± 4.6e-0846lockedunder 0.01 % of the tolerance usedy_at_bubble_pressure.0{"value": 0.8695652173913043, "rel_tol": 1e-09}dew_pressure_kPa15.625 ± 1.6e-0815.625lockedunder 0.01 % of the tolerance usedx_at_dew_pressure.0{"value": 0.0625, "rel_tol": 1e-09}relative_volatility.0{"value": 10.0, "rel_tol": 1e-09}r0004binary flash at 300 K, 25 kPa (K = 4 and 0.4): lever-rule closed form x1 = (1 - K2)/(K1 - K2) = 1/6, y1 = 2/3, b = (z1 - x1)/(y1 - x1) = 7/15; z = (1 - b) x + b y (rel 1e-9; balance abs 1e-12)passed
phase= two-phasetwo-phaselockedexact matchvapor_fraction0.466667 ± 4.7e-100.466667lockedunder 0.01 % of the tolerance usedx.0{"value": 0.16666666666666666, "rel_tol": 1e-09}y.0{"value": 0.6666666666666666, "rel_tol": 1e-09}k_values.0{"value": 4.0, "rel_tol": 1e-09}material_balance_residual0 ± 1e-125.55112e-17lockedunder 0.01 % of the tolerance usedr0005binary flash at its own bubble pressure (300 K, 46 kPa from the closed form above): vapour fraction 0, incipient vapour y1 = 20/23 (abs 1e-9 on b, rel 1e-9 on y1)passed
vapor_fraction0 ± 1e-090lockedunder 0.01 % of the tolerance usedy.0{"value": 0.8695652173913043, "rel_tol": 1e-09}r0006binary flash at its own dew pressure (300 K, 15.625 kPa from the closed form above): vapour fraction 1, incipient liquid x1 = 0.0625 (abs 1e-9 on b, rel 1e-9 on x1)passed
vapor_fraction1 ± 1e-091lockedunder 0.01 % of the tolerance usedx.0{"value": 0.0625, "rel_tol": 1e-09}r0007binary at 50 kPa with equal B (constant alpha = 10^(A1-A2) = 10), z = [0.5, 0.5]: closed forms T_bubble = B/log10((x1 10^A1 + x2 10^A2)/P) = 600/log10(110), T_dew = -B/log10(P (y1 10^-A1 + y2 10^-A2)) = -600/log10(0.0275), y1 = 10/11, x1 = 1/11 (rel 1e-9)passed
bubble_temperature_K293.917 ± 2.9e-07293.917lockedunder 0.01 % of the tolerance useddew_temperature_K384.451 ± 3.8e-07384.451lockedunder 0.01 % of the tolerance usedy_at_bubble_temperature.0{"value": 0.9090909090909091, "rel_tol": 1e-09}x_at_dew_temperature.0{"value": 0.09090909090909091, "rel_tol": 1e-09}relative_volatility_at_bubble.0{"value": 10.0, "rel_tol": 1e-09}relative_volatility_at_dew.0{"value": 10.0, "rel_tol": 1e-09}r0008ternary Rachford-Rice, exact by construction: Psat = 100, 10, 1 kPa at 300 K, P = 10 kPa (K = 10, 1, 0.1); x = (0.05, 0.45, 0.5), y = K x = (0.5, 0.45, 0.05), b = 0.25 give z = (1-b) x + b y = (0.1625, 0.45, 0.3875); RR is monotonic so b is unique (rel 1e-9)passed
phase= two-phasetwo-phaselockedexact matchvapor_fraction0.25 ± 2.5e-100.25lockedunder 0.01 % of the tolerance usedx.0{"value": 0.05, "rel_tol": 1e-09}x.2{"value": 0.5, "rel_tol": 1e-09}y.0{"value": 0.5, "rel_tol": 1e-09}y.2{"value": 0.05, "rel_tol": 1e-09}material_balance_residual0 ± 1e-124.16334e-17lockedunder 0.01 % of the tolerance used
Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.
Inputs
| Name | Unit | Default | Meaning |
|---|---|---|---|
components | One object per component: {name, A, B, C, T_min, T_max}, with log P = A - B / (T + C) in the convention set by antoine_log, antoine_pressure_unit and antoine_temperature_unit. T_min and T_max (optional) are the validity range of the fit, in the Antoine temperature unit. Coefficients are the caller's data: nothing is tabulated in the instrument. | ||
z | 1 | Overall mole fractions, one per component in the same order, summing to 1 (within 1e-6, then normalised). May be left out for a single component. | |
temperature_K | K | Temperature. Alone: bubble and dew pressure. With pressure_kPa: also the isothermal flash. | |
pressure_kPa | kPa | Absolute pressure (1 atm = 101.325 kPa). Alone: bubble and dew temperature. With temperature_K: also the isothermal flash. | |
antoine_log | log10 | log10 for log10(P) = A - B/(T + C), ln for ln(P) = A - B/(T + C). | |
antoine_pressure_unit | mmHg | Pressure unit the coefficients were fitted in. mmHg is taken as 1/760 atm (the torr; the conventional mmHg differs by 1.4e-7 relative). | |
antoine_temperature_unit | C | Temperature unit the coefficients were fitted in: C for degrees Celsius, K for kelvin. | |
reference_component | 1 | Position (1-based) of the component relative volatilities are taken against: alpha_i = Psat_i / Psat_ref. Default: the last component. | |
curve_points | 1 | 41 | Points on the binary P-x-y and T-x-y curves. |
Readings
| Name | Unit | Meaning |
|---|---|---|
mode | at temperature, at pressure, or flash at T and P | |
names | component names, in input order | |
n_components | 1 | |
z | 1 | |
psat_kPa | kPa | pure vapour pressures at temperature_K |
bubble_pressure_kPa | kPa | sum x_i Psat_i, with x = z |
y_at_bubble_pressure | 1 | |
dew_pressure_kPa | kPa | 1 / sum (y_i / Psat_i), with y = z |
x_at_dew_pressure | 1 | |
relative_volatility | 1 | Psat_i / Psat_ref at relative_volatility_at_K |
relative_volatility_at_K | K | |
bubble_temperature_K | K | |
y_at_bubble_temperature | 1 | |
dew_temperature_K | K | |
x_at_dew_temperature | 1 | |
boiling_range_K | K | dew minus bubble temperature |
pure_boiling_temperature_K | K | |
relative_volatility_at_bubble | 1 | |
relative_volatility_at_dew | 1 | |
k_values | 1 | K_i = Psat_i(T) / P |
phase | two-phase, bubble point, dew point, subcooled liquid, superheated vapour, or saturated (pure component on its boiling line: vapour fraction null) | |
vapor_fraction | 1 | Rachford-Rice vapour fraction b (molar) |
x | 1 | liquid mole fractions; null for a superheated vapour |
y | 1 | vapour mole fractions; null for a subcooled liquid |
material_balance_residual | 1 | max_i |z_i - (1 - b) x_i - b y_i| |
sum_x | 1 | |
sum_y | 1 | |
components | per component: z, psat_kPa, boiling_temperature_K, relative_volatility, k_value, x, y | |
antoine_in_range | true when every computed temperature is inside the given Antoine ranges; null when no range was given | |
warnings | temperatures outside a given Antoine range | |
files | components.csv; pxy.csv (binary, at T); txy.csv (binary, at P) |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.