Skip to content

Cooler

Represents a cooler unit operation that reduces the temperature of an inlet material stream by removing a specified amount of heat, targeting an outlet temperature, outlet vapor fraction, or temperature change. Supports steady-state and dynamic simulation modes.

DWSIM.UnitOperations.UnitOperations.Cooler
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← UnitOpBaseClass ← Cooler

At a glance

Cooler in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Gas-in
Inlet, energy 1
Outlet, material 0 Gas-out
Outlet, energy energy C-1 duty

Example

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

fs = (Flowsheet.Create("CoolerExample")
      .WithCompounds("Methane", "Ethane", "Propane", "N-butane", "N-pentane")
      .WithPropertyPackage(PropertyPackages.PengRobinson))

gas = (fs.AddMaterialStream("Gas-in")
       .At(Q.Celsius(120.0), Q.Bar(40.0))
       .SetCompoundMolarFlow("Methane", 70.0)      # mol/s
       .SetCompoundMolarFlow("Ethane", 12.0)
       .SetCompoundMolarFlow("Propane", 10.0)
       .SetCompoundMolarFlow("N-butane", 5.0)
       .SetCompoundMolarFlow("N-pentane", 3.0))
cooled = fs.AddMaterialStream("Gas-out")
duty = fs.AddEnergyStream("C-1 duty")

cooler = (fs.AddCooler("C-1")
          .WithOutletTemperature(Q.Celsius(40.0))
          .WithPressureDrop(Q.Bar(0.5))
          .ConnectFeed(gas)
          .ConnectProduct(cooled)
          .ConnectEnergyProduct(duty, 0))    # heat removed leaves through the energy outlet

fs.AutoLayout()
fs.Solve()

w = gas.Object.GetMassFlow()                          # kg/s
h_in = gas.Object.Phases[0].Properties.enthalpy       # kJ/kg
h_out = cooled.Object.Phases[0].Properties.enthalpy
print(f"Heat removed    = {cooler.Object.DeltaQ:.1f} kW")
print(f"Check m*dh      = {w * (h_in - h_out):.1f} kW")
print(f"Outlet T        = {cooled.TemperatureK - 273.15:.2f} C")
print(f"Outlet P        = {cooled.Object.Phases[0].Properties.pressure / 1e5:.2f} bar")
print(f"Vapor fraction  = {cooled.Object.Phases[2].Properties.molarfraction:.4f}")

Output

Heat removed    = 481.3 kW
Check m*dh      = 481.3 kW
Outlet T        = 40.00 C
Outlet P        = 39.50 bar
Vapor fraction  = 0.9923

DWSIM 10.2.11.0, generated 2026-10-08.

Calculation modes

Set with CalcMode (CalculationMode). The mode decides which properties are inputs; every other one is a result and is overwritten by the calculation.

Mode Value What it does Inputs
HeatRemoved 0 Outlet conditions calculated from a specified heat removal duty (kW). PROP_CL_0, PROP_CL_1, PROP_CL_3
OutletTemperature 1 Heat duty calculated to achieve the specified outlet temperature. PROP_CL_0, PROP_CL_1, PROP_CL_2
OutletVaporFraction 2 Heat duty calculated to achieve the specified outlet vapor mole fraction. PROP_CL_0, PROP_CL_1, PROP_CL_4
TemperatureChange 3 Heat duty calculated to achieve the specified temperature change. PROP_CL_0, PROP_CL_1, PROP_CL_5
EnergyStream 4 Heat duty read from the connected energy stream. PROP_CL_0, PROP_CL_1

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 in
PROP_CL_0 Pressure Drop Pa all modes
PROP_CL_1 Efficiency all modes
PROP_CL_2 Outlet Temperature K OutletTemperature
PROP_CL_3 Heat Removed kW HeatRemoved
PROP_CL_4 Outlet Molar Vapor Fraction OutletVaporFraction
PROP_CL_5 Temperature Difference K (difference) TemperatureChange

Dynamic mode

Extra properties used when the flowsheet runs in dynamic mode.

Name Unit
Flow Conductance [kg/s]/[Pa^0.5]
Volume m3
Minimum Pressure Pa
Initialize using Inlet Stream
Reset Content
Ambient Temperature K
Ambient UA Product
Wall Thermal Mass
Wall Temperature K

Learn more

API members

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

Constructors

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

Initializes a new default instance of the Cooler class.

public Cooler()
Public Sub New()

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

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

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

Properties

CalcMode: Gets or sets the active calculation mode that determines which variables are specified and which are calculated.

Gets or sets the active calculation mode that determines which variables are specified and which are calculated.

public Cooler.CalculationMode CalcMode { get; set; }
Public Property CalcMode As Cooler.CalculationMode

DeltaP: Gets or sets the pressure drop across the cooler (Pa).

Gets or sets the pressure drop across the cooler (Pa). Outlet pressure = inlet pressure - DeltaP.

public double? DeltaP { get; set; }
Public Property DeltaP As Double?

DeltaQ: Gets or sets the heat duty removed from the stream (kW).

Gets or sets the heat duty removed from the stream (kW). Positive = cooling.

public double? DeltaQ { get; set; }
Public Property DeltaQ As Double?

DeltaT: Gets or sets the calculated or specified temperature change across the cooler (K).

Gets or sets the calculated or specified temperature change across the cooler (K).

public double? DeltaT { get; set; }
Public Property DeltaT As Double?

Efficiency: Gets or sets the efficiency (%) as a plain Double proxy for Eficiencia.

Gets or sets the efficiency (%) as a plain Double proxy for Eficiencia.

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

Eficiencia: Gets or sets the cooler efficiency as a percentage (0–100).

Gets or sets the cooler efficiency as a percentage (0–100).

public double? Eficiencia { get; set; }
Public Property Eficiencia As Double?

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

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

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

HasPropertiesForDynamicMode: Gets a value indicating whether this unit operation exposes properties for dynamic mode.

Gets a value indicating whether this unit operation exposes properties for dynamic mode.

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

HeatDuty: Gets or sets the heat duty (kW) as a plain Double proxy for DeltaQ.

Gets or sets the heat duty (kW) as a plain Double proxy for DeltaQ.

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

MobileCompatible: Gets a value indicating whether this unit operation is compatible with the DWSIM mobile interface.

Gets a value indicating whether this unit operation is compatible with the DWSIM mobile interface.

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

ObjectClass: Gets or sets the simulation object class category (Exchangers).

Gets or sets the simulation object class category (Exchangers).

public override SimulationObjectClass ObjectClass { get; set; }
Public Overrides Property ObjectClass As SimulationObjectClass

OutletTemperature: Gets or sets the target outlet temperature (K) used when CalcMode is OutletTemperature.

Gets or sets the target outlet temperature (K) used when CalcMode is OutletTemperature.

public double? OutletTemperature { get; set; }
Public Property OutletTemperature As Double?

OutletVaporFraction: Gets or sets the target outlet vapor mole fraction used when CalcMode is OutletVaporFraction.

Gets or sets the target outlet vapor mole fraction used when CalcMode is OutletVaporFraction.

public double? OutletVaporFraction { get; set; }
Public Property OutletVaporFraction As Double?

PressureDrop: Gets or sets the pressure drop (Pa) as a plain Double proxy for DeltaP.

Gets or sets the pressure drop (Pa) as a plain Double proxy for DeltaP.

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

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

Gets a value indicating whether this unit operation supports dynamic simulation mode.

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

TemperatureChange: Gets or sets the temperature change (K) as a plain Double proxy for DeltaT.

Gets or sets the temperature change (K) as a plain Double proxy for DeltaT.

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

Methods

Calculate(object): Performs the steady-state cooler calculation according to CalcMode.

Performs the steady-state cooler calculation according to CalcMode. Computes outlet enthalpy, temperature, vapor fraction, and heat removal duty from the inlet stream and specified parameters.

Parameter Type Description
args Object Optional calculation arguments (not used).
public override void Calculate(object args = null)
Public Overrides Sub Calculate(args As Object = Nothing)

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

Creates a deep copy of this cooler via XML serialization.

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

CloseEditForm(): Closes and disposes the editing form for this cooler if it is open.

Closes and disposes the editing form for this cooler if it is open.

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

CreateDimensionsList(): Creates the dimensions list used for equipment sizing (Area).

Creates the dimensions list used for equipment sizing (Area).

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

CreateDynamicProperties(): Registers dynamic properties (Flow Conductance, Volume, Minimum Pressure, initialization flags) used in dynamic...

Registers dynamic properties (Flow Conductance, Volume, Minimum Pressure, initialization flags) used in dynamic simulation mode.

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

DeCalculate(): Resets the outlet material and energy streams to an uncalculated state.

Resets the outlet material and energy streams to an uncalculated state.

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

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

Opens or activates the editing form for this cooler.

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

GetCalculationModes(): Returns the list of available calculation mode names and IDs.

Returns the list of available calculation mode names and IDs.

public override string[] GetCalculationModes()
Public Overrides Function GetCalculationModes() As String()

GetDisplayDescription(): Returns the localized display description for the cooler type.

Returns the localized display description for the cooler type.

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

GetDisplayName(): Returns the localized display name for the cooler type.

Returns the localized display name for the cooler type.

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

GetIconBitmapBytes(): Returns the raw bytes of the cooler icon image resource.

Returns the raw bytes of the cooler icon image resource.

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

GetProperties(PropertyType): Returns the list of property identifiers available for this cooler.

Returns the list of property identifiers available for this cooler.

Parameter Type Description
proptype PropertyType The type of properties to retrieve.
public override string[] GetProperties(PropertyType proptype)
Public Overrides Function GetProperties(proptype As PropertyType) As String()

GetPropertyDescription(string): Returns a human-readable description for the specified property name, used in the property grid.

Returns a human-readable description for the specified property name, used in the property grid.

Parameter Type Description
p String The property display name.
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 The property identifier string.
su IUnitsOfMeasure The unit system to use; defaults to SI if not provided.
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 The property identifier string (e.g., "PROP_CL_0").
su IUnitsOfMeasure The unit system to use; defaults to SI if not provided.
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 text report summarizing the cooler's inlet, outlet, and calculation parameters.

Generates a text report summarizing the cooler's inlet, outlet, and calculation parameters.

Parameter Type Description
su IUnitsOfMeasure The unit system for reported values.
ci CultureInfo The culture info used for number formatting.
numberformat String The numeric format 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 (tabular) results report for display in the UI.

Generates a structured (tabular) results report for display in the UI.

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

RunDynamicModel(): Executes the cooler dynamic model for one integration time step, updating accumulation, temperature, and pressure.

Executes the cooler dynamic model for one integration time step, updating accumulation, temperature, and pressure.

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

SetCalculationMode(int): Sets the calculation mode by numeric ID and returns the mode name.

Sets the calculation mode by numeric ID and returns the mode name.

Parameter Type Description
modeID Int32 The integer ID of the desired calculation mode.
public override object SetCalculationMode(int modeID)
Public Overrides Function SetCalculationMode(modeID As Integer) As Object

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

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

Parameter Type Description
prop String The property identifier string.
propval Object The new value to assign.
su IUnitsOfMeasure The unit system of the supplied value; defaults to SI if not provided.
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 dimensions list (no-op for the cooler).

Updates the dimensions list (no-op for the cooler).

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

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.

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

Fields

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

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

public object f
Public f As Object