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...
10:55:02 - INFO - LOGGING (log: True)
10:55:02 - INFO - BLOCKS (total: 7, dynamic: 1, static: 6, eventful: 0)
10:55:02 - INFO - GRAPH (nodes: 7, edges: 11, alg. depth: 2, loop depth: 0, runtime: 1.356ms)
10:55:02 - INFO - STARTING -> TRANSIENT (Duration: 80.00s)
10:55:02 - INFO - --------------------   1% | 0.0s<0.1s | 1326.2 it/s
10:55:02 - INFO - ####----------------  20% | 0.0s<0.1s | 2396.1 it/s
10:55:02 - INFO - ########------------  40% | 0.0s<0.1s | 1456.2 it/s
10:55:02 - INFO - ############--------  60% | 0.1s<0.1s | 928.4 it/s
10:55:02 - INFO - ################----  80% | 0.1s<0.0s | 2990.6 it/s
10:55:02 - INFO - #################### 100% | 0.1s<--:-- | 2525.2 it/s
10:55:02 - INFO - FINISHED -> TRANSIENT (total steps: 160, successful: 160, runtime: 122.95 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...
Output

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...
Output

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...
10:55:04 - INFO - LOGGING (log: True)
10:55:04 - INFO - BLOCKS (total: 7, dynamic: 1, static: 6, eventful: 0)
10:55:04 - INFO - GRAPH (nodes: 7, edges: 11, alg. depth: 2, loop depth: 0, runtime: 0.789ms)
10:55:04 - INFO - STARTING -> TRANSIENT (Duration: 100.00s)
10:55:04 - INFO - --------------------   1% | 0.0s<0.3s | 574.1 it/s
10:55:04 - INFO - ####----------------  20% | 0.1s<0.2s | 905.1 it/s
10:55:04 - INFO - ########------------  40% | 0.1s<0.2s | 788.5 it/s
10:55:04 - INFO - ############--------  60% | 0.2s<0.1s | 946.3 it/s
10:55:04 - INFO - ################----  80% | 0.2s<0.0s | 895.3 it/s
10:55:04 - INFO - #################### 100% | 0.3s<--:-- | 1390.2 it/s
10:55:04 - INFO - FINISHED -> TRANSIENT (total steps: 200, successful: 200, runtime: 283.89 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.