Class ReliefValveSizing

java.lang.Object
neqsim.process.util.fire.ReliefValveSizing

public final class ReliefValveSizing extends Object
Dynamic relief valve (PSV) sizing for fire scenarios per API 521.

This class provides methods for sizing pressure safety valves (PSVs) for gas-filled vessels subject to fire exposure. Unlike the traditional conservative API 521 approach which sizes for peak flow, this implementation supports dynamic sizing that accounts for the transient nature of fire-induced blowdown.

Key features:

  • API 520/521 compliant orifice area calculations
  • Support for both conventional and balanced-bellows PSVs
  • Dynamic fire scenarios with time-varying heat input
  • Back pressure effects for multiple PSV installations

References:

  • API Standard 521, 7th Edition (2020) - Pressure-relieving and Depressuring Systems
  • Andreasen, A. (2021). HydDown: A Python package for calculation of hydrogen (or other gas) pressure vessel filling and discharge. Journal of Open Source Software, 6(66), 3695.
Author:
ESOL
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Result container for liquid PSV sizing calculations per API 520 Section 5.8.
    static final class 
    Result container for PSV sizing calculations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Gas constant [J/(mol*K)].
    static final double[]
    Standard API 520 orifice areas [in²].
    static final String[]
    Standard API 520 orifice letter designations.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    calculateAPI521FireHeatInput(double wettedAreaM2, boolean hasDrainage, boolean hasFireFighting)
    Calculates fire heat input per API 521 Table 4 for wetted surface.
    static double
    calculateBlowdownPressure(double setPressure, double blowdownPercent)
    Calculates the blowdown (reseat) pressure for a PSV.
    static double
    calculateCv(double orificeArea, double dischargeCoefficient)
    Calculates the flow coefficient Cv for a PSV at given conditions.
    calculateLiquidReliefArea(double volumeFlowRate, double liquidDensity, double setPressure, double overpressureFraction, double backPressure, double viscosity, boolean isBalancedBellows)
    Calculates required PSV orifice area for liquid service per API 520 Section 5.8.
    static double
    calculateMassFlowCapacity(double orificeArea, double setPressure, double overpressureFraction, double backPressure, double temperature, double molecularWeight, double compressibility, double specificHeatRatio, double dischargeCoefficient)
    Calculates the mass flow capacity of a PSV for gas/vapor service.
    static double
    calculateMaxHeatAbsorption(double massFlowCapacity, double latentHeat)
    Calculates the required heat absorption rate for a given PSV size during fire.
    calculateRequiredArea(double massFlowRate, double setPressure, double overpressureFraction, double backPressure, double temperature, double molecularWeight, double compressibility, double specificHeatRatio, boolean isBalancedBellows, boolean hasRuptureDisk)
    Calculates the required PSV orifice area for gas/vapor service per API 520.
    static double
    calculateTwoPhaseReliefArea(double massFlowRate, double setPressure, double overpressureFraction, double backPressure, double inletTemperature, double gasFraction, double gasDensity, double liquidDensity, double latentHeat, double liquidCp)
    Estimates the required relief area for two-phase (gas + liquid) service using the omega method per API 520 Appendix D (Leung's omega method).
    dynamicFireSizing(double initialMass, double initialPressure, double setPressure, double initialTemperature, double fireHeatInput, double vesselVolume, double molecularWeight, double specificHeatRatio, double compressibility, double heatCapacity, double blowdownTime)
    Dynamic sizing calculation for fire scenarios.
    static String
    getNextLargerOrifice(String currentOrifice)
    Gets the next larger standard orifice size.
    static double
    Gets the orifice area for a standard API 520 orifice designation.
    static String
    Validates PSV sizing against API 521 requirements.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • R_GAS

      public static final double R_GAS
      Gas constant [J/(mol*K)].
      See Also:
    • STANDARD_ORIFICE_AREAS_IN2

      public static final double[] STANDARD_ORIFICE_AREAS_IN2
      Standard API 520 orifice areas [in²].
    • STANDARD_ORIFICE_LETTERS

      public static final String[] STANDARD_ORIFICE_LETTERS
      Standard API 520 orifice letter designations.
  • Constructor Details

    • ReliefValveSizing

      private ReliefValveSizing()
  • Method Details

    • calculateRequiredArea

      public static ReliefValveSizing.PSVSizingResult calculateRequiredArea(double massFlowRate, double setPressure, double overpressureFraction, double backPressure, double temperature, double molecularWeight, double compressibility, double specificHeatRatio, boolean isBalancedBellows, boolean hasRuptureDisk)
      Calculates the required PSV orifice area for gas/vapor service per API 520.

      Uses the API 520 equation for critical (sonic) flow:

      A = W / (C * Kd * P1 * Kb * Kc) * sqrt(T * Z / M)
      
      Parameters:
      massFlowRate - Required relieving rate [kg/s]
      setPressure - PSV set pressure [Pa absolute]
      overpressureFraction - Overpressure fraction (0.10 for fire, 0.21 for external fire)
      backPressure - Downstream/back pressure [Pa absolute]
      temperature - Relieving temperature [K]
      molecularWeight - Molecular weight [kg/mol]
      compressibility - Compressibility factor Z
      specificHeatRatio - Cp/Cv ratio (gamma/k)
      isBalancedBellows - true for balanced-bellows PSV
      hasRuptureDisk - true if rupture disk is installed upstream
      Returns:
      PSV sizing result
    • calculateMassFlowCapacity

      public static double calculateMassFlowCapacity(double orificeArea, double setPressure, double overpressureFraction, double backPressure, double temperature, double molecularWeight, double compressibility, double specificHeatRatio, double dischargeCoefficient)
      Calculates the mass flow capacity of a PSV for gas/vapor service.
      Parameters:
      orificeArea - Effective orifice area [m²]
      setPressure - PSV set pressure [Pa absolute]
      overpressureFraction - Overpressure fraction
      backPressure - Back pressure [Pa absolute]
      temperature - Relieving temperature [K]
      molecularWeight - Molecular weight [kg/mol]
      compressibility - Compressibility factor Z
      specificHeatRatio - Cp/Cv ratio
      dischargeCoefficient - Discharge coefficient (typically 0.975)
      Returns:
      Mass flow capacity [kg/s]
    • calculateMaxHeatAbsorption

      public static double calculateMaxHeatAbsorption(double massFlowCapacity, double latentHeat)
      Calculates the required heat absorption rate for a given PSV size during fire.

      This is useful for determining if a given PSV size can handle the heat input from a fire scenario.

      Parameters:
      massFlowCapacity - PSV mass flow capacity [kg/s]
      latentHeat - Latent heat of vaporization (or Cp*dT for sensible heating) [J/kg]
      Returns:
      Maximum heat absorption rate [W]
    • dynamicFireSizing

      public static ReliefValveSizing.PSVSizingResult dynamicFireSizing(double initialMass, double initialPressure, double setPressure, double initialTemperature, double fireHeatInput, double vesselVolume, double molecularWeight, double specificHeatRatio, double compressibility, double heatCapacity, double blowdownTime)
      Dynamic sizing calculation for fire scenarios.

      Unlike static sizing which uses peak flow, this method evaluates the transient response and can result in smaller (more realistic) PSV sizes.

      Parameters:
      initialMass - Initial fluid inventory [kg]
      initialPressure - Initial pressure [Pa]
      setPressure - PSV set pressure [Pa]
      initialTemperature - Initial temperature [K]
      fireHeatInput - Constant fire heat input [W]
      vesselVolume - Vessel volume [m³]
      molecularWeight - Molecular weight [kg/mol]
      specificHeatRatio - Cp/Cv ratio
      compressibility - Compressibility factor
      heatCapacity - Heat capacity [J/(kg*K)]
      blowdownTime - Target blowdown time [s] (typically 15 minutes = 900s per API 521)
      Returns:
      PSV sizing result for fire case
    • calculateBlowdownPressure

      public static double calculateBlowdownPressure(double setPressure, double blowdownPercent)
      Calculates the blowdown (reseat) pressure for a PSV.
      Parameters:
      setPressure - PSV set pressure [Pa]
      blowdownPercent - Blowdown percentage (typically 7-10%)
      Returns:
      Blowdown/reseat pressure [Pa]
    • calculateCv

      public static double calculateCv(double orificeArea, double dischargeCoefficient)
      Calculates the flow coefficient Cv for a PSV at given conditions.

      This allows the PSV to be modeled as an equivalent control valve in process simulations.

      Parameters:
      orificeArea - Orifice area [m²]
      dischargeCoefficient - Discharge coefficient
      Returns:
      Flow coefficient Cv [gpm/sqrt(psi)]
    • validateSizing

      public static String validateSizing(ReliefValveSizing.PSVSizingResult result, boolean isFireCase)
      Validates PSV sizing against API 521 requirements.
      Parameters:
      result - PSV sizing result to validate
      isFireCase - true if this is a fire scenario
      Returns:
      Validation message (empty if valid, otherwise describes issues)
    • getNextLargerOrifice

      public static String getNextLargerOrifice(String currentOrifice)
      Gets the next larger standard orifice size.
      Parameters:
      currentOrifice - Current orifice letter designation
      Returns:
      Next larger orifice letter, or "T" if already at maximum
    • getStandardOrificeArea

      public static double getStandardOrificeArea(String orifice)
      Gets the orifice area for a standard API 520 orifice designation.
      Parameters:
      orifice - Orifice letter designation (D, E, F, G, H, J, K, L, M, N, P, Q, R, T)
      Returns:
      Orifice area [m²]
    • calculateLiquidReliefArea

      public static ReliefValveSizing.LiquidPSVSizingResult calculateLiquidReliefArea(double volumeFlowRate, double liquidDensity, double setPressure, double overpressureFraction, double backPressure, double viscosity, boolean isBalancedBellows)
      Calculates required PSV orifice area for liquid service per API 520 Section 5.8.

      Uses the API 520 liquid relief equation:

      A = Q / (38 * Kd * Kw * Kv * Kp) * sqrt(G / (P1 - P2))
      

      where Q is volume flow in US gpm, G is specific gravity, P1 is upstream relieving pressure [psig], and P2 is back pressure [psig].

      Parameters:
      volumeFlowRate - Volume flow rate at relieving conditions [m3/s]
      liquidDensity - Liquid density at relieving conditions [kg/m3]
      setPressure - PSV set pressure [Pa absolute]
      overpressureFraction - Overpressure fraction (0.10 or 0.25 for fire)
      backPressure - Downstream/back pressure [Pa absolute]
      viscosity - Dynamic viscosity [Pa*s]
      isBalancedBellows - true for balanced-bellows PSV
      Returns:
      Liquid PSV sizing result
    • calculateTwoPhaseReliefArea

      public static double calculateTwoPhaseReliefArea(double massFlowRate, double setPressure, double overpressureFraction, double backPressure, double inletTemperature, double gasFraction, double gasDensity, double liquidDensity, double latentHeat, double liquidCp)
      Estimates the required relief area for two-phase (gas + liquid) service using the omega method per API 520 Appendix D (Leung's omega method).

      The omega parameter characterizes the two-phase mixture compressibility. For flashing flow through a nozzle, omega accounts for the vapour generation during depressurization.

      Parameters:
      massFlowRate - Total two-phase mass flow rate [kg/s]
      setPressure - PSV set pressure [Pa absolute]
      overpressureFraction - Overpressure fraction
      backPressure - Back pressure [Pa absolute]
      inletTemperature - Inlet temperature [K]
      gasFraction - Mass fraction of gas at inlet conditions
      gasDensity - Gas density at inlet [kg/m3]
      liquidDensity - Liquid density at inlet [kg/m3]
      latentHeat - Latent heat of vaporization [J/kg]
      liquidCp - Liquid heat capacity [J/(kg*K)]
      Returns:
      Required orifice area [m2]
    • calculateAPI521FireHeatInput

      public static double calculateAPI521FireHeatInput(double wettedAreaM2, boolean hasDrainage, boolean hasFireFighting)
      Calculates fire heat input per API 521 Table 4 for wetted surface.

      Uses Q = C1 * F * Aws^alpha where C1 and alpha depend on drainage and fire-fighting facilities.

      Parameters:
      wettedAreaM2 - Wetted surface area [m2]
      hasDrainage - true if adequate drainage exists
      hasFireFighting - true if firefighting equipment available
      Returns:
      Heat absorption rate [W]