Flare and Relief Network¶
In this tutorial you will rate the flare system of a small unit. Three pressure relief valves discharge through laterals into a flare header, which runs to a knockout drum, a stack line and a flare tip. You will describe three relief scenarios, run them, and see the valves that the header pushes back on. Then the design tool will size the pipes, the knockout drum will be sized for its droplets, and the scenarios will be run again until every check passes.
What you will learn
- How relief devices, laterals, a header, a knockout drum and a flare tip form a flare network
- Why a flare network needs the compressible gas flow model, and what the Mach number limits are for
- How to describe relief scenarios, and how the tool finds the governing one
- How the backpressure on a relief valve is checked against its type (conventional, balanced bellows, pilot)
- How the design tool steps the pipes through the nominal sizes, and how a knockout drum is sized
Prerequisites
- Completed Gas Gathering Network
- DWSIM 10.3.0 or later
- The Pipe Network is part of the Patreon edition (Premium+).
Process Overview¶
A relief valve opens when the pressure in the equipment it protects reaches its set pressure, and it sends the gas to the flare. Several valves share one header, so the gas of one valve raises the pressure at the outlet of the others. That pressure is the backpressure, and API 520 limits it, because a valve that discharges against too much backpressure loses capacity or chatters. How much backpressure a valve tolerates depends on its type:
| Valve type | What is checked | Limit |
|---|---|---|
| Conventional | built-up backpressure (the part the flow itself creates) | 10 % of set |
| Balanced bellows | total backpressure | 30 % of set |
| Pilot-operated | total backpressure | 50 % of set |
The network in this tutorial has one valve of each type. A plant fire opens all three. A blocked outlet opens PSV-101 alone. A power failure opens PSV-102 and PSV-103, with PSV-102 at a higher rate.
graph LR
P1["PSV-101<br/>conventional, 16 bar"] --> L1["LAT-101"] --> H(("HDR-IN"))
P2["PSV-102<br/>bellows, 8 bar"] --> L2["LAT-102"] --> H
P3["PSV-103<br/>pilot, 4.5 bar"] --> L3["LAT-103"] --> H
H --> HD["HEADER<br/>300 m"] --> K["KOD"] --> S["STACK-LINE<br/>60 m, +40 m"] --> T["TIP<br/>0.5 m"] --> A["ATM"]
K --> D["KOD-DRAIN"]
Key Design Parameters¶
| Parameter | Value |
|---|---|
| Compounds | Methane, ethane, propane, n-butane, n-pentane |
| Property package | Peng-Robinson |
| Flow model of the network | Compressible gas (flare and vent headers) |
| PSV-101 | conventional, set 16 bar, orifice M, lean gas at 350 K |
| PSV-102 | balanced bellows, set 8 bar, orifice Q, rich gas (with butane and pentane) at 320 K |
| PSV-103 | pilot-operated, set 4.5 bar, orifice Q, lean gas at 350 K |
| Laterals | 6 in to start with, 40, 60 and 30 m, Mach limit 0.7 |
| Header | 12 in to start with, 300 m, rising 5 m, fittings K = 2, Mach limit 0.5 |
| Knockout drum | vertical, 3 m in diameter, 6 m long to start with, 20 min of liquid holdup |
| Stack line | 16 in to start with, 60 m, rising 40 m, fittings K = 1, Mach limit 0.5 |
| Flare tip | 0.5 m, on a 45 m stack, radiation limit 4.73 kW/m² at 100 m |
| Scenario | PSV-101 (kg/s) | PSV-102 (kg/s) | PSV-103 (kg/s) |
|---|---|---|---|
| Plant fire | 6 | 9 | 4 |
| Blocked outlet 101 | 6 | ||
| Power failure | 12 | 4 |
Step-by-Step in the Classic UI¶
1. Set up¶
File > New Chemical Process Model: add Methane, Ethane, Propane, N-butane and N-pentane, and choose Peng-Robinson. Add a Pipe Network named FLARE and open its designer. In Settings, set Flow Model to Compressible gas (flare / vent headers).
The compressible gas model marches along each pipe with the friction, the fittings, the change of elevation and the acceleration of the gas. A flare header runs close to atmospheric pressure, where the gas expands a lot along the pipe and its velocity can approach the speed of sound. The model reports the Mach number at every point and caps the flow when a pipe chokes at Mach 1.

2. The relief valves¶
Drag three Relief Device blocks and name them PSV-101, PSV-102 and PSV-103. In the editor of each one set Device Type, Set Pressure and Installed Orifice (API 526 letter) from the parameter table. Set the Rate Mode of PSV-101 to Sizing, so that the tool tells you the orifice its load needs. The other two keep Specified.

A relief device is a source: it puts its relieving rate into the network. Each one needs a material stream on the flowsheet with the composition and the temperature of the gas it relieves. Give PSV-101 and PSV-103 a lean gas (85 % methane, 10 % ethane, 5 % propane) at 350 K, and PSV-102 a rich gas (60 % methane, 15 % ethane, 12 % propane, 8 % n-butane, 5 % n-pentane) at 320 K.
3. The laterals, the header and the flare¶
Drag a Pipe Segment after each valve (LAT-101, LAT-102, LAT-103), with a node between the valve and the pipe (A1, A2, A3), and join the three laterals at a node HDR-IN. Give each lateral one straight section of 6 in (154.1 mm), 40, 60 and 30 m long. In the Properties tab of each lateral set Mach Number Limit to 0.7.
Continue with:
HEADER: a Pipe Segment of 12 in (303.2 mm), 300 m, rising 5 m, Fittings Loss Coefficient 2, Mach limit 0.5KOD: a Knockout Drum, vertical, 3 m in diameter, 6 m long, 20 min of holdup, with a node before it (KOD-IN) and two after it (KOD-GASandKOD-LIQ)STACK-LINE: a Pipe Segment of 16 in (387.4 mm), 60 m, rising 40 m, fittings K = 1, Mach limit 0.5TIP: a Flare Tip with a 0.5 m tip on a 45 m stack, a wind of 5 m/s and a radiation limit of 4732 W/m² at a target 100 m awayATM: a Sink at 1.01325 bar after the tip, andKOD-DRAIN: a Sink at 1.05 bar on the liquid outlet of the drum
The Mach limits follow API 521: 0.7 in a lateral that only carries one valve for a short time, 0.5 in the headers that carry the whole load.
4. Describe the relief scenarios¶
Open Tools > Relief Scenarios (Flare Network). Add the three scenarios of the scenario table, and in each one type the relieving rate of the valves that open. A valve without a rate in a scenario stays shut.

5. Rate the network¶
Click Run All Scenarios. The tool solves the network once per scenario and opens the Flare Network Report.


Every scenario fails:
| Check | Plant fire | Blocked outlet 101 | Power failure | Limit |
|---|---|---|---|---|
| PSV-101, built-up backpressure (% of set) | 25.8 | 15.7 | shut | 10 |
| PSV-102, total backpressure (% of set) | 65.4 | shut | 74.1 | 30 |
| PSV-103, total backpressure (% of set) | 96.9 | shut | 74.7 | 50 |
| HEADER, maximum Mach | 0.546 | 0.270 | 0.495 | 0.50 |
| KOD | carry-over | carry-over |
The header is too small for the plant fire: the gas reaches Mach 0.55 in it, and the pressure it needs to push 19 kg/s through 300 m backs up into the laterals. PSV-103 suffers the most, because its set pressure is the lowest (4.5 bar): the same header pressure is a larger fraction of its set. In the power failure PSV-102 relieves 12 kg/s, and its own 60 m lateral loses 2.9 bar of the 5.9 bar at its outlet, so the valve sits at 74 % of its set. The knockout drum is also too small. Its vapour velocity is above the velocity at which a 300 micron droplet settles, so the liquid would be carried to the stack.
The report also says the orifice each valve needs. PSV-103 needs 12.5 in² against the 11.05 in² of its Q orifice. A pilot valve tolerates backpressure but still loses capacity when the backpressure is high enough to make its flow subcritical ("sub" in the table).
6. Size the pipes¶
Open Tools > Size Flare Network (Design). Every pipe is ticked to grow. Click Size Network. The tool runs every scenario, finds the pipe that breaks a limit, gives it the next nominal size of ASME B36.10 and runs the scenarios again, until every pipe stays below its Mach limit and every valve within its backpressure.

| Pipe | Before | After | Bound by |
|---|---|---|---|
| LAT-101 | 6 in | 8 in | the rated capacity of PSV-101 |
| LAT-102 | 6 in | 10 in | the rated capacity of PSV-102 |
| LAT-103 | 6 in | 10 in | the rated capacity of PSV-103 |
| HEADER | 12 in | 18 in | the backpressure of PSV-101 in the plant fire |
| STACK-LINE | 16 in | 18 in | the plant fire |
The laterals are sized for the rated capacity of their valve, the most a valve with that orifice can pass, and the scenario load doesn't matter for them. API 521 asks for this because a valve always relieves at its rated capacity when it opens fully, whatever the load that made it open. Laterals at rated capacity controls this choice.
7. Size the knockout drum¶
Select the drum on the canvas and open Tools > Size Knockout Drum. The sizing follows API 521 5.4.2.1: it computes the velocity at which a droplet of the design size (300 microns) falls through the gas, then the drum diameter that keeps the gas below it. For the plant fire, with 19 kg/s of gas at 1.23 kg/m³, the droplet falls at 1.24 m/s, and a vertical drum needs 4.28 m of diameter. Apply the result to the drum.

The tool sizes the drum exactly at the limit. When you specify the drum, round the diameter up to a vessel size you can buy.
8. Rate it again¶
Open Relief Scenarios and click Run All Scenarios again. Every scenario passes now.

| Check | Plant fire | Blocked outlet 101 | Power failure | Limit |
|---|---|---|---|---|
| PSV-101, built-up backpressure (% of set) | 9.3 | 4.2 | shut | 10 |
| PSV-102, total backpressure (% of set) | 17.8 | shut | 17.1 | 30 |
| PSV-103, total backpressure (% of set) | 29.9 | shut | 21.0 | 50 |
| HEADER, maximum Mach | 0.302 | 0.132 | 0.263 | 0.50 |
| STACK-LINE, maximum Mach | 0.378 | 0.137 | 0.306 | 0.50 |
| Flare tip, exit Mach | 0.31 | 0.11 | 0.24 | 0.50 |
PSV-101 is the valve that sets the header size: its built-up backpressure in the plant fire sits at 9.3 % of a 10 % limit. With the lower backpressure, PSV-103 needs only 7.8 in², and its Q orifice is enough.
Results and Validation¶
Expected results
- With the original sizes, every scenario fails: PSV-103 at 96.9 % of its set in the plant fire, the header at Mach 0.546, carry-over in the knockout drum.
- The design tool grows the header from 12 to 18 in, the stack line from 16 to 18 in and the laterals to 8, 10 and 10 in.
- The knockout drum needs 4.28 m of diameter for the plant fire.
- After the design every scenario passes, and PSV-101 governs the header at 9.3 % of a 10 % limit.
Automating This Tutorial¶
Files in this repository
- Python script:
examples/pipe-networks/03_flare_relief_network.py - Pre-built flowsheet:
examples/saved/flare_relief_network.dwxmz(after the design and the drum sizing)
The script builds the network, rates it, runs the design and the drum sizing, and rates it again, printing the checks of every scenario. It needs DWSIM_PATRON_KEY when DWSIM is not activated on the machine.
import os
import sys
import pythonnet
pythonnet.load("netfx") # DWSIM is a .NET Framework application
import clr # noqa: E402
DWSIM_BIN = os.environ.get("DWSIM_BIN")
if not DWSIM_BIN:
raise SystemExit("Set DWSIM_BIN to the DWSIM installation folder before running.")
for sub in ("", "unitops", "ppacks", "extenders"):
sys.path.append(os.path.join(DWSIM_BIN, sub))
clr.AddReference("DWSIM.Automation")
clr.AddReference("DWSIM.Automation.FluentAPI")
clr.AddReference("DWSIM.UnitOperations")
clr.AddReference("DWSIM.UnitOperations.PipeNetwork")
from DWSIM.Automation.FluentAPI import Flowsheet, License, PropertyPackages, Q # noqa: E402
from DWSIM.UnitOperations.PipeNetwork.Blocks import FlareTip, KnockoutDrum, Pipe, ReliefDevice, Sink # noqa: E402
from DWSIM.UnitOperations.PipeNetwork.Classes import ( # noqa: E402
BoundarySpecification, DrumOrientation, NodalFlowModel, ReliefDeviceType, ReliefRateMode)
from DWSIM.UnitOperations.UnitOperations.Auxiliary.Pipe import PipeEditorStatus, PipeSection # noqa: E402
if not License.IsActivated:
key = os.environ.get("DWSIM_PATRON_KEY")
if not key or not License.CheckLicense(key):
raise SystemExit("The Pipe Network is a DWSIM Plus operation: set DWSIM_PATRON_KEY to your Patreon key.")
LEAN = {"Methane": 0.85, "Ethane": 0.10, "Propane": 0.05}
RICH = {"Methane": 0.60, "Ethane": 0.15, "Propane": 0.12, "N-butane": 0.08, "N-pentane": 0.05}
fs = (Flowsheet.Create("FlareNetwork")
.WithCompounds("Methane", "Ethane", "Propane", "N-butane", "N-pentane")
.WithPropertyPackage(PropertyPackages.PengRobinson))
net = fs.AddPipeNetwork("FLARE")
net.Object.NodalFlowModel = NodalFlowModel.CompressibleGas # friction, acceleration and Mach along each pipe
def set_pipe(node, length_m, rise_m, id_inch, increments, mach_limit=None, fittings_k=0.0):
pipe = node.As[Pipe]()
prof = pipe.BaseUnitOperation.Profile
prof.Sections.Clear()
prof.Sections.Add(1, PipeSection(1, "Straight Tube", 1, increments, "Carbon Steel", length_m, rise_m, id_inch + 1.0, id_inch))
prof.Status = PipeEditorStatus.OK
if mach_limit is not None:
pipe.MachLimit = mach_limit
pipe.FittingsK = fittings_k
# --- the relief valves ---------------------------------------------------------------
DEVICES = { # tag: (type, set pressure Pa, orifice letter, rate mode, gas)
"PSV-101": (ReliefDeviceType.ConventionalPSV, 16e5, "M", ReliefRateMode.Sizing, LEAN),
"PSV-102": (ReliefDeviceType.BalancedBellowsPSV, 8e5, "Q", ReliefRateMode.Specified, RICH),
"PSV-103": (ReliefDeviceType.PilotPSV, 4.5e5, "Q", ReliefRateMode.Specified, LEAN),
}
psv, lat = {}, {}
hdr_in = net.AddNode("HDR-IN")
for i, (tag, (kind, p_set, orifice, mode, _)) in enumerate(DEVICES.items(), start=1):
psv[tag] = net.AddReliefDevice(tag)
d = psv[tag].As[ReliefDevice]()
d.DeviceType, d.SetPressure, d.OrificeLetter, d.RateMode = kind, p_set, orifice, mode
a = net.AddNode(f"A{i}")
lat[tag] = net.AddPipe(f"LAT-10{i}")
set_pipe(lat[tag], (40.0, 60.0, 30.0)[i - 1], 0.0, 6.065, 8, mach_limit=0.7) # 6 in laterals
net.ConnectChain(psv[tag], a, lat[tag], hdr_in)
# --- the header, the knockout drum, the stack and the tip ------------------------------------
header = net.AddPipe("HEADER")
set_pipe(header, 300.0, 5.0, 11.938, 12, mach_limit=0.5, fittings_k=2.0) # 12 in
kod_in, kod_gas, kod_liq = net.AddNode("KOD-IN"), net.AddNode("KOD-GAS"), net.AddNode("KOD-LIQ")
kod = net.AddKnockoutDrum("KOD")
k = kod.As[KnockoutDrum]()
k.Orientation, k.Diameter, k.Length, k.HoldupMinutes = DrumOrientation.Vertical, 3.0, 6.0, 20.0
stack = net.AddPipe("STACK-LINE")
set_pipe(stack, 60.0, 40.0, 15.25, 6, mach_limit=0.5, fittings_k=1.0) # 16 in, rising 40 m
tip_in, tip_out = net.AddNode("TIP-IN"), net.AddNode("TIP-OUT")
tip = net.AddFlareTip("TIP")
t = tip.As[FlareTip]()
t.TipDiameter, t.StackHeight, t.WindSpeed, t.TargetDistance, t.RadiationLimit = 0.5, 45.0, 5.0, 100.0, 4732.0
atm = net.AddSink("ATM")
s = atm.As[Sink]()
s.BoundarySpec, s.PressureSpec = BoundarySpecification.Pressure, 101325.0
drain = net.AddSink("KOD-DRAIN")
s = drain.As[Sink]()
s.BoundarySpec, s.PressureSpec = BoundarySpecification.Pressure, 1.05e5
net.ConnectChain(hdr_in, header, kod_in, kod)
net.Connect(kod, kod_gas)
net.Connect(kod, kod_liq)
net.ConnectChain(kod_gas, stack, tip_in, tip, tip_out, atm)
net.Connect(kod_liq, drain)
def attach(node, tag, gas, t_k, p_bar):
ms = net.AttachStream(node, tag)
for name, x in gas.items():
ms.SetCompoundMolarFlow(name, 100.0 * x)
ms.At(Q.Kelvin(t_k), Q.Bar(p_bar)).Object.Calculate()
for tag, (_, p_set, _, _, gas) in DEVICES.items():
attach(psv[tag], "relief-" + tag[-3:], gas, 350.0 if gas is LEAN else 320.0, p_set / 1e5)
attach(atm, "to-flare", LEAN, 350.0, 1.01325)
attach(drain, "kod-liquid", RICH, 320.0, 1.05)
# --- the relief scenarios: which valves open together, and at what rate (kg/s) ---------------
sc = net.AddReliefScenario("Plant fire", "Fire in the unit: every valve relieves at its fire load")
sc.Set("PSV-101", 6.0); sc.Set("PSV-102", 9.0); sc.Set("PSV-103", 4.0)
sc = net.AddReliefScenario("Blocked outlet 101", "PSV-101 alone, blocked outlet")
sc.Set("PSV-101", 6.0)
sc = net.AddReliefScenario("Power failure", "Cooling lost on 102 and 103")
sc.Set("PSV-102", 12.0); sc.Set("PSV-103", 4.0)
POSITIONS = {
"PSV-101": (20, 30), "A1": (100, 40), "LAT-101": (180, 40),
"PSV-102": (20, 170), "A2": (100, 180), "LAT-102": (180, 180),
"PSV-103": (20, 310), "A3": (100, 320), "LAT-103": (180, 320),
"HDR-IN": (300, 180), "HEADER": (380, 180), "KOD-IN": (490, 180), "KOD": (560, 160),
"KOD-GAS": (660, 120), "KOD-LIQ": (660, 260), "KOD-DRAIN": (740, 250),
"STACK-LINE": (740, 120), "TIP-IN": (850, 120), "TIP": (920, 100), "TIP-OUT": (1010, 120), "ATM": (1080, 110),
}
for tag, (x, y) in POSITIONS.items():
go = net.Find(tag).Block.GraphicObject
go.X, go.Y = x, y
def report(title, rep):
print(f"\n{title}: governing scenario '{rep.GoverningScenario}', all checks met: {rep.Pass}")
for run in rep.Runs:
print(f" {run.Name}")
for d in run.Devices:
if d.Relieving:
print(f" {d.Tag}: {d.Rate:5.1f} kg/s, backpressure {d.BackpressureRatioPercent:5.1f} % of set "
f"(allowed {d.AllowablePercent:.0f} %, {d.BackpressureBasis}) {'OK' if d.BackpressureOK else 'TOO HIGH'}")
for p in run.Pipes:
flag = "CHOKED" if p.Choked else ("above limit" if p.MachExceeded else "OK")
print(f" {p.Tag:10s} {p.MassFlow:5.1f} kg/s, max Mach {p.MaxMach:5.3f} (limit {p.MachLimit:.2f}) {flag}")
rating = net.RunReliefScenarios()
report("Rating with 6 in laterals, a 12 in header and a 16 in stack line", rating)
# --- the design: the tool steps the pipes through the nominal sizes until every scenario passes -----
design = net.SizeFlareNetwork()
print(f"\nDesign: {design.Message}")
for r in design.Pipes:
print(f" {r.Tag:10s} {r.OriginalSize:>6s} -> {r.FinalSize:>6s} (binding: {r.BindingScenario})")
for r in design.Devices:
print(f" {r.Tag}: orifice {r.OriginalOrifice} -> {r.SelectedOrifice}")
# --- the knockout drum: API 521 dropout velocity, sized under the governing scenario -------------
net.RunReliefScenarios(design.FinalReport.GoverningScenario if design.FinalReport else None)
drum = net.SizeKnockoutDrum("KOD", None, True)
print(f"\nKOD: dropout velocity {drum.DropoutVelocity:.2f} m/s, vertical drum {drum.VerticalDiameter:.2f} m in diameter, "
f"{drum.VerticalHeight:.2f} m tangent to tangent")
final = net.RunReliefScenarios()
report("Rating after the design", final)
for run in final.Runs:
for e in run.Equipment:
print(f" {run.Name}: {e.Tag} {e.Note}")
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.
In the DWSIM Assistant, build the following simulation:
- Compounds Methane, Ethane, Propane, N-butane and N-pentane,
property package Peng-Robinson
- A Pipe Network "FLARE" with the compressible gas flow model:
- relief devices PSV-101 (conventional, set 16 bar, orifice M,
sizing mode), PSV-102 (balanced bellows, set 8 bar, orifice Q)
and PSV-103 (pilot, set 4.5 bar, orifice Q)
- 6 in laterals of 40, 60 and 30 m (Mach limit 0.7) into a 12 in,
300 m header (Mach limit 0.5), a vertical knockout drum 3 m by
6 m, a 16 in, 60 m stack line rising 40 m and a 0.5 m flare tip
on a 45 m stack, discharging to the atmosphere
- Relief scenarios: plant fire (6, 9 and 4 kg/s), blocked outlet on
PSV-101 (6 kg/s) and power failure (12 kg/s on PSV-102, 4 kg/s on
PSV-103)
- Run the scenarios and report the backpressure of each valve and the
maximum Mach number of each pipe, size the flare network, size the
knockout drum and run the scenarios again
Exercises
- Change PSV-103 to a conventional valve and run the scenarios with the designed sizes. Which limit does it break, and how large would the header have to be?
- Untick Laterals at rated capacity and size the network again from the original sizes. Which laterals come out smaller, and why does API 521 advise against it?
- Add a fourth scenario, a blocked outlet on PSV-102 at its rated capacity (the rate in the report). Does it change the governing scenario of any pipe?
- Move the radiation target to 60 m from the flare. How tall does the stack have to be? Select the tip and use Tools > Size Flare Stack (Radiation, Riser, Noise).
Further Reading¶
- API Standard 520, Sizing, Selection, and Installation of Pressure-relieving Devices, Part I (sizing and selection) and Part II (installation)
- API Standard 521, Pressure-relieving and Depressuring Systems
- API Standard 526, Flanged Steel Pressure-relief Valves
- DWSIM User Guide: the Pipe Network unit operation (flare and relief networks)
Next Steps¶
You now know how to describe relief scenarios, read the backpressure on each valve and let the design tool size a flare network. Continue with Fire Water Network, where the network is checked against a fire code.