Skip to content

Continuous Stirred Tank Reactor (CSTR)

Represents a Continuous Stirred-Tank Reactor (CSTR) that models a well-mixed reactor vessel where reaction kinetics are evaluated at the outlet composition. Supports conversion, kinetic, and heterogeneous catalytic reactions with optional two-phase (liquid + vapour) outlet operation.

DWSIM.UnitOperations.Reactors.Reactor_CSTR
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← UnitOpBaseClass ← Reactor ← Reactor_CSTR

At a glance

Continuous Stirred Tank Reactor (CSTR) in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Feed
Inlet, energy 1 Q
Inlet, material 2
Outlet, material 0 Product
Outlet, material 1
Outlet, material 2

Example

This code runs on every build of this site, and the output below is what it printed.

fs = (Flowsheet.Create("CSTRExample")
      .WithCompounds("Ethylene oxide", "Water", "Ethylene glycol")
      .WithPropertyPackage(PropertyPackages.NRTL))

# EO + H2O -> EG, first order in EO (water in large excess):
# r = k C_EO, k = A exp(-E/RT) = 0.311 1/min at 55 C with E = 80 kJ/mol
E = 80000.0                                              # J/mol
A = 0.311 / 60.0 * math.exp(E / (8.314 * 328.15))         # 1/s
hydration = fs.DefineKineticReaction(
    "Hydration",
    coefficients({"Ethylene oxide": -1, "Water": -1, "Ethylene glycol": 1}),
    coefficients({"Ethylene oxide": 1, "Water": 0, "Ethylene glycol": 0}),   # forward orders
    coefficients({"Ethylene oxide": 0, "Water": 0, "Ethylene glycol": 0}),   # reverse orders
    "Ethylene oxide", "Liquid", "Molar Concentration", "mol/m3", "mol/[m3.s]", A, E)
fs.ReactionSet("EG").Add(hydration)

feed = (fs.AddMaterialStream("Feed")
        .At(Q.Celsius(55.0), Q.Bar(5.0))
        .WithMolarFlow(Q.MolPerSecond(11.0))
        .SetCompoundMolarFlow("Ethylene oxide", 1.0)
        .SetCompoundMolarFlow("Water", 10.0))
product = fs.AddMaterialStream("Product")
duty = fs.AddEnergyStream("Q")

reactor = (fs.AddCSTR("R-1")
           .Isothermal()
           .WithReactionSet("EG")
           .WithVolume(Q.CubicMeters(0.25))
           .WithPressureDrop(Q.Bar(0.0))
           .ConnectFeed(feed, 0)
           .ConnectProduct(product, 0)
           .ConnectEnergyFeed(duty, 1))

fs.AutoLayout()
fs.Solve()

tau = reactor.Object.ResidenceTimeL                       # s
k = A * math.exp(-E / (8.314 * product.TemperatureK))
print(f"Residence time       = {tau / 60.0:.1f} min")
print(f"EO conversion        = {100.0 * reactor.Object.ComponentConversions['Ethylene oxide']:.1f} %"
      f" (first order CSTR, k tau / (1 + k tau): {100.0 * k * tau / (1.0 + k * tau):.1f} %)")
print(f"Glycol produced      = {product.MolarFlowMolPerSecond * product.OverallMoleFraction('Ethylene glycol'):.3f} mol/s")
print(f"Heat removed         = {-reactor.HeatDutyKW:.1f} kW")

Output

Residence time       = 18.2 min
EO conversion        = 85.0 % (first order CSTR, k tau / (1 + k tau): 85.0 %)
Glycol produced      = 0.850 mol/s
Heat removed         = 83.5 kW

DWSIM 10.2.11.0, generated 2026-10-08.

Properties

IDs accepted by GetPropertyValue, SetPropertyValue, the sensitivity analysis, the optimizer, the Adjust block and dynamic events. Units are SI; pass another unit system to GetPropertyValue to get them converted.

ID Name Unit (SI) Input
PROP_CS_0 Pressure Drop Pa yes
PROP_CS_1 Residence time s yes
PROP_CS_2 Volume m3 yes
PROP_CS_3 Temperature delta K (difference) yes
PROP_CS_4 Heat load kW yes
PROP_CS_5 Outlet Temperature K yes
PROP_CS_6 Headspace m3 yes
PROP_CS_7 Vapor residence time s yes
PROP_CS_8 Overall Heat Transfer Coefficient W/m2.K yes
PROP_CS_9 Heat Exchange Area m2 yes
PROP_CS_10 Coolant Inlet Temperature K yes
PROP_CS_11 Coolant Mass Flow Rate kg/s yes
PROP_CS_12 Coolant Specific Heat J/kg.K yes
PROP_CS_13 Coolant Flow Direction yes
PROP_CS_14 Area Calculation Mode yes
PROP_CS_15 Use Utility Stream yes
PROP_CS_16 Wall Thickness m yes
PROP_CS_17 Internal Heat Transfer Coefficient W/m2.K yes
PROP_CS_18 External Heat Transfer Coefficient W/m2.K yes
PROP_CS_19 Use Wall Properties yes
PROP_CS_20 Calculated Overall HTC W/m2.K yes
PROP_CS_21 Diameter mm yes
PROP_CS_22 Calculate Internal HTC yes
PROP_CS_23 Calculate External HTC yes
PROP_CS_24 Jacket Diameter mm yes
PROP_CS_25 Coolant Density kg/m3 yes
PROP_CS_26 Coolant Viscosity Pa.s yes
PROP_CS_27 Coolant Thermal Conductivity W/m.K yes
PROP_CS_28 Calculated Internal HTC W/m2.K yes
PROP_CS_29 Calculated External HTC W/m2.K yes
PROP_CS_30 Impeller Diameter mm yes
PROP_CS_31 Impeller Speed RPM yes
PROP_CS_32 Impeller Type yes
Mixture Reactions Use Headspace With a single outlet, mixture-phase reactions take place in the reactor volume plus the headspace when True, or in the reactor volume only when False. New reactors use False; files saved before this option keep True. yes
Calculation Mode Select the calculation mode of this reactor. result
Ethylene oxide: Conversion % result
Water: Conversion % result
Hydration: Extent mol/s result
Hydration: Rate mol/[m3.s] result
Hydration: Heat kW result

Dynamic mode

Extra properties used when the flowsheet runs in dynamic mode.

Name Unit
Operating Pressure Pa
Liquid Level m
Height m
Minimum Pressure Pa
Initialize using Inlet Stream
Reset Contents

Learn more

API members

Public members declared by this class. Inherited members are documented on the base classes.

Constructors

Reactor_CSTR(): Initializes a new default instance of the Reactor_CSTR class.

Initializes a new default instance of the Reactor_CSTR class.

public Reactor_CSTR()
Public Sub New()

Reactor_CSTR(string, string): Initializes a new instance of the Reactor_CSTR class with a name and description.

Initializes a new instance of the Reactor_CSTR class with a name and description.

Parameter Type Description
name String The display name of the CSTR.
description String A brief description of the CSTR.
public Reactor_CSTR(string name, string description)
Public Sub New(name As String, description As String)

Properties

CatalystAmount: Gets or sets the mass of catalyst loaded in the reactor (kg).

Gets or sets the mass of catalyst loaded in the reactor (kg).

public double CatalystAmount { get; set; }
Public Property CatalystAmount As Double

Diameter: Gets or sets the reactor diameter (m).

Gets or sets the reactor diameter (m).

public double Diameter { get; set; }
Public Property Diameter As Double

EquipmentTypes: Gets the list of equipment sub-types available for this reactor.

Gets the list of equipment sub-types available for this reactor.

public override List<string> EquipmentTypes { get; }
Public Overrides ReadOnly Property EquipmentTypes As List(Of String)

HasPropertiesForDynamicMode: Gets a value indicating whether this reactor exposes dedicated dynamic-mode properties.

Gets a value indicating whether this reactor exposes dedicated dynamic-mode properties.

public override bool HasPropertiesForDynamicMode { get; }
Public Overrides ReadOnly Property HasPropertiesForDynamicMode As Boolean

Headspace: Gets or sets the reactor headspace volume fraction (0�1).

Gets or sets the reactor headspace volume fraction (0�1).

public double Headspace { get; set; }
Public Property Headspace As Double

Impeller: Gets or sets the impeller type for stirred-vessel internal HTC calculation.

Gets or sets the impeller type for stirred-vessel internal HTC calculation.

public ImpellerType Impeller { get; set; }
Public Property Impeller As ImpellerType

ImpellerDiameter: Gets or sets the impeller diameter (m) for internal HTC calculation.

Gets or sets the impeller diameter (m) for internal HTC calculation.

public double ImpellerDiameter { get; set; }
Public Property ImpellerDiameter As Double

ImpellerSpeed: Gets or sets the impeller speed (RPM) for internal HTC calculation.

Gets or sets the impeller speed (RPM) for internal HTC calculation.

public double ImpellerSpeed { get; set; }
Public Property ImpellerSpeed As Double

InitialNumberOfTimeSteps: Gets or sets the initial number of time sub-steps used in the CSTR transient solver.

Gets or sets the initial number of time sub-steps used in the CSTR transient solver.

public int InitialNumberOfTimeSteps { get; set; }
Public Property InitialNumberOfTimeSteps As Integer

IsothermalTemperature: Gets or sets the isothermal temperature (K) used when the reactor operates in isothermal mode.

Gets or sets the isothermal temperature (K) used when the reactor operates in isothermal mode.

public double IsothermalTemperature { get; set; }
Public Property IsothermalTemperature As Double

MaxIterations: Gets or sets the maximum number of iterations for the CSTR solver.

Gets or sets the maximum number of iterations for the CSTR solver.

public int MaxIterations { get; set; }
Public Property MaxIterations As Integer

MixtureUsesHeadspaceInSingleOutlet: Gets or sets whether a Mixture-phase reaction in a CSTR with a single outlet reacts in Volume + Headspace.

Gets or sets whether a Mixture-phase reaction in a CSTR with a single outlet reacts in Volume + Headspace. When False (new reactors) it reacts in Volume, the same space as the liquid and vapour reactions with one outlet. Reactors saved before this setting existed load with True, as they ran then. With two outlets the reacting volume of a Mixture reaction is always Volume + Headspace.

public bool MixtureUsesHeadspaceInSingleOutlet { get; set; }
Public Property MixtureUsesHeadspaceInSingleOutlet As Boolean

MobileCompatible: Gets a value indicating whether this reactor is compatible with mobile/cross-platform interfaces.

Gets a value indicating whether this reactor is compatible with mobile/cross-platform interfaces.

public override bool MobileCompatible { get; }
Public Overrides ReadOnly Property MobileCompatible As Boolean

ResidenceTimeL: Gets or sets the liquid/solid residence time (s).

Gets or sets the liquid/solid residence time (s).

public double ResidenceTimeL { get; set; }
Public Property ResidenceTimeL As Double

ResidenceTimeV: Gets or sets the vapour residence time (s).

Gets or sets the vapour residence time (s).

public double ResidenceTimeV { get; set; }
Public Property ResidenceTimeV As Double

SupportsDynamicMode: Gets a value indicating whether this reactor supports dynamic simulation mode.

Gets a value indicating whether this reactor supports dynamic simulation mode.

public override bool SupportsDynamicMode { get; }
Public Overrides ReadOnly Property SupportsDynamicMode As Boolean

Tolerance: Gets or sets the convergence tolerance for the CSTR iteration loop.

Gets or sets the convergence tolerance for the CSTR iteration loop.

public double Tolerance { get; set; }
Public Property Tolerance As Double

Volume: Gets or sets the reactor vessel volume (m�).

Gets or sets the reactor vessel volume (m�).

public double Volume { get; set; }
Public Property Volume As Double

Methods

Calculate(object): Performs the CSTR calculation, solving the mass and energy balances at the outlet composition using the selected...

Performs the CSTR calculation, solving the mass and energy balances at the outlet composition using the selected calculation model.

Parameter Type Description
args Object Optional. If True, indicates a dynamic-mode call.
public override void Calculate(object args = null)
Public Overrides Sub Calculate(args As Object = Nothing)

Calculate_Internal_1(object): Runs the CSTR calculation called by Calculate: solves the reaction rates, the outlet composition and...

Runs the CSTR calculation called by Calculate: solves the reaction rates, the outlet composition and the energy balance for the selected operation mode. In dynamic mode the reactor holdup is used in place of the inlet stream.

Parameter Type Description
args Object Optional. True for a dynamic-mode call; Nothing or False for steady state.
public void Calculate_Internal_1(object args = null)
Public Sub Calculate_Internal_1(args As Object = Nothing)

CloneXML(): Creates a deep copy of this reactor via XML serialization.

Creates a deep copy of this reactor via XML serialization.

public override object CloneXML()
Public Overrides Function CloneXML() As Object

CloseEditForm(): Closes and disposes the editing form.

Closes and disposes the editing form.

public override void CloseEditForm()
Public Overrides Sub CloseEditForm()

CreateDimensionsList(): Creates the dimensions list (Volume) for this CSTR.

Creates the dimensions list (Volume) for this CSTR.

public override void CreateDimensionsList()
Public Overrides Sub CreateDimensionsList()

CreateDynamicProperties(): Registers the dynamic properties for dynamic simulation mode.

Registers the dynamic properties for dynamic simulation mode.

public override void CreateDynamicProperties()
Public Overrides Sub CreateDynamicProperties()

DeCalculate(): Clears the calculated results from the outlet material streams.

Clears the calculated results from the outlet material streams.

public override void DeCalculate()
Public Overrides Sub DeCalculate()

DisplayEditForm(): Opens or activates the editing form for this reactor.

Opens or activates the editing form for this reactor.

public override void DisplayEditForm()
Public Overrides Sub DisplayEditForm()

GetDisplayDescription(): Returns the localised display description for this reactor.

Returns the localised display description for this reactor.

public override string GetDisplayDescription()
Public Overrides Function GetDisplayDescription() As String

GetDisplayName(): Returns the localised display name for this reactor.

Returns the localised display name for this reactor.

public override string GetDisplayName()
Public Overrides Function GetDisplayName() As String

GetIconBitmapBytes(): Returns the icon bitmap as a byte array.

Returns the icon bitmap as a byte array.

public override byte[] GetIconBitmapBytes()
Public Overrides Function GetIconBitmapBytes() As Byte()

GetProperties(PropertyType): Returns an array of property identifiers for the specified property type.

Returns an array of property identifiers for the specified property type.

Parameter Type Description
proptype PropertyType
public override string[] GetProperties(PropertyType proptype)
Public Overrides Function GetProperties(proptype As PropertyType) As String()

GetPropertyDescription(string): Returns a human-readable description of the specified property.

Returns a human-readable description of the specified property.

Parameter Type Description
p String
public override string GetPropertyDescription(string p)
Public Overrides Function GetPropertyDescription(p As String) As String

GetPropertyUnit(string, IUnitsOfMeasure): Returns the unit string for the specified property.

Returns the unit string for the specified property.

Parameter Type Description
prop String
su IUnitsOfMeasure
public override string GetPropertyUnit(string prop, IUnitsOfMeasure su = null)
Public Overrides Function GetPropertyUnit(prop As String, su As IUnitsOfMeasure = Nothing) As String

GetPropertyValue(string, IUnitsOfMeasure): Returns the value of the specified property, converted to the given unit system.

Returns the value of the specified property, converted to the given unit system.

Parameter Type Description
prop String
su IUnitsOfMeasure
public override object GetPropertyValue(string prop, IUnitsOfMeasure su = null)
Public Overrides Function GetPropertyValue(prop As String, su As IUnitsOfMeasure = Nothing) As Object

GetReport(IUnitsOfMeasure, CultureInfo, string): Generates a plain-text report of the reactor results using the specified units and format.

Generates a plain-text report of the reactor results using the specified units and format.

Parameter Type Description
su IUnitsOfMeasure
ci CultureInfo
numberformat String
public override string GetReport(IUnitsOfMeasure su, CultureInfo ci, string numberformat)
Public Overrides Function GetReport(su As IUnitsOfMeasure, ci As CultureInfo, numberformat As String) As String

GetStructuredReport(): Generates a structured report of the reactor results as a list of typed tuples.

Generates a structured report of the reactor results as a list of typed tuples.

public override List<Tuple<ReportItemType, string[]>> GetStructuredReport()
Public Overrides Function GetStructuredReport() As List(Of Tuple(Of ReportItemType, String()))

LoadData(List<XElement>): Restores the reactor state from XML.

Restores the reactor state from XML.

Parameter Type Description
data List<XElement> List of XML elements containing the serialized state.
public override bool LoadData(List<XElement> data)
Public Overrides Function LoadData(data As List(Of XElement)) As Boolean

RunDynamicModel(): Executes one dynamic simulation time step for the CSTR.

Executes one dynamic simulation time step for the CSTR.

public override void RunDynamicModel()
Public Overrides Sub RunDynamicModel()

SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of the specified property from the given value and unit system.

Sets the value of the specified property from the given value and unit system.

Parameter Type Description
prop String
propval Object
su IUnitsOfMeasure
public override bool SetPropertyValue(string prop, object propval, IUnitsOfMeasure su = null)
Public Overrides Function SetPropertyValue(prop As String, propval As Object, su As IUnitsOfMeasure = Nothing) As Boolean

UpdateDimensionsList(): Updates the dimension values from the current reactor volume.

Updates the dimension values from the current reactor volume.

public override void UpdateDimensionsList()
Public Overrides Sub UpdateDimensionsList()

UpdateEditForm(): Refreshes the editing form with updated data.

Refreshes the editing form with updated data.

public override void UpdateEditForm()
Public Overrides Sub UpdateEditForm()

Fields

DHRi: Heat of each reaction in the last calculation, keyed by reaction ID, in kW.

Heat of each reaction in the last calculation, keyed by reaction ID, in kW.

public Dictionary<string, double> DHRi
Public DHRi As Dictionary(Of String, Double)

f: The classic (WinForms) editor window open for this reactor, if any.

The classic (WinForms) editor window open for this reactor, if any. Not saved with the flowsheet.

public object f
Public f As Object

RxiT: Overall rate of each reaction in the last calculation, keyed by reaction ID and reported as the reaction extent.

Overall rate of each reaction in the last calculation, keyed by reaction ID and reported as the reaction extent. It is the rate times the volume of the reacting phase (kinetic reactions) or times the catalyst amount (heterogeneous catalytic reactions), over the base compound stoichiometric coefficient, in mol/s. Rates from a Python script follow the same rule.

public Dictionary<string, double> RxiT
Public RxiT As Dictionary(Of String, Double)