Class PipeFlowNetwork

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

public class PipeFlowNetwork extends ProcessEquipmentBaseClass
Network of pipelines connected through manifolds using compositional PipeFlowSystem. <p> This class models pipeline networks where multiple pipelines converge to manifolds (mixers) and pipelines depart from manifolds. Unlike WellFlowlineNetwork which uses the simpler Beggs-Brill correlation, this class uses the full OnePhasePipeLine with TDMA solvers supporting: </p> <ul> <li>Compositional tracking through the network</li> <li>Steady-state solutions</li> <li>Transient/dynamic simulations</li> <li>Energy balance and heat transfer</li> </ul> <h2>Architecture</h2> <p> The network is modeled as a directed graph where: </p> <ul> <li>Nodes are manifolds (implemented as Mixer)</li> <li>Edges are pipelines (implemented as OnePhasePipeLine)</li> <li>Feed streams connect to source nodes</li> <li>The final node provides the network outlet</li> </ul> <h2>Example Usage</h2> <pre> // Create feeds Stream feed1 = new Stream("feed1", gas1); feed1.setFlowRate(5.0, "MSm3/day"); Stream feed2 = new Stream("feed2", gas2); feed2.setFlowRate(3.0, "MSm3/day"); // Create network PipeFlowNetwork network = new PipeFlowNetwork("gathering system"); // Create manifolds String manifoldA = network.createManifold("manifold A"); String endManifold = network.createManifold("end manifold"); // Add inlet pipelines to manifold A network.addInletPipeline("pipe1", feed1, manifoldA, 5000.0, 0.3, 50); network.addInletPipeline("pipe2", feed2, manifoldA, 4500.0, 0.25, 45); // Connect manifold A to end manifold with export pipeline network.connectManifolds(manifoldA, endManifold, "export", 15000.0, 0.5, 100); // Run steady-state network.run(); // Access results StreamInterface outlet = network.getOutletStream(); </pre>
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • manifolds

      private final Map<String, PipeFlowNetwork.ManifoldNode> manifolds
    • allPipelines

      private final List<PipeFlowNetwork.PipelineSegment> allPipelines
    • feedStreams

      private final List<StreamInterface> feedStreams
    • terminalManifoldName

      private String terminalManifoldName
    • compositionalTracking

      private boolean compositionalTracking
    • advectionScheme

      private AdvectionScheme advectionScheme
    • simulationTime

      private double simulationTime
    • initialized

      private boolean initialized
    • defaultWallRoughness

      private double defaultWallRoughness
    • defaultOuterTemperature

      private double[] defaultOuterTemperature
    • defaultOuterHeatTransfer

      private double[] defaultOuterHeatTransfer
    • defaultWallHeatTransfer

      private double[] defaultWallHeatTransfer
  • Constructor Details

    • PipeFlowNetwork

      public PipeFlowNetwork(String name)
      Create a new pipeline flow network.
      Parameters:
      name - network name
  • Method Details

    • createManifold

      public String createManifold(String name)
      Create a manifold node in the network.
      Parameters:
      name - manifold name
      Returns:
      the manifold name (for use in connecting pipelines)
    • addInletPipeline

      public PipeFlowNetwork.PipelineSegment addInletPipeline(String pipeName, StreamInterface feedStream, String toManifold, double length, double diameter, int numberOfNodes)
      Add an inlet pipeline from a feed stream to a manifold.
      Parameters:
      pipeName - pipeline name
      feedStream - feed stream (source)
      toManifold - target manifold name
      length - pipeline length in meters
      diameter - pipeline diameter in meters
      numberOfNodes - number of computational nodes
      Returns:
      the created pipeline segment
    • connectManifolds

      public PipeFlowNetwork.PipelineSegment connectManifolds(String fromManifold, String toManifold, String pipeName, double length, double diameter, int numberOfNodes)
      Connect two manifolds with a pipeline.
      Parameters:
      fromManifold - source manifold name
      toManifold - target manifold name
      pipeName - pipeline name
      length - pipeline length in meters
      diameter - pipeline diameter in meters
      numberOfNodes - number of computational nodes
      Returns:
      the created pipeline segment
    • createPipeline

      private OnePhasePipeLine createPipeline(String name, StreamInterface inletStream, double length, double diameter, int numberOfNodes)
      Create and configure a pipeline.
      Parameters:
      name - the pipeline name
      inletStream - the inlet stream
      length - the pipeline length in meters
      diameter - the pipeline diameter in meters
      numberOfNodes - the number of computational nodes
      Returns:
      the configured pipeline
    • setDefaultWallRoughness

      public void setDefaultWallRoughness(double roughness)
      Set the default wall roughness for new pipelines.
      Parameters:
      roughness - wall roughness in meters
    • setDefaultOuterTemperature

      public void setDefaultOuterTemperature(double temperature)
      Set the default outer temperature for new pipelines.
      Parameters:
      temperature - outer temperature in Kelvin
    • setDefaultHeatTransferCoefficients

      public void setDefaultHeatTransferCoefficients(double outerCoeff, double wallCoeff)
      Set default heat transfer coefficients for new pipelines.
      Parameters:
      outerCoeff - outer heat transfer coefficient (W/m2K)
      wallCoeff - wall heat transfer coefficient (W/m2K)
    • setCompositionalTracking

      public void setCompositionalTracking(boolean enable)
      Enable or disable compositional tracking.
      Parameters:
      enable - true to enable compositional tracking
    • setAdvectionScheme

      public void setAdvectionScheme(AdvectionScheme scheme)
      Set the advection scheme for compositional tracking.
      Parameters:
      scheme - advection scheme
    • getPipelines

      public List<PipeFlowNetwork.PipelineSegment> getPipelines()
      Get all pipeline segments in the network.
      Returns:
      list of pipeline segments
    • getManifolds

      public Map<String, PipeFlowNetwork.ManifoldNode> getManifolds()
      Get all manifold nodes in the network.
      Returns:
      map of manifold names to nodes
    • getTerminalManifold

      public PipeFlowNetwork.ManifoldNode getTerminalManifold()
      Get the terminal manifold (network outlet).
      Returns:
      the terminal manifold node
    • getOutletStream

      public StreamInterface getOutletStream()
      Get the outlet stream from the network.
      Returns:
      the outlet stream
    • getSimulationTime

      public double getSimulationTime()
      Get the current simulation time.
      Returns:
      simulation time in seconds
    • resetSimulationTime

      public void resetSimulationTime()
      Reset simulation time to zero.
    • getExecutionOrder

      private List<PipeFlowNetwork.ManifoldNode> getExecutionOrder()
      Get execution order for manifolds (topological sort).
      Returns:
      list of manifold nodes in execution order
    • addToExecutionOrder

      private void addToExecutionOrder(PipeFlowNetwork.ManifoldNode node, List<PipeFlowNetwork.ManifoldNode> order, Set<String> visited)
    • run

      public void run(UUID id)
      Run steady-state simulation for the entire network.
      Parameters:
      id - UUID
    • runTransient

      public void runTransient(double dt, UUID id)
      Run transient simulation for the specified time step.
      Parameters:
      dt - time step in seconds
      id - calculation identifier
    • getPressureProfile

      public double[] getPressureProfile(String pipeName, String unit)
      Get the pressure profile along a specific pipeline.
      Parameters:
      pipeName - pipeline name
      unit - pressure unit ("bara" or "Pa")
      Returns:
      array of pressures at each node
    • getTemperatureProfile

      public double[] getTemperatureProfile(String pipeName, String unit)
      Get the temperature profile along a specific pipeline.
      Parameters:
      pipeName - pipeline name
      unit - temperature unit ("K" or "C")
      Returns:
      array of temperatures at each node
    • getCompositionProfile

      public double[] getCompositionProfile(String pipeName, String componentName)
      Get the composition profile along a specific pipeline.
      Parameters:
      pipeName - pipeline name
      componentName - component name
      Returns:
      array of mass fractions at each node
    • getVelocityProfile

      public double[] getVelocityProfile(String pipeName)
      Get the velocity profile along a specific pipeline.
      Parameters:
      pipeName - pipeline name
      Returns:
      array of velocities (m/s) at each node
    • getTotalPressureDrop

      public double getTotalPressureDrop(String unit)
      Get total network pressure drop.
      Parameters:
      unit - pressure unit
      Returns:
      total pressure drop
    • 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.