Recycle Loops¶
In this tutorial you will build a flowsheet with a recycle stream in DWSIM's Classic UI, where part of a process output is fed back to the input. Recycle loops are fundamental in chemical engineering: unreacted feed, solvents, and catalysts are routinely recycled to improve efficiency.
What you will learn
- How to build a closed-loop flowsheet using Mixer, Splitter, and the Recycle logical operation
- How DWSIM detects tear streams and iterates to convergence
- How to specify split ratios and inspect convergence in the Console Output
Prerequisites
- Completed Reaction Systems
- Concept of tear streams: the solver "tears" a recycle loop, guesses the tear stream conditions, solves forward, and iterates until convergence
Process Overview¶
A simple recycle loop:
- Mixer combines fresh feed with the recycle stream
- Process unit (here a Heater simulating any processing step)
- Splitter divides the output into a product stream and a recycle stream
- Recycle logical operation closes the loop and triggers the iterative solver
Process Flow Diagram¶
graph LR
FF["Fresh Feed<br/>300 K, 1 atm<br/>1 kg/s Water"] --> MIX["MIX-1"]
MIX --> H["H-1<br/>(Heater)<br/>350 K"]
H --> SP["SP-1<br/>(Splitter)"]
SP -->|70%| PROD["Product"]
SP -->|30%| REC["Recycle"]
REC --> RC["RC-1<br/>(Recycle)"]
RC --> MIX
Key Design Parameters¶
| Parameter | Value | Unit |
|---|---|---|
| Compound | Water | - |
| Property Package | Steam Tables | - |
| Fresh feed temperature | 300 | K |
| Fresh feed pressure | 1 atm | Pa |
| Fresh feed mass flow | 1.0 | kg/s |
| Heater outlet temperature | 350 | K |
| Split ratio (product) | 0.70 (70% to product) | - |
Step-by-Step in the Classic UI¶
1. Set up the simulation¶
File > New Chemical Process Model:
- Compounds:
Water - Property Package:
Steam Tables - Click Finish
2. Create the streams¶
Drag five Material Streams to the canvas:
- Fresh-Feed (T = 300 K, P = 1 atm, m = 1 kg/s, Water = 1.0)
- Mixed (empty)
- Heated (empty)
- Product (empty)
- Recycle (empty)
- Recycle-Return (empty)
Yes, that is six. The Recycle-Return stream represents the output of the Recycle logical operation back to the Mixer.
3. Insert the Mixer¶
Drag a Mixer to the canvas, name it MIX-1. In its Connections panel:
- Inlet 1:
Fresh-Feed - Inlet 2:
Recycle-Return - Outlet:
Mixed
4. Insert the Heater¶
Drag a Heater named H-1:
- Outlet Temperature:
350 K, ΔP: 0, Efficiency: 100% - Inlet:
Mixed, Outlet:Heated, Energy: create new
5. Insert the Splitter¶
Drag a Splitter from the Object Palette, name it SP-1. In the editor:
- Splitting Mode:
Split Ratios - Outlet 1 Ratio:
0.70 - Outlet 2 Ratio:
0.30
Connections:
- Inlet:
Heated - Outlet 1:
Product - Outlet 2:
Recycle

6. Insert the Recycle (logical operation)¶
Drag a Recycle object from the Object Palette to the canvas (under the Logical Operations category). Name it RC-1. In the editor:
- Inlet:
Recycle - Outlet:
Recycle-Return - Convergence Tolerance: leave at default (e.g., 0.01%)
- Maximum Iterations: 50

7. Solve¶
F6 ON → Solve. The solver detects the cycle, picks a tear stream, makes an initial guess, and iterates. Watch the Console Output panel for messages like "Recycle iteration 1, convergence error 5.2%, tolerance 0.01%". After several iterations the loop converges.
8. Inspect the steady state¶
Open the Results tabs:
- Product mass flow: should equal
1.0 kg/s(= fresh feed; mass conservation) - Mixed mass flow: ~
1.43 kg/s(= 1.0 / 0.70 because 30% is recycled) - Recycle mass flow: ~
0.43 kg/s(= 1.43 × 0.30)

Results and Validation¶
| Variable | Expected | Unit |
|---|---|---|
| Product mass flow | ~1.0 | kg/s |
| Recycle mass flow | ~0.43 | kg/s |
| Mixed stream flow | ~1.43 | kg/s |
Expected results
At steady state, product flow equals fresh feed (mass conservation - everything that enters as fresh feed must leave as product). The recycle splits the internal flow: 30% recycle means internal flow = 1.0 / 0.70 = 1.43 kg/s.
Understanding the Results¶
The recycle loop amplifies internal flow rate. With 70/30 split, the mixer sees 43% more flow than the fresh feed alone. This is useful in real processes:
- Increases conversion per pass through a reactor
- Helps control internal temperatures and concentrations
The DWSIM solver handles the circular dependency by iteration: it guesses the recycle stream conditions, solves all units in sequence, compares the calculated recycle conditions with the guess, and adjusts using Wegstein acceleration until they match.
Why Wegstein acceleration?
Wegstein detects oscillation patterns in successive recycle iterations and damps overshoots, converging in far fewer iterations than direct substitution. It is also simpler to set up than full Newton-Raphson, which would need a Jacobian of the whole flowsheet. For most well-posed recycles, Wegstein converges to the default 0.01% tolerance in 5-15 iterations.
Automating This Tutorial¶
Files in this repository
- Python script:
examples/intermediate/04_recycle_loops.py - Pre-built flowsheet:
examples/saved/recycle_loop.dwxmz
from DWSIM.Automation.FluentAPI import Flowsheet, PropertyPackages, Q
from DWSIM.Interfaces.Enums.GraphicObjects import ObjectType
fs = (Flowsheet.Create("RecycleTutorial")
.WithCompound("Water")
.WithPropertyPackage(PropertyPackages.SteamTables))
fresh = (fs.AddMaterialStream("Fresh-Feed")
.At(Q.Kelvin(300.0), Q.Pascal(101325.0))
.WithMassFlow(Q.KgPerSecond(1.0)))
mixed = fs.AddMaterialStream("Mixed")
heated = fs.AddMaterialStream("Heated")
product = fs.AddMaterialStream("Product")
recycle = fs.AddMaterialStream("Recycle")
recycle_return = fs.AddMaterialStream("Recycle-Return")
(fs.AddMixer("MIX-1")
.ConnectFeed(fresh, 0)
.ConnectFeed(recycle_return, 1)
.ConnectProduct(mixed, 0))
(fs.AddHeater("H-1")
.WithOutletTemperature(350.0.Kelvin())
.WithPressureDrop(0.0.Pascal())
.WithEfficiencyPercent(100.0)
.ConnectFeed(mixed, 0)
.ConnectProduct(heated, 0))
(fs.AddSplitter("SP-1")
.WithSplitRatios([0.70, 0.30])
.ConnectFeed(heated, 0)
.ConnectProduct(product, 0)
.ConnectProduct(recycle, 1))
fs.AddUnitOperation(ObjectType.Recycle, "RC-1") \
.ConnectFeed(recycle, 0) \
.ConnectProduct(recycle_return, 0)
fs.AutoLayout()
fs.Solve()
print(f"Product = {product.MassFlowKgPerSecond:.4f} kg/s")
print(f"Recycle = {recycle.MassFlowKgPerSecond:.4f} kg/s")
Build with dwsim.unitop.add for Mixer, Heater, Splitter, and Recycle, connect them via dwsim.unitop.connect, then 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 "RecycleTutorial"
- Add Water as the only compound; set the property package to "SteamTables"
- Add a material stream named "Fresh-Feed" at 300 K and 101325 Pa
with a mass flow of 1.0 kg/s (Water = 1.0)
- Add empty material streams "Mixed", "Heated", "Product",
"Recycle" and "Recycle-Return"
- Add a Mixer named "MIX-1"; connect Fresh-Feed and Recycle-Return
as feeds and Mixed as the product
- Add a Heater named "H-1" with outlet temperature 350 K, pressure
drop 0 Pa and efficiency 100 %; feed it from Mixed and produce Heated
- Add a Splitter named "SP-1" with split ratios 0.70 / 0.30; feed
it from Heated; outlet 1 = Product, outlet 2 = Recycle
- Add a Recycle logical operation named "RC-1"; feed it from
Recycle and produce Recycle-Return (closing the loop)
- Solve the flowsheet (the solver will iterate to convergence)
- Report the converged Product mass flow (kg/s) and Recycle mass
flow (kg/s)
Exercises
- Change the split ratio to 50/50. How does the internal flow rate change?
- Replace the Heater with a Conversion Reactor (define a fictitious A → B reaction). The recycle now increases overall conversion of unreacted A.
- What happens with 100% recycle (split 0/1)? Why can't the solver converge?
Further Reading¶
Selected references from the DWSIM technical bibliography. Click the DOI link to access each paper.
- A. Wächter & L. T. Biegler. (2006). On the Implementation of an Interior-Point Filter Line-Search Algorithm for Large-Scale Nonlinear Programming. Mathematical Programming. doi:10.1007/s10107-004-0559-y
- Michael Michelsen & Jorgen Mollerup. (2007). Thermodynamic Models: Fundamentals and Computational Aspects. Tie-Line Publications
- K. Thomsen. (1997). Aqueous electrolytes: model parameters and process simulation
Next Steps¶
In Phase Envelope, you will learn how to generate pressure-temperature phase diagrams for multi-component mixtures using the Utilities menu.