Skip to content

Mixer Basics

In this tutorial you will mix two water streams at different temperatures using DWSIM's Classic UI and verify that the outlet temperature satisfies the energy balance. This is the first tutorial where you connect streams to a unit operation.

What you will learn

  • How to add multiple material streams to a flowsheet
  • How to insert a Mixer unit operation from the Object Palette
  • How to connect streams to a unit operation through the Object Editor's Connections panel
  • How to interpret the calculated outlet temperature

Prerequisites

  • Completed Your First Simulation
  • Basic understanding of energy balance: the outlet temperature of an adiabatic mixer is determined by conservation of enthalpy

Process Overview

An adiabatic mixer combines two or more inlet streams into a single outlet stream with no heat exchange with the surroundings. The outlet temperature is not simply the average of the inlet temperatures; it is the temperature at which the total enthalpy of the outlet equals the sum of inlet enthalpies.

For water streams at moderate temperatures, you can estimate the outlet temperature using a weighted average:

T_out ~ (m1 * T1 + m2 * T2) / (m1 + m2)

This approximation works well when Cp is roughly constant, but DWSIM performs the rigorous enthalpy-based calculation.

Process Flow Diagram

graph LR
    I1["Inlet-1<br/>300 K, 1 atm<br/>100 kg/s Water"] --> MIX["MIX-1<br/>(Mixer)"]
    I2["Inlet-2<br/>348 K, 1 atm<br/>50 kg/s Water"] --> MIX
    MIX --> OUT["Outlet<br/>(calculated)"]

Key Design Parameters

Parameter Inlet-1 Inlet-2
Compound Water Water
Temperature 300 K (27 °C) 348 K (75 °C)
Pressure 101325 Pa (1 atm) 101325 Pa (1 atm)
Mass flow 100 kg/s 50 kg/s

Step-by-Step in the Classic UI

1. Create a new simulation with Water and Steam Tables

Repeat the wizard flow you used in Tutorial 1:

  • File > New Chemical Process Model
  • Compounds page: add Water
  • Property Packages page: add Steam Tables (IAPWS-IF97)
  • Accept defaults on the remaining pages and click Finish

The empty flowsheet appears.

2. Add the first inlet stream

Drag a Material Stream from the Object Palette to the canvas. Right-click it and rename it to Inlet-1.

Double-click the stream to open the Object Editor, then enter:

  • Temperature: 300 K
  • Pressure: 1 atm
  • Mass Flow: 100 kg/s
  • Composition: Water = 1.0

First inlet stream specifications

3. Add the second inlet stream

Drag a second Material Stream to the canvas, rename it Inlet-2, and set:

  • Temperature: 348 K
  • Pressure: 1 atm
  • Mass Flow: 50 kg/s
  • Composition: Water = 1.0

4. Add an empty outlet stream

Drag a third Material Stream to the canvas, rename it Outlet, and leave it empty - no temperature, pressure, or composition. The solver will calculate everything from the mixer's energy balance.

Three streams on the canvas

5. Insert the Mixer

Drag a Mixer from the Object Palette to the canvas. Rename it to MIX-1.

6. Connect Inlet-1 to the Mixer

Double-click the Mixer to open its Object Editor. In the Connections panel:

  • Find the Inlet 1 dropdown and select Inlet-1
  • Find the Inlet 2 dropdown and select Inlet-2
  • Find the Outlet dropdown and select Outlet

DWSIM draws connecting lines between the streams and the Mixer on the canvas.

Mixer connections set in the Object Editor

Alternative: connect from the canvas

Instead of using the Connections panel, you can right-click an inlet stream and choose Connect to > select the Mixer. This is faster for simple flowsheets.

7. Solve the flowsheet

Make sure Flowsheet Calculator Active (F6) is ON on the toolbar, then click Solve.

All four objects (the three streams and the Mixer) turn green to indicate successful calculation.

Solved mixer flowsheet

8. View the outlet stream results

Double-click the Outlet stream and switch to the Results tab. You should see:

  • Temperature: ~316 K (around 43 °C)
  • Pressure: 101325 Pa
  • Mass Flow: 150 kg/s (= 100 + 50)
  • Vapor Fraction: 0.0 (liquid)

Outlet stream results

Results and Validation

Variable Expected Unit
Outlet temperature ~316 K (43 °C) K
Outlet mass flow 150.0 kg/s
Outlet pressure 101325 Pa
Vapor fraction 0.0 (liquid) -

Expected results

The outlet mass flow is exactly 150 kg/s (100 + 50), confirming mass conservation. The temperature (~316 K) falls between the two inlet temperatures, weighted toward the larger stream. The simple weighted average gives (100 * 300 + 50 * 348) / 150 = 316 K, which matches the rigorous calculation closely because Cp of water varies little over this range.

Understanding the Results

The mixer performs an adiabatic enthalpy balance:

m1 * H1(T1, P) + m2 * H2(T2, P) = m_out * H_out(T_out, P)

Because both streams are pure water at the same pressure and both in the liquid phase, the energy balance reduces to finding T_out such that the total enthalpy is conserved. The Steam Tables model gives precise enthalpies at each temperature, yielding the exact outlet temperature.

If the specific heats were very different between 300 K and 348 K (as would happen near a phase transition), the simple weighted-average formula would be less accurate. The rigorous enthalpy balance always gives the correct result.

Automating This Tutorial

Files in this repository

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

fs = (Flowsheet.Create("MixerTutorial")
      .WithCompound("Water")
      .WithPropertyPackage(PropertyPackages.SteamTables))

inlet1 = (fs.AddMaterialStream("Inlet-1")
          .At(Q.Kelvin(300.0), Q.Pascal(101325.0))
          .WithMassFlow(Q.KgPerSecond(100.0)))

inlet2 = (fs.AddMaterialStream("Inlet-2")
          .At(Q.Kelvin(348.0), Q.Pascal(101325.0))
          .WithMassFlow(Q.KgPerSecond(50.0)))

outlet = fs.AddMaterialStream("Outlet")

(fs.AddMixer("MIX-1")
   .ConnectFeed(inlet1, 0)
   .ConnectFeed(inlet2, 1)
   .ConnectProduct(outlet, 0))

fs.AutoLayout()
fs.Solve()

print(f"Outlet T   = {outlet.TemperatureK:.4f} K")
print(f"Mass flow  = {outlet.MassFlowKgPerSecond:.4f} kg/s")
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
  "name":"dwsim.flowsheet.create",
  "arguments":{"name":"MixerTutorial"}
}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{
  "name":"dwsim.thermo.add_compounds",
  "arguments":{"flowsheet_id":"<ID>","names":["Water"]}
}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{
  "name":"dwsim.thermo.set_property_package",
  "arguments":{"flowsheet_id":"<ID>","name":"SteamTables"}
}}
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{
  "name":"dwsim.stream.add_material",
  "arguments":{
    "flowsheet_id":"<ID>","name":"Inlet-1",
    "temperature_K":300,"pressure_Pa":101325,
    "mass_flow_kg_s":100,"composition":{"Water":1.0}
  }
}}
{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{
  "name":"dwsim.stream.add_material",
  "arguments":{
    "flowsheet_id":"<ID>","name":"Inlet-2",
    "temperature_K":348,"pressure_Pa":101325,
    "mass_flow_kg_s":50,"composition":{"Water":1.0}
  }
}}
{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{
  "name":"dwsim.stream.add_material",
  "arguments":{"flowsheet_id":"<ID>","name":"Outlet"}
}}
{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{
  "name":"dwsim.unitop.add",
  "arguments":{"flowsheet_id":"<ID>","type":"Mixer","name":"MIX-1"}
}}

Then connect via dwsim.unitop.connect and finally 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 "MixerTutorial"
- Add Water as the only compound; set the property package to "SteamTables"
- Add a material stream named "Inlet-1" at 300 K and 101325 Pa
  with a mass flow of 100 kg/s (Water = 1.0)
- Add a material stream named "Inlet-2" at 348 K and 101325 Pa
  with a mass flow of 50 kg/s (Water = 1.0)
- Add an empty material stream named "Outlet"
- Add a Mixer named "MIX-1"; connect Inlet-1 and Inlet-2 as feeds
  and Outlet as the product
- Solve the flowsheet
- Report the calculated outlet temperature (K) and the outlet
  mass flow (kg/s)

Exercises

  1. Add a third inlet stream at 400 K, 25 kg/s. Open MIX-1's Object Editor and connect it to Inlet 3. How does the outlet temperature change?
  2. Change the compound from Water to Ethanol (Edit > Simulation Settings > Compounds). Does the outlet temperature change? Why?
  3. Save the simulation as a .dwxmz file via File > Save.

Further Reading

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

  • W.L. McCabe, J. Smith & P. Harriott. (2005). Unit Operations of Chemical Engineering. McGraw-Hill Education
  • Joseph Smith. (1996). Intro to Chemical Engineering Thermodynamics. McGraw-Hill Companies
  • Stanley I. Sandler. (2006). Chemical, Biochemical, and Engineering Thermodynamics. John Wiley & Sons

Next Steps

You now know how to connect streams to a unit operation through the Object Editor's Connections panel. In the next tutorial, Heater and Cooler, you will learn about energy streams and heat duty calculations.