Class TransientWellbore

All Implemented Interfaces:
Serializable, Runnable, CapacityConstrainedEquipment, PipeLineInterface, ProcessEquipmentInterface, TwoPortInterface, ProcessElementInterface, SimulationInterface, NamedInterface

public class TransientWellbore extends Pipeline
Transient wellbore model for simulating shutdown cooling and depressurization. Models the thermal equilibration of a wellbore after injection stops, accounting for radial heat conduction to the formation (geothermal gradient) and the resulting phase behaviour changes.

The model divides the wellbore into vertical segments and computes the temperature profile as the fluid cools toward the formation temperature at each depth. During cooling, flash calculations determine if two-phase conditions develop and track impurity enrichment in the gas phase.

Usage example:

TransientWellbore well = new TransientWellbore("InjWell", feedStream);
well.setWellDepth(1300.0);
well.setTubingDiameter(0.1571);
well.setFormationTemperature(277.15, 316.15); // 4C at top, 43C at bottom
well.setShutdownCoolingRate(5.0); // K/hr exponential decay rate
well.setNumberOfSegments(20);
well.runShutdownSimulation(24.0, 1.0); // 24 hours, 1-hour steps
List<double[]> profiles = well.getTemperatureProfiles();
Version:
1.0
Author:
neqsim
See Also:
  • Field Details

    • serialVersionUID

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

      private double wellDepth
      Well measured depth in meters.
    • tubingDiameter

      private double tubingDiameter
      Tubing inner diameter in meters.
    • formationTempTop

      private double formationTempTop
      Formation temperature at wellhead (top) in Kelvin.
    • formationTempBottom

      private double formationTempBottom
      Formation temperature at bottom-hole in Kelvin.
    • numberOfSegments

      private int numberOfSegments
      Number of vertical segments for discretization.
    • coolingTimeConstant

      private double coolingTimeConstant
      Cooling time constant for exponential decay toward formation temperature in hours.
    • radialHeatTransferCoeff

      private double radialHeatTransferCoeff
      Overall radial heat transfer coefficient in W/(m2.K).
    • depressurizationRate

      private double depressurizationRate
      Depressurization rate in bar per hour (0 = no depressurization).
    • snapshots

      private final List<TransientWellbore.TransientSnapshot> snapshots
      Time step results: list of snapshots, each containing depth vs (T, P, phases, compositions).
  • Constructor Details

    • TransientWellbore

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

      public TransientWellbore(String name, StreamInterface inletStream)
      Constructor for TransientWellbore with inlet stream.
      Parameters:
      name - the equipment name
      inletStream - the inlet (feed) stream defining initial fluid conditions
  • Method Details

    • setWellDepth

      public void setWellDepth(double depth)
      Sets the well measured depth.
      Parameters:
      depth - the well depth in meters
    • getWellDepth

      public double getWellDepth()
      Gets the well depth.
      Returns:
      the well depth in meters
    • setTubingDiameter

      public void setTubingDiameter(double diameter)
      Sets the tubing inner diameter.
      Parameters:
      diameter - the inner diameter in meters
    • getTubingDiameter

      public double getTubingDiameter()
      Gets the tubing inner diameter.
      Returns:
      the inner diameter in meters
    • setFormationTemperature

      public void setFormationTemperature(double topTempKelvin, double bottomTempKelvin)
      Sets the formation temperature at the wellhead and bottom-hole. A linear geothermal gradient is assumed between these two points.
      Parameters:
      topTempKelvin - formation temperature at the wellhead in Kelvin
      bottomTempKelvin - formation temperature at the bottom-hole in Kelvin
    • setShutdownCoolingRate

      public void setShutdownCoolingRate(double timeConstantHours)
      Sets the exponential cooling time constant. The fluid temperature at each segment evolves as: T(t) = T_formation + (T_initial - T_formation) * exp(-t / tau). Smaller values mean faster cooling.
      Parameters:
      timeConstantHours - the cooling time constant in hours
    • getShutdownCoolingRate

      public double getShutdownCoolingRate()
      Gets the cooling time constant.
      Returns:
      the cooling time constant in hours
    • setRadialHeatTransferCoefficient

      public void setRadialHeatTransferCoefficient(double coefficient)
      Sets the radial heat transfer coefficient for heat exchange between wellbore fluid and formation.
      Parameters:
      coefficient - the overall heat transfer coefficient in W/(m2.K)
    • getRadialHeatTransferCoefficient

      public double getRadialHeatTransferCoefficient()
      Gets the radial heat transfer coefficient.
      Returns:
      the coefficient in W/(m2.K)
    • setDepressurizationRate

      public void setDepressurizationRate(double rateBarPerHour)
      Sets the wellhead depressurization rate during shutdown.
      Parameters:
      rateBarPerHour - the pressure decrease rate in bar per hour (0 = constant pressure)
    • getDepressurizationRate

      public double getDepressurizationRate()
      Gets the depressurization rate.
      Returns:
      the rate in bar per hour
    • setNumberOfSegments

      public void setNumberOfSegments(int segments)
      Sets the number of vertical segments.
      Parameters:
      segments - the number of segments
    • getNumberOfSegments

      public int getNumberOfSegments()
      Gets the number of segments.
      Returns:
      the number of segments
    • runShutdownSimulation

      public void runShutdownSimulation(double totalTimeHours, double timeStepHours)
      Runs the shutdown transient simulation. Starting from the initial operating conditions in the inlet stream, the wellbore cools toward the formation temperature over the specified duration.
      Parameters:
      totalTimeHours - the total simulation duration in hours
      timeStepHours - the time step size in hours
    • createSnapshot

      private TransientWellbore.TransientSnapshot createSnapshot(double timeHours, double[] depths, double[] temperatures, double[] pressures, SystemInterface baseFluid)
      Creates a snapshot of the wellbore state at a given time by performing flash calculations at each segment.
      Parameters:
      timeHours - the simulation time in hours
      depths - the depth array
      temperatures - the temperature array in Kelvin
      pressures - the pressure array in bara
      baseFluid - the base fluid for cloning
      Returns:
      a TransientSnapshot with all segment data
    • getSnapshots

      public List<TransientWellbore.TransientSnapshot> getSnapshots()
      Gets all snapshots from the shutdown simulation.
      Returns:
      a list of TransientSnapshot objects, one per time step
    • getTemperatureProfiles

      public List<double[]> getTemperatureProfiles()
      Gets the temperature profiles as a list of double arrays (one per time step).
      Returns:
      list of temperature arrays in Kelvin
    • getTimePoints

      public double[] getTimePoints()
      Gets the time points of each snapshot.
      Returns:
      array of time values in hours
    • getMaxGasPhaseConcentration

      public double getMaxGasPhaseConcentration(String componentName)
      Returns the maximum H2 concentration in the gas phase across all segments and time steps.
      Parameters:
      componentName - the component to check (e.g., "hydrogen")
      Returns:
      the maximum gas phase mole fraction, or 0 if no two-phase conditions
    • 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