Class AdiabaticPipe

All Implemented Interfaces:
Serializable, Runnable, AutoSizeable, CapacityConstrainedEquipment, PipeLineInterface, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface
Direct Known Subclasses:
IncompressiblePipeFlow

public class AdiabaticPipe extends Pipeline implements AutoSizeable
Single-phase adiabatic pipe model.

This class models a simple adiabatic (no heat transfer) pipe for single-phase flow using basic gas flow equations. It calculates pressure drop from friction and elevation changes.

Calculation Modes

  • Calculate outlet pressure - Given inlet conditions and flow rate
  • Calculate flow rate - Given inlet and outlet pressures (when outlet pressure is set)

The pipeline implements CapacityConstrainedEquipment (inherited from Pipeline) with constraints:

  • Velocity - SOFT limit based on erosional velocity
  • LOF (Likelihood of Failure) - SOFT limit for flow-induced vibration
  • FRMS - SOFT limit for flow-induced vibration intensity
  • Volume flow - DESIGN limit from mechanical design

Example Usage

// Create gas stream
SystemInterface gas = new SystemSrkEos(278.15, 220.0);
gas.addComponent("methane", 24.0, "MSm^3/day");
gas.setMixingRule("classic");

Stream inlet = new Stream("inlet", gas);
inlet.run();

// Create adiabatic pipe
AdiabaticPipe pipe = new AdiabaticPipe("pipeline", inlet);
pipe.setLength(700000.0); // 700 km
pipe.setDiameter(0.7112); // ~28 inches
pipe.setPipeWallRoughness(5e-6);
pipe.run();

System.out.println("Outlet pressure: " + pipe.getOutletPressure("bara") + " bara");
Version:
2.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • inletPressure

      double inletPressure
    • setTemperature

      boolean setTemperature
    • setPressureOut

      boolean setPressureOut
    • temperatureOut

      protected double temperatureOut
    • pressureOut

      protected double pressureOut
    • dH

      double dH
    • pipeSpecification

      String pipeSpecification
    • insideDiameter

      double insideDiameter
    • pipeWallRoughnessLocal

      double pipeWallRoughnessLocal
    • supportArrangement

      private String supportArrangement
      Support arrangement for FIV calculations.
    • maxDesignVelocity

      private double maxDesignVelocity
      Maximum design velocity in m/s.
    • maxDesignLOF

      private double maxDesignLOF
      Maximum design LOF value.
    • maxDesignFRMS

      private double maxDesignFRMS
      Maximum design FRMS value.
    • rhonePoulencVelocity

      private RhonePoulencVelocity rhonePoulencVelocity
      Rhone-Poulenc velocity calculator. When non-null, maximum velocity is determined from the Rhone-Poulenc curves instead of API RP 14E.
    • pipeWallThickness

      private double pipeWallThickness
      Wall thickness in meters.
    • autoSized

      private boolean autoSized
      Flag indicating if pipe has been auto-sized.
  • Constructor Details

    • AdiabaticPipe

      public AdiabaticPipe(String name)
      Constructor for AdiabaticPipe.
      Parameters:
      name - name of pipe
    • AdiabaticPipe

      public AdiabaticPipe(String name, StreamInterface inStream)
      Constructor for AdiabaticPipe.
      Parameters:
      name - name of pipe
      inStream - input stream
  • Method Details

    • setLength

      public void setLength(double length)
      Set the total pipe length.
      Specified by:
      setLength in interface PipeLineInterface
      Overrides:
      setLength in class Pipeline
      Parameters:
      length - the pipe length in meters
    • getLength

      public double getLength()
      Get the total pipe length.
      Specified by:
      getLength in interface PipeLineInterface
      Overrides:
      getLength in class Pipeline
      Returns:
      the pipe length in meters
    • setDiameter

      public void setDiameter(double diameter)
      Set the pipe inner diameter.
      Specified by:
      setDiameter in interface PipeLineInterface
      Overrides:
      setDiameter in class Pipeline
      Parameters:
      diameter - the inner diameter in meters
    • getDiameter

      public double getDiameter()
      Get the pipe inner diameter.
      Specified by:
      getDiameter in interface PipeLineInterface
      Overrides:
      getDiameter in class Pipeline
      Returns:
      the inner diameter in meters
    • setPipeWallRoughness

      public void setPipeWallRoughness(double roughness)
      Set the pipe wall roughness.
      Specified by:
      setPipeWallRoughness in interface PipeLineInterface
      Overrides:
      setPipeWallRoughness in class Pipeline
      Parameters:
      roughness - the wall roughness in meters
    • getPipeWallRoughness

      public double getPipeWallRoughness()
      Get the pipe wall roughness.
      Specified by:
      getPipeWallRoughness in interface PipeLineInterface
      Overrides:
      getPipeWallRoughness in class Pipeline
      Returns:
      the wall roughness in meters
    • setInletElevation

      public void setInletElevation(double inletElevation)
      Set the inlet elevation above reference.
      Specified by:
      setInletElevation in interface PipeLineInterface
      Overrides:
      setInletElevation in class Pipeline
      Parameters:
      inletElevation - inlet elevation in meters
    • getInletElevation

      public double getInletElevation()
      Get the inlet elevation above reference.
      Specified by:
      getInletElevation in interface PipeLineInterface
      Overrides:
      getInletElevation in class Pipeline
      Returns:
      inlet elevation in meters
    • setOutletElevation

      public void setOutletElevation(double outletElevation)
      Set the outlet elevation above reference.
      Specified by:
      setOutletElevation in interface PipeLineInterface
      Overrides:
      setOutletElevation in class Pipeline
      Parameters:
      outletElevation - outlet elevation in meters
    • getOutletElevation

      public double getOutletElevation()
      Get the outlet elevation above reference.
      Specified by:
      getOutletElevation in interface PipeLineInterface
      Overrides:
      getOutletElevation in class Pipeline
      Returns:
      outlet elevation in meters
    • setPipeSpecification

      public void setPipeSpecification(double nominalDiameter, String pipeSec)
      Set pipe specification from database.
      Specified by:
      setPipeSpecification in interface PipeLineInterface
      Overrides:
      setPipeSpecification in class Pipeline
      Parameters:
      nominalDiameter - nominal diameter in mm or inches
      pipeSec - pipe specification code (e.g., "API 5L", "ANSI B36.10")
    • setOutletTemperature

      public void setOutletTemperature(double temperature)
      Set outlet temperature of twoport.
      Specified by:
      setOutletTemperature in interface PipeLineInterface
      Specified by:
      setOutletTemperature in interface TwoPortInterface
      Overrides:
      setOutletTemperature in class Pipeline
      Parameters:
      temperature - value to set in kelvin
    • setOutletPressure

      public void setOutletPressure(double pressure)
      Set outlet pressure of twoport.
      Specified by:
      setOutletPressure in interface PipeLineInterface
      Specified by:
      setOutletPressure in interface TwoPortInterface
      Overrides:
      setOutletPressure in class Pipeline
      Parameters:
      pressure - value to set in unit bara
    • calcWallFrictionFactor

      public double calcWallFrictionFactor(double reynoldsNumber)
      Calculate the wall friction factor using the Haaland equation.
      Parameters:
      reynoldsNumber - the Reynolds number
      Returns:
      the Darcy friction factor
    • calcPressureOut

      public double calcPressureOut()
      Calculate the outlet pressure based on friction and elevation losses.

      This method calculates the pressure drop using the general flow equation for compressible gas flow, accounting for:

      • Friction pressure loss (using effective length including fittings)
      • Elevation pressure change (hydrostatic head)

      The effective length includes both physical pipe length and equivalent length from fittings:

      L_eff = L_physical + Σ(L/D)_i × D
      
      Returns:
      the outlet pressure in bara
    • calcFlow

      public double calcFlow()
      Calculate the flow rate required to achieve the specified outlet pressure.

      Uses bisection iteration to find the flow rate that achieves the target outlet pressure.

      Returns:
      the calculated flow rate in the current system units
    • run

      public void run(UUID id)

      In this method all thermodynamic and unit operations will be calculated in a steady state calculation.

      Specified by:
      run in interface SimulationInterface
      Overrides:
      run in class Pipeline
      Parameters:
      id - UUID
    • displayResult

      public void displayResult()

      displayResult.

      Specified by:
      displayResult in interface ProcessEquipmentInterface
      Overrides:
      displayResult in class Pipeline
    • getPipe

      public FlowSystemInterface getPipe()
      Get the underlying flow system (for advanced models).
      Specified by:
      getPipe in interface PipeLineInterface
      Overrides:
      getPipe in class Pipeline
      Returns:
      flow system interface or null if not applicable
    • setInitialFlowPattern

      public void setInitialFlowPattern(String flowPattern)
      Set initial flow pattern for simulation initialization.
      Specified by:
      setInitialFlowPattern in interface PipeLineInterface
      Overrides:
      setInitialFlowPattern in class Pipeline
      Parameters:
      flowPattern - initial flow pattern (e.g., "stratified", "slug")
    • getPressureDrop

      public double getPressureDrop()
      Get the total pressure drop across the pipeline.
      Specified by:
      getPressureDrop in interface PipeLineInterface
      Overrides:
      getPressureDrop in class Pipeline
      Returns:
      pressure drop in bar
    • getFlowRegime

      public String getFlowRegime()
      Get the determined flow regime.
      Specified by:
      getFlowRegime in interface PipeLineInterface
      Overrides:
      getFlowRegime in class Pipeline
      Returns:
      flow regime as string (e.g., "stratified", "slug", "annular", "dispersed bubble")
    • getVelocity

      public double getVelocity()
      Get the flow velocity in the pipe.
      Specified by:
      getVelocity in interface PipeLineInterface
      Overrides:
      getVelocity in class Pipeline
      Returns:
      velocity in m/s
    • getReynoldsNumber

      public double getReynoldsNumber()
      Get the Reynolds number for the flow.
      Specified by:
      getReynoldsNumber in interface PipeLineInterface
      Overrides:
      getReynoldsNumber in class Pipeline
      Returns:
      Reynolds number (dimensionless)
    • getFrictionFactor

      public double getFrictionFactor()
      Get the friction factor.
      Specified by:
      getFrictionFactor in interface PipeLineInterface
      Overrides:
      getFrictionFactor in class Pipeline
      Returns:
      Darcy friction factor (dimensionless)
    • getSupportArrangement

      public String getSupportArrangement()
      Get support arrangement for FIV calculations.
      Returns:
      support arrangement (Stiff, Medium stiff, Medium, Flexible)
    • setSupportArrangement

      public void setSupportArrangement(String arrangement)
      Set support arrangement for FIV calculations.
      Parameters:
      arrangement - support arrangement (Stiff, Medium stiff, Medium, Flexible)
    • setRhonePoulencServiceType

      public void setRhonePoulencServiceType(RhonePoulencVelocity.ServiceType serviceType)
      Enable Rhone-Poulenc maximum velocity calculation for gas pipes.

      When enabled, the maximum allowable velocity is determined from the Rhone-Poulenc curves instead of the API RP 14E erosional velocity. The Rhone-Poulenc method uses a power-law correlation between gas density and maximum velocity, with service-type-dependent constants.

      Parameters:
      serviceType - the gas service type (NON_CORROSIVE_GAS or CORROSIVE_GAS)
    • useRhonePoulencVelocity

      public void useRhonePoulencVelocity()
      Enable Rhone-Poulenc maximum velocity calculation with default non-corrosive gas settings.

      Equivalent to calling setRhonePoulencServiceType(ServiceType.NON_CORROSIVE_GAS).

    • setRhonePoulencServiceType

      public void setRhonePoulencServiceType(RhonePoulencVelocity.ServiceType serviceType, boolean useInterpolation)
      Enable Rhone-Poulenc maximum velocity calculation using tabulated data with log-log interpolation for higher accuracy.
      Parameters:
      serviceType - the gas service type
      useInterpolation - true to use tabulated interpolation, false for power-law formula
    • disableRhonePoulencVelocity

      public void disableRhonePoulencVelocity()
      Disable Rhone-Poulenc maximum velocity and revert to API RP 14E erosional velocity.
    • isRhonePoulencEnabled

      public boolean isRhonePoulencEnabled()
      Check if Rhone-Poulenc maximum velocity is enabled.
      Returns:
      true if Rhone-Poulenc method is active
    • getRhonePoulencCalculator

      public RhonePoulencVelocity getRhonePoulencCalculator()
      Get the Rhone-Poulenc velocity calculator, or null if not enabled.
      Returns:
      the RhonePoulencVelocity calculator or null
    • getRhonePoulencMaxVelocity

      public double getRhonePoulencMaxVelocity()
      Calculate the maximum allowable gas velocity using the Rhone-Poulenc curves.

      This method uses the current gas density from the simulation to look up the maximum velocity from the Rhone-Poulenc correlation. If Rhone-Poulenc is not enabled, this returns 0.0.

      Returns:
      maximum allowable velocity in m/s, or 0.0 if not enabled or density unavailable
    • getMaxAllowableVelocity

      public double getMaxAllowableVelocity()
      Get the effective maximum allowable velocity using the currently configured method.

      Returns Rhone-Poulenc max velocity if enabled, otherwise the API RP 14E erosional velocity.

      Returns:
      maximum allowable velocity in m/s
    • getMaxVelocityMethod

      public String getMaxVelocityMethod()
      Get the name of the currently active maximum velocity method.
      Returns:
      "RHONE_POULENC" or "API_RP_14E"
    • getGasDensityForVelocity

      private double getGasDensityForVelocity()
      Get the gas density used for velocity calculations.
      Returns:
      gas density in kg/m3, or 0.0 if unavailable
    • setPipeWallThickness

      public void setPipeWallThickness(double thickness)
      Set pipe wall thickness.
      Parameters:
      thickness - wall thickness in meters
    • getPipeWallThickness

      public double getPipeWallThickness()
      Get pipe wall thickness.
      Returns:
      wall thickness in meters
    • getErosionalVelocity

      public double getErosionalVelocity(double cFactor)
      Calculate erosional velocity per API RP 14E.
      Parameters:
      cFactor - erosional C-factor (typically 100-150)
      Returns:
      erosional velocity in m/s
    • getErosionalVelocity

      public double getErosionalVelocity()
      Calculate erosional velocity with default C-factor of 100.
      Returns:
      erosional velocity in m/s
    • getMixtureVelocity

      public double getMixtureVelocity()
      Get the mixture velocity in m/s.
      Returns:
      mixture velocity in m/s
    • calculateLOF

      public double calculateLOF()
      Calculate Likelihood of Failure (LOF) for flow-induced vibration.

      LOF interpretation:

      • < 0.5: Low risk - acceptable
      • 0.5 - 1.0: Medium risk - monitoring recommended
      • > 1.0: High risk - design review required
      Returns:
      LOF value (dimensionless)
    • calculateFRMS

      public double calculateFRMS()
      Calculate Flow-induced vibration RMS (FRMS).
      Returns:
      FRMS value
    • calculateFRMS

      public double calculateFRMS(double frmsConstant)
      Calculate Flow-induced vibration RMS (FRMS) with specified constant.
      Parameters:
      frmsConstant - FRMS constant (typically 6.7)
      Returns:
      FRMS value
    • getFIVAnalysis

      public Map<String,Object> getFIVAnalysis()
      Get comprehensive FIV analysis results as a map.
      Returns:
      map containing all FIV analysis results
    • getFIVAnalysisJson

      public String getFIVAnalysisJson()
      Get FIV analysis as JSON string.
      Returns:
      JSON string with FIV analysis
    • setMaxDesignVelocity

      public void setMaxDesignVelocity(double maxVelocity)
      Set maximum design velocity for capacity constraints.
      Parameters:
      maxVelocity - maximum velocity in m/s
    • setMaxDesignLOF

      public void setMaxDesignLOF(double maxLOF)
      Set maximum design LOF for capacity constraints.
      Parameters:
      maxLOF - maximum LOF value
    • setMaxDesignFRMS

      public void setMaxDesignFRMS(double maxFRMS)
      Set maximum design FRMS for capacity constraints.
      Parameters:
      maxFRMS - maximum FRMS value
    • initializeCapacityConstraints

      protected void initializeCapacityConstraints()
      Override parent's capacity constraint initialization to add FIV/FRMS constraints.
      Overrides:
      initializeCapacityConstraints in class Pipeline
    • autoSize

      public void autoSize(double safetyFactor)
      Automatically size the equipment based on connected stream conditions.

      This method calculates dimensions and design parameters using the inlet stream properties and applies the specified safety factor. The equipment must have a valid inlet stream connected before calling this method.

      Specified by:
      autoSize in interface AutoSizeable
      Parameters:
      safetyFactor - multiplier for design capacity, typically 1.1-1.3 (10-30% over design)
    • selectStandardPipeSize

      private double selectStandardPipeSize(double calculatedDiameterInches)
      Selects standard pipe nominal diameter based on calculated diameter.
      Parameters:
      calculatedDiameterInches - calculated inside diameter in inches
      Returns:
      nearest standard pipe nominal diameter in inches
    • autoSize

      public void autoSize()
      Automatically size using default safety factor (1.2 = 20% margin).
      Specified by:
      autoSize in interface AutoSizeable
    • autoSize

      public void autoSize(String company, String trDocument)
      Automatically size using company-specific design standards.

      This method applies design rules from the specified company's technical requirements (TR) documents. The standards are loaded from the NeqSim design database.

      Specified by:
      autoSize in interface AutoSizeable
      Parameters:
      company - company name (e.g., "Equinor", "Shell", "TotalEnergies")
      trDocument - TR document reference (e.g., "TR2000", "DEP-31.38.01.11")
    • isAutoSized

      public boolean isAutoSized()
      Check if equipment has been auto-sized.
      Specified by:
      isAutoSized in interface AutoSizeable
      Returns:
      true if autoSize() has been called successfully
    • getSizingReport

      public String getSizingReport()
      Get a detailed sizing report after auto-sizing.

      The report includes:

      • Design basis (flow rates, pressures, temperatures)
      • Calculated dimensions
      • Design parameters (K-factor, Cv, velocity, etc.)
      • Safety margins
      Specified by:
      getSizingReport in interface AutoSizeable
      Returns:
      formatted sizing report string
    • getSizingReportJson

      public String getSizingReportJson()
      Get sizing report as JSON for programmatic access.
      Specified by:
      getSizingReportJson in interface AutoSizeable
      Returns:
      JSON string with sizing data
    • main

      public static void main(String[] name)
      Main method for testing.
      Parameters:
      name - command line arguments