Class TubingPerformance

All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface

public class TubingPerformance extends TwoPortEquipment

TubingPerformance class - Vertical Lift Performance (VLP) model for wellbore tubing.

This class calculates the pressure drop through wellbore tubing using various multiphase flow correlations. It can generate VLP curves (also known as Tubing Performance Curves or Outflow Performance Relationships) for use in nodal analysis and reservoir simulation.

Supported Pressure-Drop Correlations

  • BEGGS_BRILL - General purpose, all inclinations (default)
  • HAGEDORN_BROWN - Vertical/near-vertical oil wells
  • GRAY - Gas wells with condensate
  • HASAN_KABIR - Mechanistic model for all well types
  • DUNS_ROS - Gas wells

Temperature Models

  • ISOTHERMAL - Constant temperature throughout tubing
  • LINEAR_GRADIENT - Linear temperature profile from BH to WH
  • RAMEY - Ramey (1962) steady-state geothermal model

Usage Example - VLP Curve Generation

// Create reservoir fluid
SystemInterface fluid = new SystemSrkEos(373.15, 250.0);
fluid.addComponent("methane", 85.0);
fluid.addComponent("n-heptane", 15.0);
fluid.setMixingRule("classic");
fluid.setMultiPhaseCheck(true);

// Create wellhead stream
Stream wellStream = new Stream("well stream", fluid);
wellStream.setFlowRate(5000, "Sm3/day");
wellStream.run();

// Create tubing performance model
TubingPerformance tubing = new TubingPerformance("producer tubing", wellStream);
tubing.setTubingLength(2500.0, "m"); // True vertical depth
tubing.setTubingDiameter(0.1016, "m"); // 4-inch tubing
tubing.setWallRoughness(2.5e-5, "m");
tubing.setInclination(85.0); // 85 degrees from horizontal

// Set temperature model
tubing.setTemperatureModel(TubingPerformance.TemperatureModel.RAMEY);
tubing.setBottomHoleTemperature(100.0, "C");
tubing.setWellheadTemperature(40.0, "C");
tubing.setGeothermalGradient(0.03, "K/m");

// Generate VLP curve
double[] flowRates = {1000, 2000, 3000, 5000, 7000, 10000}; // Sm3/day
double[][] vlpCurve = tubing.generateVLPCurve(flowRates, "Sm3/day", "bara");

// vlpCurve[0] = flow rates
// vlpCurve[1] = bottom-hole pressures required

Integration with WellFlow (IPR-VLP Nodal Analysis)

// Create WellFlow for IPR
WellFlow ipr = new WellFlow("well IPR");
ipr.setInletStream(reservoirStream);
ipr.setVogelParameters(5000, 180, 250); // qTest, pwfTest, pRes

// Create TubingPerformance for VLP
TubingPerformance vlp = new TubingPerformance("tubing VLP", ipr.getOutletStream());
vlp.setTubingLength(2500, "m");
vlp.setTubingDiameter(0.1016, "m");

// Find operating point
double[] operatingPoint = vlp.findOperatingPoint(ipr, 50.0, "bara"); // WHP = 50 bara
// operatingPoint[0] = operating flow rate (Sm3/day)
// operatingPoint[1] = bottom-hole flowing pressure (bara)
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

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

      private static final org.apache.logging.log4j.Logger logger
      Logger object for class.
    • tubingLength

      private double tubingLength
    • tubingDiameter

      private double tubingDiameter
    • wallRoughness

      private double wallRoughness
    • inclination

      private double inclination
    • numberOfSegments

      private int numberOfSegments
    • pressureDropCorrelation

      private TubingPerformance.PressureDropCorrelation pressureDropCorrelation
    • temperatureModel

      private TubingPerformance.TemperatureModel temperatureModel
    • bottomHoleTemperature

      private double bottomHoleTemperature
    • wellheadTemperature

      private double wellheadTemperature
    • geothermalGradient

      private double geothermalGradient
    • overallHeatTransferCoeff

      private double overallHeatTransferCoeff
    • formationThermalConductivity

      private double formationThermalConductivity
    • productionTime

      private double productionTime
    • bottomHolePressure

      private double bottomHolePressure
    • wellheadPressure

      private double wellheadPressure
    • pressureProfile

      private double[] pressureProfile
    • temperatureProfile

      private double[] temperatureProfile
    • depthProfile

      private double[] depthProfile
    • holdupProfile

      private double[] holdupProfile
    • totalPressureDrop

      private double totalPressureDrop
    • vlpFlowRates

      private double[] vlpFlowRates
    • vlpBottomHolePressures

      private double[] vlpBottomHolePressures
    • vlpWellheadPressures

      private double[] vlpWellheadPressures
    • useTableVLP

      private boolean useTableVLP
    • tableVLPFlowRates

      private double[] tableVLPFlowRates
    • tableVLPBHP

      private double[] tableVLPBHP
    • tableVLPWellheadPressure

      private double tableVLPWellheadPressure
  • Constructor Details

    • TubingPerformance

      public TubingPerformance(String name)
      Constructor for TubingPerformance.
      Parameters:
      name - equipment name
    • TubingPerformance

      public TubingPerformance(String name, StreamInterface inletStream)
      Constructor for TubingPerformance with inlet stream.
      Parameters:
      name - equipment name
      inletStream - inlet stream (typically from reservoir or WellFlow)
  • Method Details

    • setTubingLength

      public void setTubingLength(double length, String unit)
      Set tubing measured depth (along wellbore).
      Parameters:
      length - tubing length
      unit - length unit ("m", "ft")
    • setTubingDiameter

      public void setTubingDiameter(double diameter, String unit)
      Set tubing inner diameter.
      Parameters:
      diameter - inner diameter
      unit - diameter unit ("m", "in", "mm")
    • setWallRoughness

      public void setWallRoughness(double roughness, String unit)
      Set pipe wall roughness.
      Parameters:
      roughness - wall roughness
      unit - roughness unit ("m", "mm", "in")
    • setInclination

      public void setInclination(double angleDegrees)
      Set well inclination from horizontal.
      Parameters:
      angleDegrees - inclination angle (90 = vertical, 0 = horizontal)
    • setNumberOfSegments

      public void setNumberOfSegments(int segments)
      Set number of calculation segments.
      Parameters:
      segments - number of segments for pressure integration
    • setPressureDropCorrelation

      public void setPressureDropCorrelation(TubingPerformance.PressureDropCorrelation correlation)
      Set the pressure-drop correlation to use.
      Parameters:
      correlation - pressure-drop correlation
    • setTemperatureModel

      public void setTemperatureModel(TubingPerformance.TemperatureModel model)
      Set the temperature model to use.
      Parameters:
      model - temperature model
    • setBottomHoleTemperature

      public void setBottomHoleTemperature(double temperature, String unit)
      Set bottom-hole temperature (reservoir temperature).
      Parameters:
      temperature - bottom-hole temperature
      unit - temperature unit ("K", "C", "F")
    • setWellheadTemperature

      public void setWellheadTemperature(double temperature, String unit)
      Set wellhead temperature.
      Parameters:
      temperature - wellhead temperature
      unit - temperature unit ("K", "C", "F")
    • setGeothermalGradient

      public void setGeothermalGradient(double gradient, String unit)
      Set geothermal gradient for Ramey model.
      Parameters:
      gradient - temperature gradient
      unit - gradient unit ("K/m", "C/100m", "F/100ft")
    • setOverallHeatTransferCoefficient

      public void setOverallHeatTransferCoefficient(double coefficient)
      Set overall heat transfer coefficient for wellbore.
      Parameters:
      coefficient - heat transfer coefficient in W/(m²·K)
    • setProductionTime

      public void setProductionTime(double time, String unit)
      Set production time for transient Ramey model.
      Parameters:
      time - production time
      unit - time unit ("s", "hr", "day")
    • convertTemperatureToKelvin

      private double convertTemperatureToKelvin(double temp, String unit)
    • run

      public void run(UUID id)

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

      Calculates wellhead conditions from bottom-hole conditions by integrating the pressure-drop correlation up the tubing.

      Parameters:
      id - UUID
    • calculateTemperatureAtDepth

      private double calculateTemperatureAtDepth(double depth, double bhTemp)
      Calculate temperature at a given depth using the selected temperature model.
      Parameters:
      depth - current depth (m from surface, 0 = surface)
      bhTemp - bottom-hole temperature (K)
      Returns:
      temperature at depth (K)
    • calculateRameyTemperature

      private double calculateRameyTemperature(double depth, double bhTemp)
      Calculate temperature using Ramey (1962) steady-state model.

      The Ramey model accounts for:

      • Geothermal gradient of the formation
      • Heat transfer between wellbore and formation
      • Time-dependent behavior (transient heat conduction)
      Parameters:
      depth - depth from surface (m)
      bhTemp - bottom-hole temperature (K)
      Returns:
      temperature at depth (K)
    • calculateSegmentPressureDrop

      private double calculateSegmentPressureDrop(SystemInterface fluid, double segmentLength)
      Calculate pressure drop for a single segment using the selected correlation.
      Parameters:
      fluid - fluid at segment conditions
      segmentLength - length of segment (m)
      Returns:
      pressure drop (bar)
    • calculateBeggsBrillPressureDrop

      private double calculateBeggsBrillPressureDrop(SystemInterface fluid, double segmentLength)
      Beggs and Brill (1973) pressure drop calculation.
      Parameters:
      fluid - the fluid system
      segmentLength - the segment length in meters
      Returns:
      pressure drop in bar
    • calculateHagedornBrownPressureDrop

      private double calculateHagedornBrownPressureDrop(SystemInterface fluid, double segmentLength)
      Hagedorn and Brown (1965) pressure drop - optimized for vertical oil wells.
      Parameters:
      fluid - the fluid system
      segmentLength - the segment length in meters
      Returns:
      pressure drop in bar
    • calculateGrayPressureDrop

      private double calculateGrayPressureDrop(SystemInterface fluid, double segmentLength)
      Gray (1974) pressure drop - optimized for gas wells with condensate.
      Parameters:
      fluid - the fluid system
      segmentLength - the segment length in meters
      Returns:
      pressure drop in bar
    • calculateHasanKabirPressureDrop

      private double calculateHasanKabirPressureDrop(SystemInterface fluid, double segmentLength)
      Hasan and Kabir (2002) mechanistic model.
      Parameters:
      fluid - the fluid system
      segmentLength - the segment length in meters
      Returns:
      pressure drop in bar
    • calculateDunsRosPressureDrop

      private double calculateDunsRosPressureDrop(SystemInterface fluid, double segmentLength)
      Duns and Ros (1963) pressure drop - for gas wells.
      Parameters:
      fluid - the fluid system
      segmentLength - the segment length in meters
      Returns:
      pressure drop in bar
    • calculateFrictionFactor

      private double calculateFrictionFactor(double Re)
      Calculate Darcy friction factor using Colebrook-White equation.
      Parameters:
      Re - Reynolds number
      Returns:
      Darcy friction factor
    • generateVLPCurve

      public double[][] generateVLPCurve(double[] flowRates, String flowUnit, String pressureUnit)
      Generate a VLP curve (Tubing Performance Curve).

      Calculates the required bottom-hole pressure for each flow rate to achieve a specified wellhead pressure. This is essential for nodal analysis and reservoir simulation coupling.

      Parameters:
      flowRates - array of flow rates to evaluate
      flowUnit - flow rate unit ("Sm3/day", "bbl/day", "kg/sec", etc.)
      pressureUnit - pressure unit for output ("bara", "psia", etc.)
      Returns:
      2D array: [0]=flow rates, [1]=bottom-hole pressures, [2]=wellhead pressures
    • generateVLPCurve

      public double[][] generateVLPCurve(double[] flowRates, String flowUnit, String pressureUnit, double targetWHP)
      Generate a VLP curve for a specified wellhead pressure.
      Parameters:
      flowRates - array of flow rates to evaluate
      flowUnit - flow rate unit
      pressureUnit - pressure unit for output
      targetWHP - target wellhead pressure (bara)
      Returns:
      2D array: [0]=flow rates, [1]=bottom-hole pressures, [2]=wellhead pressures
    • generateVLPFamily

      public List<double[][]> generateVLPFamily(double[] flowRates, String flowUnit, double[] whPressures, String pressureUnit)
      Generate VLP curves for multiple wellhead pressures.

      This produces a family of VLP curves useful for sensitivity analysis and reservoir simulator table generation.

      Parameters:
      flowRates - array of flow rates
      flowUnit - flow rate unit
      whPressures - array of wellhead pressures
      pressureUnit - pressure unit
      Returns:
      List of VLP curves, one per WHP
    • findOperatingPoint

      public double[] findOperatingPoint(WellFlow iprModel, double wellheadPressure, String pressureUnit)
      Find the operating point (intersection of IPR and VLP).

      Given a WellFlow (IPR model) and target wellhead pressure, finds the flow rate and bottom-hole pressure where IPR = VLP.

      Parameters:
      iprModel - WellFlow object representing the IPR
      wellheadPressure - target wellhead pressure
      pressureUnit - pressure unit
      Returns:
      double[2]: [0]=operating flow rate (Sm3/day), [1]=BHP (bara)
    • calculateIPRPressure

      private double calculateIPRPressure(WellFlow iprModel, double flowRate, double reservoirPressure)
      Calculate IPR pressure for a given flow rate using the WellFlow model.
      Parameters:
      iprModel - the WellFlow IPR model
      flowRate - the flow rate
      reservoirPressure - the reservoir pressure in bar
      Returns:
      the calculated bottom-hole pressure in bar
    • convertFlowRate

      private double convertFlowRate(double value, String fromUnit, String toUnit)
    • convertPressure

      private double convertPressure(double value, String fromUnit, String toUnit)
    • getBottomHolePressure

      public double getBottomHolePressure(String unit)
      Get calculated bottom-hole pressure.
      Parameters:
      unit - pressure unit
      Returns:
      bottom-hole pressure
    • getWellheadPressure

      public double getWellheadPressure(String unit)
      Get calculated wellhead pressure.
      Parameters:
      unit - pressure unit
      Returns:
      wellhead pressure
    • getTotalPressureDrop

      public double getTotalPressureDrop(String unit)
      Get total pressure drop through tubing.
      Parameters:
      unit - pressure unit
      Returns:
      total pressure drop
    • getPressureProfile

      public double[] getPressureProfile()
      Get pressure profile along tubing.
      Returns:
      pressure profile array (bara)
    • getTemperatureProfile

      public double[] getTemperatureProfile()
      Get temperature profile along tubing.
      Returns:
      temperature profile array (K)
    • getDepthProfile

      public double[] getDepthProfile()
      Get depth profile (from surface).
      Returns:
      depth profile array (m)
    • getHoldupProfile

      public double[] getHoldupProfile()
      Get liquid holdup profile.
      Returns:
      holdup profile array (fraction)
    • getVLPCurve

      public double[][] getVLPCurve()
      Get the most recent VLP curve data.
      Returns:
      VLP curve: [0]=flow rates, [1]=BHP, [2]=WHP
    • setTableVLP

      public void setTableVLP(double[] flowRates, double[] bottomHolePressures, double wellheadPressure)
      Set VLP table data for table-based pressure drop calculation.

      When using table VLP, the pressure drop is interpolated from the provided curve instead of being calculated from correlations. This is useful when you have measured or pre-calculated VLP data.

      Parameters:
      flowRates - flow rates (same unit as stream flow rate)
      bottomHolePressures - corresponding bottom-hole pressures (bara)
      wellheadPressure - wellhead pressure that the curve was generated for (bara)
    • loadVLPFromFile

      public void loadVLPFromFile(String filePath, double wellheadPressure) throws IOException
      Load VLP curve from a CSV file.

      The CSV file should have two columns: flow rate and bottom-hole pressure. The wellhead pressure must be specified separately. The first row can be a header (will be skipped if non-numeric).

      Example CSV format:

      FlowRate(MSm3/day),BHP(bara)
      0.5,85
      1.0,92
      2.0,115
      3.0,145
      4.0,182
      5.0,225
      
      Parameters:
      filePath - path to the CSV file
      wellheadPressure - wellhead pressure the curve was generated for (bara)
      Throws:
      IOException - if file cannot be read
    • loadVLPFromFile

      public void loadVLPFromFile(Path filePath, double wellheadPressure) throws IOException
      Load VLP curve from a CSV file.
      Parameters:
      filePath - path to the CSV file
      wellheadPressure - wellhead pressure the curve was generated for (bara)
      Throws:
      IOException - if file cannot be read
      See Also:
    • isUsingTableVLP

      public boolean isUsingTableVLP()
      Check if using table-based VLP.
      Returns:
      true if using table VLP, false if using correlation-based
    • disableTableVLP

      public void disableTableVLP()
      Disable table-based VLP and use correlation-based calculations.
    • interpolateBHPFromTable

      public double interpolateBHPFromTable(double flowRate)
      Get BHP from table VLP by interpolation.
      Parameters:
      flowRate - flow rate
      Returns:
      interpolated bottom-hole pressure (bara)
    • getVLPTableFlowRates

      public double[] getVLPTableFlowRates()
      Get the current VLP table flow rates.
      Returns:
      array of flow rates, or empty array if not using table VLP
    • getVLPTableBHP

      public double[] getVLPTableBHP()
      Get the current VLP table BHP values.
      Returns:
      array of BHP values (bara), or empty array if not using table VLP
    • getVLPTableWellheadPressure

      public double getVLPTableWellheadPressure()
      Get the wellhead pressure for the VLP table.
      Returns:
      wellhead pressure (bara), or NaN if not using table VLP
    • sortVLPTableByFlowRate

      private void sortVLPTableByFlowRate()