Skip to content

Relief Valve

Represents a safety relief valve (PSV / PRV) unit operation that opens progressively between a set-point pressure and a fully-opened pressure, relieving fluid to a downstream line. The orifice area, discharge coefficient, and back-pressure corrections follow API 520 / ASME Section VIII methodology.

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

At a glance

Relief Valve in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Relief-in
Outlet, material 0 Flare

Example

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

fs = (Flowsheet.Create("ReliefValveExample")
      .WithCompounds("Methane", "Ethane", "Propane")
      .WithPropertyPackage(PropertyPackages.PengRobinson))

# protected system at 8.5 bar, between the set pressure and the fully opened pressure
relief_in = (fs.AddMaterialStream("Relief-in")
             .At(Q.Celsius(40.0), Q.Bar(8.5))
             .SetCompoundMolarFlow("Methane", 5.0)      # mol/s, a first guess for the steady state
             .SetCompoundMolarFlow("Ethane", 0.6)
             .SetCompoundMolarFlow("Propane", 0.3)
             .AsPressureSpec())
flare = fs.AddMaterialStream("Flare").At(Q.Celsius(40.0), Q.Atm(1.0)).AsPressureSpec()

psv = (fs.AddExternalUnitOperation("Relief Valve", "PSV-1")
       .ConnectFeed(relief_in)
       .ConnectProduct(flare))

rv = psv.Object.__implementation__          # the generic builder holds an ISimulationObject
rv.SetPointPressure = 8.0e5                 # Pa
rv.FullyOpenedPressure = 8.8e5              # Pa
rv.OrificeArea = 1.26e-4                    # m2, API letter E
rv.DischargeCoefficient = 0.975
rv.DefinedOpeningKvRelationShipType = Valve.OpeningKvRelationshipType.Linear

fs.AutoLayout()
fs.Solve()
flare.Object.Phases[0].Properties.pressure = 101325.0   # boundary pressure for the dynamic run

# the relief valve computes its flow in dynamic mode only
(fs.Dynamics.DefineIntegrator("Int1")
   .WithIntegrationStep(Q.Seconds(1.0))
   .WithDuration(Q.Seconds(5.0))
   .Monitor("Flare", "PROP_MS_2", "kg/s", "relief flow"))
fs.Dynamics.DefineSchedule("Sch1").WithIntegrator("Int1").UseCurrentStateAsInitial(True).MakeCurrent()
result = fs.RunDynamics("Sch1").Execute()

lift = (8.5e5 - rv.SetPointPressure) / (rv.FullyOpenedPressure - rv.SetPointPressure)
print(f"Lift            = {lift * 100.0:.1f} %")
print(f"Relief flow     = {result.GetSeries('relief flow').Final:.4f} kg/s")
print(f"Flare T         = {flare.TemperatureK - 273.15:.1f} C")
print(f"Flare P         = {flare.PressurePa / 1e5:.3f} bar")

Output

Lift            = 62.5 %
Relief flow     = 0.1173 kg/s
Flare T         = 35.8 C
Flare P         = 1.013 bar

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_RV_0 Calculation Mode yes
PROP_RV_1 Set Pressure Pa yes
PROP_RV_2 Overpressure % yes
PROP_RV_3 Back Pressure Pa yes
PROP_RV_4 Discharge Coefficient (Kd) yes
PROP_RV_5 Back Pressure Correction Factor (Kb) yes
PROP_RV_6 Combination Correction Factor (Kc) yes
PROP_RV_7 Orifice Area m2 yes
PROP_RV_8 Standard Orifice yes
PROP_RV_9 Relieving Pressure Pa result
PROP_RV_10 Relieving Capacity kg/s result
PROP_RV_11 Required Orifice Area m2 result
PROP_RV_12 Choked Flow result
PROP_RV_13 Fully-Opened Pressure Pa yes
PROP_RV_14 Viscosity Correction Factor (Kv) yes
PROP_RV_15 Liquid Back Pressure Correction Factor (Kw) yes
PROP_RV_16 Calculate Viscosity Correction yes
PROP_RV_17 Update Outlet Stream yes

Learn more

API members

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

Constructors

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

Initializes a new default instance of the ReliefValve class.

public ReliefValve()
Public Sub New()

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

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

Parameter Type Description
Name String The display name of the relief valve.
Description String A brief description of the relief valve.
public ReliefValve(string Name, string Description)
Public Sub New(Name As String, Description As String)

Properties

BackPressure: Gets or sets the total back pressure (Pa, absolute) the steady-state calculation discharges to.

Gets or sets the total back pressure (Pa, absolute) the steady-state calculation discharges to. Default atmospheric.

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

BackPressureCoefficient: Gets or sets the back-pressure correction factor applied to the relieving capacity.

Gets or sets the back-pressure correction factor applied to the relieving capacity.

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

CalculateViscosityCorrection: Gets or sets whether the steady state works out the liquid viscosity correction Kv from the Reynolds number through...

Gets or sets whether the steady state works out the liquid viscosity correction Kv from the Reynolds number through the orifice (API 520 Part I) and stores it in ViscosityCoefficient, which the dynamic model then uses. Default False: the user value is used as it is.

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

CalculationMode: Gets or sets the steady-state calculation mode.

Gets or sets the steady-state calculation mode. Rating gives the relieving capacity of OrificeArea; Sizing gives the area the inlet mass flow needs and the smallest API 526 orifice that holds it. Both report the required area. Default Rating.

public ReliefValve.ReliefValveCalculationMode CalculationMode { get; set; }
Public Property CalculationMode As ReliefValve.ReliefValveCalculationMode

CharacteristicParameter: Gets or sets the characteristic parameter used with the equal-percentage inherent curve.

Gets or sets the characteristic parameter used with the equal-percentage inherent curve.

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

CombinationCorrectionFactor: Gets or sets the combination correction factor Kc (rupture disk upstream of the valve).

Gets or sets the combination correction factor Kc (rupture disk upstream of the valve). Default 1.

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

DefinedOpeningKvRelationShipType: Gets or sets the relationship type between valve opening and effective Kv.

Gets or sets the relationship type between valve opening and effective Kv.

public Valve.OpeningKvRelationshipType DefinedOpeningKvRelationShipType { get; set; }
Public Property DefinedOpeningKvRelationShipType As Valve.OpeningKvRelationshipType

DischargeCoefficient: Gets or sets the effective discharge coefficient of the orifice.

Gets or sets the effective discharge coefficient of the orifice.

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

FullyOpenedPressure: Gets or sets the pressure (Pa) at which the relief valve is fully open.

Gets or sets the pressure (Pa) at which the relief valve is fully open.

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

HasPropertiesForDynamicMode: Gets a value indicating whether this unit operation has no dedicated dynamic-mode properties.

Gets a value indicating whether this unit operation has no dedicated dynamic-mode properties.

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

LiquidBackPressureCoefficient: Gets or sets the liquid back pressure correction factor Kw (balanced bellows valves).

Gets or sets the liquid back pressure correction factor Kw (balanced bellows valves). Default 1.

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

MobileCompatible: Gets a value indicating this unit operation is not compatible with mobile/cross-platform interfaces.

Gets a value indicating this unit operation is not compatible with mobile/cross-platform interfaces.

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

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

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

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

OpeningKvRelDataTableX: Gets or sets the X-axis data (opening %) for a user-defined Kv data table.

Gets or sets the X-axis data (opening %) for a user-defined Kv data table.

public List<double> OpeningKvRelDataTableX { get; set; }
Public Property OpeningKvRelDataTableX As List(Of Double)

OpeningKvRelDataTableY: Gets or sets the Y-axis data (Kv %) for a user-defined Kv data table.

Gets or sets the Y-axis data (Kv %) for a user-defined Kv data table.

public List<double> OpeningKvRelDataTableY { get; set; }
Public Property OpeningKvRelDataTableY As List(Of Double)

OrificeArea: Gets or sets the effective orifice area (m²).

Gets or sets the effective orifice area (m²). Default is API orifice designation "D".

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

OverpressurePercent: Gets or sets the allowable overpressure, % of the gauge set pressure.

Gets or sets the allowable overpressure, % of the gauge set pressure. With a set pressure above zero, the API 520 relieving pressure is P1 = Patm + (Pset - Patm) (1 + overpressure / 100); with no set pressure, P1 is the inlet stream pressure. Default 10.

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

PercentOpeningVersusPercentKvExpression: Gets or sets the expression relating percentage opening to percentage Kv (e.g.

Gets or sets the expression relating percentage opening to percentage Kv (e.g. "1.0*OP").

public string PercentOpeningVersusPercentKvExpression { get; set; }
Public Property PercentOpeningVersusPercentKvExpression As String

ResultCapacity: Result: relieving capacity (kg/s) of the orifice in use (rating) or of the selected API 526 orifice (sizing).

Result: relieving capacity (kg/s) of the orifice in use (rating) or of the selected API 526 orifice (sizing).

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

ResultChokedFlow: Result: True when the flow through the orifice is critical (choked).

Result: True when the flow through the orifice is critical (choked).

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

ResultFlowRegime: Result: the flow regime the steady-state calculation used (Vapor, Liquid or Two-Phase).

Result: the flow regime the steady-state calculation used (Vapor, Liquid or Two-Phase).

public string ResultFlowRegime { get; set; }
Public Property ResultFlowRegime As String

ResultMessage: Result: warnings of the last steady-state calculation, empty when there were none.

Result: warnings of the last steady-state calculation, empty when there were none.

public string ResultMessage { get; set; }
Public Property ResultMessage As String

ResultRelievingPressure: Result: relieving pressure P1 used by the steady-state calculation (Pa, absolute).

Result: relieving pressure P1 used by the steady-state calculation (Pa, absolute).

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

ResultRequiredArea: Result: effective orifice area (m²) the inlet mass flow needs at the relieving conditions.

Result: effective orifice area (m²) the inlet mass flow needs at the relieving conditions.

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

ResultStandardOrifice: Result: API 526 orifice letter, the one matching the orifice area (rating) or the smallest that holds the required...

Result: API 526 orifice letter, the one matching the orifice area (rating) or the smallest that holds the required area (sizing).

public string ResultStandardOrifice { get; set; }
Public Property ResultStandardOrifice As String

SetPointPressure: Gets or sets the set-point pressure (Pa) at which the relief valve begins to open.

Gets or sets the set-point pressure (Pa) at which the relief valve begins to open.

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

StandardOrificeAreas: Gets the list of standard API orifice letter designations with their areas.

Gets the list of standard API orifice letter designations with their areas.

public static object StandardOrificeAreas { get; set; }
Public Shared Property StandardOrificeAreas As Object

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

UpdateOutletStream: Gets or sets whether the steady state writes the outlet stream: the inlet mass flow and composition at the back...

Gets or sets whether the steady state writes the outlet stream: the inlet mass flow and composition at the back pressure, with the inlet enthalpy (isenthalpic letdown, as the dynamic model writes it). Default False, which leaves the outlet stream untouched as the steady state always did.

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

ViscosityCoefficient: Gets or sets the viscosity correction coefficient applied to the discharge calculation.

Gets or sets the viscosity correction coefficient applied to the discharge calculation.

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

Methods

Calculate(object): Steady-state relief valve calculation (API 520 Part I).

Steady-state relief valve calculation (API 520 Part I). The inlet stream gives the relieving state (temperature, phase split, density, k, viscosity) and the mass flow to relieve; the set pressure and the overpressure give the relieving pressure P1; BackPressure gives P2.

Parameter Type Description
args Object
public override void Calculate(object args = null)
Public Overrides Sub Calculate(args As Object = Nothing)

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

Creates a deep copy 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()

DeCalculate(): Clears the outlet stream when the steady state writes it (UpdateOutletStream); otherwise the...

Clears the outlet stream when the steady state writes it (UpdateOutletStream); otherwise the outlet stream is left alone, as the steady state leaves it.

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

DisplayEditForm(): Opens or activates the editing form.

Opens or activates the editing form.

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

GetDisplayDescription(): Returns the display description for this unit operation.

Returns the display description for this unit operation.

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

GetDisplayName(): Returns the display name for this unit operation.

Returns the display name for this unit operation.

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

GetEditingForm(): Returns the editing form instance.

Returns the editing form instance.

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

GetIconBitmapBytes(): Returns the raw bytes of the icon image for this unit operation.

Returns the raw bytes of the icon image for this unit operation.

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

GetProperties(PropertyType): Returns the property identifiers of the given type (PROP_RV_0 to PROP_RV_17).

Returns the property identifiers of the given type (PROP_RV_0 to PROP_RV_17).

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

GetPropertyUnit(string, IUnitsOfMeasure): Returns the unit of a property in the given unit system (SI when Nothing).

Returns the unit of a property in the given unit system (SI when Nothing).

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 a property in the given unit system (SI when Nothing).

Returns the value of a property in the given unit system (SI when Nothing).

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

RunDynamicModel(): Performs the dynamic-mode calculation for the relief valve.

Performs the dynamic-mode calculation for the relief valve.

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

SetPropertyValue(string, object, IUnitsOfMeasure): Sets a property from a value in the given unit system (SI when Nothing).

Sets a property from a value in the given unit system (SI when Nothing). The standard orifice (PROP_RV_8) takes an API 526 letter, D to T, and writes its area to the orifice area.

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

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

Refreshes the editing form with updated data.

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

Fields

editwindow: Reserved handle for an editor window; not assigned or read by the current code.

Reserved handle for an editor window; not assigned or read by the current code. Not saved with the flowsheet.

public object editwindow
Public editwindow As Object