This is a 1D transient pipeline simulator. The layout below the sidebar shows four profiles along the pipe (pressure, flow, temperature, viscosity) plus a rolling time-history panel. The sidebar drives scenarios: valve slam, heat slug, point leak, pump pressure/flow steps, and working-fluid selection.
Friction in turbulent pipe flow is given by the Darcy–Weisbach equation, with the friction factor f from the Colebrook correlation (implemented here via Swamee–Jain, the explicit fit).
Because ρ is essentially constant, the momentum balance integrates to a linear head profile. Q is constant along the pipe (∂Q/∂x = 0).
For a compressible gas with constant T and low Mach, mass flux ρV is constant, and ρ ∝ p. Substituting:
→ p2 is linear in x (the Weymouth equation). In the pressure plot you see a concave curve for gas, straight line for liquid.
When a valve closes faster than 2L/a, the fluid behind it cannot “see” the closure in time and is compressed against the valve. The resulting pressure jump is given by the Joukowsky equation:
where a is the acoustic wave speed and ΔV is the instantaneous change in flow velocity. The wave then travels back up the pipe at speed a and reflects between boundaries, ringing down only through friction.
An inline heater deposits volumetric power q (W/m3) into a zone [x0, x1]. The heated slug then advects downstream at the local fluid velocity V (much slower than a pressure wave). Wall heat transfer to ground at U acts over the perimeter and slowly relaxes T back to T_amb.
Pressure is continuous across the leak point; flow is not. The leak discharges to atmosphere via an orifice law:
K is calibrated so a “5%” leak discharges 5% of the steady-state flow/mass-flow at nominal operating pressure. In the liquid MOC solver, the leak is imposed at an interior node by coupling C+ and C− characteristics with the orifice law — a quadratic in √H gives H_leak, then Q_up and Q_dn fall out.
When the leak opens, a low-pressure wave propagates both upstream and downstream from the leak point at speed a. The inlet mass flux reacts first (it hears the pressure drop), then the outlet, with a lag of (L − x_leak)/a.
| Constant pressure | Constant flow | |
|---|---|---|
| P_in | held | drops (downstream friction falls) |
| Q_in | rises (to feed the leak) | held |
| Q_out | drops slightly | drops more |
| ΔP | unchanged | decreases |
The inlet boundary condition in any 1D unsteady pipe solver needs one scalar constraint (the other comes from the characteristic or Riemann invariant arriving from inside the pipe).
Fix H[0] (liquid) or p[0] (gas). The inlet mass flow floats, determined by the downstream characteristic. This models a large reservoir / unlimited-capacity pump at fixed discharge pressure.
Fix Q[0] (or mass flux ρu for gas). The inlet pressure floats. This models a positive-displacement pump that always delivers a fixed volumetric rate.
Leak under constant pressure: P_in stays put, pump works harder (Q_in rises). Useful for leak-detection via inlet-over-flow alarms.
Leak under constant flow: P_in drops because downstream friction falls as less fluid flows past the leak. Useful for leak-detection via inlet-pressure drop alarms.
Method of Characteristics on the compressible continuity + momentum equations, assuming small density changes so the wave speed a is constant (set by the bulk modulus of the liquid and the pipe wall elasticity). This is the industry standard for liquid-hammer analysis.
Applies to: water, refined products, crude oils, LNG (a liquid at −162 °C), essentially any single-phase liquid.
Finite-volume on conservative variables q = [ρ, ρu, ρE]. HLL Riemann flux at faces, with wave-speed estimates SL = min(uL−aL, uR−aR), SR = max(uL+aL, uR+aR):
| Phenomenon | Liquid | Gas |
|---|---|---|
| Density variation along pipe | < 0.5% | 2× or more |
| Q_in vs Q_out at steady state | equal | Q_out > Q_in (expansion) |
| Pressure profile | linear in x | p2 linear (Weymouth) |
| Wave speed | constant | depends on state |
| Hammer ΔP | tens of bar | few bar |
| Fluid | Solver | °API | ρ (kg/m³) | μ_ref | T_ref | P_in | Notes |
|---|---|---|---|---|---|---|---|
| Light Crude | Liquid MOC | 39.6 | 850 | 10 cP | 25 °C | 67 bar | WTI-like benchmark; typical refined-product line |
| Heavy Crude | Liquid MOC | 17.5 | 950 | 200 cP | 60 °C (heated) | 121 bar | Bitumen / dilbit; needs higher P + heating |
| LNG | Liquid MOC | n/a | 450 | 0.13 cP | −160 °C | 5.3 bar | Cryogenic liquid methane; transfer-line scale |
| Arab Light (Petroline) | Liquid MOC | 33.4 | 860 | 5 cP @ 40°C | 40 °C | 93 bar | Saudi East–West; 1200 km × 48" |
| Natural Gas | Gas Euler | — | ~50 at line P | 10.5 µPa·s (Sutherland) | 15 °C | 70 bar | Long-haul transmission; Z≈0.9 |
| LP Distribution | Gas Euler | — | ~10 | 10.5 µPa·s | 15 °C | 15 bar | Distribution-network pressures |
| Langeled (North Sea) | Gas Euler | — | ~150 at line P | 10.8 µPa·s | 12 °C inlet / 5 °C seabed | 200 bar | Norway→UK subsea export; 1166 km × 42" |
API gravity is a derived density scale used throughout the oil industry. Water = 10° API. Higher API means lighter crude.
| Range | Classification | Typical μ |
|---|---|---|
| > 31.1° | Light crude | < 10 cP |
| 22.3–31.1° | Medium crude | 10–100 cP |
| 10–22.3° | Heavy crude | 100–10 000 cP |
| < 10° | Extra-heavy / bitumen | > 10 000 cP |
api_gravity metadata. ρ shown in the snapshot is the physical density used in the solver; it should agree with SG × 999 to within 1%.Saudi Aramco's East–West Crude Oil Pipeline (Petroline) is the kingdom's strategic export route bypassing the Strait of Hormuz. It runs Abqaiq (Eastern Province) to Yanbu on the Red Sea, feeding Yanbu's export terminals and the Red Sea refineries.
| Property | Value |
|---|---|
| API gravity | 33.4° |
| Specific gravity | 0.859 |
| Density at 15 °C | 860 kg/m³ |
| Viscosity at 40 °C | ~5 cP |
| Viscosity at 20 °C | ~11–13 cP |
| Sulfur content | ~1.9% wt |
| Pour point | −40 °C (no wax issues in desert ambient) |
Runs from the Nyhamna processing terminal in Norway (feeding gas from the Ormen Lange field and Troll) to Easington on the UK east coast. Designed to carry ~20% of UK gas demand at peak.
| Component | Mol % |
|---|---|
| Methane (CH4) | ~90 |
| Ethane (C2H6) | ~5 |
| Propane (C3H8) | ~1.0 |
| Butanes (C4) | ~0.4 |
| Heavier (C5+) | ~0.1 |
| CO2 | ~1.0 |
| N2 | ~0.5 |
This gives molar mass M ≈ 18 g/mol, γ ≈ 1.29, compressibility factor Z ≈ 0.85 at 200 bar / 5 °C, specific gravity (air=1) ~0.62. Sutherland viscosity is slightly higher than pure methane because of the ethane+ components.
| Fluid | B = Ea/R | μ ratio at Tamb vs Tref |
|---|---|---|
| Light crude | 4000 K | ~1.3× |
| Heavy crude | 7000 K | ~23× (much stiffer when cooled!) |
| LNG | 300 K | ~1.2× |
Gas viscosity rises with T (kinetic-theory reason: more molecular collisions). In a cooled section, μ drops slightly → Re rises → f changes.