Class WellFlowlineNetwork

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

public class WellFlowlineNetwork extends ProcessEquipmentBaseClass
Network wrapper that links WellFlow inflow models with PipeBeggsAndBrills hydraulics and gathers the outlets into configurable manifolds.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • manifolds

      private final List<WellFlowlineNetwork.ManifoldNode> manifolds
    • facilityPipeline

      private PipeBeggsAndBrills facilityPipeline
    • propagateArrivalPressureToWells

      private boolean propagateArrivalPressureToWells
    • forceFlowFromPressureSolve

      private boolean forceFlowFromPressureSolve
    • targetEndpointPressure

      private Double targetEndpointPressure
    • targetEndpointPressureUnit

      private String targetEndpointPressureUnit
    • iterationTolerance

      private double iterationTolerance
    • maxIterations

      private int maxIterations
    • lastTerminalManifoldPressure

      private Double lastTerminalManifoldPressure
  • Constructor Details

    • WellFlowlineNetwork

      public WellFlowlineNetwork(String name)
      Create a new network wrapper.
      Parameters:
      name - network name
  • Method Details

    • createManifold

      public WellFlowlineNetwork.ManifoldNode createManifold(String name)
      Create an unconnected manifold node that can later be linked to other manifolds via pipelines.
      Parameters:
      name - manifold name
      Returns:
      the created WellFlowlineNetwork.ManifoldNode
    • addBranch

      public WellFlowlineNetwork.Branch addBranch(String branchName, WellFlow well, PipeBeggsAndBrills pipeline)
      Add a branch to the network using preconfigured well and pipeline units. The pipeline inlet is forced to the well outlet and its outlet is attached to the terminal manifold by default.
      Parameters:
      branchName - branch identifier
      well - configured WellFlow
      pipeline - configured PipeBeggsAndBrills
      Returns:
      the added WellFlowlineNetwork.Branch
    • addBranch

      public WellFlowlineNetwork.Branch addBranch(String branchName, WellFlow well, PipeBeggsAndBrills pipeline, WellFlowlineNetwork.ManifoldNode manifold)
      Add a branch to a specific manifold in the network.
      Parameters:
      branchName - branch identifier
      well - configured WellFlow
      pipeline - configured PipeBeggsAndBrills
      manifold - manifold that should receive the branch outlet
      Returns:
      the added WellFlowlineNetwork.Branch
    • addBranch

      public WellFlowlineNetwork.Branch addBranch(String branchName, WellFlow well, PipeBeggsAndBrills pipeline, ThrottlingValve choke, WellFlowlineNetwork.ManifoldNode manifold)
      Add a branch with an optional production choke to a specific manifold.
      Parameters:
      branchName - branch identifier
      well - configured WellFlow
      pipeline - configured PipeBeggsAndBrills
      choke - optional ThrottlingValve placed between the well outlet and pipeline inlet
      manifold - manifold that should receive the branch outlet
      Returns:
      the added WellFlowlineNetwork.Branch
    • addBranch

      public WellFlowlineNetwork.Branch addBranch(String branchName, StreamInterface reservoirStream)
      Convenience helper that creates a branch from a reservoir stream by instantiating a WellFlow and PipeBeggsAndBrills pair and attaching it to the terminal manifold.
      Parameters:
      branchName - branch identifier
      reservoirStream - stream representing reservoir inflow
      Returns:
      the created WellFlowlineNetwork.Branch
    • addBranch

      public WellFlowlineNetwork.Branch addBranch(String branchName, StreamInterface reservoirStream, WellFlowlineNetwork.ManifoldNode manifold)
      Convenience helper that creates a branch from a reservoir stream for a specific manifold.
      Parameters:
      branchName - branch identifier
      reservoirStream - stream representing reservoir inflow
      manifold - manifold that should receive the branch outlet
      Returns:
      the created WellFlowlineNetwork.Branch
    • getBranches

      public List<WellFlowlineNetwork.Branch> getBranches()
      Get an immutable view of network branches for optimization or tuning.
      Returns:
      list of branches
    • getManifolds

      public List<WellFlowlineNetwork.ManifoldNode> getManifolds()
      Get the configured manifolds in upstream-to-downstream order.
      Returns:
      manifolds
    • getArrivalMixer

      public Mixer getArrivalMixer()
      Get the arrival mixer that gathers all branch outlets (useful for reporting or re-routing).
      Returns:
      arrival mixer
    • setFacilityPipeline

      public void setFacilityPipeline(PipeBeggsAndBrills pipeline)
      Attach a common pipeline from the arrival manifold to the receiving facility. The pipeline inlet is automatically wired to the terminal manifold outlet.
      Parameters:
      pipeline - configured PipeBeggsAndBrills representing the shared pipeline
    • addManifold

      public WellFlowlineNetwork.ManifoldNode addManifold(String name, PipeBeggsAndBrills connectionPipeline)
      Add an additional manifold downstream of the current endpoint, connecting it with the supplied pipeline. The pipeline inlet is automatically wired to the current terminal manifold outlet.
      Parameters:
      name - manifold name
      connectionPipeline - pipeline from the current endpoint manifold to the new manifold
      Returns:
      the created WellFlowlineNetwork.ManifoldNode
    • connectManifolds

      public void connectManifolds(WellFlowlineNetwork.ManifoldNode upstream, WellFlowlineNetwork.ManifoldNode downstream, PipeBeggsAndBrills connectionPipeline)
      Connect an upstream manifold to a downstream manifold using the provided pipeline.
      Parameters:
      upstream - upstream manifold
      downstream - downstream manifold that should receive the pipeline outlet
      connectionPipeline - pipeline from upstream to downstream
    • setPropagateArrivalPressureToWells

      public void setPropagateArrivalPressureToWells(boolean propagate)
      Control whether the arrival pressure should be pushed back to wells that are configured to compute flow from outlet pressure (production-index, Vogel, or Fetkovich modes with solveFlowFromOutletPressure(true)).
      Parameters:
      propagate - true to push arrival pressure back to wells
    • setForceFlowFromPressureSolve

      public void setForceFlowFromPressureSolve(boolean enable)
      Automatically switch wells to solve for flow from outlet pressure when running with a specified target endpoint pressure.
      Parameters:
      enable - true to force wells to solve for flow from pressure
    • setTargetEndpointPressure

      public void setTargetEndpointPressure(double pressure, String unit)
      Specify the desired pressure at the network endpoint (arrival manifold if no facility pipeline, otherwise the facility pipeline outlet). The network will iterate manifold pressure to match this target while solving individual well rates from backpressure.
      Parameters:
      pressure - target endpoint pressure
      unit - pressure unit
    • setIterationTolerance

      public void setIterationTolerance(double tolerance)
      Configure convergence tolerance when iterating manifold pressure to reach the target endpoint pressure.
      Parameters:
      tolerance - absolute pressure tolerance in bara
    • setMaxIterations

      public void setMaxIterations(int maxIterations)
      Configure maximum number of iterations when matching target endpoint pressure.
      Parameters:
      maxIterations - iteration cap
    • getArrivalStream

      public StreamInterface getArrivalStream()
      Stream representing combined arrival conditions at the platform inlet.
      Returns:
      arrival stream
    • getTerminalManifoldPressure

      public Double getTerminalManifoldPressure(String unit)
      Report the most recent pressure enforced at the terminal manifold while solving toward a target endpoint pressure.
      Parameters:
      unit - requested unit
      Returns:
      terminal manifold pressure, or null if the network has not been run
    • run

      public void run(UUID id)
      Description copied from interface: SimulationInterface

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

      Parameters:
      id - UUID
    • runTransient

      public void runTransient(double dt, UUID id)
      Description copied from interface: SimulationInterface

      runTransient

      This method calculates thermodynamic and unit operations using difference equations if available and calculateSteadyState is true. Use setCalculateSteadyState to set the parameter. Sets calc identifier UUID.
      Parameters:
      dt - Delta time [s]
      id - Calculation identifier
    • setName

      public void setName(String name)
      Description copied from class: NamedBaseClass

      Setter for the field name.

      Specified by:
      setName in interface NamedInterface
      Overrides:
      setName in class NamedBaseClass
      Parameters:
      name - a String object
    • toJson

      public String toJson()
      Description copied from class: ProcessEquipmentBaseClass

      Serializes the Process Equipment along with its state to a JSON string.

      Specified by:
      toJson in interface ProcessEquipmentInterface
      Overrides:
      toJson in class ProcessEquipmentBaseClass
      Returns:
      json string.
    • enforceManifoldPressures

      private void enforceManifoldPressures(UUID id)
      Force a single pressure at each manifold outlet and optionally push that backpressure to wells that solve for flow from outlet pressure.
      Parameters:
      id - calculation identifier
    • iterateForEndpointPressure

      private void iterateForEndpointPressure(UUID id)
      Iteratively adjust terminal manifold pressure so that the endpoint (arrival or facility outlet) pressure matches the configured target.
      Parameters:
      id - calculation identifier
    • runWithEndpointPressure

      private double runWithEndpointPressure(double manifoldPressure, UUID id)
      Execute branch runs and facility pipeline while enforcing a specified terminal manifold pressure.
      Parameters:
      manifoldPressure - pressure in bara at the terminal manifold
      id - calculation identifier
      Returns:
      pressure achieved at the endpoint (arrival if no facility pipeline, otherwise facility pipeline outlet)
    • runManifolds

      private void runManifolds(UUID id, boolean forceEndpointPressure, Double endpointPressure)
      Run through all manifolds and branches in upstream-to-downstream order.
      Parameters:
      id - calculation identifier
      forceEndpointPressure - whether to force endpoint pressure
      endpointPressure - the endpoint pressure to force
    • runManifold

      private void runManifold(WellFlowlineNetwork.ManifoldNode manifold, UUID id, boolean overridePressure, Double forcedPressure)
    • getReachableManifoldsInFlowOrder

      private List<WellFlowlineNetwork.ManifoldNode> getReachableManifoldsInFlowOrder()
      Determine a topologically sorted list of manifolds that feed the tail manifold. Manifolds that are not connected to the terminal chain are ignored to avoid null arrival streams interfering with calculations.
      Returns:
      list of manifolds in flow order
    • getTailManifold

      private WellFlowlineNetwork.ManifoldNode getTailManifold()