Skip to content

Reaction Systems

In this tutorial you will model the water-gas shift reaction (CO + H2O ⇌ CO2 + H2) using DWSIM's Classic UI. You will compare three reactor models - Conversion, Equilibrium, and Gibbs - to understand when each is appropriate.

What you will learn

  • How to define reactions in Edit > Simulation Settings > Reactions
  • How to add Conversion, Equilibrium, and Gibbs reactors from the Object Palette
  • How to associate a reaction set with a reactor
  • When to choose each reactor type

Prerequisites

Process Overview

DWSIM provides several reactor models:

Reactor Type When to Use
Conversion You know the conversion percentage (from experiments or heuristics)
Equilibrium You have a Keq expression and want to predict equilibrium-limited conversion
Gibbs You want to find the global minimum of Gibbs energy (no reaction definitions needed)

Why three different reactor types?

Conversion forces a fixed extent of reaction; use it when you have experimental conversion data or vendor heuristics. Equilibrium uses a Keq expression and predicts equilibrium-limited conversion; use it when reaction kinetics are fast relative to residence time. Gibbs minimizes total free energy without explicit reaction definitions; it is the most general approach but needs accurate thermodynamic data for every species considered.

The water-gas shift (WGS) reaction is industrially important for hydrogen production: CO + H2O → CO2 + H2.

Process Flow Diagram

graph LR
    F["Feed<br/>600 K, 10 atm<br/>CO + H2O + CO2 + H2"] --> R["Reactor<br/>(Conv / Equil / Gibbs)"]
    R --> P["Product<br/>(equilibrium composition)"]

Key Design Parameters

Parameter Value Unit
Compounds Water, Carbon monoxide, Carbon dioxide, Hydrogen -
Property Package Peng-Robinson -
Feed temperature 600 K
Feed pressure 10 atm Pa
Feed composition 40% CO, 40% H2O, 10% CO2, 10% H2 molar
Feed molar flow 10 mol/s

Step-by-Step in the Classic UI

1. Set up the simulation

File > New Chemical Process Model:

  • Compounds: Water, Carbon monoxide, Carbon dioxide, Hydrogen
  • Property Package: Peng-Robinson
  • Click Finish

Why Peng-Robinson?

Peng-Robinson is the industry standard for hydrocarbons, light gases (CO, CO2, H2, N2), and high-pressure vapor-liquid equilibria. It is a cubic equation of state, fast to evaluate, and accurate for non-polar and weakly polar systems. Avoid PR for highly polar or hydrogen-bonding mixtures (water-alcohol, electrolytes); use NRTL/UNIQUAC there instead.

2. Define the WGS reaction

After the wizard closes, open Edit > Simulation Settings > Reactions.

Click Add New Reaction and choose Equilibrium type. In the reaction editor:

  • Name: WGS
  • Stoichiometry:
    • Carbon monoxide: -1
    • Water: -1
    • Carbon dioxide: +1
    • Hydrogen: +1
  • Base compound: Carbon dioxide
  • Phase: Vapor
  • Basis: Activity
  • ln(Keq) Expression: 4577.8/T - 4.33

WGS equilibrium reaction defined

Click OK to save.

Now create a Reaction Set named WGS_Set and add the WGS reaction to it. The Reaction Set is what you assign to a reactor.

3. Create the feed stream

Drag a Material Stream named Feed, configure:

  • T = 600 K, P = 10 atm, Molar Flow = 10 mol/s
  • Composition (Mole Fraction):
    • Carbon monoxide: 0.4
    • Water: 0.4
    • Carbon dioxide: 0.1
    • Hydrogen: 0.1

4. Insert an Equilibrium Reactor

Drag an Equilibrium Reactor from the Object Palette to the canvas. Rename it R-Eq. Open the editor:

  • Calculation Mode: Isothermal
  • Reaction Set: select WGS_Set from the dropdown
  • Pressure Drop: 0 Pa

In the Connections panel:

  • Inlet: Feed
  • Outlet 1 (Vapor): create a new stream Product-Eq
  • Outlet 2 (Liquid): create a new stream Product-Eq-Liq (may be empty if all vapor)
  • Energy: click [Click here to create]

Equilibrium reactor configured

5. (Optional) Add a Conversion Reactor for comparison

Drag a Conversion Reactor to the canvas, rename R-Conv. Before configuring it, define a conversion-type reaction in Edit > Simulation Settings > Reactions (similar to the equilibrium one but specify Conversion (%) = 80) and add it to a new Reaction Set WGS_Conv.

In R-Conv's editor: assign Reaction Set WGS_Conv, Isothermal mode, connect to Feed and a new outlet Product-Conv.

Sharing the feed across reactors

Both reactors can take the same Feed stream as inlet. DWSIM duplicates the feed flow to each reactor automatically. To compare results properly, copy the feed conditions but use separate inlet streams (Feed-Eq, Feed-Conv).

6. (Optional) Add a Gibbs Reactor

A Gibbs reactor needs no reaction definition - it minimizes the total Gibbs free energy automatically. Drag a Gibbs Reactor, name it R-Gibbs, set Isothermal mode, no Reaction Set required, connect feed and outlet streams.

7. Solve

F6 ON → Solve. All reactors converge.

8. Compare the products

Open the Results tab on each product stream and compare CO mole fraction:

  • Product-Conv (80% conversion): CO ~ 0.08 (40% × 0.2 = exact remaining)
  • Product-Eq (Keq-based at 600 K): CO determined by equilibrium
  • Product-Gibbs: should agree closely with Product-Eq

Comparing reactor outputs

Results and Validation

Reactor CO Conversion H2 Mole Fraction
Conversion (80% fixed) 80% (specified) ~0.28
Equilibrium (Keq) Determined by Keq at 600 K ~0.20-0.30
Gibbs (free energy min) Determined by Gibbs minimization ~0.20-0.30

Expected results

Conversion reactor gives exactly 80%. Equilibrium and Gibbs reactors should agree closely (both predict thermodynamic equilibrium). All three should conserve atoms (C, H, O balance).

Understanding the Results

  • Conversion: forces a fixed extent of reaction regardless of thermodynamics. Use when you have experimental data.
  • Equilibrium: uses your Keq expression. At 600 K, WGS favors products (Keq > 1).
  • Gibbs: minimizes total Gibbs free energy without explicit reaction definitions. Most general but requires accurate thermodynamic data.

For WGS, Equilibrium and Gibbs should agree closely, validating both your Keq expression and the property package.

Automating This Tutorial

Files in this repository

from DWSIM.Automation.FluentAPI import Flowsheet, PropertyPackages, Q

fs = (Flowsheet.Create("ReactionTutorial")
      .WithCompounds("Water", "Carbon monoxide",
                     "Carbon dioxide", "Hydrogen")
      .WithPropertyPackage(PropertyPackages.PengRobinson))

rxn = fs.DefineEquilibriumReaction("WGS",
    stoichiometry={"Carbon monoxide": -1, "Water": -1,
                   "Carbon dioxide": 1, "Hydrogen": 1},
    baseCompound="Carbon dioxide",
    phase="Vapor", basis="Activity", units="",
    lnKeqExpression="4577.8/T - 4.33")
fs.ReactionSet("WGS_Set").Add(rxn)

feed = (fs.AddMaterialStream("Feed")
        .At(Q.Kelvin(600.0), Q.Pascal(1013250.0))
        .WithMolarFlow(10.0.MolPerSecond())
        .SetCompoundMolarFlow("Carbon monoxide", 4.0)
        .SetCompoundMolarFlow("Water", 4.0)
        .SetCompoundMolarFlow("Carbon dioxide", 1.0)
        .SetCompoundMolarFlow("Hydrogen", 1.0))

product = fs.AddMaterialStream("Product")
q = fs.AddEnergyStream("Q")
fs.AddEquilibriumReactor("R-Eq") \
  .Isothermal() \
  .WithReactionSet("WGS_Set") \
  .ConnectFeed(feed, 0) \
  .ConnectProduct(product, 0) \
  .ConnectEnergyFeed(q, 1)

fs.AutoLayout()
fs.Solve()

Use dwsim.reaction.define_equilibrium to register the WGS reaction, then add the Equilibrium Reactor and connect the streams via standard tool calls. See the MCP Server reaction example for the full sequence.

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 "ReactionTutorial"
- Add Water, Carbon monoxide, Carbon dioxide and Hydrogen as
  compounds; set the property package to "PengRobinson"
- Define an equilibrium reaction "WGS" with stoichiometry
  Carbon monoxide = -1, Water = -1, Carbon dioxide = +1,
  Hydrogen = +1; base compound = Carbon dioxide; phase = Vapor;
  basis = Activity; ln(Keq) expression = "4577.8/T - 4.33".
  Add it to a Reaction Set named "WGS_Set"
- Add a material stream named "Feed" at 600 K and 1013250 Pa
  (10 atm) with a molar flow of 10 mol/s and component molar
  flows: Carbon monoxide = 4.0, Water = 4.0, Carbon dioxide = 1.0,
  Hydrogen = 1.0
- Add an empty material stream "Product" and an energy stream "Q"
- Add an Equilibrium Reactor named "R-Eq" in isothermal mode using
  the WGS_Set reaction set; feed it from Feed, send the outlet to
  Product and connect Q as the energy stream
- Solve the flowsheet
- Report the outlet mole fractions of CO, H2, CO2 and H2O in the
  Product stream and the CO conversion

Exercises

  1. Change the temperature to 800 K. Open the reactor's editor → Calculation Mode → set new temperature, then re-solve. The WGS is exothermic, so higher temperature should decrease equilibrium conversion.
  2. Increase pressure to 50 atm. Does it affect WGS equilibrium? (Hint: count moles of gas on each side.)
  3. Add excess water (8 mol/s instead of 4). How does this shift equilibrium by Le Chatelier's principle?

Further Reading

Selected references from the DWSIM technical bibliography. Click the DOI link to access each paper.

  • A. K. Myers & A. L. Myers. (1986). Numerical Solution of Chemical Equilibria with Simultaneous Reactions. J. Chem. Phys.
  • 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
  • John M. Prausnitz, Rüdiger N. Lichtenthaler & Edmundo Gomes de Azevedo. (1999). Molecular Thermodynamics of Fluid-Phase Equilibria. Prentice Hall PTR
  • Joseph Smith. (1996). Intro to Chemical Engineering Thermodynamics. McGraw-Hill Companies

Next Steps

In Recycle Loops, you will learn how to handle streams that feed back into the process.