# Scientific model

## 1. Purpose and scope

The family models steady-state separation of a binary liquid feed into a distillate enriched in the more volatile light key and a bottoms stream enriched in the less volatile heavy key. All eight laboratories call the same deterministic JavaScript engine.

The core is an ideal McCabe–Thiele equilibrium-stage calculation with:

- constant relative volatility, `alpha > 1`;
- constant molar overflow (CMO);
- a total condenser (not counted as an equilibrium stage);
- an equilibrium reboiler (counted as an equilibrium stage);
- one feed and two product streams;
- a user-specified feed thermal condition `q`;
- a total-reflux-ratio definition `R = L0 / D`.

This is an educational screening model, not a rigorous process simulator.

## 2. Vapor–liquid equilibrium

Let `x` be the liquid mole fraction of light key and `y*` the equilibrium vapor mole fraction. With constant relative volatility `alpha`:

\[
y^* = \frac{\alpha x}{1 + (\alpha - 1)x}
\]

The inverse used for McCabe–Thiele stepping is:

\[
x = \frac{y}{\alpha - (\alpha - 1)y}
\]

The model assumes idealized binary equilibrium behavior. It does not calculate activity coefficients, fugacity coefficients, azeotropes, pressure-dependent property tables, or temperature profiles.

## 3. Material balance

For feed flow `F`, feed light-key composition `zF`, distillate flow `D` and bottoms flow `B`:

\[
F = D + B
\]

\[
F z_F = D x_D + B x_B
\]

Therefore:

\[
D = F\frac{z_F-x_B}{x_D-x_B}, \qquad B=F-D
\]

Light-key recovery to distillate is `D*xD/(F*zF)`. The parameter normalizer enforces `xB < zF < xD`.

## 4. Operating lines

### Rectifying section

\[
y = \frac{R}{R+1}x + \frac{x_D}{R+1}
\]

### Feed q-line

For `q != 1`:

\[
y = \frac{q}{q-1}x - \frac{z_F}{q-1}
\]

For `q = 1`, the q-line is vertical at `x = zF` (saturated-liquid feed).

### Stripping section

The intersection of the rectifying line and q-line is joined to `(xB, xB)`. That straight line is the stripping operating line:

\[
y=m_S x+b_S
\]

The engine computes the intersection algebraically and derives `mS` and `bS` from the two points.

## 5. Minimum reflux

The pinch point `(xP, yP)` is the relevant intersection of the equilibrium curve and q-line. At minimum reflux, the rectifying operating line passes through `(xD, xD)` and the pinch point:

\[
R_{min}=\frac{x_D-y_P}{y_P-x_P}
\]

The q = 1 case uses `xP = zF`. For other q values the engine brackets and bisects the equilibrium/q-line intersection. A design at or below `Rmin` is marked infeasible for finite stage stepping.

## 6. McCabe–Thiele stage stepping

Starting at `(xD, xD)`, the engine alternates:

1. horizontal movement to the equilibrium curve using the inverse VLE relation;
2. vertical movement to the applicable rectifying or stripping operating line.

The step changes section at the rectifying/q-line intersection. The final horizontal step is linearly fractioned when the bottoms target lies between two calculated equilibrium compositions. The returned theoretical-stage count includes the equilibrium reboiler and excludes the total condenser.

Actual tray estimate:

\[
N_{trays}=\left\lceil\frac{\max(0,N_{ideal}-1)}{E_M}\right\rceil
\]

where `EM` is the user-selected overall tray-efficiency approximation. This is a simplified conversion, not a tray-by-tray Murphree-efficiency calculation.

## 7. Preliminary equipment sizing

The design studio uses the calculated boil-up `V = (R+1)D`.

Ideal-gas vapor density:

\[
\rho_V=\frac{P MW_V}{R_g T}
\]

Vapor volumetric flow:

\[
Q_V=\frac{V R_g T}{P}
\]

A first-pass Souders–Brown estimate is used:

\[
u_{flood}=C\sqrt{\frac{\rho_L-\rho_V}{\rho_V}},\quad C=0.107\;m/s
\]

Design velocity is 80% of the estimated flooding velocity. Required cross-sectional area is `Qv/uDesign`, and diameter is `sqrt(4A/pi)`. The height estimate uses 0.50 m tray spacing plus 2.5 m for end allowances.

Reboiler duty is a boil-up latent-heat proxy:

\[
Q_{reb}=\frac{V\;(kmol/h)\times1000\;(mol/kmol)\times\Delta H_{vap}\;(kJ/mol)}{3600}\;(kW)
\]

The sizing estimates are indicative only. The model does not check entrainment, weeping, downcomer backup, foaming, tray pressure drop, detailed tray geometry, mechanical loads, corrosion allowance, nozzle loads, or applicable design codes.

## 8. Numerical safeguards

- Parameter values are clamped to documented ranges.
- Composition ordering is normalized to maintain `xB < zF < xD`.
- Minimum-reflux intersections use a scan followed by bisection.
- Stage stepping is capped at 180 iterations and reports non-convergence explicitly.
- Non-finite values are not presented as valid design results.

## 9. Validation examples

For the default parameter set (`alpha=2.4`, `xD=0.95`, `xB=0.05`, `zF=0.45`, `q=1`, `R=2.5`, `F=100 kmol/h`, `EM=0.65`), the shared engine returns approximately:

- minimum reflux: 1.3521;
- theoretical stages: 10.7121;
- estimated actual trays: 15;
- distillate flow: 44.4444 kmol/h;
- bottoms flow: 55.5556 kmol/h;
- vapor traffic: 155.5556 kmol/h.

Exact values are calculated at runtime from the engine and can vary only if the shared parameters change.
