Recycle¶
![]()
Represents a material recycle convergence block that iterates stream conditions until inlet and outlet properties match within the specified tolerances. Supports Wegstein, Dominant Eigenvalue, and successive substitution acceleration methods.
DWSIM.UnitOperations.SpecialOps.Recycle
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← SpecialOpBaseClass ← Recycle
At a glance¶

| Port | Index | Connected in the example |
|---|---|---|
| Inlet, material | 0 |
Recycle-in |
| Outlet, material | 0 |
Recycle-out |
Example¶
This code runs on every build of this site, and the output below is what it printed.
fs = (Flowsheet.Create("RecycleExample")
.WithCompounds("Methanol", "Water")
.WithPropertyPackage(PropertyPackages.NRTL))
feed = (fs.AddMaterialStream("Feed")
.At(Q.Celsius(25.0), Q.Bar(1.01325))
.SetCompoundMolarFlow("Methanol", 10.0) # mol/s
.SetCompoundMolarFlow("Water", 10.0))
mixed = fs.AddMaterialStream("Mixed")
heated = fs.AddMaterialStream("Heated")
vapor = fs.AddMaterialStream("Vapor")
liquid = fs.AddMaterialStream("Liquid")
purge = fs.AddMaterialStream("Bottoms")
tear_in = fs.AddMaterialStream("Recycle-in") # leaves the splitter
tear_out = fs.AddMaterialStream("Recycle-out") # leaves the recycle block
fs.AddMixer("MIX-1").ConnectFeed(feed, 0).ConnectFeed(tear_out, 1).ConnectProduct(mixed)
(fs.AddHeater("H-1").WithOutletTemperature(Q.Celsius(80.0)).WithPressureDrop(Q.Pascal(0.0))
.ConnectFeed(mixed).ConnectProduct(heated))
fs.AddSeparator("V-1").ConnectFeed(heated).ConnectProduct(vapor, 0).ConnectProduct(liquid, 1)
(fs.AddSplitter("SP-1").WithSplitRatios(0.5, 0.5)
.ConnectFeed(liquid).ConnectProduct(purge, 0).ConnectProduct(tear_in, 1))
recycle = (fs.AddUnitOperation(ObjectType.OT_Recycle, "REC-1")
.ConnectFeed(tear_in)
.ConnectProduct(tear_out))
rec = recycle.Object.__implementation__
rec.MaximumIterations = 50
# The default mass flow tolerance, 0.01 kg/s, is loose for a 0.5 kg/s loop: tighten it.
rec.SetPropertyValue("PROP_RY_1", 1.0e-5) # mass flow tolerance, kg/s
rec.SetPropertyValue("PROP_RY_2", 0.01) # temperature tolerance, K
fs.AutoLayout()
fs.Solve()
m_in = feed.MassFlowKgPerSecond
m_out = vapor.MassFlowKgPerSecond + purge.MassFlowKgPerSecond
print(f"Converged = {rec.Converged} after {rec.IterationsTaken} iterations")
print(f"Recycle flow = {tear_out.MolarFlowMolPerSecond:.3f} mol/s "
f"(splitter side {tear_in.MolarFlowMolPerSecond:.3f} mol/s)")
print(f"Vapor product = {vapor.MolarFlowMolPerSecond:.3f} mol/s, "
f"methanol {vapor.OverallMoleFraction('Methanol'):.4f}")
print(f"Mass balance = {m_in:.5f} kg/s in, {m_out:.5f} kg/s out")
Output
Converged = True after 13 iterations
Recycle flow = 6.366 mol/s (splitter side 6.366 mol/s)
Vapor product = 13.634 mol/s, methanol 0.6221
Mass balance = 0.50057 kg/s in, 0.50058 kg/s out
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_RY_0 |
Maximum Iterations | yes | |
PROP_RY_1 |
Mass Flow Tolerance | kg/s | yes |
PROP_RY_2 |
Temperature Tolerance | K (difference) | yes |
PROP_RY_3 |
Pressure Tolerance | Pa | yes |
PROP_RY_4 |
Mass Flow Error | kg/s | result |
PROP_RY_5 |
Temperature Error | K (difference) | result |
PROP_RY_6 |
Pressure Error | Pa | result |
PROP_RY_7 |
Relative Mass Flow Tolerance | yes |
Learn more¶
-
User guide
-
Tutorials
-
FluentAPI
API members¶
Public members declared by this class. Inherited members are documented on the base classes.
Constructors¶
Recycle(): Initializes a new default instance of the Recycle class.
Initializes a new default instance of the Recycle class.
Recycle(string, string): Initializes a new instance of the Recycle class with a name and description.
Initializes a new instance of the Recycle class with a name and description.
| Parameter | Type | Description |
|---|---|---|
name |
String |
The display name of the recycle block. |
description |
String |
A brief description of the recycle block. |
Properties¶
ConvergenceParameters: Gets or sets the convergence tolerance parameters (temperature, pressure, mass flow, etc.).
Gets or sets the convergence tolerance parameters (temperature, pressure, mass flow, etc.).
CopyOnStreamDataError: Gets or sets whether stream data should be copied even when an error occurs reading stream properties.
Gets or sets whether stream data should be copied even when an error occurs reading stream properties.
HasPropertiesForDynamicMode: Gets a value indicating whether this recycle block exposes properties for dynamic mode.
Gets a value indicating whether this recycle block exposes properties for dynamic mode.
IterationCount: Gets or sets the current iteration counter during an active convergence run.
Gets or sets the current iteration counter during an active convergence run.
IterationsTaken: Gets or sets the total number of iterations taken during the last convergence run.
Gets or sets the total number of iterations taken during the last convergence run.
LegacyMode: Gets or sets whether to use the legacy convergence algorithm.
Gets or sets whether to use the legacy convergence algorithm.
MaximumIterations: Gets or sets the maximum number of iterations allowed before convergence is considered failed.
Gets or sets the maximum number of iterations allowed before convergence is considered failed.
MobileCompatible: Gets a value indicating whether this recycle block is compatible with the DWSIM mobile interface.
Gets a value indicating whether this recycle block is compatible with the DWSIM mobile interface.
SmoothingFactor: Gets or sets the damping factor applied to variable updates during convergence iterations (1.0 = no damping).
Gets or sets the damping factor applied to variable updates during convergence iterations (1.0 = no damping).
SupportsDynamicMode: Gets a value indicating whether this recycle block supports dynamic simulation mode.
Gets a value indicating whether this recycle block supports dynamic simulation mode.
WegsteinParameters: Gets or sets the Wegstein acceleration parameters used during convergence.
Gets or sets the Wegstein acceleration parameters used during convergence.
Methods¶
Calculate(object): Performs one iteration of the recycle convergence check, optionally applying Wegstein or Broyden acceleration, and...
Performs one iteration of the recycle convergence check, optionally applying Wegstein or Broyden acceleration, and updates the outlet stream with the new estimated values.
| Parameter | Type | Description |
|---|---|---|
args |
Object |
Optional calculation arguments (not used). |
CloneXML(): Creates a deep copy of this recycle block via XML serialization.
Creates a deep copy of this recycle block via XML serialization.
CloseEditForm(): Closes and disposes the editing form for this recycle block if it is open.
Closes and disposes the editing form for this recycle block if it is open.
DeCalculate(): Resets the iteration counter, effectively unsetting the convergence state.
Resets the iteration counter, effectively unsetting the convergence state.
DisplayEditForm(): Opens or activates the editing form for this recycle block.
Opens or activates the editing form for this recycle block.
GetDisplayDescription(): Returns the localized display description for the recycle block type.
Returns the localized display description for the recycle block type.
GetDisplayName(): Returns the localized display name for the recycle block type.
Returns the localized display name for the recycle block type.
GetIconBitmapBytes(): Returns the raw bytes of the recycle block icon image resource.
Returns the raw bytes of the recycle block icon image resource.
GetProperties(PropertyType): Returns the list of property identifiers available for this recycle block filtered by property type.
Returns the list of property identifiers available for this recycle block filtered by property type.
| Parameter | Type | Description |
|---|---|---|
proptype |
PropertyType |
The type of properties to retrieve. |
GetPropertyUnit(string, IUnitsOfMeasure): Returns the unit string for the specified property in the given unit system.
Returns the unit string for the specified property in the given unit system.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
The property identifier string. |
su |
IUnitsOfMeasure |
The unit system to use; defaults to SI if not provided. |
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 |
The property identifier string (e.g., "PROP_RY_0"). |
su |
IUnitsOfMeasure |
The unit system to use; defaults to SI if not provided. |
LoadData(List<XElement>): Restores the recycle block state from a list of XML elements.
Restores the recycle block state from a list of XML elements.
| Parameter | Type | Description |
|---|---|---|
data |
List<XElement> |
The list of XElement objects containing the serialized state. |
MAX(object): Returns the maximum value from an array-like object.
Returns the maximum value from an array-like object.
| Parameter | Type | Description |
|---|---|---|
Vv |
Object |
An array whose maximum element is to be found. |
RunDynamicModel(): Executes one dynamic-mode step by directly assigning the inlet stream properties to the outlet stream.
Executes one dynamic-mode step by directly assigning the inlet stream properties to the outlet stream.
SaveData(): Serializes the recycle block state to a list of XML elements for persistence.
Serializes the recycle block state to a list of XML elements for persistence.
SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of the specified property after converting from the given unit system to SI.
Sets the value of the specified property after converting from the given unit system to SI.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
The property identifier string. |
propval |
Object |
The new value in the units of su. |
su |
IUnitsOfMeasure |
The unit system of the supplied value; defaults to SI if not provided. |
UpdateEditForm(): Refreshes the displayed data in the editing form if it is currently open.
Refreshes the displayed data in the editing form if it is currently open.
Fields¶