This example is interactive. Click the play button on any cell to execute it, or run all cells in sequence.

Multi-Component Flash Separation (BTX)

Simulating an isothermal flash drum for a ternary benzene–toluene–p-xylene (BTX) mixture. The MultiComponentFlash block uses Raoult's law with Antoine correlations to compute K-values and solves the Rachford-Rice equation via Brent's method.

This example is inspired by MiniSim's SimpleFlash example, adapted to PathSim's dynamic simulation framework.

Feed conditions:

  • 10 mol/s total flow
  • 50% benzene, 10% toluene, 40% p-xylene (molar)
  • 1 atm pressure
  • Temperature sweep: 340 K → 420 K
Python
Loading...

Flash Drum Setup

The MultiComponentFlash block defaults to BTX Antoine parameters (ln form, Pa, K):

Component A B C
Benzene 20.7936 2788.51 -52.36
Toluene 20.9064 3096.52 -53.67
p-Xylene 20.9891 3346.65 -57.84

We feed the drum with constant composition and pressure while ramping temperature to observe the transition from all-liquid through two-phase to all-vapor.

Python
Loading...
18:18:22 - INFO - LOGGING (log: True)
18:18:22 - INFO - BLOCKS (total: 7, dynamic: 1, static: 6, eventful: 0)
18:18:22 - INFO - GRAPH (nodes: 7, edges: 11, alg. depth: 2, loop depth: 0, runtime: 0.784ms)
18:18:22 - INFO - STARTING -> TRANSIENT (Duration: 80.00s)
18:18:22 - INFO - --------------------   1% | 0.0s<0.2s | 824.3 it/s
18:18:22 - INFO - ####----------------  20% | 0.0s<0.1s | 2262.5 it/s
18:18:22 - INFO - ########------------  40% | 0.1s<0.1s | 1100.4 it/s
18:18:22 - INFO - ############--------  60% | 0.1s<0.1s | 963.0 it/s
18:18:22 - INFO - ################----  80% | 0.1s<0.0s | 2996.8 it/s
18:18:22 - INFO - #################### 100% | 0.2s<--:-- | 2868.4 it/s
18:18:22 - INFO - FINISHED -> TRANSIENT (total steps: 160, successful: 160, runtime: 154.89 ms)

Results: Flow Rates

As temperature increases, the vapor fraction grows. Below the bubble point the drum produces only liquid; above the dew point it produces only vapor.

Python
Loading...

Results: VLE Diagram

Plot the vapor vs liquid composition for each component across the temperature sweep. The diagonal represents equal vapor and liquid composition — deviation from it shows the separation achieved by the flash.

Python
Loading...

Fixed-Temperature Flash at 380 K

For a direct comparison with MiniSim's result (which solves at steady state), we run a fixed-temperature flash and let the holdup reach equilibrium.

Python
Loading...
18:18:22 - INFO - LOGGING (log: True)
18:18:22 - INFO - BLOCKS (total: 7, dynamic: 1, static: 6, eventful: 0)
18:18:22 - INFO - GRAPH (nodes: 7, edges: 11, alg. depth: 2, loop depth: 0, runtime: 0.292ms)
18:18:22 - INFO - STARTING -> TRANSIENT (Duration: 100.00s)
18:18:22 - INFO - --------------------   1% | 0.0s<0.3s | 603.0 it/s
18:18:22 - INFO - ####----------------  20% | 0.0s<0.2s | 876.2 it/s
18:18:22 - INFO - ########------------  40% | 0.1s<0.2s | 737.9 it/s
18:18:23 - INFO - ############--------  60% | 0.2s<0.1s | 958.4 it/s
18:18:23 - INFO - ################----  80% | 0.3s<0.0s | 884.7 it/s
18:18:23 - INFO - #################### 100% | 0.3s<--:-- | 939.0 it/s
18:18:23 - INFO - FINISHED -> TRANSIENT (total steps: 200, successful: 200, runtime: 308.90 ms)
BTX Flash at 380 K, 1 atm
========================================
                          Vapor     Liquid
----------------------------------------
Flow rate [mol/s]         5.083      4.917
Benzene                  0.6766     0.3176
Toluene                  0.0947     0.1072
p-Xylene                 0.2288     0.5752

The lighter component (benzene) is enriched in the vapor phase while the heavier component (p-xylene) concentrates in the liquid — exactly the separation behaviour expected from VLE. The dynamic formulation reaches the same steady state that an equation-oriented solver (like MiniSim) finds directly.