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

Continuous Stirred-Tank Reactor

Simulating the startup transient of an exothermic first-order reaction in a cooled CSTR, showing the dynamic interaction between concentration decay and temperature rise.

The CSTR model couples a material balance with an energy balance. For a first-order irreversible reaction MATHINLINE2ENDMATH with Arrhenius kinetics:

MATHDISPLAY0ENDMATH

MATHDISPLAY1ENDMATH

where MATHINLINE3ENDMATH and MATHINLINE4ENDMATH is the residence time.

Python
Loading...

Configure the reactor with parameters typical of an exothermic liquid-phase reaction. The reactor starts empty (MATHINLINE0ENDMATH) at ambient temperature and is fed with a concentrated stream.

Python
Loading...

Feed a constant concentration of 1000 mol/m³ at 320 K, with the coolant held at 290 K. A Scope records both the outlet concentration and temperature.

Python
Loading...
18:18:16 - INFO - LOGGING (log: True)
18:18:16 - INFO - BLOCKS (total: 5, dynamic: 1, static: 4, eventful: 0)
18:18:16 - INFO - GRAPH (nodes: 5, edges: 5, alg. depth: 1, loop depth: 0, runtime: 0.178ms)
18:18:16 - INFO - STARTING -> TRANSIENT (Duration: 200.00s)
18:18:16 - INFO - --------------------   1% | 0.0s<0.2s | 10438.4 it/s
18:18:16 - INFO - ####----------------  20% | 0.1s<0.2s | 9809.2 it/s
18:18:17 - INFO - ########------------  40% | 0.1s<0.1s | 11593.4 it/s
18:18:17 - INFO - ############--------  60% | 0.2s<0.1s | 9446.7 it/s
18:18:17 - INFO - ################----  80% | 0.2s<0.0s | 9664.1 it/s
18:18:17 - INFO - #################### 100% | 0.3s<--:-- | 10929.2 it/s
18:18:17 - INFO - FINISHED -> TRANSIENT (total steps: 2001, successful: 2001, runtime: 260.93 ms)
Python
Loading...

The reactor starts cold and empty. As fresh feed enters, concentration rises initially but then the Arrhenius kinetics kick in — the exothermic reaction heats the fluid, which accelerates the rate, consuming more reactant. The cooling jacket prevents thermal runaway and the system settles to a steady state where reaction rate balances the feed.