Ammonia Synthesis (Haber-Bosch)¶
In this tutorial you will build a simplified Haber-Bosch ammonia synthesis loop in DWSIM's Classic UI: a single-pass train of compression, preheating, equilibrium reaction, cooling, and gas-liquid separation.
What you will learn
- How to build a multi-unit industrial flowsheet from feed to product
- How to define an equilibrium reaction with a temperature-dependent Keq
- How to verify atomic balances (H and N conservation)
Prerequisites
- Completed Reaction Systems and Refrigeration Cycle
Process Overview¶
Haber-Bosch: N2 + 3H2 → 2NH3 (exothermic, equilibrium-limited). Industrial conditions: 100-300 bar, 400-500 °C.
In this simplified single-pass model, we compress a 3:1 H2:N2 feed to 200 bar, heat to 700 K, react, cool to 250 K to condense liquid NH3, and separate gas from liquid.
Process Flow Diagram¶
graph LR
F["Feed<br/>3H2 + 1N2<br/>30 bar"] --> C["C-1<br/>Compressor<br/>200 bar"]
C --> H["H-1<br/>Heater<br/>700 K"]
H --> R["R-1<br/>Eq. Reactor"]
R --> CL["CL-1<br/>Cooler<br/>250 K"]
CL --> V["V-1<br/>Separator"]
V -->|Gas| PG["Purge Gas"]
V -->|Liquid| NH3["Liquid NH3"]
Key Design Parameters¶
| Parameter | Value |
|---|---|
| Compounds | Hydrogen, Nitrogen, Ammonia |
| Property Package | Peng-Robinson |
| Feed | 3 H2 + 1 N2 mol/s, 300 K, 30 bar |
| Compressor outlet | 200 bar, 75% efficiency |
| Reactor T | 700 K (isothermal) |
| Cooler outlet | 250 K |
| ln(Keq) | 11000/T - 25.0 |
Step-by-Step in the Classic UI¶
1. Set up¶
File > New Chemical Process Model:
- Compounds:
Hydrogen,Nitrogen,Ammonia - Property Package:
Peng-Robinson
Why Peng-Robinson at 200 bar?
PR handles high-pressure non-ideality and the supercritical-like behavior of light gases. Activity-coefficient models would be inappropriate at this pressure range; cubic EOS is the right tool for high-pressure gas-phase systems.
2. Define the equilibrium reaction¶
Edit > Simulation Settings > Reactions → Add New Reaction → Equilibrium type:
- Name:
R_NH3 - Stoichiometry: Nitrogen =
-1, Hydrogen =-3, Ammonia =+2 - Base compound:
Ammonia - Phase:
Vapor, Basis:Activity - ln(Keq):
11000/T - 25.0
Create a Reaction Set NH3Set and add the reaction to it.
Why an Equilibrium Reactor?
The Haber-Bosch reaction is severely equilibrium-limited at industrial conditions. A Conversion Reactor would force an arbitrary extent; the Equilibrium Reactor uses thermodynamics (Keq vs T) to determine the maximum NH3 yield achievable.
Why high pressure favors NH3?
By Le Chatelier's principle, the reaction goes from 4 mol of gas to 2 mol; high P pushes equilibrium toward fewer moles (NH3). Industrial loops run at 150-300 bar despite the compression cost, precisely for this reason.
3. Build the train (drag-and-drop)¶
Drag the following from the Object Palette in this order, renaming each:
- Material Stream
Feed(T=300 K, P=30 bar, total molar flow=4 mol/s, mole fractions: H2=0.75, N2=0.25, NH3=0) - Compressor
C-1(Adiabatic, outlet P=200 bar, η=75%) - Material Stream
Comp-Out(empty) - Heater
H-1(outlet T=700 K, ΔP=0, η=100%) - Material Stream
Hot(empty) - Equilibrium Reactor
R-1(Isothermal mode, Reaction Set = NH3Set, ΔP=0) - Material Stream
Rx-Out(empty) - Cooler
CL-1(outlet T=250 K, ΔP=0, η=100%) - Material Stream
Cold(empty) - Separator Vessel
V-1 - Material Stream
Purge-Gas(empty) - Material Stream
NH3-Liquid(empty)
Plus three energy streams: W_comp, Q_rx, Q_cool (auto-create from each unit's Energy connection).
4. Wire the connections¶
Open each unit operation's Object Editor and set its Connections panel:
- C-1: Inlet=Feed, Outlet=Comp-Out, Energy=W_comp
- H-1: Inlet=Comp-Out, Outlet=Hot
- R-1: Inlet=Hot, Outlet 1 (vapor)=Rx-Out, Outlet 2 (liquid)=Rx-Liq (create empty), Energy=Q_rx
- CL-1: Inlet=Rx-Out, Outlet=Cold, Energy=Q_cool
- V-1: Inlet=Cold, Vapor Outlet=Purge-Gas, Liquid Outlet=NH3-Liquid

5. Solve¶
F6 ON → Solve.
6. Inspect results¶
- NH3-Liquid stream: ammonia mole fraction should be > 0.50 (enriched)
- Purge-Gas stream: predominantly H2 and N2
- Energy streams:
W_compshows compression power,Q_rxandQ_coolshow heat removal
Verify atomic balances using the Mass and Energy Balance Summary under Flowsheet Analysis menu.

Results and Validation¶
| Variable | Expected |
|---|---|
| N2 conversion | 5 - 99% |
| NH3 in liquid product | > 50 mol% |
| NH3 in purge gas | < 50 mol% |
| H atomic balance | Within 0.5% |
| N atomic balance | Within 0.5% |
Expected results
Equilibrium-limited NH3 production at 700 K. Cooling to 250 K condenses NH3, separating it from unreacted H2/N2.
Understanding the Results¶
- Le Chatelier: high pressure (200 bar) shifts equilibrium toward products (4 mol → 2 mol)
- Temperature trade-off: lower T favors equilibrium but catalyst needs ~400-500 °C
- Separation by condensation: NH3 (BP -33 °C) condenses at 250 K / 200 bar; H2 (-253 °C) and N2 (-196 °C) remain gaseous
In a real plant, the purge gas would be recycled back to the compressor (with a small purge to remove inerts), pushing overall conversion above 95%.
Automating This Tutorial¶
Files in this repository
- Python script:
examples/advanced/02_ammonia_synthesis.py - Pre-built flowsheet:
examples/saved/ammonia_synthesis.dwxmz
See examples/advanced/02_ammonia_synthesis.py in the DWSIM.Tutorials repository.
Build using dwsim.reaction.define_equilibrium, dwsim.unitop.add for each operation, dwsim.unitop.connect, and dwsim.solve.run.
Output may vary
Results depend on the LLM's reasoning quality and tool-use accuracy. Always verify the simulation matches your intent before relying on the numbers.
Use DWSIM (via the MCP server) to build the following simulation:
- Create a flowsheet called "AmmoniaSynthesis"
- Add Hydrogen, Nitrogen and Ammonia as compounds; set the property
package to "Peng-Robinson"
- Define an equilibrium reaction "R_NH3" with stoichiometry
N2 = -1, H2 = -3, NH3 = +2; base compound = Ammonia, phase = Vapor,
basis = Activity, ln(Keq) = 11000/T - 25.0; add it to a new reaction
set "NH3Set"
- Add a material stream "Feed" at 300 K and 30 bar with total molar flow
= 4 mol/s and mole fractions H2 = 0.75, N2 = 0.25, NH3 = 0
- Add a Compressor "C-1" (adiabatic, outlet P = 200 bar, efficiency = 75%)
with energy stream W_comp
- Add a Heater "H-1" with outlet T = 700 K, ΔP = 0, efficiency = 100%
- Add an Equilibrium Reactor "R-1" in isothermal mode using reaction set
NH3Set, ΔP = 0, with energy stream Q_rx
- Add a Cooler "CL-1" with outlet T = 250 K, ΔP = 0, efficiency = 100%,
energy stream Q_cool
- Add a Separator Vessel "V-1" with vapor outlet "Purge-Gas" and liquid
outlet "NH3-Liquid"
- Connect: Feed → C-1 → H-1 → R-1 → CL-1 → V-1
- Solve the flowsheet
- Report N2 conversion, the NH3 mole fraction in NH3-Liquid and in
Purge-Gas, and the energy flows W_comp, Q_rx and Q_cool
Exercises
- Lower reactor T to 500 K. How does conversion change?
- Reduce compression to 50 bar. Equilibrium impact?
- Add a recycle loop (Recycle logical operation) connecting Purge-Gas back to a Mixer at the feed.
Further Reading¶
Selected references from the DWSIM technical bibliography. Click the DOI link to access each paper.
- Kai Hou & Ronald Hughes. (2001). The Kinetics of Methane Steam Reforming over a Ni/α-Al₂O₃ Catalyst. Chemical Engineering Journal. doi:10.1016/S1385-8947(00)00367-3
- Arthur L. Kohl & Richard B. Nielsen. (1997). Gas Purification. Gulf Publishing
- A. K. Myers & A. L. Myers. (1986). Numerical Solution of Chemical Equilibria with Simultaneous Reactions. J. Chem. Phys.
- Ding-Yu Peng & Donald B. Robinson. (1976). A New Two-Constant Equation of State. Industrial & Engineering Chemistry Fundamentals. doi:10.1021/i160057a011
Next Steps¶
In Benzene/Toluene Separation, you will build a complete distillation train.